[PATCH] Remove parameter lsal from 'create_breakpoints_sal' in 'struct breakpoint_ops'

Yao Qi yao@codesourcery.com
Thu Jul 4 02:27:00 GMT 2013


Hi,
I find parameter 'lsal' of 'create_breakpoints_sal' is only used in
strace with marker, and it can be retrieved from 'canonical->sals'
vector.  This patch is to remove parameter 'lsal' from member
'create_breakpoints_sal' in order to simplify the interface.

This patch only affects the strace with marker, so regression tested
gdb.trace/strace.exp (with desired ust installed).  Is it OK?

gdb:

2013-07-04  Yao Qi  <yao@codesourcery.com>

	* breakpoint.h (struct breakpoint_ops) <create_breakpoints_sal>:
	Remove parameter 'lsal'.
	* breakpoint.c (create_breakpoint): Move local variable 'lsal'
	to inner block.  Caller update.
	(base_breakpoint_create_breakpoints_sal): Update.
	(bkpt_create_breakpoints_sal): Likewise.
	(tracepoint_create_breakpoints_sal): Likewise.
	(strace_marker_create_breakpoints_sal): Get 'lsal' from the
	element 0 of vector 'canonical->sals'.
---
 gdb/breakpoint.c |   16 +++++++---------
 gdb/breakpoint.h |    3 +--
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e558e2e..fe74577 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9613,13 +9613,13 @@ create_breakpoint (struct gdbarch *gdbarch,
      breakpoint.  */
   if (!pending)
     {
-      struct linespec_sals *lsal;
-
-      lsal = VEC_index (linespec_sals, canonical.sals, 0);
-
       if (parse_arg)
         {
 	  char *rest;
+	  struct linespec_sals *lsal;
+
+	  lsal = VEC_index (linespec_sals, canonical.sals, 0);
+
 	  /* Here we only parse 'arg' to separate condition
 	     from thread number, so parsing in context of first
 	     sal is OK.  When setting the breakpoint we'll
@@ -9653,7 +9653,7 @@ create_breakpoint (struct gdbarch *gdbarch,
 	    }
         }
 
-      ops->create_breakpoints_sal (gdbarch, &canonical, lsal,
+      ops->create_breakpoints_sal (gdbarch, &canonical,
 				   cond_string, extra_string, type_wanted,
 				   tempflag ? disp_del : disp_donttouch,
 				   thread, task, ignore_count, ops,
@@ -12726,7 +12726,6 @@ base_breakpoint_create_sals_from_address (char **arg,
 static void
 base_breakpoint_create_breakpoints_sal (struct gdbarch *gdbarch,
 					struct linespec_result *c,
-					struct linespec_sals *lsal,
 					char *cond_string,
 					char *extra_string,
 					enum bptype type_wanted,
@@ -12948,7 +12947,6 @@ bkpt_create_sals_from_address (char **arg,
 static void
 bkpt_create_breakpoints_sal (struct gdbarch *gdbarch,
 			     struct linespec_result *canonical,
-			     struct linespec_sals *lsal,
 			     char *cond_string,
 			     char *extra_string,
 			     enum bptype type_wanted,
@@ -13286,7 +13284,6 @@ tracepoint_create_sals_from_address (char **arg,
 static void
 tracepoint_create_breakpoints_sal (struct gdbarch *gdbarch,
 				   struct linespec_result *canonical,
-				   struct linespec_sals *lsal,
 				   char *cond_string,
 				   char *extra_string,
 				   enum bptype type_wanted,
@@ -13438,7 +13435,6 @@ strace_marker_create_sals_from_address (char **arg,
 static void
 strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
 				      struct linespec_result *canonical,
-				      struct linespec_sals *lsal,
 				      char *cond_string,
 				      char *extra_string,
 				      enum bptype type_wanted,
@@ -13450,6 +13446,8 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
 				      int internal, unsigned flags)
 {
   int i;
+  struct linespec_sals *lsal = VEC_index (linespec_sals,
+					  canonical->sals, 0);
 
   /* If the user is creating a static tracepoint by marker id
      (strace -m MARKER_ID), then store the sals index, so that
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 19961fe..374164c 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -595,8 +595,7 @@ struct breakpoint_ops
      This function is called inside `create_breakpoint'.  */
   void (*create_breakpoints_sal) (struct gdbarch *,
 				  struct linespec_result *,
-				  struct linespec_sals *, char *,
-				  char *,
+				  char *, char *,
 				  enum bptype, enum bpdisp, int, int,
 				  int, const struct breakpoint_ops *,
 				  int, int, int, unsigned);
-- 
1.7.7.6



More information about the Gdb-patches mailing list