|
From: | Nick Clifton |
Subject: | Re: Nonsense in manpage of strip? |
Date: | Tue, 25 Jan 2005 12:28:17 +0000 |
User-agent: | Mozilla Thunderbird 1.0 (X11/20041206) |
Hi Michael,
1.<Link the executable as normal.> 2.<Copy "foo" to "foo.full"> 3.<Run "strip --strip-debug foo"> 4.<Run "objcopy --add-gnu-debuglink=foo.full foo"> Shouldn't Step 4 not simply be '<Copy "foo.full" to "foo">'?
No, the --add-gnu-debuglink switch actually causes objcopy to insert a new section (.gnu.debuglink) into the program it is copying. This section is used by debuggers to locate the stripped out debug information when they load the "foo" executable.
Yes, but 'foo.full' is already the 'foo' executable with included debugging information, because in Step 2 we just preserved that as 'foo.full'. Whyshould i copy that information into the stripped program, when i can achieve the same result by just taking the unstripped version?
Because you do not copy all of the debug information from foo.full into full. Instead objcopy merely creates a new section called .gnu.debuglink which contains a description of how to find the foo.full executable. Thus you still have a stripped "foo" executable which is only slightly bigger than at the end of step 3, but which can now be debugged by debuggers which understand about how to use the .gnu.debuglink section.
Cheers Nick
[Prev in Thread] | Current Thread | [Next in Thread] |