Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] Remove parameter 'struct breakpoint *t' of encode_actions and encode_actions_1
Date: Thu, 30 May 2013 06:35:00 -0000	[thread overview]
Message-ID: <1369895749-17590-1-git-send-email-yao@codesourcery.com> (raw)

Hi,
I am going to post a patch series written by Pedro some times
ago.  Some changes are refactor to existing GDB code base, I
extract them from the patch series, and post these preparatory patches
at first.  Here is one:

Functions encode_actions_1 and encode_actions pass both 'bp_location'
and 'breakpoint' in parameters, but the latter can be retrieved from
the former.  The latter one can be removed.  The patch is somewhat
obvious, and review still is welcome.  Regression tested on
x86_64-linux.

gdb:

2013-05-30  Pedro Alves  <pedro@codesourcery.com>
	    Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (encode_actions_1): Remove parameter 't'.
	Caller update.
	(encode_actions): Likewise.
	* remote.c (remote_download_tracepoint): Caller update.
	* tracepoint.h (encode_actions): Update declaration.
---
 gdb/remote.c     |    2 +-
 gdb/tracepoint.c |   13 ++++++-------
 gdb/tracepoint.h |    2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index b96b381..d8854ae 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10506,7 +10506,7 @@ remote_download_tracepoint (struct bp_location *loc)
   struct breakpoint *b = loc->owner;
   struct tracepoint *t = (struct tracepoint *) b;
 
-  encode_actions (loc->owner, loc, &tdp_actions, &stepping_actions);
+  encode_actions (loc, &tdp_actions, &stepping_actions);
   old_chain = make_cleanup (free_actions_list_cleanup_wrapper,
 			    tdp_actions);
   (void) make_cleanup (free_actions_list_cleanup_wrapper,
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 899e538..26aedac 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1364,7 +1364,6 @@ stringify_collection_list (struct collection_list *list)
 
 static void
 encode_actions_1 (struct command_line *action,
-		  struct breakpoint *t,
 		  struct bp_location *tloc,
 		  int frame_reg,
 		  LONGEST frame_offset,
@@ -1597,7 +1596,7 @@ encode_actions_1 (struct command_line *action,
 	     here.  */
 	  gdb_assert (stepping_list);
 
-	  encode_actions_1 (action->body_list[0], t, tloc, frame_reg,
+	  encode_actions_1 (action->body_list[0], tloc, frame_reg,
 			    frame_offset, stepping_list, NULL);
 	}
       else
@@ -1608,8 +1607,8 @@ encode_actions_1 (struct command_line *action,
 /* Render all actions into gdb protocol.  */
 
 void
-encode_actions (struct breakpoint *t, struct bp_location *tloc,
-		char ***tdp_actions, char ***stepping_actions)
+encode_actions (struct bp_location *tloc, char ***tdp_actions,
+		char ***stepping_actions)
 {
   char *default_collect_line = NULL;
   struct command_line *actions;
@@ -1629,7 +1628,7 @@ encode_actions (struct breakpoint *t, struct bp_location *tloc,
   gdbarch_virtual_frame_pointer (tloc->gdbarch,
 				 tloc->address, &frame_reg, &frame_offset);
 
-  actions = breakpoint_commands (t);
+  actions = breakpoint_commands (tloc->owner);
 
   /* If there are default expressions to collect, make up a collect
      action and prepend to the action list to encode.  Note that since
@@ -1641,7 +1640,7 @@ encode_actions (struct breakpoint *t, struct bp_location *tloc,
       default_collect_line =  xstrprintf ("collect %s", default_collect);
       make_cleanup (xfree, default_collect_line);
 
-      validate_actionline (default_collect_line, t);
+      validate_actionline (default_collect_line, tloc->owner);
 
       default_collect_action = xmalloc (sizeof (struct command_line));
       make_cleanup (xfree, default_collect_action);
@@ -1649,7 +1648,7 @@ encode_actions (struct breakpoint *t, struct bp_location *tloc,
       default_collect_action->line = default_collect_line;
       actions = default_collect_action;
     }
-  encode_actions_1 (actions, t, tloc, frame_reg, frame_offset,
+  encode_actions_1 (actions, tloc, frame_reg, frame_offset,
 		    &tracepoint_list, &stepping_list);
 
   memrange_sortmerge (&tracepoint_list);
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 18762ca..d7ebc16 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -357,7 +357,7 @@ void free_actions (struct breakpoint *);
 
 extern const char *decode_agent_options (const char *exp, int *trace_string);
 
-extern void encode_actions (struct breakpoint *t, struct bp_location *tloc,
+extern void encode_actions (struct bp_location *tloc,
 			    char ***tdp_actions, char ***stepping_actions);
 
 extern void validate_actionline (const char *, struct breakpoint *);
-- 
1.7.7.6


             reply	other threads:[~2013-05-30  6:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30  6:35 Yao Qi [this message]
2013-05-30  9:02 ` Pedro Alves
2013-05-30  9:40   ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369895749-17590-1-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox