From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 9AB8F3857C7F; Tue, 6 Oct 2020 10:01:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AB8F3857C7F Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/dbgcnt-report-upper-limit)] dbgcnt: print list after compilation X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/dbgcnt-report-upper-limit X-Git-Oldrev: 7650be78f97cc3294584f37e28953b36b33ef15b X-Git-Newrev: 8c3a02599edded4f9d0183da4c1f1a65ae2203ee Message-Id: <20201006100148.9AB8F3857C7F@sourceware.org> Date: Tue, 6 Oct 2020 10:01:48 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2020 10:01:48 -0000 https://gcc.gnu.org/g:8c3a02599edded4f9d0183da4c1f1a65ae2203ee commit 8c3a02599edded4f9d0183da4c1f1a65ae2203ee Author: Martin Liska Date: Tue Oct 6 11:18:55 2020 +0200 dbgcnt: print list after compilation gcc/ChangeLog: * common.opt: Remove -fdbg-cnt-list from deferred options. * dbgcnt.c (dbg_cnt_set_limit_by_index): Make a copy to original_limits. (dbg_cnt_list_all_counters): Print also current counter value and print to stderr. * opts-global.c (handle_common_deferred_options): Do not handle -fdbg-cnt-list. * opts.c (common_handle_option): Likewise. * toplev.c (finalize): Handle it after compilation here. Diff: --- gcc/common.opt | 2 +- gcc/dbgcnt.c | 25 +++++++++++++++---------- gcc/opts-global.c | 4 ---- gcc/opts.c | 5 ----- gcc/toplev.c | 4 ++++ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt index 292c2de694e..7e789d1c47f 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1202,7 +1202,7 @@ Common Report Var(flag_data_sections) Place data items into their own section. fdbg-cnt-list -Common Report Var(common_deferred_options) Defer +Common Report Var(flag_dbg_cnt_list) List all available debugging counters with their limits and counts. fdbg-cnt= diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c index 01893ce7238..2a2dd57507d 100644 --- a/gcc/dbgcnt.c +++ b/gcc/dbgcnt.c @@ -45,6 +45,7 @@ static struct string2counter_map map[debug_counter_number_of_counters] = typedef std::pair limit_tuple; static vec limits[debug_counter_number_of_counters]; +static vec original_limits[debug_counter_number_of_counters]; static unsigned int count[debug_counter_number_of_counters]; @@ -134,6 +135,8 @@ dbg_cnt_set_limit_by_index (enum debug_counter index, const char *name, } } + original_limits[index] = limits[index].copy (); + return true; } @@ -226,25 +229,27 @@ void dbg_cnt_list_all_counters (void) { int i; - printf (" %-30s %s\n", G_("counter name"), G_("closed intervals")); - printf ("-----------------------------------------------------------------\n"); + fprintf (stderr, " %-30s%-15s %s\n", G_("counter name"), + G_("counter value"), G_("closed intervals")); + fprintf (stderr, "-----------------------------------------------------------------\n"); for (i = 0; i < debug_counter_number_of_counters; i++) { - printf (" %-30s ", map[i].name); - if (limits[i].exists ()) + fprintf (stderr, " %-30s%-15d ", map[i].name, count[i]); + if (original_limits[i].exists ()) { - for (int j = limits[i].length () - 1; j >= 0; j--) + for (int j = original_limits[i].length () - 1; j >= 0; j--) { - printf ("[%u, %u]", limits[i][j].first, limits[i][j].second); + fprintf (stderr, "[%u, %u]", original_limits[i][j].first, + original_limits[i][j].second); if (j > 0) - printf (", "); + fprintf (stderr, ", "); } - putchar ('\n'); + fprintf (stderr, "\n"); } else - printf ("unset\n"); + fprintf (stderr, "unset\n"); } - printf ("\n"); + fprintf (stderr, "\n"); } #if CHECKING_P diff --git a/gcc/opts-global.c b/gcc/opts-global.c index b024ab8e18f..1816acf805b 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -378,10 +378,6 @@ handle_common_deferred_options (void) dbg_cnt_process_opt (opt->arg); break; - case OPT_fdbg_cnt_list: - dbg_cnt_list_all_counters (); - break; - case OPT_fdebug_prefix_map_: add_debug_prefix_map (opt->arg); break; diff --git a/gcc/opts.c b/gcc/opts.c index 3bda59afced..da503c32dd0 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2361,11 +2361,6 @@ common_handle_option (struct gcc_options *opts, /* Deferred. */ break; - case OPT_fdbg_cnt_list: - /* Deferred. */ - opts->x_exit_after_options = true; - break; - case OPT_fdebug_prefix_map_: case OPT_ffile_prefix_map_: /* Deferred. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index a4cb8bb262e..8c1e1e1f44f 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -86,6 +86,7 @@ along with GCC; see the file COPYING3. If not see #include "optinfo-emit-json.h" #include "ipa-modref-tree.h" #include "ipa-modref.h" +#include "dbgcnt.h" #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) #include "dbxout.h" @@ -2213,6 +2214,9 @@ finalize (bool no_backend) if (profile_report) dump_profile_report (); + if (flag_dbg_cnt_list) + dbg_cnt_list_all_counters (); + /* Language-specific end of compilation actions. */ lang_hooks.finish (); }