This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/82857] libbacktrace: please support binaries stripped with dwz -m (following the .gnu_debugaltlink)
- From: "vries at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Nov 2018 16:26:59 +0000
- Subject: [Bug other/82857] libbacktrace: please support binaries stripped with dwz -m (following the .gnu_debugaltlink)
- Auto-submitted: auto-generated
- References: <bug-82857-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82857
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-11-01
CC| |vries at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Test-case:
...
$ cat bt.c
#include "backtrace.h"
int
main (void)
{
struct backtrace_state *state = backtrace_create_state ("./a.out", 0, NULL,
NULL);
backtrace_print (state, 0, stderr);
return 0;
}
...
Test script:
...
$ cat test.sh
#!/bin/sh
###########################
rm -Rf a.out ./a.out.debug
###########################
src=bt.c
pwd=$(pwd -P)
gcc_src=$pwd/src
gcc_build=$pwd/build
CFLAGS="-I $gcc_src/libbacktrace"
LDFLAGS="-lbacktrace -L $gcc_build/libbacktrace/.libs/"
gcc $src -O0 -g $CFLAGS $LDFLAGS
###########################
echo "Non-stripped"
./a.out 2>&1 | grep -c /bt.c
###########################
cp a.out a.out.debug
strip --only-keep-debug a.out.debug
cp a.out.debug a.out.debug.saved
###########################
objcopy --strip-debug ./a.out
#strip a.out
echo "Stripped"
./a.out 2>&1 | grep -c /bt.c
###########################
objcopy --add-gnu-debuglink=a.out.debug ./a.out
echo "Stripped with debuglink"
./a.out 2>&1 | grep -c /bt.c
###########################
objcopy a.out.debug --compress-debug-sections=zlib
# We need to reset the debuglink, because the checksum has changed
objcopy -R .gnu_debuglink ./a.out
objcopy --add-gnu-debuglink=a.out.debug ./a.out
echo "Stripped with debuglink to compressed with objcopy"
./a.out 2>&1 | grep -c /bt.c
###########################
cp a.out.debug.saved a.out.debug
dwz a.out.debug
# We need to reset the debuglink, because the checksum has changed
objcopy -R .gnu_debuglink ./a.out
objcopy --add-gnu-debuglink=a.out.debug ./a.out
echo "Stripped with debuglink to compressed with dwz"
./a.out 2>&1 | grep -c /bt.c
###########################
cp a.out.debug.saved a.out.debug
cp a.out.debug.saved a.out.2.debug
dwz -m common.debug a.out.debug a.out.2.debug
# We need to reset the debuglink, because the checksum has changed
objcopy -R .gnu_debuglink ./a.out
objcopy --add-gnu-debuglink=a.out.debug ./a.out
echo "Stripped with debuglink to compressed with dwz -m"
./a.out 2>&1 | grep -c /bt.c
...
Test output:
...
$ ./test.sh
Non-stripped
1
Stripped
0
Stripped with debuglink
1
Stripped with debuglink to compressed with objcopy
1
Stripped with debuglink to compressed with dwz
1
Stripped with debuglink to compressed with dwz -m
0
...
Confirmed on master.