https://bugs.llvm.org/show_bug.cgi?id=36209

            Bug ID: 36209
           Summary: Regression: JITed Code Debugging Broken on LLDB 6.0
                    Release Branch
           Product: lldb
           Version: 6.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-...@lists.llvm.org
          Reporter: stefan.graen...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Created attachment 19797
  --> https://bugs.llvm.org/attachment.cgi?id=19797&action=edit
Full logs from LLDB 6.0, LLDB 5.0 and LLDB 4.0

With LLDB built from branch release_60 it is no longer possible to set a
breakpoint in JIT-compiled code. This worked well for release_50. LLDB 6.0
fails with error message:
warning: failed to set breakpoint site at 0x4 for breakpoint 1.1: error: 2
sending the breakpoint request


Repro with a default configuration of LLVM/Clang/LLDB on Linux Mint 18:

$ cat hellow.cpp
#include <stdio.h>

void jitbp() {
  printf("Hello World!\n");
}

int main() {
  jitbp();
  return 0;
}

$ clang -g -c -S -emit-llvm hellow.cpp 
$ ./lli hellow.ll
Hello World!
$ ./lldb -- lli
(lldb) target create "lli"
Current executable set to 'lli' (x86_64).
(lldb) b jitbp
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) log enable lldb jit
(lldb) r hellow.ll


Actual output with LLDB 6.0:

lldb             JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
lldb             JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
Process 17664 launched: '/media/LLVM/llvm60/build-debug-clang-lld-lldb/bin/lli'
(x86_64)
intern-state     JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
...
intern-state     JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
intern-state     JITLoaderGDB::SetJITBreakpoint setting JIT breakpoint
intern-state     JITLoaderGDB::JITDebugBreakpointHit hit JIT breakpoint
intern-state     JITLoaderGDB::ReadJITDescriptorImpl registering JIT entry at
0x781230 (3432 bytes)
warning: failed to set breakpoint site at 0x4 for breakpoint 1.1: error: 2
sending the breakpoint request
1 location added to breakpoint 1
warning: failed to set breakpoint site at 0x4 for breakpoint 1.1: error: 2
sending the breakpoint request
Hello World!
intern-state     JITLoaderGDB::JITDebugBreakpointHit hit JIT breakpoint
intern-state     JITLoaderGDB::ReadJITDescriptorImpl unregistering JIT entry at
0x781230
Process 17664 exited with status = 0 (0x00000000) 
(lldb) q


Expected output, tested with LLDB 5.0 and LLDB 4.0:

JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
Process 16807 launched: '/media/LLVM/llvm50/build-debug-clang-lld-lldb/bin/lli'
(x86_64)
JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
...
JITLoaderGDB::SetJITBreakpoint looking for JIT register hook
JITLoaderGDB::SetJITBreakpoint setting JIT breakpoint
JITLoaderGDB::JITDebugBreakpointHit hit JIT breakpoint
JITLoaderGDB::ReadJITDescriptorImpl registering JIT entry at 0x754850 (3432
bytes)
1 location added to breakpoint 1
Process 16807 stopped
* thread #1, name = 'lli', stop reason = breakpoint 1.1
    frame #0: 0x00007ffff7fee004 JIT(0x754850)`jitbp() at hellow.cpp:4
   1    #include <stdio.h>
   2    
   3    void jitbp() {
-> 4      printf("Hello World!\n");
   5    }
   6    
   7    int main() {
(lldb) n
Hello World!
Process 16807 stopped
* thread #1, name = 'lli', stop reason = step over
    frame #0: 0x00007ffff7fee01c JIT(0x754850)`jitbp() at hellow.cpp:5
   2    
   3    void jitbp() {
   4      printf("Hello World!\n");
-> 5    }
   6    
   7    int main() {
   8      jitbp();
(lldb) c
Process 16807 resuming
JITLoaderGDB::JITDebugBreakpointHit hit JIT breakpoint
JITLoaderGDB::ReadJITDescriptorImpl unregistering JIT entry at 0x754850
Process 16807 exited with status = 0 (0x00000000) 
(lldb) q


The same issue can be reproduced with a slightly modified version of LLDB that
allows debugging JITed code on Mac OS X. Please find attached the full logs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to