[lldb-dev] Problem with address breakpoints
Ted Woodward via lldb-dev
lldb-dev at lists.llvm.org
Wed Jul 25 13:27:50 PDT 2018
Hi Jim,
I found a breakpoint problem. 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:
(lldb) r
Process 20293 launched: '/usr2/tedwood/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: '/usr2/tedwood/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: '/usr2/tedwood/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 = '/usr2/tedwood/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
Ted
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project
More information about the lldb-dev
mailing list