From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Yao Qi <qiyaoltc@gmail.com>,
"Markus T. Metzger" <markus.t.metzger@intel.com>
Subject: [PATCH] linux-record: Squash cases with identical handling
Date: Wed, 13 Apr 2016 10:55:00 -0000 [thread overview]
Message-ID: <m3zisxdbgq.fsf@oc1027705133.ibm.com> (raw)
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've had this in my pipe for some time, so here it is. There should not
be any functional change.
-- >8 --
Subject: [PATCH] linux-record: Squash cases with identical handling
In record_linux_system_call there are some cases with identical
handling. These are merged together to reduce code duplication.
gdb/ChangeLog:
* linux-record.c (record_linux_system_call): Merge handling for
readlink/recv/read and pipe/pipe2. Also move handling for ppoll
before the case for poll and use fall-through logic.
---
gdb/linux-record.c | 40 ++++++++--------------------------------
1 file changed, 8 insertions(+), 32 deletions(-)
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index fda7ada..6b84a18 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -264,6 +264,8 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
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;
@@ -645,12 +648,6 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_symlink:
break;
- case gdb_sys_readlink:
- regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
- if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
- return -1;
- break;
-
case gdb_sys_uselib:
case gdb_sys_swapon:
break;
@@ -742,12 +739,6 @@ Do you want to stop the program?"),
}
break;
- case gdb_sys_recv:
- regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
- if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
- return -1;
- break;
-
case gdb_sys_recvmsg:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (record_linux_msghdr (regcache, tdep, tmpulongest))
@@ -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?"),
return -1;
break;
- case gdb_sys_ppoll:
- regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
- if (tmpulongest)
- {
- ULONGEST nfds;
-
- regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
- if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
- tdep->size_pollfd * nfds))
- return -1;
- }
- if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_timespec))
- return -1;
- break;
-
case gdb_sys_unshare:
case gdb_sys_set_robust_list:
break;
@@ -2035,11 +2016,6 @@ Do you want to stop the program?"),
case gdb_sys_dup3:
break;
- case gdb_sys_pipe2:
- if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
- return -1;
- break;
-
case gdb_sys_inotify_init1:
break;
--
2.5.0
next reply other threads:[~2016-04-13 10:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 10:55 Andreas Arnez [this message]
2016-04-13 12:03 ` Yao Qi
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=m3zisxdbgq.fsf@oc1027705133.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=markus.t.metzger@intel.com \
--cc=qiyaoltc@gmail.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