From: Philippe Elie <phil.el@wanadoo.fr>
To: Nick Clifton <nickc@redhat.com>
Cc: graydon@redhat.com, oprofile-list@sourceforge.net,
binutils@sources.redhat.com, gdb@sources.redhat.com
Subject: Re: separated debuginfo patch
Date: Fri, 04 Jul 2003 23:38:00 -0000 [thread overview]
Message-ID: <3F062EDF.4060801@wanadoo.fr> (raw)
In-Reply-To: <m3brwasjkh.fsf@redhat.com>
Nick Clifton wrote:
> Hi Philippe,
[trying to avoid crc'ing the separate debug file]
I need to know how GDB guys want I deal with the gdb part, for now
gdb.diff just remove (#if 0) all duplicated code from bfd and use
bfd_follow_gnu_debuglink() to retrieve the debug info file. Is it
ok to remove this code or must I update the duplicated code according
to the change in bfd ?
> The problem binutils has is that the debuginfo file and .gnu-debuginfo
> section in the stripped file are created by two different steps (1).
> Thus adding the same timestamp to both files is tricky and would
> require that the debuginfo file be first created with a blank
> timestamp section and then later, when the .gnu-debuginfo section is
> added, the timestamp is initialised.
I avoided it by forcing user to specify the timestamp in both step
>
> The other problem with timestamps is that it means that bootstrap
> sequences that involve the creation of debuginfo file will no longer
> work. ie the debuginfo files and stripped executables from two
> different bootstrap stages will no longer compare as identical because
> of the timestamps.
>
> This problem could be avoided by using a unique-binary-identifier that
> is specified on the command line, rather than a timestamp that is
> generated by the objcopy/strip program. ie objcopy could have a new
> switch such as:
>
> --set-debuglink-timestamp=<number>
>
> If this switch is not specified when --add-gnu-debuglink is used, then
> a timestamp is added, otherwise <number> is added. Generating a
> non-trivial value for <number> however might prove difficult...
I like it, such number is packager responsiblility, for gnu
based system `date +%s` should be sufficient. I changed slightly
it, number is not optionnal and must be provided by caller, is
it a real problem ?
> We just need to agree on the format and name of the timestamp section
> in the debuginfo file, and how to distinguish old .gnu-debuglink
> sections (only containing a crc) from new ones (containing a crc and a
> timestamp).
I disambiguite the two case by looking the section size. See
bfd.diff, it's a bit ugly but I don't see how I can deal cleanly
with this problem.
>
> Possibilities for the new section in the debuginfo file include:
>
> .gnu_debuglink (ie reuse the section name that is found in the
> stripped executable. The version in the debuginfo
> file could be exactly the same format, or it could
> be a shortened version with only the timestamp and
> not the filename or crc).
>
> .gnu_debuglink_timestamp (a bit wordy, but self documenting)
I tried to re-use exactly the same format but putting a valid
filename in the .gnu_debuglink in debug info file conduct gdb
into an infinite loop so on I preferred to play safe and use
a separate section.
The patch is a RFC rather than a submission, it needs some cleanup,
updating bfd documentation etc. btw bfd documentation gives two
alternative to use this feature but the first doesn't works with or
w/o the attached patch:
@item Run @code{objcopy --strip-debug foo} to create a
stripped executable.
@item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
to add a link to the debugging info into the stripped executable.
gdb doesn't like file produced in this way and gdb document
only the second way which works
@item Copy @code{foo} to @code{foo.full}
@item Run @code{objcopy --strip-debug foo}
@item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
The patch is tested with gdb code with and w/o gdeb.diff applied,
it works transparentely for gdb except obviously the old code
always does the crc.
patch can be tested through this two ways:
gcc -g -O2 test.cpp
cp a.out a.out.dbg
strip --strip-unneeded a.out
objcopy --set-debuglink-timestamp=12 a.out.dbg
objcopy --set-debuglink-timestamp=12 --add-gnu-debuglink=a.out.dbg a.out
gcc -g -O2 test.cpp
cp a.out a.out.dbg
strip --strip-unneeded a.out
objcopy --add-gnu-debuglink=a.out.dbg a.out
the first is now the preferred way. I don't like at all
than gdb need the full file it makes separate debug info
less usefull, can a GDB wizard gives some clues if it's
feasible to use the file stripped from it's code/data
section and if it'll be hard to implement ?
regards,
Philippe Elie
next prev parent reply other threads:[~2003-07-04 23:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87wuf3s4q3.fsf@dub.venge.net>
[not found] ` <3F02B1A5.5000102@wanadoo.fr>
[not found] ` <87adbwpkhj.fsf@dub.venge.net>
[not found] ` <3F03EB19.4090801@wanadoo.fr>
2003-07-04 10:04 ` Nick Clifton
2003-07-04 23:38 ` Philippe Elie [this message]
2003-07-04 23:40 ` Philippe Elie
2003-07-11 16:01 ` Nick Clifton
2003-07-18 6:42 ` Jim Blandy
2003-07-18 8:06 ` Nick Clifton
2003-07-18 13:42 ` Andrew Cagney
2003-07-18 14:03 ` Daniel Jacobowitz
2003-07-18 14:41 ` graydon hoare
2003-07-18 7:32 Michael Elizabeth Chastain
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=3F062EDF.4060801@wanadoo.fr \
--to=phil.el@wanadoo.fr \
--cc=binutils@sources.redhat.com \
--cc=gdb@sources.redhat.com \
--cc=graydon@redhat.com \
--cc=nickc@redhat.com \
--cc=oprofile-list@sourceforge.net \
/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