From: Jan Kratochvil Date: Wed, 11 Sep 2013 08:31:44 +0000 (+0000) Subject: minidebuginfo: Fix stripping/debuginfo X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=edf9f00c51bc274219a12a2b572abc9ad259af96;p=binutils-gdb.git minidebuginfo: Fix stripping/debuginfo gdb/doc/ 2013-09-11 Jan Kratochvil * gdb.texinfo (MiniDebugInfo): Prepare file debug and use it to create mini_debuginfo. Strip binary before adding mini_debuginfo to it. gdb/testsuite/ 2013-09-11 Jan Kratochvil * gdb.base/gnu-debugdata.exp (objcopy 1): Move it lower and use only debug part of the binary. --- diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 442b6018b0e..1b3e45c1827 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-11 Jan Kratochvil + + * gdb.texinfo (MiniDebugInfo): Prepare file debug and use it to create + mini_debuginfo. Strip binary before adding mini_debuginfo to it. + 2013-09-11 Jan Kratochvil Sync documentation with gdb.base/gnu-debugdata.exp. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 00f8e7774bc..b6ba23921a6 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -17340,10 +17340,16 @@ nm @var{binary} --format=posix --defined-only \ # table. comm -13 dynsyms funcsyms > keep_symbols +# Separate full debug info into debug binary. +objcopy --only-keep-debug @var{binary} debug + # Copy the full debuginfo, keeping only a minimal set of symbols and # removing some unnecessary sections. objcopy -S --remove-section .gdb_index --remove-section .comment \ - --keep-symbols=keep_symbols @var{binary} mini_debuginfo + --keep-symbols=keep_symbols debug mini_debuginfo + +# Drop the full debug info from the original binary. +strip --strip-all -R .comment @var{binary} # Inject the compressed data into the .gnu_debugdata section of the # original binary. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1bf8fb8a92a..aa7397e5179 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-11 Jan Kratochvil + + * gdb.base/gnu-debugdata.exp (objcopy 1): Move it lower and use only + debug part of the binary. + 2013-09-11 Jan Kratochvil * gdb.base/gnu-debugdata.exp (strip): Add -R .comment. diff --git a/gdb/testsuite/gdb.base/gnu-debugdata.exp b/gdb/testsuite/gdb.base/gnu-debugdata.exp index bbd3a763726..e567ea8acda 100644 --- a/gdb/testsuite/gdb.base/gnu-debugdata.exp +++ b/gdb/testsuite/gdb.base/gnu-debugdata.exp @@ -89,13 +89,6 @@ if {[run_on_host "comm" "comm" "-13 ${binfile}.dynsyms ${binfile}.funcsyms" "" \ return -1 } -# Copy the full debuginfo, keeping only a minimal set of symbols and -# removing some unnecessary sections. -remote_file host delete ${binfile}.mini_debuginfo -if {[run_on_host "objcopy 1" [transform objcopy] "-S --remove-section .gdb_index --remove-section .comment --keep-symbols=${binfile}.keep_symbols ${binfile} ${binfile}.mini_debuginfo"]} { - return -1 -} - # GDB specific - we do not have split executable in advance. remote_file host delete ${binfile}.strip if {[run_on_host "strip" [transform strip] \ @@ -110,6 +103,13 @@ if {[run_on_host "copydebug" [transform objcopy] \ return -1 } +# Copy the full debuginfo, keeping only a minimal set of symbols and +# removing some unnecessary sections. +remote_file host delete ${binfile}.mini_debuginfo +if {[run_on_host "objcopy 1" [transform objcopy] "-S --remove-section .gdb_index --remove-section .comment --keep-symbols=${binfile}.keep_symbols ${binfile}.debug ${binfile}.mini_debuginfo"]} { + return -1 +} + # Add the .gnu_debuglink section to the .gnu_debugdata file. # .gnu_debuglink is normally not present in the .gnu_debugdata section but in # some files there may be PT_NOTE with NT_GNU_BUILD_ID and GDB could look up