diff options
author | Nick Clifton <nickc@redhat.com> | 2020-08-12 13:31:59 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-08-12 13:31:59 +0100 |
commit | 79bc120c7be00596098c09cecd25383ae6ddce34 (patch) | |
tree | 52603d55375f972945e4e25f611f7bd89f637a1e /binutils/testsuite | |
parent | 79ddc88496c3c18eac94b7776dc75b05c33abf25 (diff) | |
download | gdb-79bc120c7be00596098c09cecd25383ae6ddce34.zip gdb-79bc120c7be00596098c09cecd25383ae6ddce34.tar.gz gdb-79bc120c7be00596098c09cecd25383ae6ddce34.tar.bz2 |
Add demangling support to readelf.
PR binutils/26331
* readelf.c (do_demangle): New option flag.
(print_symbol): If do_demangle is enabled, demangle the symbol.
(enum long_option_values): New enum to hold long option values.
(options): Add demangle, no-demangle, recursion-limit and
no-recursion-limit options. Alpha sort the table.
(usage): Describe the new options.
(parse_args): Handle the new options.
* NEWS: Mention the new feature.
* doc/binutils.texi: Document the new feature.
* testsuite/binutils-all/readelf.exp: Test the new feature.
* testsuite/binutils-all/mangled.s: New file - assembler source.
* testsuite/binutils-all/readelf.demangled: New file - expected
output from readelf.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r-- | binutils/testsuite/binutils-all/mangled.s | 6 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/readelf.demangled | 5 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/readelf.exp | 16 |
3 files changed, 27 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/mangled.s b/binutils/testsuite/binutils-all/mangled.s new file mode 100644 index 0000000..0a28d6d --- /dev/null +++ b/binutils/testsuite/binutils-all/mangled.s @@ -0,0 +1,6 @@ + .text + + .global _ZN4gold12Output_relocILi9ELb1ELi64ELb0EEC2EPNS_12Sized_relobjILi64ELb0EEEjjPNS_11Output_dataEmbbbb +_ZN4gold12Output_relocILi9ELb1ELi64ELb0EEC2EPNS_12Sized_relobjILi64ELb0EEEjjPNS_11Output_dataEmbbbb: + .dc.d 0 + diff --git a/binutils/testsuite/binutils-all/readelf.demangled b/binutils/testsuite/binutils-all/readelf.demangled new file mode 100644 index 0000000..a137ced --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.demangled @@ -0,0 +1,5 @@ + +Symbol table '.symtab' contains .* entries: +#... +.*gold::Output_reloc<9, true, 64, false>::Output_reloc\(gold::Sized_relobj<64, false>\*, unsigned int, unsigned int, gold::Output_data\*, unsigned long, bool, bool, bool, bool\) +#pass diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index 0ca2748..d7f47da 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -345,12 +345,28 @@ if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { readelf_test -r $tempfile readelf.r {} } +# Test demangling symbol names. +if {![binutils_assemble $srcdir/$subdir/mangled.s tmpdir/mangled.o]} then { + unresolved "readelf -s -C bintest (failed to assemble)" +} else { + + if ![is_remote host] { + set tempfile tmpdir/mangled.o + } else { + set tempfile [remote_download host tmpdir/mangled.o] + } + + # Run the test. + readelf_test {--syms --demangle --wide} $tempfile readelf.demangled {} +} + readelf_wi_test readelf_compressed_wa_test readelf_dump_test run_dump_test "pr25543" + # PR 13482 - Check for off-by-one errors when dumping .note sections. if {![binutils_assemble $srcdir/$subdir/version.s tmpdir/version.o]} then { unresolved "readelf -n version (failed to assemble)" |