free_dwo_info ();
}
+typedef struct
+{
+ const char letter;
+ const char *option;
+ int *variable;
+ int val;
+} debug_dump_long_opts;
+
+static const debug_dump_long_opts debug_option_table[] =
+{
+ { 'A', "addr", &do_debug_addr, 1 },
+ { 'a', "abbrev", &do_debug_abbrevs, 1 },
+ { 'c', "cu_index", &do_debug_cu_index, 1 },
+#ifdef HAVE_LIBDEBUGINFOD
+ { 'D', "use-debuginfod", &use_debuginfod, 1 },
+ { 'E', "do-not-use-debuginfod", &use_debuginfod, 0 },
+#endif
+ { 'F', "frames-interp", &do_debug_frames_interp, 1 },
+ { 'f', "frames", &do_debug_frames, 1 },
+ { 'g', "gdb_index", &do_gdb_index, 1 },
+ { 'i', "info", &do_debug_info, 1 },
+ { 'K', "follow-links", &do_follow_links, 1 },
+ { 'k', "links", &do_debug_links, 1 },
+ { 'L', "decodedline", &do_debug_lines, FLAG_DEBUG_LINES_DECODED },
+ { 'l', "rawline", &do_debug_lines, FLAG_DEBUG_LINES_RAW },
+ /* For compatibility with earlier versions of readelf. */
+ { 'l', "line", &do_debug_lines, FLAG_DEBUG_LINES_RAW },
+ { 'm', "macro", &do_debug_macinfo, 1 },
+ { 'N', "no-follow-links", &do_follow_links, 0 },
+ { 'O', "str-offsets", &do_debug_str_offsets, 1 },
+ { 'o', "loc", &do_debug_loc, 1 },
+ { 'p', "pubnames", &do_debug_pubnames, 1 },
+ { 'R', "Ranges", &do_debug_ranges, 1 },
+ { 'r', "aranges", &do_debug_aranges, 1 },
+ /* For compatibility with earlier versions of readelf. */
+ { 'r', "ranges", &do_debug_aranges, 1 },
+ { 's', "str", &do_debug_str, 1 },
+ { 'T', "trace_aranges", &do_trace_aranges, 1 },
+ { 't', "pubtypes", &do_debug_pubtypes, 1 },
+ { 'U', "trace_info", &do_trace_info, 1 },
+ { 'u', "trace_abbrev", &do_trace_abbrevs, 1 },
+ { 0, NULL, NULL, 0 }
+};
+
/* Enable display of specific DWARF sections as determined by the comma
separated strings in NAMES. Returns non-zero if any displaying was
enabled. */
int
dwarf_select_sections_by_names (const char *names)
{
- typedef struct
- {
- const char * option;
- int * variable;
- int val;
- }
- debug_dump_long_opts;
-
- static const debug_dump_long_opts opts_table [] =
- {
- /* Please keep this table alpha- sorted. */
- { "Ranges", & do_debug_ranges, 1 },
- { "abbrev", & do_debug_abbrevs, 1 },
- { "addr", & do_debug_addr, 1 },
- { "aranges", & do_debug_aranges, 1 },
- { "cu_index", & do_debug_cu_index, 1 },
- { "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED },
-#ifdef HAVE_LIBDEBUGINFOD
- { "do-not-use-debuginfod", & use_debuginfod, 0 },
-#endif
- { "follow-links", & do_follow_links, 1 },
- { "frames", & do_debug_frames, 1 },
- { "frames-interp", & do_debug_frames_interp, 1 },
- /* The special .gdb_index section. */
- { "gdb_index", & do_gdb_index, 1 },
- { "info", & do_debug_info, 1 },
- { "line", & do_debug_lines, FLAG_DEBUG_LINES_RAW }, /* For backwards compatibility. */
- { "links", & do_debug_links, 1 },
- { "loc", & do_debug_loc, 1 },
- { "macro", & do_debug_macinfo, 1 },
- { "no-follow-links", & do_follow_links, 0 },
- { "pubnames", & do_debug_pubnames, 1 },
- { "pubtypes", & do_debug_pubtypes, 1 },
- /* This entry is for compatibility
- with earlier versions of readelf. */
- { "ranges", & do_debug_aranges, 1 },
- { "rawline", & do_debug_lines, FLAG_DEBUG_LINES_RAW },
- { "str", & do_debug_str, 1 },
- { "str-offsets", & do_debug_str_offsets, 1 },
- /* These trace_* sections are used by Itanium VMS. */
- { "trace_abbrev", & do_trace_abbrevs, 1 },
- { "trace_aranges", & do_trace_aranges, 1 },
- { "trace_info", & do_trace_info, 1 },
-#ifdef HAVE_LIBDEBUGINFOD
- { "use-debuginfod", & use_debuginfod, 1 },
-#endif
- { NULL, NULL, 0 }
- };
-
const char *p;
int result = 0;
p = names;
while (*p)
{
- const debug_dump_long_opts * entry;
+ const debug_dump_long_opts *entry;
- for (entry = opts_table; entry->option; entry++)
+ for (entry = debug_option_table; entry->option; entry++)
{
size_t len = strlen (entry->option);
* entry->variable = entry->val;
result |= entry->val;
- /* The --debug-dump=frames-interp option also
- enables the --debug-dump=frames option. */
- if (do_debug_frames_interp)
- do_debug_frames = 1;
-
p += len;
break;
}
p++;
}
+ /* The --debug-dump=frames-interp option also enables the
+ --debug-dump=frames option. */
+ if (do_debug_frames_interp)
+ do_debug_frames = 1;
+
return result;
}
int
dwarf_select_sections_by_letters (const char *letters)
{
- typedef struct
- {
- const char letter;
- int * variable;
- int val;
- bool cont;
- }
- debug_dump_letter_opts;
-
- static const debug_dump_letter_opts letter_table [] =
- {
- { 'A', & do_debug_addr, 1, false},
- { 'a', & do_debug_abbrevs, 1, false },
- { 'c', & do_debug_cu_index, 1, false },
-#ifdef HAVE_LIBDEBUGINFOD
- { 'D', & use_debuginfod, 1, false },
- { 'E', & use_debuginfod, 0, false },
-#endif
- { 'F', & do_debug_frames_interp, 1, true }, /* Note the fall through. */
- { 'f', & do_debug_frames, 1, false },
- { 'g', & do_gdb_index, 1, false },
- { 'i', & do_debug_info, 1, false },
- { 'K', & do_follow_links, 1, false },
- { 'k', & do_debug_links, 1, false },
- { 'L', & do_debug_lines, FLAG_DEBUG_LINES_DECODED, false },
- { 'l', & do_debug_lines, FLAG_DEBUG_LINES_RAW, false },
- { 'm', & do_debug_macinfo, 1, false },
- { 'N', & do_follow_links, 0, false },
- { 'O', & do_debug_str_offsets, 1, false },
- { 'o', & do_debug_loc, 1, false },
- { 'p', & do_debug_pubnames, 1, false },
- { 'R', & do_debug_ranges, 1, false },
- { 'r', & do_debug_aranges, 1, false },
- { 's', & do_debug_str, 1, false },
- { 'T', & do_trace_aranges, 1, false },
- { 't', & do_debug_pubtypes, 1, false },
- { 'U', & do_trace_info, 1, false },
- { 'u', & do_trace_abbrevs, 1, false },
- { 0, NULL, 0, false }
- };
-
int result = 0;
while (* letters)
{
- const debug_dump_letter_opts * entry;
+ const debug_dump_long_opts *entry;
- for (entry = letter_table; entry->letter; entry++)
+ for (entry = debug_option_table; entry->letter; entry++)
{
if (entry->letter == * letters)
{
* entry->variable |= entry->val;
result |= entry->val;
-
- if (! entry->cont)
- break;
+ break;
}
}
letters ++;
}
+ /* The --debug-dump=frames-interp option also enables the
+ --debug-dump=frames option. */
+ if (do_debug_frames_interp)
+ do_debug_frames = 1;
+
return result;
}