Open Quuxplusone opened 10 years ago
Bugzilla Link | PR20297 |
Status | NEW |
Importance | P normal |
Reported by | Vince Harron (vharron@google.com) |
Reported on | 2014-07-14 14:19:05 -0700 |
Last modified on | 2014-09-23 15:26:30 -0700 |
Version | 3.4 |
Hardware | Macintosh MacOS X |
CC | clayborg@gmail.com, emaste@freebsd.org |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
vharron-macbookpro:bp vharron$ lldb --version
lldb-310.2.37
(But I also reproduced this in head of SVN)
With ccache:
cu_sp->GetPath().c_str() /Users/vharron/.ccache/tmp/bp.tmp.vharron-
macbookpro.roam.corp.google.com.6262.i
Without ccache:
cu_sp->GetPath().c_str() /Users/vharron/dev/bp/bp.c
(oops, there is a typo in the "working case" it was missing the -g flag.
Corrected here)
working case:
vharron-macbookpro:bp vharron$ gcc -g -c -o bp.o bp.c
vharron-macbookpro:bp vharron$ gcc -o bp bp.o
vharron-macbookpro:bp vharron$ lldb bp
Current executable set to 'bp' (x86_64).
(lldb) b bp.c:5
Breakpoint 1: where = bp`main + 22 at bp.c:5, address = 0x0000000100000f56
(lldb) r
Process 6218 launched: '/Users/vharron/dev/bp/bp' (x86_64)
Process 6218 stopped
* thread #1: tid = 0xa93b9, 0x0000000100000f56 bp`main + 22 at bp.c:5, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000f56 bp`main + 22 at bp.c:5
2
3 int
4 main() {
-> 5 printf("Hello, World!\n");
6 return 0;
7 }
8
(lldb) quit
Try adding this to your ~/.lldbinit file:
settings set target.inline-breakpoint-strategy always
That appears to work around the problem.
vharron-macbookpro:bp vharron$ ./build.sh
+ CCACHE=ccache
+ ccache gcc -g -o bp.o -c bp.c
+ gcc -o bp bp.o
vharron-macbookpro:bp vharron$ cat ~/.lldbinit
settings set target.inline-breakpoint-strategy always
vharron-macbookpro:bp vharron$ lldb bp
Current executable set to 'bp' (x86_64).
(lldb) b bp.c:5
Breakpoint 1: where = bp`main + 22 at bp.c:5, address = 0x0000000100000f56
(lldb) quit
vharron-macbookpro:bp vharron$ rm ~/.lldbinit
vharron-macbookpro:bp vharron$ lldb bp
Current executable set to 'bp' (x86_64).
(lldb) b bp.c:5
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
Do you have any ideas for how to solve this without the lldbinit setting?
No, if we set the default value of this setting to "always" we end up with serious breakpoint by file + line performance regressions with large C++ projects (like the clang source base).
Our current notion is that if a breakpoint happens in an implementation file (.c .cpp and many more), we only look in translation units that match the implementation file. If it is in any file that isn't an implementation file, then we auto enable looking for breakpoints anywhere. People #include'ing other source files is pretty rare, so this generally works ok. But in cases where some other tool is going this, like in your case, it ends up not working by default. There is no quick way to detect this without causing the performance regression, so currently this is "behaves correctly".
I would just add this line to your ~/.lldbinit file for now.