aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2017-03-21 13:05:19 +0000
committerNick Clifton <nickc@redhat.com>2017-03-21 13:05:19 +0000
commit4a14e306468af630a27302d68b8d4c59733141b4 (patch)
treef4ce41f2040e4349dd656f81beaf1f6fd66612db /binutils/objdump.c
parent645d3342ba2b920722991255513030bb903b794e (diff)
downloadgdb-4a14e306468af630a27302d68b8d4c59733141b4.zip
gdb-4a14e306468af630a27302d68b8d4c59733141b4.tar.gz
gdb-4a14e306468af630a27302d68b8d4c59733141b4.tar.bz2
Add --inlines option to objdump to include scope backtrace of inlined functions when generating source line number information.
* objdump.c (unwind_inlines): Add. (option_values): Add OPTION_INLINES. (show_line): Unwind inlines if requested. (main): Parse OPTION_INLINES. (usage): Document --inlines. * doc/binutils.texi: Document --inlines. * NEWS: Likewise.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 6cd8d0b..58521dd 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -117,6 +117,7 @@ static bfd_boolean display_file_offsets;/* -F */
static const char *prefix; /* --prefix */
static int prefix_strip; /* --prefix-strip */
static size_t prefix_length;
+static bfd_boolean unwind_inlines; /* --inlines. */
/* A structure to record the sections mentioned in -j switches. */
struct only
@@ -257,6 +258,7 @@ usage (FILE *stream, int status)
--insn-width=WIDTH Display WIDTH bytes on a single line for -d\n\
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n\
--special-syms Include special symbols in symbol dumps\n\
+ --inlines Print all inlines for source line (with -l)\n\
--prefix=PREFIX Add PREFIX to absolute paths for -S\n\
--prefix-strip=LEVEL Strip initial directory names for -S\n"));
fprintf (stream, _("\
@@ -296,7 +298,8 @@ enum option_values
OPTION_ADJUST_VMA,
OPTION_DWARF_DEPTH,
OPTION_DWARF_CHECK,
- OPTION_DWARF_START
+ OPTION_DWARF_START,
+ OPTION_INLINES
};
static struct option long_options[]=
@@ -348,6 +351,7 @@ static struct option long_options[]=
{"dwarf-depth", required_argument, 0, OPTION_DWARF_DEPTH},
{"dwarf-start", required_argument, 0, OPTION_DWARF_START},
{"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK},
+ {"inlines", no_argument, 0, OPTION_INLINES},
{0, no_argument, 0, 0}
};
@@ -1543,6 +1547,17 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
else
printf ("%s:%u\n", filename == NULL ? "???" : filename, linenumber);
}
+ if (unwind_inlines)
+ {
+ const char *filename2;
+ const char *functionname2;
+ unsigned line2;
+
+ while (bfd_find_inliner_info (abfd, &filename2, &functionname2,
+ &line2))
+ printf ("inlined by %s:%u (%s)\n", filename2, line2,
+ functionname2);
+ }
}
if (with_source_code
@@ -3808,6 +3823,9 @@ main (int argc, char **argv)
if (insn_width <= 0)
fatal (_("error: instruction width must be positive"));
break;
+ case OPTION_INLINES:
+ unwind_inlines = TRUE;
+ break;
case 'E':
if (strcmp (optarg, "B") == 0)
endian = BFD_ENDIAN_BIG;