[llvm-bugs] [Bug 38317] New: Address breakpoints don't work if set before the process launches

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 25 14:54:27 PDT 2018


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

            Bug ID: 38317
           Summary: Address breakpoints don't work if set before the
                    process launches
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: ted.woodward at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

Setting a breakpoint by address doesn't work if the process isn't running. I
traced it back to r322348, "Fix Breakpoint::RemoveInvalidLocations to fix the
exec testcase.", from January 11.


With ToT from a few days ago on x86_64 Linux, I get the address of main and set
a breakpoint:
(lldb) p main
(int (*)(int, char **)) $0 = 0x0000000000400570
(lldb) b 0x400570
Breakpoint 1: address = 0x0000000000400570

I run, it launches and runs to completion without hitting the breakpoint:
(lldb) r
Process 20293 launched: '/home/ted/lldb_test/factlin' (x86_64) Factorial of 10
is 3628800 Process 20293 exited with status = 0 (0x00000000)

Set a breakpoint by line, launch, and it stops:
(lldb) b 19
Breakpoint 2: where = factlin`main + 22 at factorial.c:32, address =
0x0000000000400586
(lldb) r
Process 20352 launched: '/home/ted/lldb_test/factlin' (x86_64) Process 20352
stopped
* thread #1, name = 'factlin', stop reason = breakpoint 2.1
    frame #0: 0x0000000000400586 factlin`main(argc=1, argv=0x00007fffffffe218)
at factorial.c:32
   29     }
   30   */
   31  
-> 32     base = 10;
   33  
   34     printf("Factorial of %d is %d\n", base, factorial(base));
   35     return 0;

Set the breakpoint by address while the process is running and run again. This
time it stops at the new address breakpoint.
(lldb) b 0x400570
Breakpoint 3: where = factlin`main at factorial.c:13, address =
0x0000000000400570
(lldb) r
There is a running process, kill it and restart?: [Y/n] Process 20352 exited
with status = 9 (0x00000009) Process 20366 launched:
'/home/ted/lldb_test/factlin' (x86_64) Process 20366 stopped
* thread #1, name = 'factlin', stop reason = breakpoint 3.1
    frame #0: 0x0000000000400570 factlin`main(argc=<unavailable>,
argv=<unavailable>) at factorial.c:13
   10   }
   11  
   12   int main(int argc, char **argv)
-> 13   {
   14     unsigned base;
   15  
   16   /*

Break list shows the first breakpoint as unresolved, and the third as resolved.
(lldb) br l
Current breakpoints:
1: address = 0x0000000000400570, locations = 1
  1.1: address = 0x0000000000400570, unresolved, hit count = 0 

2: file = '/home/ted/lldb_test/factorial.c', line = 19, exact_match = 0,
locations = 1, resolved = 1, hit count = 1
  2.1: where = factlin`main + 22 at factorial.c:32, address =
0x0000000000400586, resolved, hit count = 1 

3: address = factlin[0x0000000000400570], locations = 1, resolved = 1, hit
count = 1
  3.1: where = factlin`main at factorial.c:13, address = 0x0000000000400570,
resolved, hit count = 1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180725/86c9ccb2/attachment.html>


More information about the llvm-bugs mailing list