lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> If this is a core file from an assertion then we can do some more
> analysis. Try to load the core file into gdb, then select the
> highest frame that has the J parameter in it. Print the value of
> J->pt. If it's non-NULL, then please do the following:
> 
> x/s ((GCstr *)J->pt->chunkname.gcptr32)+1
> p ((BCLine *)J->pt->lineinfo.ptr32)[0]
> p ((BCLine *)J->pt->lineinfo.ptr32)[(int *)J->pc-(int *)((char *)J->pt+sizeof(GCproto))]
> p (int *)J->pc-(int *)((char *)J->pt+sizeof(GCproto))
> 
> This prints in order: the name of the file, the line where the
> function was defined and the line for the bytecode where a failure
> was detected. The last one prints the bytecode offset. Please
> compare this against -jbc and show me the surrounding bytecodes
> plus the source code of the function (if possible).

Ok, here you go:

#0  0x00007f98eed1f595 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007f98eed1f595 in raise () from /lib/libc.so.6
#1  0x00007f98eed20a16 in abort () from /lib/libc.so.6
#2  0x00007f98eed180f5 in __assert_fail () from /lib/libc.so.6
#3  0x00007f98ef2f99ca in rec_check_slots (J=0x41321548) at lj_record.c:128
#4  lj_record_ins (J=0x41321548) at lj_record.c:2143
#5  0x00007f98ef303893 in trace_state (L=0x4042eb48, dummy=<value optimized out>, ud=0x41321548) at lj_trace.c:569
#6  0x00007f98ef2d4908 in lj_vm_cpcall () from /usr/lib/libluajit-5.1.so.2
#7  0x00007f98ef30421f in lj_trace_ins (J=0x41321548, pc=<value optimized out>) at lj_trace.c:624
#8  0x00007f98ef2df49f in lj_dispatch_call (L=0x4042eb48, pc=0x41334adc) at lj_dispatch.c:421
#9  0x00007f98ef2d6003 in lj_vm_hotcall () from /usr/lib/libluajit-5.1.so.2
#10 ..... [MY CODE TRACE]
(gdb) fr 3
#3  0x00007f98ef2f99ca in rec_check_slots (J=0x41321548) at lj_record.c:128
128               lua_assert(tref_isnumber(tr));  /* Could be IRT_INT etc., too. */
(gdb) print J->pt
$1 = (GCproto *) 0x41334a98
(gdb) x/s ((GCstr *)J->pt->chunkname.gcptr32)+1
0x413315b8:      "@lua/lib-core.lua"
(gdb) p ((BCLine *)J->pt->lineinfo.ptr32)[0]
$2 = 90
(gdb) p ((BCLine *)J->pt->lineinfo.ptr32)[(int *)J->pc-(int *)((char *)J->pt+sizeof(GCproto))]
$3 = 90
(gdb) p (int *)J->pc-(int *)((char *)J->pt+sizeof(GCproto))
$4 = 0
(gdb) 


-- BYTECODE -- lib-core.lua:90-97
0001    GGET     2   0      ; "assert"
0002    ISFC     3   0
0003    JMP      3 => 0005
0004    MOV      3   1
0005 => CALL     2   1   2
0006    GGET     2   1      ; "cfg"
0007    TGETS    2   2   2  ; "server"
0008    TGETS    2   2   3  ; "nid"
0009    ISNEV    0   2
0010    JMP      2 => 0016
0011    GGET     2   4      ; "call"
0012    MOV      3   1
0013    VARG     4   0   2
0014    CALLMT   2   1
0015    JMP      2 => 0024
0016 => GGET     2   5      ; "rcall"
0017    GGET     3   6      ; "content"
0018    TGETS    3   3   7  ; "servers"
0019    TGETV    3   3   0
0020    TGETS    3   3   8  ; "rpc"
0021    MOV      4   1
0022    VARG     5   0   2
0023    CALLMT   2   2
0024 => RET0     0   1


---- source code ----

module('core', package.seeall)

require 'lib-util'

-- [SKIPPED]

function rpc(nid, eid, ...)
        assert(nid and eid)
        if nid == cfg.server.nid then
                return call(eid, ...)
        else
                return rcall(content.servers[nid].rpc, eid, ...)
        end
end


// Seny