This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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.

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

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?

View this message in context:
Sent from the Sourceware - gdb list mailing list archive at

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]