aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2012-05-11 18:18:34 +0000
committerCary Coutant <ccoutant@google.com>2012-05-11 18:18:34 +0000
commit4723351a020971562868ce3d500be1824e820a51 (patch)
tree28bbdf737a49a2fc81caef9aee9092d3459eb3fa /binutils/readelf.c
parent6dea1fbd79e621463ba1eba5b4b417ecdf16b3eb (diff)
downloadgdb-4723351a020971562868ce3d500be1824e820a51.zip
gdb-4723351a020971562868ce3d500be1824e820a51.tar.gz
gdb-4723351a020971562868ce3d500be1824e820a51.tar.bz2
* doc/binutils.texi: Add --dwarf-check option.
* dwarf.c (dwarf_check): New global flag. (fetch_indexed_string): New function. (fetch_indexed_value): New function. (get_FORM_name): Add DW_FORM_GNU_str_index and DW_FORM_GNU_addr_index. (decode_location_expression): Add DW_OP_GNU_addr_index. (read_and_display_attr_value): Add DW_FORM_GNU_str_index, DW_FORM_GNU_addr_index, DW_AT_GNU_addr_base, and DW_AT_GNU_ranges_base. (get_AT_name): Add new attributes for Fission. (process_debug_info): Load new debug sections for Fission. (load_debug_info): Check for .debug_info.dwo section. (display_loc_list, display_loc_list_dwo): New functions. (display_debug_loc): Move logic to above two functions. (display_debug_info): Choose abbrev section based on info section. (display_debug_types): Likewise. (display_trace_info): Likewise. (comp_addr_base): New function. (display_debug_addr): New function. (display_debug_str_offsets): New function. (display_debug_ranges): Allow missing range lists. Suppress diagnostics if dwarf_check not set. (debug_displays): Add column to select abbrev section. * dwarf.h (enum dwarf_section_display_enum): Add new debug sections for Fission. (struct dwarf_section): Add abbrev_sec field. (struct dwarf_section_display): New type. (debug_info): Add addr_base, ranges_base fields. (dwarf_check): New global variable. * objdump.c (usage): Add --dwarf-check option. (enum option_values): Add OPTION_DWARF_CHECK. (long_options): Add --dwarf-check. (main): Likewise. * readelf.c (OPTION_DWARF_CHECK): New macro. (options): Add --dwarf-check. (parse_args): Likewise. (process_section_headers): Use const_strneq instead of streq.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 84a13a7..a2884b2 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -3128,6 +3128,7 @@ get_section_type_name (unsigned int sh_type)
#define OPTION_DYN_SYMS 513
#define OPTION_DWARF_DEPTH 514
#define OPTION_DWARF_START 515
+#define OPTION_DWARF_CHECK 516
static struct option options[] =
{
@@ -3163,6 +3164,7 @@ static struct option 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},
{"version", no_argument, 0, 'v'},
{"wide", no_argument, 0, 'W'},
@@ -3431,6 +3433,9 @@ parse_args (int argc, char ** argv)
dwarf_start_die = strtoul (optarg, & cp, 0);
}
break;
+ case OPTION_DWARF_CHECK:
+ dwarf_check = 1;
+ break;
case OPTION_DYN_SYMS:
do_dyn_syms++;
break;
@@ -4639,19 +4644,19 @@ process_section_headers (FILE * file)
name += sizeof (".debug_") - 1;
if (do_debugging
- || (do_debug_info && streq (name, "info"))
- || (do_debug_info && streq (name, "types"))
- || (do_debug_abbrevs && streq (name, "abbrev"))
- || (do_debug_lines && streq (name, "line"))
- || (do_debug_pubnames && streq (name, "pubnames"))
- || (do_debug_pubtypes && streq (name, "pubtypes"))
- || (do_debug_aranges && streq (name, "aranges"))
- || (do_debug_ranges && streq (name, "ranges"))
- || (do_debug_frames && streq (name, "frame"))
- || (do_debug_macinfo && streq (name, "macinfo"))
- || (do_debug_macinfo && streq (name, "macro"))
- || (do_debug_str && streq (name, "str"))
- || (do_debug_loc && streq (name, "loc"))
+ || (do_debug_info && const_strneq (name, "info"))
+ || (do_debug_info && const_strneq (name, "types"))
+ || (do_debug_abbrevs && const_strneq (name, "abbrev"))
+ || (do_debug_lines && const_strneq (name, "line"))
+ || (do_debug_pubnames && const_strneq (name, "pubnames"))
+ || (do_debug_pubtypes && const_strneq (name, "pubtypes"))
+ || (do_debug_aranges && const_strneq (name, "aranges"))
+ || (do_debug_ranges && const_strneq (name, "ranges"))
+ || (do_debug_frames && const_strneq (name, "frame"))
+ || (do_debug_macinfo && const_strneq (name, "macinfo"))
+ || (do_debug_macinfo && const_strneq (name, "macro"))
+ || (do_debug_str && const_strneq (name, "str"))
+ || (do_debug_loc && const_strneq (name, "loc"))
)
request_dump_bynumber (i, DEBUG_DUMP);
}