lua-users home
lua-l archive

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


Solinsky, Jeff - PAL wrote:
> What part of the code base does LuaJIT leave the jitted machine
> code and jump back to the interpreter? I would like to add some
> debugging prints around that point to help determine where this
> segmentation fault is occurring. 

Try with simple tests first. One trace that exits at the end:

  for i=1,100 do end

Two traces, where the first one links to the second:

  for i=1,200 do if i > 100 then end end

If this crashes, then use a breakpoint for the following symbol
(only present in debug builds): lj_vm_exit_handler
That should end up back in C code.

If the first test doesn't crash, but the second does, then you'd
need to add a breakpoint at lj_BC_JLOOP and 'display/i $pc'. Then
step from that code into the first trace and look at its code
(x/20i $pc). Then continue until it exits and reenters the first
trace. Then stepi until it branches to the second trace and see
what happens.

One problem is that running things under GDB will probably flush
the caches on every step, anyway. So you may not be able to
reproduce the same behavior.

--Mike