Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

macos - LLDB Error: Unable to resolve breakpoint to any actual locations

I'm trying to use LLDB (because I apparently can't use gdb anymore) to debug som of my code and each time I try to...

(lldb) breakpoint set -f file.c -l 65

I get...

Breakpoint 1: no locations (pending)
WARNING: Unable to resolve breakpoint to any actual locations.

I've tried different things like assigning the breakpoint to a function and such but I always get the same error. When running there's no break. Please help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

lldb: resolving breakpoints to locations

If your out file doesn't have debugging symbols enabled for Code Generation Options then breakpoints likely can't be resolved to locations within your .c source file.

When you create your out file enable debug information:

$ clang -g -O0 file.c -o file
$ lldb file
(lldb) target create "file"
Current executable set to 'file' (x86_64).
(lldb) b file.c:13
Breakpoint 1: where = file`main + 29 at file.c:13, address = 0x0000000100000f4d

Using the -g option adds the necessary debug information to your file for lldb. It should now resolve when you breakpoint set -f file.c -l n (which can be abbreviated as b file.c:n).

-g Generate debug information. Note that Clang debug information works best at -O0.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...