* How to create separate files with debug information?
@ 2007-04-16 4:09 Shriramana Sharma
2007-04-16 5:12 ` vadiraj
2007-04-16 13:49 ` Glynn Clements
0 siblings, 2 replies; 3+ messages in thread
From: Shriramana Sharma @ 2007-04-16 4:09 UTC (permalink / raw)
To: linux-c-programming
When we strip a file, we remove any debug information from it. This is
done to reduce the size of the file.
I have seen package managers provide separate files with debug
information. For instance, I have a libQtGui.so.4.2.3.debug file 55 MB
in size separate from the libQtGui.so.4.2.3 file which is 7 MB in size.
Now the questions:
First: Is this kind of providing separate debug files applicable only
for library or also for applications?
Second: How do I create such .debug files with debug information only? I
find that these debug files are not executables.
Thank you.
Shriramana Sharma.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to create separate files with debug information?
2007-04-16 4:09 How to create separate files with debug information? Shriramana Sharma
@ 2007-04-16 5:12 ` vadiraj
2007-04-16 13:49 ` Glynn Clements
1 sibling, 0 replies; 3+ messages in thread
From: vadiraj @ 2007-04-16 5:12 UTC (permalink / raw)
To: linux-c-programming
On Mon, 2007-04-16 at 09:39 +0530, Shriramana Sharma wrote:
> Now the questions:
>
> First: Is this kind of providing separate debug files applicable only
> for library or also for applications?
Yes you can have debug file for applications too.
>
> Second: How do I create such .debug files with debug information only? I
> find that these debug files are not executables.
any binary/library compiled with debug flag are with debugging
information. I believe .debug in your example will be linked to the file
that the application will link. Ex. libQtGui.so ->
libQtGui.so.4.2.3.debug
Cheers,
Vadi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to create separate files with debug information?
2007-04-16 4:09 How to create separate files with debug information? Shriramana Sharma
2007-04-16 5:12 ` vadiraj
@ 2007-04-16 13:49 ` Glynn Clements
1 sibling, 0 replies; 3+ messages in thread
From: Glynn Clements @ 2007-04-16 13:49 UTC (permalink / raw)
To: Shriramana Sharma; +Cc: linux-c-programming
Shriramana Sharma wrote:
> When we strip a file, we remove any debug information from it. This is
> done to reduce the size of the file.
>
> I have seen package managers provide separate files with debug
> information. For instance, I have a libQtGui.so.4.2.3.debug file 55 MB
> in size separate from the libQtGui.so.4.2.3 file which is 7 MB in size.
>
> Now the questions:
>
> First: Is this kind of providing separate debug files applicable only
> for library or also for applications?
>
> Second: How do I create such .debug files with debug information only? I
> find that these debug files are not executables.
I haven't tried it, but I found this in the binutils Info file:
`--only-keep-debug'
Strip a file, removing any sections that would be stripped by
`--strip-debug' and leaving the debugging sections.
The intention is that this option will be used in conjunction with
`--add-gnu-debuglink' to create a two part executable. One a
stripped binary which will occupy less space in RAM and in a
distribution and the second a debugging information file which is
only needed if debugging abilities are required. The suggested
procedure to create these files is as follows:
1. Link the executable as normal. Assuming that is is called
`foo' then...
2. Run `objcopy --only-keep-debug foo foo.dbg' to create a file
containing the debugging info.
3. Run `objcopy --strip-debug foo' to create a stripped
executable.
4. Run `objcopy --add-gnu-debuglink=foo.dbg foo' to add a link
to the debugging info into the stripped executable.
Note - the choice of `.dbg' as an extension for the debug info
file is arbitrary. Also the `--only-keep-debug' step is optional.
You could instead do this:
1. Link the executable as normal.
2. Copy `foo' to `foo.full'
3. Run `objcopy --strip-debug foo'
4. Run `objcopy --add-gnu-debuglink=foo.full foo'
ie the file pointed to by the `--add-gnu-debuglink' can be the
full executable. It does not have to be a file created by the
`--only-keep-debug' switch.
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-16 13:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-16 4:09 How to create separate files with debug information? Shriramana Sharma
2007-04-16 5:12 ` vadiraj
2007-04-16 13:49 ` Glynn Clements
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 NNTP newsgroup(s).