From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17283 invoked by alias); 27 Sep 2013 13:25:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 17270 invoked by uid 89); 27 Sep 2013 13:25:04 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Sep 2013 13:25:04 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPAM_SUBJECT autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8RDOxEW018665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 Sep 2013 09:24:59 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8RDOvw7006878; Fri, 27 Sep 2013 09:24:58 -0400 Message-ID: <52458729.4030006@redhat.com> Date: Fri, 27 Sep 2013 13:25:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Philippe Waroquiers 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) References: <1379796907.5980.20.camel@soleil> In-Reply-To: <1379796907.5980.20.camel@soleil> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-09/txt/msg00954.txt.bz2 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 * remote.c (struct stop_reply) : 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