Zach Devito
2014-Mar-25 20:35 UTC
[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/9dd91f9d/attachment.html>
Kaylor, Andrew
2014-Mar-25 23:14 UTC
[LLVMdev] Getting the Debugging JIT-ed Code with GDB example to work
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>
Kaylor, Andrew
2014-Mar-25 23:19 UTC
[LLVMdev] Getting the Debugging JIT-ed Code with GDB example to work
Actually, put aside what I said in my previous reply for a second. I just noticed in your output below that GDB didn't have symbols for lli. That's probably the heart of your problem. GDB relies on hooking a known function to get the JITed code registration to work. Since it didn't find symbols for lli, it won't find the hook function. You'll need to use a build of lli with symbols to make this work. -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/5cd3a0ad/attachment.html>
Zach Devito
2014-Mar-26 01:44 UTC
[LLVMdev] Getting the Debugging JIT-ed Code with GDB example to work
I tested it with the symbols enabled for lli and it still doesn't work. Below is the assembly for GDBJITRegistrar::registerObject containing the inlined body of NotifyDebugger. It looks like the call to __jit_debug_register_code was inlined away despite being marked with LLVM_ATTRIBUTE_NOINLINE. LLVM was compiled with the following GCC: zdevito at derp:~/terra/tests$ gcc --version> gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 > Copyright (C) 2011 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Maybe the LLVM_ATTRIBUTE_NOINLINE macro is defined wrong, or the compiler is ignoring it? Zach Dump of assembler code for function (anonymous> namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&): > 0x0000000000b1eba0 <+0>: push rbp > 0x0000000000b1eba1 <+1>: push r15 > 0x0000000000b1eba3 <+3>: push r14 > 0x0000000000b1eba5 <+5>: push r13 > 0x0000000000b1eba7 <+7>: push r12 > 0x0000000000b1eba9 <+9>: push rbx > 0x0000000000b1ebaa <+10>: sub rsp,0x28 > 0x0000000000b1ebae <+14>: mov r14,rdi > 0x0000000000b1ebb1 <+17>: mov rax,QWORD PTR [rsi+0x8] > 0x0000000000b1ebb5 <+21>: mov r13,QWORD PTR [rax+0x8] > 0x0000000000b1ebb9 <+25>: mov QWORD PTR [rsp+0x8],r13 > 0x0000000000b1ebbe <+30>: test r13,r13 > 0x0000000000b1ebc1 <+33>: je 0xb1edcf <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+559> > 0x0000000000b1ebc7 <+39>: mov rax,QWORD PTR [rax+0x10] > 0x0000000000b1ebcb <+43>: sub rax,r13 > 0x0000000000b1ebce <+46>: mov QWORD PTR [rsp],rax > 0x0000000000b1ebd2 <+50>: mov r15,QWORD PTR [r14+0x8] > 0x0000000000b1ebd6 <+54>: mov ebp,DWORD PTR [r14+0x18] > 0x0000000000b1ebda <+58>: add r14,0x8 > 0x0000000000b1ebde <+62>: test rbp,rbp > 0x0000000000b1ebe1 <+65>: je 0xb1ec3f <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+159> > 0x0000000000b1ebe3 <+67>: mov rax,r13 > 0x0000000000b1ebe6 <+70>: or rax,0x4 > 0x0000000000b1ebea <+74>: cmp rax,0xfffffffffffffffc > 0x0000000000b1ebee <+78>: je 0xb1ee1e <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+638> > 0x0000000000b1ebf4 <+84>: mov ecx,r13d > 0x0000000000b1ebf7 <+87>: shr ecx,0x9 > 0x0000000000b1ebfa <+90>: mov eax,r13d > 0x0000000000b1ebfd <+93>: shr eax,0x4 > 0x0000000000b1ec00 <+96>: xor eax,ecx > 0x0000000000b1ec02 <+98>: lea ecx,[rbp-0x1] > 0x0000000000b1ec05 <+101>: and eax,ecx > 0x0000000000b1ec07 <+103>: lea rdx,[rax+rax*2] > 0x0000000000b1ec0b <+107>: mov rsi,QWORD PTR [r15+rdx*8] > 0x0000000000b1ec0f <+111>: cmp r13,rsi > 0x0000000000b1ec12 <+114>: je 0xb1ec4a <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+170> > 0x0000000000b1ec14 <+116>: mov edx,0x1 > 0x0000000000b1ec19 <+121>: nop DWORD PTR [rax+0x0] > 0x0000000000b1ec20 <+128>: cmp rsi,0xfffffffffffffffc > 0x0000000000b1ec24 <+132>: je 0xb1ec3f <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+159> > 0x0000000000b1ec26 <+134>: add eax,edx > 0x0000000000b1ec28 <+136>: and eax,ecx > 0x0000000000b1ec2a <+138>: lea rdi,[rax+rax*2] > 0x0000000000b1ec2e <+142>: mov rsi,QWORD PTR [r15+rdi*8] > 0x0000000000b1ec32 <+146>: inc edx > 0x0000000000b1ec34 <+148>: cmp r13,rsi > 0x0000000000b1ec37 <+151>: jne 0xb1ec20 <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+128> > 0x0000000000b1ec39 <+153>: lea rax,[r15+rdi*8] > 0x0000000000b1ec3d <+157>: jmp 0xb1ec4e <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+174> > 0x0000000000b1ec3f <+159>: lea rax,[rbp+rbp*2+0x0] > 0x0000000000b1ec44 <+164>: lea rax,[r15+rax*8] > 0x0000000000b1ec48 <+168>: jmp 0xb1ec4e <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+174> > 0x0000000000b1ec4a <+170>: lea rax,[r15+rdx*8] > 0x0000000000b1ec4e <+174>: lea rcx,[rbp+rbp*2+0x0] > 0x0000000000b1ec53 <+179>: lea rcx,[r15+rcx*8] > 0x0000000000b1ec57 <+183>: cmp rax,rcx > 0x0000000000b1ec5a <+186>: jne 0xb1edee <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+590> > 0x0000000000b1ec60 <+192>: mov edi,0x20 > 0x0000000000b1ec65 <+197>: call 0x4e8120 <_Znwm at plt> > 0x0000000000b1ec6a <+202>: mov r12,rax > 0x0000000000b1ec6d <+205>: mov QWORD PTR [r12+0x18],0x0 > 0x0000000000b1ec76 <+214>: mov QWORD PTR [r12+0x10],0x0 > 0x0000000000b1ec7f <+223>: mov QWORD PTR [r12+0x8],0x0 > 0x0000000000b1ec88 <+232>: mov QWORD PTR [r12],0x0 > 0x0000000000b1ec90 <+240>: test r12,r12 > 0x0000000000b1ec93 <+243>: je 0xb1ee0d <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+621> > 0x0000000000b1ec99 <+249>: mov QWORD PTR [r12+0x10],r13 > 0x0000000000b1ec9e <+254>: mov rax,QWORD PTR [rsp] > 0x0000000000b1eca2 <+258>: mov QWORD PTR [r12+0x18],rax > 0x0000000000b1eca7 <+263>: xor eax,eax > 0x0000000000b1eca9 <+265>: test ebp,ebp > 0x0000000000b1ecab <+267>: je 0xb1ed2b <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+395> > 0x0000000000b1ecad <+269>: mov rax,r13 > 0x0000000000b1ecb0 <+272>: or rax,0x4 > 0x0000000000b1ecb4 <+276>: cmp rax,0xfffffffffffffffc > 0x0000000000b1ecb8 <+280>: je 0xb1ee1e <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+638> > 0x0000000000b1ecbe <+286>: mov eax,r13d > 0x0000000000b1ecc1 <+289>: shr eax,0x9 > 0x0000000000b1ecc4 <+292>: mov ecx,r13d > 0x0000000000b1ecc7 <+295>: shr ecx,0x4 > 0x0000000000b1ecca <+298>: xor ecx,eax > 0x0000000000b1eccc <+300>: dec ebp > 0x0000000000b1ecce <+302>: and ecx,ebp > 0x0000000000b1ecd0 <+304>: lea rdx,[rcx+rcx*2] > 0x0000000000b1ecd4 <+308>: lea rax,[r15+rdx*8] > 0x0000000000b1ecd8 <+312>: mov rdi,QWORD PTR [r15+rdx*8] > 0x0000000000b1ecdc <+316>: cmp r13,rdi > 0x0000000000b1ecdf <+319>: je 0xb1ed65 <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+453> > 0x0000000000b1ece5 <+325>: xor edx,edx > 0x0000000000b1ece7 <+327>: mov esi,0x1 > 0x0000000000b1ecec <+332>: nop DWORD PTR [rax+0x0] > 0x0000000000b1ecf0 <+336>: cmp rdi,0xfffffffffffffffc > 0x0000000000b1ecf4 <+340>: je 0xb1ed24 <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+388> > 0x0000000000b1ecf6 <+342>: add ecx,esi > 0x0000000000b1ecf8 <+344>: and ecx,ebp > 0x0000000000b1ecfa <+346>: test rdx,rdx > 0x0000000000b1ecfd <+349>: sete r8b > 0x0000000000b1ed01 <+353>: cmp rdi,0xfffffffffffffff8 > 0x0000000000b1ed05 <+357>: sete bl > 0x0000000000b1ed08 <+360>: test r8b,bl > 0x0000000000b1ed0b <+363>: cmovne rdx,rax > 0x0000000000b1ed0f <+367>: lea rdi,[rcx+rcx*2] > 0x0000000000b1ed13 <+371>: lea rax,[r15+rdi*8] > 0x0000000000b1ed17 <+375>: mov rdi,QWORD PTR [r15+rdi*8] > 0x0000000000b1ed1b <+379>: inc esi > 0x0000000000b1ed1d <+381>: cmp r13,rdi > 0x0000000000b1ed20 <+384>: jne 0xb1ecf0 <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+336> > 0x0000000000b1ed22 <+386>: jmp 0xb1ed65 <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+453> > 0x0000000000b1ed24 <+388>: test rdx,rdx > 0x0000000000b1ed27 <+391>: cmovne rax,rdx > 0x0000000000b1ed2b <+395>: xorps xmm0,xmm0 > 0x0000000000b1ed2e <+398>: movaps XMMWORD PTR [rsp+0x10],xmm0 > 0x0000000000b1ed33 <+403>: lea rsi,[rsp+0x8] > 0x0000000000b1ed38 <+408>: mov rdi,r14 > 0x0000000000b1ed3b <+411>: mov rdx,rax > 0x0000000000b1ed3e <+414>: call 0xb1f150 > <llvm::DenseMapBase<llvm::DenseMap<char const*, std::pair<unsigned long, > jit_code_entry*>, llvm::DenseMapInfo<char const*> >, char const*, > std::pair<unsigned long, jit_code_entry*>, llvm::DenseMapInfo<char const*> > >::InsertIntoBucketImpl(char const* const&, std::pair<char const*, > std::pair<unsigned long, jit_code_entry*> >*)> > 0x0000000000b1ed43 <+419>: mov rcx,QWORD PTR [rsp+0x8] > 0x0000000000b1ed48 <+424>: mov QWORD PTR [rax],rcx > 0x0000000000b1ed4b <+427>: mov rcx,rax > 0x0000000000b1ed4e <+430>: add rcx,0x8 > 0x0000000000b1ed52 <+434>: je 0xb1ed65 <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+453> > 0x0000000000b1ed54 <+436>: mov rdx,QWORD PTR [rsp+0x10] > 0x0000000000b1ed59 <+441>: mov rsi,QWORD PTR [rsp+0x18] > 0x0000000000b1ed5e <+446>: mov QWORD PTR [rcx+0x8],rsi > 0x0000000000b1ed62 <+450>: mov QWORD PTR [rcx],rdx > 0x0000000000b1ed65 <+453>: mov rcx,QWORD PTR [rsp] > 0x0000000000b1ed69 <+457>: mov QWORD PTR [rax+0x8],rcx > 0x0000000000b1ed6d <+461>: mov QWORD PTR [rax+0x10],r12 > => 0x0000000000b1ed71 <+465>: lea rdi,[rip+0x707310] # > 0x1226088 <_ZN12_GLOBAL__N_112JITDebugLockE> > 0x0000000000b1ed78 <+472>: call 0xca3810 > <llvm::sys::MutexImpl::acquire()> > 0x0000000000b1ed7d <+477>: mov rax,QWORD PTR [rip+0x6fdeb4] > # 0x121cc38 > 0x0000000000b1ed84 <+484>: mov DWORD PTR [rax+0x4],0x1 > 0x0000000000b1ed8b <+491>: mov QWORD PTR [r12+0x8],0x0 > 0x0000000000b1ed94 <+500>: mov rax,QWORD PTR [rax+0x10] > 0x0000000000b1ed98 <+504>: mov QWORD PTR [r12],rax > 0x0000000000b1ed9c <+508>: test rax,rax > 0x0000000000b1ed9f <+511>: je 0xb1eda5 <(anonymous > namespace)::GDBJITRegistrar::registerObject(llvm::ObjectBuffer const&)+517> > 0x0000000000b1eda1 <+513>: mov QWORD PTR [rax+0x8],r12 > 0x0000000000b1eda5 <+517>: mov rax,QWORD PTR [rip+0x6fde8c] > # 0x121cc38 > 0x0000000000b1edac <+524>: mov QWORD PTR [rax+0x10],r12 > 0x0000000000b1edb0 <+528>: mov QWORD PTR [rax+0x8],r12 > 0x0000000000b1edb4 <+532>: lea rdi,[rip+0x7072cd] # > 0x1226088 <_ZN12_GLOBAL__N_112JITDebugLockE> > 0x0000000000b1edbb <+539>: call 0xca3850 > <llvm::sys::MutexImpl::release()> > 0x0000000000b1edc0 <+544>: add rsp,0x28 > 0x0000000000b1edc4 <+548>: pop rbx > 0x0000000000b1edc5 <+549>: pop r12 > 0x0000000000b1edc7 <+551>: pop r13 > 0x0000000000b1edc9 <+553>: pop r14 > 0x0000000000b1edcb <+555>: pop r15 > 0x0000000000b1edcd <+557>: pop rbp > 0x0000000000b1edce <+558>: ret > 0x0000000000b1edcf <+559>: lea rdi,[rip+0x35f9a9] # 0xe7e77f > 0x0000000000b1edd6 <+566>: lea rsi,[rip+0x35f6fc] # 0xe7e4d9 > 0x0000000000b1eddd <+573>: lea rcx,[rip+0x35f9da] # 0xe7e7be > 0x0000000000b1ede4 <+580>: mov edx,0x84 > 0x0000000000b1ede9 <+585>: call 0x4e7ef0 <__assert_fail at plt> > 0x0000000000b1edee <+590>: lea rdi,[rip+0x35fa29] # 0xe7e81e > 0x0000000000b1edf5 <+597>: lea rsi,[rip+0x35f6dd] # 0xe7e4d9 > 0x0000000000b1edfc <+604>: lea rcx,[rip+0x35f9bb] # 0xe7e7be > 0x0000000000b1ee03 <+611>: mov edx,0x86 > 0x0000000000b1ee08 <+616>: call 0x4e7ef0 <__assert_fail at plt> > 0x0000000000b1ee0d <+621>: lea rdi,[rip+0x35fa73] # 0xe7e887 > 0x0000000000b1ee14 <+628>: mov esi,0x1 > 0x0000000000b1ee19 <+633>: call 0xc9dbe0 > <llvm::report_fatal_error(char const*, bool)> > 0x0000000000b1ee1e <+638>: lea rdi,[rip+0x1a8998] # 0xcc77bd > 0x0000000000b1ee25 <+645>: lea rsi,[rip+0x1a8045] # 0xcc6e71 > 0x0000000000b1ee2c <+652>: lea rcx,[rip+0x35f722] # 0xe7e555 > 0x0000000000b1ee33 <+659>: mov edx,0x1e0 > 0x0000000000b1ee38 <+664>: call 0x4e7ef0 <__assert_fail at plt>On Tue, Mar 25, 2014 at 4:19 PM, Kaylor, Andrew <andrew.kaylor at intel.com>wrote:> Actually, put aside what I said in my previous reply for a second. > > > > I just noticed in your output below that GDB didn't have symbols for lli. > That's probably the heart of your problem. GDB relies on hooking a known > function to get the JITed code registration to work. Since it didn't find > symbols for lli, it won't find the hook function. > > > > You'll need to use a build of lli with symbols to make this work. > > > > -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/f6593bcb/attachment.html>