<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Address breakpoints don't work if set before the process launches"
href="https://bugs.llvm.org/show_bug.cgi?id=38317">38317</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Address breakpoints don't work if set before the process launches
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ted.woodward@codeaurora.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>