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

Jusctsch schumjs@gmail.com
Wed Oct 5 21:13:00 GMT 2011


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.

ex.
(gdb) bt
#0  Foo::DoFoo(this=0x832461cc0,
    iState=Foo::DoFooState)
    at ioengine/SCSI/FooSM.cpp:743
...
(gdb) l 743
738
739     /**
740       
******************************************************************************
741        *  Brief: Foo
742        *
743        *  function for handling foo
744        *
745        *  @return  unsigned int
746        *
747       
*****************************************************************************


I was curious if I could write my code differently to avoid this. What are
examples that would cause this?
Compiled out #ifdefs?
Splitting up one executed line into multiple lines on the IDE?
Inlined Functions?

Thanks
-- 
View this message in context: http://old.nabble.com/Causes-of-differences-between-source-and-binary-built-with-symbols-while-debugging-tp32596213p32596213.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.



More information about the Gdb mailing list