diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-01-30 09:17:56 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-01-31 10:16:49 -0800 |
commit | e1dbfc17c5305eef8f021c1baa703151bffc1490 (patch) | |
tree | ecca0df32edcb737c8c323fc4f1a0f2f8893ed6c /binutils/readelf.c | |
parent | 492325c4b78933e41608c53963d29b1f16affd47 (diff) | |
download | gdb-e1dbfc17c5305eef8f021c1baa703151bffc1490.zip gdb-e1dbfc17c5305eef8f021c1baa703151bffc1490.tar.gz gdb-e1dbfc17c5305eef8f021c1baa703151bffc1490.tar.bz2 |
Load debug section only when dumping debug sections
Don't load debug sections if we aren't dumping any debug sections.
PR binutils/28843
* objdump.c (dump_any_debugging): New.
(load_debug_section): Return false if dump_any_debugging isn't
set.
(main): Set dump_any_debugging when dumping any debug sections.
* readelf (dump_any_debugging): New.
(parse_args): Set dump_any_debugging when dumping any debug
sections.
(load_debug_section): Return false if dump_any_debugging isn't
set.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index b45683c..e56e9b5 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -239,6 +239,7 @@ static bool decompress_dumps = false; static bool do_not_show_symbol_truncation = false; static bool do_demangle = false; /* Pretty print C++ symbol names. */ static bool process_links = false; +static bool dump_any_debugging = false; static int demangle_flags = DMGL_ANSI | DMGL_PARAMS; static int sym_base = 0; @@ -5332,6 +5333,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv) case 'P': process_links = true; do_follow_links = true; + dump_any_debugging = true; break; case 'x': request_dump (dumpdata, HEX_DUMP); @@ -5347,6 +5349,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv) break; case 'w': do_dump = true; + dump_any_debugging = true; if (optarg == NULL) { do_debugging = true; @@ -5360,6 +5363,7 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv) break; case OPTION_DEBUG_DUMP: do_dump = true; + dump_any_debugging = true; if (optarg == NULL) { do_debugging = true; @@ -15913,6 +15917,9 @@ load_debug_section (enum dwarf_section_display_enum debug, void * data) Elf_Internal_Shdr * sec; Filedata * filedata = (Filedata *) data; + if (!dump_any_debugging) + return false; + /* Without section headers we cannot find any sections. */ if (filedata->section_headers == NULL) return false; |