diff options
author | Martin Liska <mliska@suse.cz> | 2020-10-06 11:18:55 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-10-06 15:49:42 +0200 |
commit | a30d4fc5199ba16cec39fd3f9cca878a9699cf4e (patch) | |
tree | 792e99742209ea776be1a9797ebc1bd3d1a541d4 /gcc/dbgcnt.c | |
parent | 8988ec5b4232ba1d54a2737d2d03a3161b64300e (diff) | |
download | gcc-a30d4fc5199ba16cec39fd3f9cca878a9699cf4e.zip gcc-a30d4fc5199ba16cec39fd3f9cca878a9699cf4e.tar.gz gcc-a30d4fc5199ba16cec39fd3f9cca878a9699cf4e.tar.bz2 |
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.
Diffstat (limited to 'gcc/dbgcnt.c')
-rw-r--r-- | gcc/dbgcnt.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c index 01893ce..2a2dd57 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<unsigned int, unsigned int> limit_tuple; static vec<limit_tuple> limits[debug_counter_number_of_counters]; +static vec<limit_tuple> 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 |