diff options
author | Nick Clifton <nickc@redhat.com> | 2019-08-28 11:39:19 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2019-08-28 11:39:19 +0100 |
commit | a1c110a3fe02f5cb8de18137f6615005288e849e (patch) | |
tree | 7a2209dfa1f841214890f58efffd960bd2ce9dee /binutils/testsuite | |
parent | 72dd1784ef6c5157af03c50975aee603e9b6078e (diff) | |
download | gdb-a1c110a3fe02f5cb8de18137f6615005288e849e.zip gdb-a1c110a3fe02f5cb8de18137f6615005288e849e.tar.gz gdb-a1c110a3fe02f5cb8de18137f6615005288e849e.tar.bz2 |
Add a --source-comment=<text> option to objdump which provides a prefix to dipslayed source code lines.
PR 24931
* objdump.c (source_comment): New static variable.
(option_values): Add OPTION_SOURCE_COMMENT.
(long_opions): Add --source-comment.
(print_line): If source comment is set, use it as a prefix to the
source code line.
(main): Handle OPTION_SOURCE_COMMENT.
* doc/binutils.texi: Document the new option.
* NEWS: Mention the new feature.
* testsuite/binutils-all/objdump.exp (test_objdump_S): Add tests
of the -S and --source-comment options.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index c229194..9630bac 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -803,6 +803,46 @@ proc test_objdump_dotnet_assemblies {} { test_objdump_dotnet_assemblies +# Test objdump -S + +proc test_objdump_S { } { + global srcdir + global subdir + global OBJDUMP + global OBJDUMPFLAGS + + set test "objdump -S" + + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug] != "" } { + unsupported "$test (build)" + return + } + + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -S tmpdir/testprog"] + + set want "static int local = 2" + + if [regexp $want $got] then { + pass $test + } else { + fail $test + } + + set test "objdump --source-comment" + + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --source-comment=// tmpdir/testprog"] + + set want "//static int local = 2" + + if [regexp $want $got] then { + pass $test + } else { + fail $test + } +} + +test_objdump_S + # Options which are not tested: -a -D -R -T -x -l --stabs # I don't see any generic way to test any of these other than -a. # Tests could be written for specific targets, and that should be done |