forked from Imagelibrary/binutils-gdb
Gate the displaying of non-debug sections in separate debuginfo files.
PR 27478 * objdump.c (process_links): New variable. (usage): Add --process-links. (long_options): Likewise. (dump_bfd): Stop processing once the bfd has been loaded unless this is the main file or process_links has been enabled. (main): Handle the process-links option. * readelf.c (process_links): New variable. (struct filedata): Add is_separate field. (options): Add --process-links. (usage): Likewise. (parse_args): Likewise. (process_file_header): Include the filename when dumping information for separate debuginfo files. (process_program_headers): Likewise. (process_section_headers): Likewise. (process_section_groups): Likewise. (process_relocs): Likewise. (process_dynamic_section): Likewise. (process_version_sections): Likewise. (display_lto_symtab): Likewise. (process_symbol_table): Likewise. (process_syminfo): Likewise. (initialise_dumps_by_name): Likewise. (process_section_contents): Likewise. (process_notes_at): Likewise. (process_notes): Likewise. (open_file): Add is_separate parameter. Use to initialise the is_separate field in the filedata structure. (open_deug): Update call to open_file. (process_object): Add processing of the contents of separate debuginfo files, gated by the process_links variable. (process_archive): Update call to open_file. (process_file): Initialise the is_separate field in the filedata structure. * dwarf.c (load_separate_debug_info_file): Only report the loading of a separate file if debug links are being dumped. * objcopy.c (keep_section_symbols): New variable. (enum command_line_switch): Add OPTION_KEEP_SYMBOLS. (strip_options): Add keep-section-symbols. (copy_options): Likewise. (copy_usage): Likewise. (strip_usage): Likewise. (copy_object): Keep section symbols if requested by command line option. (strip_main): Handle --keep-section-symbols. (copy_main): Likewise. * doc/binutils.texi: Document the new options. * NEWS: Mention the new features. * testsuite/binutils-all/compress.exp (test_gnu_debuglink): Update options passed to objdump. Use diff rather than cmp to compare the dumped data. * testsuite/binutils-all/objdump.WK2: Update regexp. * testsuite/binutils-all/objdump.WK3: Update regexp. * testsuite/binutils-all/objdump.exp: Use --process-links instead of --dwarf=follow-links. * testsuite/binutils-all/readelf.exp (readelf_test): Include readelf's output in the log when the test fails. Add the -P option to the -wKis test. * testsuite/binutils-all/readelf.wKis: Update expected output.
This commit is contained in:
@@ -693,7 +693,7 @@ proc test_gnu_debuglink {} {
|
||||
unsupported "$test (build)"
|
||||
return
|
||||
}
|
||||
set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.dump"]
|
||||
set got [remote_exec host "$OBJDUMP -d tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.dump"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
fail "$test (objcopy dump)"
|
||||
return
|
||||
@@ -714,7 +714,7 @@ proc test_gnu_debuglink {} {
|
||||
fail "$test (objcopy link decompress)"
|
||||
return
|
||||
}
|
||||
set got [remote_exec host "$OBJDUMP -S -WN tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.decompress.dump"]
|
||||
set got [remote_exec host "$OBJDUMP -d -WK tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.decompress.dump"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
fail "$test (objcopy dump decompress)"
|
||||
return
|
||||
@@ -723,7 +723,7 @@ proc test_gnu_debuglink {} {
|
||||
fail "$test (objcopy link compress)"
|
||||
return
|
||||
}
|
||||
set got [remote_exec host "$OBJDUMP -S -WN tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.compress.dump"]
|
||||
set got [remote_exec host "$OBJDUMP -d -WK tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.compress.dump"]
|
||||
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
|
||||
fail "$test (objcopy dump compress)"
|
||||
return
|
||||
@@ -731,9 +731,9 @@ proc test_gnu_debuglink {} {
|
||||
|
||||
set src1 tmpdir/testprog.dump
|
||||
set src2 tmpdir/testprog.compress.dump
|
||||
send_log "cmp ${src1} ${src2}\n"
|
||||
verbose "cmp ${src1} ${src2}"
|
||||
set status [remote_exec build cmp "${src1} ${src2}"]
|
||||
send_log "diff ${src1} ${src2}\n"
|
||||
verbose "diff ${src1} ${src2}"
|
||||
set status [remote_exec build diff "${src1} ${src2}"]
|
||||
set exec_output [lindex $status 1]
|
||||
set exec_output [prune_warnings $exec_output]
|
||||
if ![string match "" $exec_output] then {
|
||||
@@ -746,9 +746,9 @@ proc test_gnu_debuglink {} {
|
||||
|
||||
set src1 tmpdir/testprog.decompress.dump
|
||||
set src2 tmpdir/testprog.compress.dump
|
||||
send_log "cmp ${src1} ${src2}\n"
|
||||
verbose "cmp ${src1} ${src2}"
|
||||
set status [remote_exec build cmp "${src1} ${src2}"]
|
||||
send_log "diff ${src1} ${src2}\n"
|
||||
verbose "diff ${src1} ${src2}"
|
||||
set status [remote_exec build diff "${src1} ${src2}"]
|
||||
set exec_output [lindex $status 1]
|
||||
set exec_output [prune_warnings $exec_output]
|
||||
if ![string match "" $exec_output] then {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#...
|
||||
.*debuglink.o: Found separate debug info file:.*linkdebug.debug
|
||||
.*linkdebug.debug:.*
|
||||
#...
|
||||
Contents of the .debug_str section \(loaded from .*linkdebug.debug\):
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#...
|
||||
.*debuglink.o: Found separate debug info file:.*linkdebug.debug
|
||||
#...
|
||||
.*linkdebug.debug:.*
|
||||
#...
|
||||
.* .debug_abbrev .*
|
||||
|
||||
@@ -671,8 +671,8 @@ proc test_follow_debuglink { options dumpfile } {
|
||||
}
|
||||
|
||||
if {[is_elf_format]} then {
|
||||
test_follow_debuglink "--dwarf=follow-links --dwarf=info --dwarf=str" objdump.WK2
|
||||
test_follow_debuglink "--dwarf=follow-links --headers --wide" objdump.WK3
|
||||
test_follow_debuglink "--process-links --dwarf=info --dwarf=str" objdump.WK2
|
||||
test_follow_debuglink "--process-links --headers --wide" objdump.WK3
|
||||
}
|
||||
|
||||
# Test objdump output with start and stop address limits for the specified
|
||||
|
||||
@@ -118,8 +118,9 @@ proc readelf_test { options binary_file regexp_file } {
|
||||
}
|
||||
|
||||
if { [regexp_diff readelf.out $srcdir/$subdir/$regexp_file] } then {
|
||||
send_log [file_contents readelf.out]
|
||||
send_log "\n"
|
||||
fail $testname
|
||||
verbose "output is \n[file_contents readelf.out]" 2
|
||||
return
|
||||
}
|
||||
|
||||
@@ -526,7 +527,7 @@ if {![binutils_assemble $srcdir/$subdir/debuglink.s tmpdir/debuglink.o]} then {
|
||||
set tempfile2 [remote_download host tmpdir/linkdebug.debug]
|
||||
}
|
||||
|
||||
readelf_test {-wKis} $tempfile readelf.wKis
|
||||
readelf_test "-wKis -P" $tempfile readelf.wKis
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#...
|
||||
.*debuglink.o: Found separate debug info file:.*linkdebug.debug
|
||||
#...
|
||||
Contents of the .debug_str section \(loaded from .*debuglink.o\):
|
||||
|
||||
0x00000000 73747269 6e672d31 00737472 696e672d string-1.string-
|
||||
|
||||
Reference in New Issue
Block a user