Causes of differences between source and binary built with symbols while debugging

David Paterson dnpaterson@gmail.com
Thu Oct 6 08:13:00 GMT 2011


On Wed, Oct 5, 2011 at 10:13 PM, Jusctsch <schumjs@gmail.com> wrote:
>
> Hello,
> I have a basic question about debugging with GDB when browsing source files.
> I have built my executable binary without any optimization and with -g.
> When debugging after 'source'-ing in my source files, I noticed that they
> did not always line up. They being the source, and the line number provided
> by gdb after loading in the symbols.

One thing to check is that you have definitely compiled and linked the file that
you think you are debugging.  If your executable hasn't been fully rebuilt you
may have references to line numbers in an older version of that file.

Try a clean / full rebuild and see if the problem remains.

David P.



More information about the Gdb mailing list