public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Looking for advice for GNU debuglink generation.
@ 2021-01-26  2:46 Kalamatee
  2021-01-26 10:14 ` Nick Clifton
  2021-01-27 14:15 ` Michael Matz
  0 siblings, 2 replies; 3+ messages in thread
From: Kalamatee @ 2021-01-26  2:46 UTC (permalink / raw)
  To: binutils

Hello,

I am looking for advice on the generation of gnu debug link information in
binaries
Currently when cross compiling our operating system, we export the debug,.
strip the binary, and add the debug link which "works" to some extent, but
only if the file layout matches on another machine running the
hosted version of our operating system.

The problem we have is our binaries are generated under some directory
(e.g. /home/test/build/AROS/), which is present in the debug link
information for all the binaries we generate. Is there some way to define a
base path that the linker will strip when adding this?

In future, we had hoped to move the generated debug information under
<build dir>/Developer/Debug/dbg - - but again doing so doesn't work because
it then looks for <build dir>/Developer/Debug/dbg/<biuld dir>/<relative
path to binary>/<binary>

Any advice would be greatly appreciated....

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Looking for advice for GNU debuglink generation.
  2021-01-26  2:46 Looking for advice for GNU debuglink generation Kalamatee
@ 2021-01-26 10:14 ` Nick Clifton
  2021-01-27 14:15 ` Michael Matz
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2021-01-26 10:14 UTC (permalink / raw)
  To: Kalamatee, binutils

Hi Kalamatee,

> I am looking for advice on the generation of gnu debug link information in
> binaries

A good starting place would be the source file bfd/opncls.c which contains
several functions related to separate debug information.  In particular the
find_separate_debug_file() function has heuristics for locating the debug
files.

> The problem we have is our binaries are generated under some directory
> (e.g. /home/test/build/AROS/), which is present in the debug link
> information for all the binaries we generate. Is there some way to define a
> base path that the linker will strip when adding this?

It is the objcopy program rather than the linker which is responsible for
adding the debug links, and it strips *all* of the path components from the
filename before storing it.  (See bfd_create_gnu_debuglink_section() where
it calls lbasename).
  
> In future, we had hoped to move the generated debug information under
> <build dir>/Developer/Debug/dbg - - but again doing so doesn't work because
> it then looks for <build dir>/Developer/Debug/dbg/<biuld dir>/<relative
> path to binary>/<binary>

When you say "it looks for", what is "it" ?  If you mean the objdump program
or readelf then you may need to modify the code in the load_separate_debug_info()
function in binutils/dwarf.c.

Cheers
   Nick




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Looking for advice for GNU debuglink generation.
  2021-01-26  2:46 Looking for advice for GNU debuglink generation Kalamatee
  2021-01-26 10:14 ` Nick Clifton
@ 2021-01-27 14:15 ` Michael Matz
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Matz @ 2021-01-27 14:15 UTC (permalink / raw)
  To: Kalamatee; +Cc: binutils

Hello,

On Tue, 26 Jan 2021, Kalamatee via Binutils wrote:

> I am looking for advice on the generation of gnu debug link information 
> in binaries Currently when cross compiling our operating system, we 
> export the debug,. strip the binary, and add the debug link which 
> "works" to some extent, but only if the file layout matches on another 
> machine running the hosted version of our operating system.
> 
> The problem we have is our binaries are generated under some directory
> (e.g. /home/test/build/AROS/), which is present in the debug link
> information for all the binaries we generate. Is there some way to define a
> base path that the linker will strip when adding this?
> 
> In future, we had hoped to move the generated debug information under
> <build dir>/Developer/Debug/dbg - - but again doing so doesn't work because
> it then looks for <build dir>/Developer/Debug/dbg/<biuld dir>/<relative
> path to binary>/<binary>
> 
> Any advice would be greatly appreciated....

Apart from what Nick said, some people use debugedit to post-process debug 
information exactly for case like the above, i.e. path rewriting.  It's 
part of rpm, and some distros install it user-callable. You might want to 
take a look if it fits your needs:

  https://github.com/rpm-software-management/rpm/blob/master/tools/debugedit.c
  http://manpages.ubuntu.com/manpages/bionic/man8/debugedit.8.html


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-27 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26  2:46 Looking for advice for GNU debuglink generation Kalamatee
2021-01-26 10:14 ` Nick Clifton
2021-01-27 14:15 ` Michael Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).