[LLVMdev] how to debug with interpreter

Reid Kleckner reid.kleckner at gmail.com
Sun Mar 20 08:56:06 PDT 2011


x/20i $pc - 20 or so is your friend.  In general, you can't
disassemble x86 backwards, but gdb does a reasonably good job if you
just guess.

Alternatively, if you're on Linux, there's the gdb-jit interface,
which should give you symbols and unwind tables without any extra
effort on your part:
http://llvm.org/docs/DebuggingJITedCode.html

To answer your original question about the interpreter, you can pass
-force-interpreter to lli or pass args to the execution engine
creation, but the interpreter is considered incomplete and buggy.  Its
original purpose was to help debug the JIT, but now the JIT works
reliably, so it hasn't been maintained.

Reid

On Fri, Mar 18, 2011 at 7:26 PM, Rob Nikander <rob.nikander at gmail.com> wrote:
> Hi,
>
> I'm using the JIT execution engine for my language, and I'm finding it
> extremely painful to find bugs in generated code.  I get a "seg fault"
> and I can't see where it happened.  Writing a debugger or generating
> info for GDB seems like too much work at this point.   Is there a way
> to use the Interpreter to run this code, stepping through and printing
> the LLVM instructions, to find the one that triggers the seg fault?  I
> have not been writing any files to disk and have not yet used much in
> LLVM except the C++ API.
>
> thanks,
> Rob
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list