aboutsummaryrefslogtreecommitdiff
path: root/binutils/addr2line.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2009-12-09 12:58:23 +0000
committerTristan Gingold <gingold@adacore.com>2009-12-09 12:58:23 +0000
commitbe6f64938f985dfb0eaa2107b99f193bb865ce04 (patch)
tree1f2ff18a44815e86c2d546f1b0e81cf63205590e /binutils/addr2line.c
parent03b952fddad1179c316bb9230f696034e6ae3bef (diff)
downloadgdb-be6f64938f985dfb0eaa2107b99f193bb865ce04.zip
gdb-be6f64938f985dfb0eaa2107b99f193bb865ce04.tar.gz
gdb-be6f64938f985dfb0eaa2107b99f193bb865ce04.tar.bz2
2009-12-09 Tristan Gingold <gingold@adacore.com>
* addr2line.c (translate_addresses): Display addresses if option -a is used. (with_addresses): New variable. (long_options): Add option '-a'. (usage): Add usage for option '-a'. (main): Handle option '-a'. * doc/binutils.texi (addr2line): Document option '-a'. * NEWS: Mention new feature.
Diffstat (limited to 'binutils/addr2line.c')
-rw-r--r--binutils/addr2line.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index 1872521..2ecdbfa 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -39,6 +39,7 @@
#include "bucomm.h"
static bfd_boolean unwind_inlines; /* -i, unwind inlined functions. */
+static bfd_boolean with_addresses; /* -a, show addresses. */
static bfd_boolean with_functions; /* -f, show function names. */
static bfd_boolean do_demangle; /* -C, demangle names. */
static bfd_boolean base_names; /* -s, strip directory names. */
@@ -50,6 +51,7 @@ static asymbol **syms; /* Symbol table. */
static struct option long_options[] =
{
+ {"addresses", no_argument, NULL, 'a'},
{"basenames", no_argument, NULL, 's'},
{"demangle", optional_argument, NULL, 'C'},
{"exe", required_argument, NULL, 'e'},
@@ -78,6 +80,7 @@ usage (FILE *stream, int status)
fprintf (stream, _(" If no addresses are specified on the command line, they will be read from stdin\n"));
fprintf (stream, _(" The options are:\n\
@<file> Read options from <file>\n\
+ -a --addresses Show addresses\n\
-b --target=<bfdname> Set the binary file format\n\
-e --exe=<executable> Set the input file name (default is a.out)\n\
-i --inlines Unwind inlined functions\n\
@@ -209,6 +212,13 @@ translate_addresses (bfd *abfd, asection *section)
pc = bfd_scan_vma (*addr++, NULL, 16);
}
+ if (with_addresses)
+ {
+ printf ("0x");
+ bfd_printf_vma (abfd, pc);
+ printf ("\n");
+ }
+
found = FALSE;
if (section)
find_offset_in_section (abfd, section);
@@ -354,13 +364,16 @@ main (int argc, char **argv)
file_name = NULL;
section_name = NULL;
target = NULL;
- while ((c = getopt_long (argc, argv, "b:Ce:sfHhij:Vv", long_options, (int *) 0))
+ while ((c = getopt_long (argc, argv, "ab:Ce:sfHhij:Vv", long_options, (int *) 0))
!= EOF)
{
switch (c)
{
case 0:
break; /* We've been given a long option. */
+ case 'a':
+ with_addresses = TRUE;
+ break;
case 'b':
target = optarg;
break;