Filip J.
Filip J.

Reputation: 625

For a library, GDB does only see source in header files, whereas source in .cpp files is not available

I am using gdb to debug a program compiled against a static library. Both the library and the program were compiled with debug symbols. For this library, gdb does only see the source code implemented in .h files and not the source code implemented in .cpp files. I wonder why?

What could be the reason for this? Any suggestions are welcome!

Some details:

Upvotes: 3

Views: 3671

Answers (1)

Employed Russian
Employed Russian

Reputation: 213446

What could be the reason for this?

Either

  • you've built the library without -g flag, or
  • you've stripped the library after it was built (this is very unlikely).

Check your library build log. You believe you built it with -g, but you are very likely mistaken.

Upvotes: 1

Related Questions