lua-users home
lua-l archive

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


Arseny Vakhrushev wrote:
> function rpc(nid, eid, ...)

Ok, so this happens when this function is called. But the state
got inconsistent before the call, so we need to find its caller.
For the next steps I'm assuming this function is only called by
other Lua functions and it's neither tail-called nor indirectly
via metamethods.

So please try this:

x/32gx J->L->base-30
set $ppc = (int *)J->L->base[-1].fr.tp.ftsz
p/x $ppc[-1]
set $ra = (($ppc[-1])>>8)&255
set $fn = (GCfunc *)J->L->base[-$ra-2].fr.func.gcptr32
set $pt = (GCproto *)($fn->l.pc.ptr32-sizeof(GCproto))
x/s ((GCstr *)$pt->chunkname.gcptr32)+1
p ((BCLine *)$pt->lineinfo.ptr32)[0]
set $bcofs = (int *)$ppc-(int *)((char*)$pt+sizeof(GCproto))
p ((BCLine *)$pt->lineinfo.ptr32)[$bcofs]
p $bcofs

The last four results are name, starting line, current line and
bytecode offset for the calling Lua function. Again, I'd need to
see the bytecode/source code of it.

[The other question is whether entertaining the rest of the
mailing list with serious GDB magic is really a good idea. :-) ]

--Mike