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.
This commit is contained in:
Nick Clifton
2019-08-28 11:39:19 +01:00
parent 72dd1784ef
commit a1c110a3fe
5 changed files with 83 additions and 1 deletions

View File

@ -2104,6 +2104,7 @@ objdump [@option{-a}|@option{--archive-headers}]
[@option{-j} @var{section}|@option{--section=}@var{section}]
[@option{-l}|@option{--line-numbers}]
[@option{-S}|@option{--source}]
[@option{--source-comment}[=@var{text}]]
[@option{-m} @var{machine}|@option{--architecture=}@var{machine}]
[@option{-M} @var{options}|@option{--disassembler-options=}@var{options}]
[@option{-p}|@option{--private-headers}]
@ -2613,6 +2614,15 @@ non-empty sections are displayed.
Display source code intermixed with disassembly, if possible. Implies
@option{-d}.
@item --source-comment[=@var{txt}]
@cindex source disassembly
@cindex disassembly, with source
Like the @option{-S} option, but all source code lines are displayed
with a prefix of @var{txt}. Typically @var{txt} will be a comment
string which can be used to distinguish the assembler code from the
source code. If @var{txt} is not provided then a default string of
@var{``# ``} (hash followed by a space), will be used.
@item --prefix=@var{prefix}
@cindex Add prefix to absolute paths
Specify @var{prefix} to add to the absolute paths when used with