This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Use gdb::def_vector in func_command


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0b868b60c97b13566cefc8c8f1984225b0165eec

commit 0b868b60c97b13566cefc8c8f1984225b0165eec
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Sep 6 16:03:28 2017 -0600

    Use gdb::def_vector in func_command
    
    This changes func_command to use gdb::def_vector, removing a cleanup.
    
    ChangeLog
    2017-09-09  Tom Tromey  <tom@tromey.com>
    
    	* stack.c (func_command): Use gdb::def_vector.

Diff:
---
 gdb/ChangeLog | 4 ++++
 gdb/stack.c   | 7 ++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a05e635..2ccf4e6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2017-09-09  Tom Tromey  <tom@tromey.com>
 
+	* stack.c (func_command): Use gdb::def_vector.
+
+2017-09-09  Tom Tromey  <tom@tromey.com>
+
 	* mi/mi-cmd-var.c (mi_cmd_var_list_children): Use gdb::optional,
 	ui_out_emit_list, ui_out_emit_tuple.
 	(mi_cmd_var_update): Likewise.
diff --git a/gdb/stack.c b/gdb/stack.c
index a3bc9a3..2433009 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -52,6 +52,7 @@
 #include "symfile.h"
 #include "extension.h"
 #include "observer.h"
+#include "common/def-vector.h"
 
 /* The possible choices of "set print frame-arguments", and the value
    of this setting.  */
@@ -2521,7 +2522,6 @@ func_command (char *arg, int from_tty)
   struct frame_info *frame;
   int found = 0;
   int level = 1;
-  struct function_bounds *func_bounds = NULL;
 
   if (arg == NULL)
     return;
@@ -2529,8 +2529,7 @@ func_command (char *arg, int from_tty)
   frame = get_current_frame ();
   std::vector<symtab_and_line> sals
     = decode_line_with_current_source (arg, DECODE_LINE_FUNFIRSTLINE);
-  func_bounds = XNEWVEC (struct function_bounds, sals.size ());
-  struct cleanup *cleanups = make_cleanup (xfree, func_bounds);
+  gdb::def_vector<function_bounds> func_bounds (sals.size ());
   for (size_t i = 0; (i < sals.size () && !found); i++)
     {
       if (sals[i].pspace != current_program_space)
@@ -2557,8 +2556,6 @@ func_command (char *arg, int from_tty)
     }
   while (!found && level == 0);
 
-  do_cleanups (cleanups);
-
   if (!found)
     printf_filtered (_("'%s' not within current stack frame.\n"), arg);
   else if (frame != get_selected_frame (NULL))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]