From: Martin Runge <martin.runge@web.de>
To: gdb@sourceware.org
Cc: Martin Runge <martin.runge@rohde-schwarz.com>
Subject: RFC: include mod time and size in DWARF file name table
Date: Sat, 12 Jan 2013 13:24:00 -0000 [thread overview]
Message-ID: <CAF4KFGoTbn53j=jDgnddc1OmOvavUEN_=_sHkXOpOqf55F1O_Q@mail.gmail.com> (raw)
Hi all,
The DWARF standard seems to have fields for the modification time and
file size of each source file that was used to build a binary.
Standard tools like readelf and objdump will display them but by
default, gcc fills the with zero (except for VMS targets):
readelf -wl dwarftest1
.....
The File Name Table:
Entry Dir Time Size Name
1 1 0 0 dwarftest1.cpp
2 2 0 0 iostream
3 2 0 0 cstddef
4 2 0 0 cwchar
....
I patched gcc ( gas from binutils, to more precise ) to fill in
modification time and file size of the source files. The result:
readelf -wl dwarftest1
....
The File Name Table:
Entry Dir Time Size Name
1 1 1352976872 149 dwarftest1.cpp
2 2 1353406399 2665 iostream
3 3 1353406307 12542 stddef.h
4 2 1353406399 1838 cstddef
5 2 1353406399 6665 cwchar
....
This information can be used to check, if one is debugging the right
source file, or if the source file has changed since compilation,
which leads to displaced stepping and other strange errors.
It can also be used to detect errors like the following:
a program that links to a library and the library itself have been
compiled using different versions of the header files that specify the
library's interface, e.g. data types passed from one to the other.
So why do I post this in gdb ML since GCC/binutils fill in this information?
There are comments in the GCC sources that explain, that GCC fills in
zeros instead of time and size, because some debuggers stop working
correctly when this information is present.
Is this still valid? I think, for gdb and Linux targets its not true.
I have started developing a gdb patch that will check source files
based on the time and size information before setting breakpoints
there or displaying the source.
Does anybody see any problems with this approach that I just havn't
run into yet? And if it works, would the gdb developers support a
change request to GCC/binutils?
regards
Martin
next reply other threads:[~2013-01-12 13:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-12 13:24 Martin Runge [this message]
2013-01-13 4:19 ` John Gilmore
2013-01-13 5:54 ` Joel Brobecker
2013-01-14 12:31 ` Martin Runge
2013-01-15 17:51 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAF4KFGoTbn53j=jDgnddc1OmOvavUEN_=_sHkXOpOqf55F1O_Q@mail.gmail.com' \
--to=martin.runge@web.de \
--cc=gdb@sourceware.org \
--cc=martin.runge@rohde-schwarz.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox