<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - C: lldb cant find file:line in "included" code (set breakpoint / source list)"
href="http://llvm.org/bugs/show_bug.cgi?id=19974">19974</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>C: lldb cant find file:line in "included" code (set breakpoint / source list)
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sford@geeky-boy.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Searched bugzilla, couldn't find. Might be a bug in clang or llvm, but the
symptom is in lldb, so I'm putting it here. Tool versions listed below.
If I have a C module include additional C code using #include, I can't set
breakpoints or list source by file / line. I can use file / line for the main
.c file which does the including, and other separately-compiled modules, but
not in the included file.
REPRODUCTION
file x.c:
1 #include <stdio.h>
2 void x1();
3 int main(int argc, char **argv)
4 {
5 printf("main starts\n");
6 x1();
7 printf("main exiting\n");
8 return 0;
9 }
10 #include "x1.c"
file x1.c:
1 void x1()
2 {
3 printf("in x1\n");
4 }
Build line:
1 $ clang -g -o x x.c
2 $ clang -v
3 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
4 Target: x86_64-apple-darwin13.2.0
5 Thread model: posix
Debug session:
1 lldb ./x
2 Current executable set to './x' (x86_64).
3 (lldb) v
4 lldb-310.2.37
5 (lldb) b x1.c:3
6 Breakpoint 1: no locations (pending).
7 WARNING: Unable to resolve breakpoint to any actual locations.
8 (lldb) b x.c:6
9 Breakpoint 2: where = x`main + 32 at x.c:6, address = 0x0000000100000f00
10 (lldb) source list -f x.c -l 3
11 3 int main(int argc, char **argv)
12 4 {
13 5 printf("main starting\n");
14 6 x1();
15 7 printf("main exiting\n");
16 8 }
17 9 #include "x1.c"
18 (lldb) source list -f x1.c -l 1
19 error: Could not find source file "x1.c".
I also tried the full breakpoint set command with long options with no
difference. I also tried using x.c with line numbers above 10, thinking it
might attribute the x1.c lines as additional lines in x.c. No help.
However, I am able to set a breakpoint on the x1() function:
21 (lldb) breakpoint set -name x1
22 Breakpoint 3: where = x`x1 + 15 at x1.c:3, address = 0x0000000100000f3f
Interesting that it is able to *report* the location as "x1.c:3", but you can't
break on that specification.
Also, if I remove x.c line 10 (#include "x1.c"), add stdio.h to x1.c, compile
them separately and link them, it works OK.
P.S. - in case anybody is curious why I would include C code like that, x1.c is
unit test code that wants to do white-box testing and therefore wants access to
structure fields and static functions not available to separately-compiled
modules. Yes, there are other ways to do it; this is the way I do it.</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>