[LLVMdev] Getting the Debugging JIT-ed Code with GDB example to work

Kaylor, Andrew andrew.kaylor at intel.com
Tue Mar 25 16:14:53 PDT 2014


I haven't tried that in a while.  It's possible that it has been broken.  I thought there was a test for it, but I'm not seeing it right now.

A couple of suggestions to help you troubleshoot the problem:


1.       Enable verbose output in GDB.

2.       Set a breakpoint in MCJIT.cpp where it calls loadedObject->registerWithDebugger.  Step through that and verify that it gets as far as the call to __jit_debug_register_code in GDBRegistrar.cpp.

When __jit_debug_register_code is called, you should get a message saying that GDB has loaded symbols for the dynamic code (or possibly that it couldn't find symbols).

Let me know what happens when you do that, and I might be able to make a reasonable suggestion as to what to do next.

-Andy

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Zach Devito
Sent: Tuesday, March 25, 2014 1:35 PM
To: LLVM Developers Mailing List
Subject: [LLVMdev] Getting the Debugging JIT-ed Code with GDB example to work

I'm trying to run the example described at:

http://llvm.org/docs/DebuggingJITedCode.html

I followed the sample command line session (below, with versions numbers for everything), but gdb doesn't stop at the breakpoints as described. Any idea what is wrong?

Thanks,

Zach


zdevito at derp:~/terra/tests$ ~/clang+llvm-3.4-x86_64-unknown-ubuntu12.04/bin/clang -cc1 -O0 -g -emit-llvm showdebug.c
zdevito at derp:~/terra/tests$ gdb --args ~/clang+llvm-3.4-x86_64-unknown-ubuntu12.04/bin/lli -use-mcjit showdebug.ll 5
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/zdevito/clang+llvm-3.4-x86_64-unknown-ubuntu12.04/bin/lli...(no debugging symbols found)...done.
(gdb) b showdebug.c:6
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (showdebug.c:6) pending.
(gdb) r
Starting program: /home/zdevito/clang+llvm-3.4-x86_64-unknown-ubuntu12.04/bin/lli -use-mcjit showdebug.ll 5
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 8538) exited with code 0170]
(gdb)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140325/8422ab28/attachment.html>


More information about the llvm-dev mailing list