Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: gdb-patches@sourceware.org
Subject: [COMMIT PATCH] remote.c: Remove unnecessary fields from 'struct stop_reply'. (was: Re: RFA [PATCH v3] Implement 'catch syscall' for gdbserver)
Date: Fri, 27 Sep 2013 13:25:00 -0000	[thread overview]
Message-ID: <52458729.4030006@redhat.com> (raw)
In-Reply-To: <1379796907.5980.20.camel@soleil>

On 09/21/2013 09:55 PM, Philippe Waroquiers wrote:
> @@ -5284,6 +5377,11 @@ typedef struct stop_reply
>    int stopped_by_watchpoint_p;
>    CORE_ADDR watch_data_address;
>  
> +  /* Set to 1 if the stop_reply is for a syscall entry or
> +     return.  The field ws.value.syscall_number then identifies
> +     the syscall.  */
> +  int syscall;
> +
>    int solibs_changed;
>    int replay_event;

While reviewing this patch, I wondered why we actually need this
field.  Turns out we don't.  I've applied the patch below.

----------
Subject: [PATCH] remote.c: Remove unnecessary fields from 'struct
 stop_reply'.

I noticed these fields aren't really necessary -- if the T stop reply
indicated any we have any special event, the fallthrough doesn't
really do anything.

Tested on x86_64 Fedora 17 w/ local gdbserver, and also confirmed
"catch load" against a Windows gdbserver running under Wine, which
exercises TARGET_WAITKIND_LOADED, still works as expected.

gdb/
2013-09-27  Pedro Alves  <palves@redhat.com>

	* remote.c (struct stop_reply) <solibs_changed, replay_event>:
	Delete fields.
	(remote_parse_stop_reply): Adjust, setting event->ws.kind
	directly.
---
 gdb/remote.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 2e116d9..0fa1e2b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5284,9 +5284,6 @@ typedef struct stop_reply
   int stopped_by_watchpoint_p;
   CORE_ADDR watch_data_address;

-  int solibs_changed;
-  int replay_event;
-
   int core;
 } *stop_reply_p;

@@ -5546,8 +5543,6 @@ remote_parse_stop_reply (char *buf, struct stop_reply *event)
   event->ptid = null_ptid;
   event->ws.kind = TARGET_WAITKIND_IGNORE;
   event->ws.value.integer = 0;
-  event->solibs_changed = 0;
-  event->replay_event = 0;
   event->stopped_by_watchpoint_p = 0;
   event->regcache = NULL;
   event->core = -1;
@@ -5611,15 +5606,14 @@ Packet: '%s'\n"),
 		  while (*p_temp && *p_temp != ';')
 		    p_temp++;

-		  event->solibs_changed = 1;
+		  event->ws.kind = TARGET_WAITKIND_LOADED;
 		  p = p_temp;
 		}
 	      else if (strncmp (p, "replaylog", p1 - p) == 0)
 		{
-		  /* NO_HISTORY event.
-		     p1 will indicate "begin" or "end", but
-		     it makes no difference for now, so ignore it.  */
-		  event->replay_event = 1;
+		  event->ws.kind = TARGET_WAITKIND_NO_HISTORY;
+		  /* p1 will indicate "begin" or "end", but it makes
+		     no difference for now, so ignore it.  */
 		  p_temp = strchr (p1 + 1, ';');
 		  if (p_temp)
 		    p = p_temp;
@@ -5675,18 +5669,15 @@ Packet: '%s'\n"),
 		   buf, p);
 	  ++p;
 	}
+
+      if (event->ws.kind != TARGET_WAITKIND_IGNORE)
+	break;
+
       /* fall through */
     case 'S':		/* Old style status, just signal only.  */
-      if (event->solibs_changed)
-	event->ws.kind = TARGET_WAITKIND_LOADED;
-      else if (event->replay_event)
-	event->ws.kind = TARGET_WAITKIND_NO_HISTORY;
-      else
-	{
-	  event->ws.kind = TARGET_WAITKIND_STOPPED;
-	  event->ws.value.sig = (enum gdb_signal)
-	    (((fromhex (buf[1])) << 4) + (fromhex (buf[2])));
-	}
+      event->ws.kind = TARGET_WAITKIND_STOPPED;
+      event->ws.value.sig = (enum gdb_signal)
+	(((fromhex (buf[1])) << 4) + (fromhex (buf[2])));
       break;
     case 'W':		/* Target exited.  */
     case 'X':
-- 
1.7.11.7



  parent reply	other threads:[~2013-09-27 13:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-21 20:55 RFA [PATCH v3] Implement 'catch syscall' for gdbserver Philippe Waroquiers
2013-09-21 21:03 ` Eli Zaretskii
2013-09-23 11:51 ` Agovic, Sanimir
2013-09-23 19:32   ` Philippe Waroquiers
2013-09-24  7:07     ` Agovic, Sanimir
2013-09-25 16:55       ` Sergio Durigan Junior
2013-09-25 22:55         ` Philippe Waroquiers
2013-09-27 13:25 ` Pedro Alves [this message]
2013-09-27 19:30 ` Pedro Alves
2013-09-27 20:13   ` Philippe Waroquiers
2013-09-27 20:55 ` Sergio Durigan Junior
2013-09-29 15:04   ` RFA [PATCH v4] Implement 'catch syscall' for gdbserver (was Re: RFA [PATCH v3] Implement 'catch syscall' for gdbserver) Philippe Waroquiers
2013-10-01  5:16     ` Sergio Durigan Junior
2013-10-02 21:02       ` Sergio Durigan Junior
2013-10-02 19:41     ` Always run the PTRACE_O_TRACESYSGOOD tests even if PTRACE_O_TRACEFORK is not supported. (was: Re: RFA [PATCH v4] " Pedro Alves
2013-10-02 22:08       ` Philippe Waroquiers
2013-10-03 10:16         ` Always run the PTRACE_O_TRACESYSGOOD tests even if PTRACE_O_TRACEFORK is not supported Pedro Alves
2013-10-03 18:40     ` RFA [PATCH v4] Implement 'catch syscall' for gdbserver (was Re: RFA [PATCH v3] Implement 'catch syscall' for gdbserver) Pedro Alves
2013-10-03 19:53       ` Tom Tromey
2013-10-04 17:41         ` Pedro Alves
2013-10-03 22:02       ` Philippe Waroquiers
2013-10-04 17:29         ` Pedro Alves
2013-10-05  9:15           ` Pedro Alves
2013-10-09 21:54             ` Philippe Waroquiers
2013-10-09 22:05               ` Sergio Durigan Junior
2013-10-09 22:09                 ` Philippe Waroquiers
2013-10-04  4:22     ` Luis Machado
2013-10-04 17:40       ` Pedro Alves
2013-10-04 18:55         ` Stan Shebs
2013-10-07 19:07           ` Pedro Alves

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=52458729.4030006@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /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