From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id F09B83858407 for ; Thu, 16 Jun 2022 00:30:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F09B83858407 Received: by mail-pl1-x62e.google.com with SMTP id r1so11751582plo.10 for ; Wed, 15 Jun 2022 17:30:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=Z3S7pADMd+OPtEXoJcf9sCF2vei0WPbA0QCAkRe4zVU=; b=tw3/0U3fae9Y3wSzPC2JFmM2w2FInYy7q05B2aeyMlhlI1pLmU6kJh3UkZBYvGQfj7 twjQQ4sucIeLOy2NeUbNKxDPCfgQhjE3jVN6ZBggaukMdSbIKg+NIX9xAXw4f8SmjFBM J3zeyJ7zfIjzKGV6bbFM33JJVt5NdyDjF0pPhCbnABjqjz9UaBJuib8hplzkp6ku4EZL cL+zzyKeLVSmVcBH7J6BxzskIPhaETWxBefpoFCrGBelVmxswU6eKVCBIlfzaKpd9Y4+ 0MRHDsx1QPykVHP9QAzgi9SWCD0kpeMHLPI4w4qb1Ax8RWt8Pnd3KHLr/fY6iRyRQS40 Q4sw== X-Gm-Message-State: AJIora++dXnHGCsYWbSLzWka1Yka3hbNzxj+3s1bZBtruQsVVB0ionpJ Eomf4GpGx/++PR8grfksFkWS10JzegA= X-Google-Smtp-Source: AGRyM1v2cnfZyMDG6zCIuGhF3fMfBUIwddQlnraJg0YIv//ikhXpLFadwa+oKZDXBAigpjb9/pxlwQ== X-Received: by 2002:a17:902:bd92:b0:168:f1cf:2c6a with SMTP id q18-20020a170902bd9200b00168f1cf2c6amr2314156pls.35.1655339441423; Wed, 15 Jun 2022 17:30:41 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id p14-20020a170902780e00b0015e8d4eb273sm217959pll.189.2022.06.15.17.30.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 17:30:40 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 257881140198; Thu, 16 Jun 2022 10:00:38 +0930 (ACST) Date: Thu, 16 Jun 2022 10:00:38 +0930 From: Alan Modra To: binutils@sourceware.org Subject: Restore readelf -wF Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3037.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2022 00:30:45 -0000 Commit 94585d6d4495 resulted in readelf -wF failing with Unrecognized debug letter option 'F' binutils/ * dwarf.c (debug_dump_long_opts): Add letter. (debug_option_table): New, replacing.. (opts_table, letter_table): ..these. (dwarf_select_sections_by_names): Adjust to suit. Set do_debug_frames outside of loop. (dwarf_select_sections_by_letters): Similarly. gas/ * testsuite/gas/i386/ehinterp.d: Use readelf -wF. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index f11eeaa24ce..cb2523af1f3 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -12034,6 +12034,50 @@ free_debug_memory (void) 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. */ @@ -12041,64 +12085,15 @@ free_debug_memory (void) 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); @@ -12108,11 +12103,6 @@ dwarf_select_sections_by_names (const char *names) * 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; } @@ -12130,6 +12120,11 @@ dwarf_select_sections_by_names (const char *names) 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; } @@ -12139,62 +12134,19 @@ dwarf_select_sections_by_names (const char *names) 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; } } @@ -12204,6 +12156,11 @@ dwarf_select_sections_by_letters (const char *letters) 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; } diff --git a/gas/testsuite/gas/i386/ehinterp.d b/gas/testsuite/gas/i386/ehinterp.d index 5b6ac858709..d4988261195 100644 --- a/gas/testsuite/gas/i386/ehinterp.d +++ b/gas/testsuite/gas/i386/ehinterp.d @@ -1,4 +1,4 @@ -#readelf: --debug-dump=frames-interp +#readelf: -wF Contents of the \.eh_frame section: -- Alan Modra Australia Development Lab, IBM