gdb: make signal_catch_counts a static array
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 7 Oct 2020 12:13:44 +0000 (08:13 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Wed, 7 Oct 2020 12:13:44 +0000 (08:13 -0400)
I noticed that signal_catch_counts is a dynamically-allocated array of
constant size, allocated at startup an never freed.  This might as well
be a statically-allocated array.

gdb/ChangeLog:

* break-catch-sig.c (signal_catch_counts): Make a static arrray.
(_initialize_break_catch_sig): Don't allocate array.

Change-Id: I220321df5ad6c1d2664ec9d483eea2dc1c979afe

gdb/ChangeLog
gdb/break-catch-sig.c

index 2744ad8e0975b42ec35377f522bfb154e9bcfd30..6a69e630852c4cb52ee36f112460822f40923555 100644 (file)
@@ -1,3 +1,8 @@
+2020-10-07  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * break-catch-sig.c (signal_catch_counts): Make a static arrray.
+       (_initialize_break_catch_sig): Don't allocate array.
+
 2020-10-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * symtab.c (find_pc_line): Return unmapped addresses when the
index e3e6f6fd8c9d1ee73ae9f0805067a5983e73546a..5c7cdf1fecc69d64a312c50eb07d810419b24cf4 100644 (file)
@@ -60,7 +60,7 @@ static struct breakpoint_ops signal_catchpoint_ops;
 
 /* Count of each signal.  */
 
-static unsigned int *signal_catch_counts;
+static unsigned int signal_catch_counts[GDB_SIGNAL_LAST];
 
 \f
 
@@ -430,8 +430,6 @@ _initialize_break_catch_sig ()
 {
   initialize_signal_catchpoint_ops ();
 
-  signal_catch_counts = XCNEWVEC (unsigned int, GDB_SIGNAL_LAST);
-
   add_catch_command ("signal", _("\
 Catch signals by their names and/or numbers.\n\
 Usage: catch signal [[NAME|NUMBER] [NAME|NUMBER]...|all]\n\