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] Make output_thread_groups take an std::vector<int>


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

commit 5c632425957f0150a0d5d1e747f0425f74622132
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Fri Nov 17 13:02:23 2017 -0500

    Make output_thread_groups take an std::vector<int>
    
    A simple replacement of VEC with std::vector.
    
    gdb/ChangeLog:
    
    	* breakpoint.c (output_thread_groups): Take an std::vector.
    	(print_one_breakpoint_location): Adjust.

Diff:
---
 gdb/ChangeLog    |  5 +++++
 gdb/breakpoint.c | 17 +++++++----------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1d2c3c5..373ae85 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-17  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* breakpoint.c (output_thread_groups): Take an std::vector.
+	(print_one_breakpoint_location): Adjust.
+
 2017-11-17  Joel Brobecker  <brobecker@adacore.com>
 
 	* ada-lang.c (resolve_subexp): Add handling of OP_VAR_MSYM_VALUE.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 516cccf..d8d0ed0 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -6031,12 +6031,10 @@ bptype_string (enum bptype type)
 static void
 output_thread_groups (struct ui_out *uiout,
 		      const char *field_name,
-		      VEC(int) *inf_num,
+		      const std::vector<int> &inf_nums,
 		      int mi_only)
 {
   int is_mi = uiout->is_mi_like_p ();
-  int inf;
-  int i;
 
   /* For backward compatibility, don't display inferiors in CLI unless
      there are several.  Always display them for MI. */
@@ -6045,13 +6043,13 @@ output_thread_groups (struct ui_out *uiout,
 
   ui_out_emit_list list_emitter (uiout, field_name);
 
-  for (i = 0; VEC_iterate (int, inf_num, i, inf); ++i)
+  for (size_t i = 0; i < inf_nums.size (); i++)
     {
       if (is_mi)
 	{
 	  char mi_group[10];
 
-	  xsnprintf (mi_group, sizeof (mi_group), "i%d", inf);
+	  xsnprintf (mi_group, sizeof (mi_group), "i%d", inf_nums[i]);
 	  uiout->field_string (NULL, mi_group);
 	}
       else
@@ -6061,7 +6059,7 @@ output_thread_groups (struct ui_out *uiout,
 	  else
 	    uiout->text (", ");
 	
-	  uiout->text (plongest (inf));
+	  uiout->text (plongest (inf_nums[i]));
 	}
     }
 }
@@ -6220,13 +6218,13 @@ print_one_breakpoint_location (struct breakpoint *b,
   if (loc != NULL && !header_of_multiple)
     {
       struct inferior *inf;
-      VEC(int) *inf_num = NULL;
+      std::vector<int> inf_nums;
       int mi_only = 1;
 
       ALL_INFERIORS (inf)
 	{
 	  if (inf->pspace == loc->pspace)
-	    VEC_safe_push (int, inf_num, inf->num);
+	    inf_nums.push_back (inf->num);
 	}
 
         /* For backward compatibility, don't display inferiors in CLI unless
@@ -6239,8 +6237,7 @@ print_one_breakpoint_location (struct breakpoint *b,
 		   moribund_locations and thus having NULL OWNER.  */
 		&& loc->owner->type != bp_catchpoint))
 	mi_only = 0;
-      output_thread_groups (uiout, "thread-groups", inf_num, mi_only);
-      VEC_free (int, inf_num);
+      output_thread_groups (uiout, "thread-groups", inf_nums, mi_only);
     }
 
   if (!part_of_multiple)


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