This is the mail archive of the gdb@sourceware.org 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]

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


On 6 October 2011 10:13, David Paterson <dnpaterson@gmail.com> wrote:
> 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.

If user attaches to a process which uses a module from a different
path then GDB detects that. (Unless he/she is using remote debugging -
there is no way to report the .note.gnu.build-id section - or any
section for that matter.)

If the sources were modified since the binary was built last time then
bad luck. Competition (MSVC) includes MD5 hashes of source files in
debug information, GCC does not.

-- 
Petr Hluzin


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