Message ID | 1458154517-25441-2-git-send-email-arnez@linux.vnet.ibm.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 114622 invoked by alias); 16 Mar 2016 18:56:14 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 114610 invoked by uid 89); 16 Mar 2016 18:56:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=interpreted, 23126, Hx-languages-length:1255 X-HELO: e06smtp05.uk.ibm.com Received: from e06smtp05.uk.ibm.com (HELO e06smtp05.uk.ibm.com) (195.75.94.101) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 16 Mar 2016 18:56:03 +0000 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for <gdb-patches@sourceware.org> from <arnez@linux.vnet.ibm.com>; Wed, 16 Mar 2016 18:56:00 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 16 Mar 2016 18:55:59 -0000 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: arnez@linux.vnet.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id C870B17D805A for <gdb-patches@sourceware.org>; Wed, 16 Mar 2016 18:56:30 +0000 (GMT) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2GItwAO3408278 for <gdb-patches@sourceware.org>; Wed, 16 Mar 2016 18:55:59 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2GItwqi030713 for <gdb-patches@sourceware.org>; Wed, 16 Mar 2016 14:55:58 -0400 Received: from oc1027705133.ibm.com (dyn-9-152-212-180.boeblingen.de.ibm.com [9.152.212.180]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u2GItHlf029728; Wed, 16 Mar 2016 14:55:58 -0400 From: Andreas Arnez <arnez@linux.vnet.ibm.com> To: gdb-patches@sourceware.org Cc: Yao Qi <qiyaoltc@gmail.com>, "Metzger, Markus T" <markus.t.metzger@intel.com>, =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= <koriakin@0x04.net> Subject: [PATCH 1/3] linux-record: Fix bad fall-through for pipe/pipe2 Date: Wed, 16 Mar 2016 19:54:35 +0100 Message-Id: <1458154517-25441-2-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1458154517-25441-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1458154517-25441-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16031618-0021-0000-0000-0000065477CB X-IsSubscribed: yes |
Commit Message
Andreas Arnez
March 16, 2016, 6:54 p.m. UTC
This patch added handling for some syscalls to linux-record.c: https://sourceware.org/ml/gdb-patches/2015-10/msg00452.html But for both `pipe' and `pipe2' the patch lacks a statement after an `if', such that the following `break' is interpreted as the `if'-body instead. This adds the missing (return-) statements for the conditionals. gdb/ChangeLog: * linux-record.c (record_linux_system_call): Add missing return statements to handling of pipe and pipe2 syscalls. --- gdb/linux-record.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
On 16/03/16 19:54, Andreas Arnez wrote: > This patch added handling for some syscalls to linux-record.c: > > https://sourceware.org/ml/gdb-patches/2015-10/msg00452.html > > But for both `pipe' and `pipe2' the patch lacks a statement after an > `if', such that the following `break' is interpreted as the `if'-body > instead. > > This adds the missing (return-) statements for the conditionals. Whoops, my bad. This looks like obvious patch material. Though I wonder why it wasn't detected earlier by someone running GCC 6 with its -Wmisleading-indentation warning - does it not catch it? Btw, it seems that cases gdb_sys_pipe2 and gdb_sys_pipe could be squashed into one. > > gdb/ChangeLog: > > * linux-record.c (record_linux_system_call): Add missing return > statements to handling of pipe and pipe2 syscalls. > --- > gdb/linux-record.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdb/linux-record.c b/gdb/linux-record.c > index a40845a..2e86936 100644 > --- a/gdb/linux-record.c > +++ b/gdb/linux-record.c > @@ -354,6 +354,7 @@ record_linux_system_call (enum gdb_syscall syscall, > regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); > if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, > tdep->size_int * 2)) > + return -1; > break; > > case gdb_sys_times: > @@ -2312,6 +2313,7 @@ Do you want to stop the program?"), > regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); > if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, > tdep->size_int * 2)) > + return -1; > break; > > case gdb_sys_inotify_init1: >
Andreas Arnez <arnez@linux.vnet.ibm.com> writes: > gdb/ChangeLog: > > * linux-record.c (record_linux_system_call): Add missing return > statements to handling of pipe and pipe2 syscalls. Patch is good to me.
On Thu, Mar 17 2016, Yao Qi wrote: > Andreas Arnez <arnez@linux.vnet.ibm.com> writes: > >> gdb/ChangeLog: >> >> * linux-record.c (record_linux_system_call): Add missing return >> statements to handling of pipe and pipe2 syscalls. > > Patch is good to me. Thanks, pushed.
On Wed, Mar 16 2016, Marcin KoĆcielnicki wrote: > On 16/03/16 19:54, Andreas Arnez wrote: >> This patch added handling for some syscalls to linux-record.c: >> >> https://sourceware.org/ml/gdb-patches/2015-10/msg00452.html >> >> But for both `pipe' and `pipe2' the patch lacks a statement after an >> `if', such that the following `break' is interpreted as the `if'-body >> instead. >> >> This adds the missing (return-) statements for the conditionals. > > Whoops, my bad. This looks like obvious patch material. Though I > wonder why it wasn't detected earlier by someone running GCC 6 with > its -Wmisleading-indentation warning - does it not catch it? Right, it doesn't catch it (yet): https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66298 > Btw, it seems that cases gdb_sys_pipe2 and gdb_sys_pipe could be > squashed into one. Right, and a few other cases could be squashed as well. Mabye I'll post another patch for that... -- Andreas
diff --git a/gdb/linux-record.c b/gdb/linux-record.c index a40845a..2e86936 100644 --- a/gdb/linux-record.c +++ b/gdb/linux-record.c @@ -354,6 +354,7 @@ record_linux_system_call (enum gdb_syscall syscall, regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int * 2)) + return -1; break; case gdb_sys_times: @@ -2312,6 +2313,7 @@ Do you want to stop the program?"), regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int * 2)) + return -1; break; case gdb_sys_inotify_init1: