public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/dbgcnt-report-upper-limit)] dbgcnt: print list after compilation
@ 2020-10-06 9:20 Martin Liska
0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2020-10-06 9:20 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:298663950224092427c6d3eb6c498b7b34201e95
commit 298663950224092427c6d3eb6c498b7b34201e95
Author: Martin Liska <mliska@suse.cz>
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 | 23 ++++++++++++++---------
gcc/opts-global.c | 4 ----
gcc/opts.c | 5 -----
gcc/toplev.c | 4 ++++
5 files changed, 19 insertions(+), 19 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..8967b2f4bda 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"));
+ fprintf (stderr, " %-30s%-15s %s\n", G_("counter name"),
+ G_("counter value"), G_("closed intervals"));
printf ("-----------------------------------------------------------------\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 ();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/marxin/heads/dbgcnt-report-upper-limit)] dbgcnt: print list after compilation
@ 2020-10-06 10:01 Martin Liska
0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2020-10-06 10:01 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8c3a02599edded4f9d0183da4c1f1a65ae2203ee
commit 8c3a02599edded4f9d0183da4c1f1a65ae2203ee
Author: Martin Liska <mliska@suse.cz>
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<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
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 ();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-06 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 9:20 [gcc(refs/users/marxin/heads/dbgcnt-report-upper-limit)] dbgcnt: print list after compilation Martin Liska
2020-10-06 10:01 Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).