From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93350 invoked by alias); 13 Apr 2016 12:03:12 -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 93335 invoked by uid 89); 13 Apr 2016 12:03:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:10.98.15.142, judge X-HELO: mail-pf0-f174.google.com Received: from mail-pf0-f174.google.com (HELO mail-pf0-f174.google.com) (209.85.192.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 13 Apr 2016 12:03:01 +0000 Received: by mail-pf0-f174.google.com with SMTP id n1so33117313pfn.2 for ; Wed, 13 Apr 2016 05:03:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=lFWk42dBtkMY9+jqVKrz+PfY8/Sc/LkbKJOpeu8QuNc=; b=BVJJ5g8zHREo/XxfPHlCwjFbQJwivVRZiKVrzpCpG/18G2ef39PwEn2eghxPJcPYkf 2+/kOQUQDhNdDzOJDgY7LlZ2fOybPDertNJIeGN7t3Yw28wDinPH3i0ueVKHkUNrgF/9 SheXkB7xPkOU8pSYQyRzA5VgFutWdq8oze7dZo6+EgnOT8os4sYXualrv3ENetDn77ma sMK20vbos+I46BFNJmkCNClsw0iQSXcXk07FuH9sZMPLn+iAZdJzHZC77at7Gy2PXNuq EUx46FHCd0HF4A1RN/uh8UL0FRwkk1WTrIFUw1sjxvgtF3VAa0sm8PuvsL63jikK74L0 GueA== X-Gm-Message-State: AOPr4FUotqXlX8x7g6bHJhNuJUdjCXX1GqeDZJPtXxFZupgUqDIzCPl+9mrC5EwwAv2dSA== X-Received: by 10.98.15.142 with SMTP id 14mr12439175pfp.6.1460548979402; Wed, 13 Apr 2016 05:02:59 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id qy7sm50817342pab.34.2016.04.13.05.02.55 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 13 Apr 2016 05:02:58 -0700 (PDT) From: Yao Qi To: Andreas Arnez Cc: gdb-patches@sourceware.org, Yao Qi , "Markus T. Metzger" Subject: Re: [PATCH] linux-record: Squash cases with identical handling References: Date: Wed, 13 Apr 2016 12:03:00 -0000 In-Reply-To: (Andreas Arnez's message of "Wed, 13 Apr 2016 12:55:49 +0200") Message-ID: <86ega9k97g.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00268.txt.bz2 Andreas Arnez writes: Hi Andreas, > While discussing a fix for a bad fall-through in linux-record.c, it was > pointed out that the cases for gdb_sys_pipe2 and gdb_sys_pipe can be > squashed into one. Thus I promised a minor cleanup for cases with > identical handling: > > https://sourceware.org/ml/gdb-patches/2016-03/msg00310.html I thought about squashing them too, but the reason I didn't do that is these enum gdb_syscall in the switch block are listed in the numeric order, so that it is quite easy to find whether a syscall is supported, or add a new syscall. I am not against your patch, but want to let people know why the code is written that way, so that people can judge which one is better. >=20=20 > case gdb_sys_read: > + case gdb_sys_readlink: > + case gdb_sys_recv: > regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest); > if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest)) > return -1; > @@ -348,6 +350,7 @@ record_linux_system_call (enum gdb_syscall syscall, > break; >=20=20 > case gdb_sys_pipe: > + case gdb_sys_pipe2: > if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2)) > return -1; > break; I don't mind this... anyway, it can shorten the code. > @@ -1364,6 +1355,11 @@ Do you want to stop the program?"), > case gdb_sys_ni_syscall167: > break; >=20=20 > + case gdb_sys_ppoll: > + if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_timespec)) > + return -1; > + /* Fall through. */ > + > case gdb_sys_poll: > regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); > if (tmpulongest) > @@ -1959,21 +1955,6 @@ Do you want to stop the program?"), but, I don't like the fall-through. --=20 Yao (=E9=BD=90=E5=B0=A7)