From: Yao Qi <qiyaoltc@gmail.com>
To: Andreas Arnez <arnez@linux.vnet.ibm.com>
Cc: gdb-patches@sourceware.org, Yao Qi <qiyaoltc@gmail.com>,
"Markus T. Metzger" <markus.t.metzger@intel.com>
Subject: Re: [PATCH] linux-record: Squash cases with identical handling
Date: Wed, 13 Apr 2016 12:03:00 -0000 [thread overview]
Message-ID: <86ega9k97g.fsf@gmail.com> (raw)
In-Reply-To: <m3zisxdbgq.fsf@oc1027705133.ibm.com> (Andreas Arnez's message of "Wed, 13 Apr 2016 12:55:49 +0200")
Andreas Arnez <arnez@linux.vnet.ibm.com> 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.
>
> 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;
>
> 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;
>
> + 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.
--
Yao (齐尧)
next prev parent reply other threads:[~2016-04-13 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 10:55 Andreas Arnez
2016-04-13 12:03 ` Yao Qi [this message]
2016-04-13 15:05 ` Andreas Arnez
2016-04-14 10:11 ` Yao Qi
2016-04-19 15:10 ` Andreas Arnez
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=86ega9k97g.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=markus.t.metzger@intel.com \
/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