+void
+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 },
+ { "aranges", & do_debug_aranges, 1 },
+ { "frames", & do_debug_frames, 1 },
+ { "frames-interp", & do_debug_frames_interp, 1 },
+ { "info", & do_debug_info, 1 },
+ { "line", & do_debug_lines, FLAG_DEBUG_LINES_RAW }, /* For backwards compatibility. */
+ { "rawline", & do_debug_lines, FLAG_DEBUG_LINES_RAW },
+ { "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED },
+ { "loc", & do_debug_loc, 1 },
+ { "macro", & do_debug_macinfo, 1 },
+ { "pubnames", & do_debug_pubnames, 1 },
+ /* This entry is for compatability
+ with earlier versions of readelf. */
+ { "ranges", & do_debug_aranges, 1 },
+ { "str", & do_debug_str, 1 },
+ { NULL, NULL, 0 }
+ };
+
+ const char *p;
+
+ p = names;
+ while (*p)
+ {
+ const debug_dump_long_opts * entry;
+
+ for (entry = opts_table; entry->option; entry++)
+ {
+ size_t len = strlen (entry->option);
+
+ if (strncmp (p, entry->option, len) == 0
+ && (p[len] == ',' || p[len] == '\0'))
+ {
+ * entry->variable |= 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;
+ }
+ }
+
+ if (entry->option == NULL)
+ {
+ warn (_("Unrecognized debug option '%s'\n"), p);
+ p = strchr (p, ',');
+ if (p == NULL)
+ break;
+ }
+
+ if (*p == ',')
+ p++;
+ }
+}
+
+void
+dwarf_select_sections_by_letters (const char *letters)
+{
+ unsigned int index = 0;
+
+ while (letters[index])
+ switch (letters[index++])
+ {
+ case 'i':
+ do_debug_info = 1;
+ break;
+
+ case 'a':
+ do_debug_abbrevs = 1;
+ break;
+
+ case 'l':
+ do_debug_lines |= FLAG_DEBUG_LINES_RAW;
+ break;
+
+ case 'L':
+ do_debug_lines |= FLAG_DEBUG_LINES_DECODED;
+ break;
+
+ case 'p':
+ do_debug_pubnames = 1;
+ break;
+
+ case 'r':
+ do_debug_aranges = 1;
+ break;
+
+ case 'R':
+ do_debug_ranges = 1;
+ break;
+
+ case 'F':
+ do_debug_frames_interp = 1;
+ case 'f':
+ do_debug_frames = 1;
+ break;
+
+ case 'm':
+ do_debug_macinfo = 1;
+ break;
+
+ case 's':
+ do_debug_str = 1;
+ break;
+
+ case 'o':
+ do_debug_loc = 1;
+ break;
+
+ default:
+ warn (_("Unrecognized debug option '%s'\n"), optarg);
+ break;
+ }
+}
+
+void
+dwarf_select_sections_all (void)
+{
+ do_debug_info = 1;
+ do_debug_abbrevs = 1;
+ do_debug_lines = FLAG_DEBUG_LINES_RAW;
+ do_debug_pubnames = 1;
+ do_debug_aranges = 1;
+ do_debug_ranges = 1;
+ do_debug_frames = 1;
+ do_debug_macinfo = 1;
+ do_debug_str = 1;
+ do_debug_loc = 1;
+}
+