Nibor
Nibor

Reputation: 1258

lldb : Unable to resolve breakpoint in Hello World example

I created a Hello World example in C++ and tried to debug it with lldb from the terminal on Mac OSX.

> lldb a.out
Current executable set to 'a.out' (x86_64).

I can set breakpoints on names (eg. 'main'), but not on line numbers. If I try

breakpoint set --file test.c --line 5

or

b test.c:5

I get

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

The file 'test.c' is located in the current folder. What goes wrong?

Upvotes: 1

Views: 2538

Answers (1)

Kun Ling
Kun Ling

Reputation: 2219

Acording to Dwarf Debugging Information Format, the line number, file location information are stored in the Dwarf format. Such information is what GDB used to set line number as a breakpoint.

Usually, the Dwarf format information is generated by compiler, such as GCC with the -g options. Please try with -g options to see whether it works.

Meanwhile, there also some other debug helpful options in GCC which might be more helpful to you, such as -g3, compiler will generate more detail information for debug, such as macros.

Upvotes: 3

Related Questions