* addr2line.c (long_options): Add new option 'section'.

(usage): Document new -j/--section option.
	(find_offset_in_section): New function.
	(translate_addresses): Add 'section' parameter.
	If it is non-null, call find_offset_in_section on it.
	(process_file): Add 'section_name' parameter.
	If it is non-null, look for the section in the BFD object.
	Pass the section to translate_addresses.
	(main): Handle new -j option.
	Pass the section name to process_file.
	* doc/binutils.texi (addr2line): Document new -j/--section option.
This commit is contained in:
Eric Botcazou
2006-04-05 16:12:01 +00:00
parent dfcffada0b
commit c5f8c3881a
3 changed files with 80 additions and 19 deletions

View File

@@ -2601,6 +2601,7 @@ addr2line [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
[@option{-e} @var{filename}|@option{--exe=}@var{filename}]
[@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}]
[@option{-i}|@option{--inlines}]
[@option{-j}|@option{--section=}@var{name}]
[@option{-H}|@option{--help}] [@option{-V}|@option{--version}]
[addr addr @dots{}]
@c man end
@@ -2608,13 +2609,14 @@ addr2line [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
@c man begin DESCRIPTION addr2line
@command{addr2line} translates program addresses into file names and line
numbers. Given an address and an executable, it uses the debugging
information in the executable to figure out which file name and line
number are associated with a given address.
@command{addr2line} translates addresses into file names and line numbers.
Given an address in an executable or an offset in a section of a relocatable
object, it uses the debugging information to figure out which file name and
line number are associated with it.
The executable to use is specified with the @option{-e} option. The
default is the file @file{a.out}.
The executable or relocatable object to use is specified with the @option{-e}
option. The default is the file @file{a.out}. The section in the relocatable
object to use is specified with the @option{-j} option.
@command{addr2line} has two modes of operation.
@@ -2682,6 +2684,10 @@ function will also be printed. For example, if @code{main} inlines
@code{callee1} which inlines @code{callee2}, and address is from
@code{callee2}, the source information for @code{callee1} and @code{main}
will also be printed.
@item -j
@itemx --section
Read offsets relative to the specified section instead of absolute addresses.
@end table
@c man end