From: Michael Snyder <msnyder@vmware.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Hui Zhu <teawater@gmail.com>,
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject: Re: [RFA] cleanup of syscall consts in process record
Date: Tue, 08 Sep 2009 19:08:00 -0000 [thread overview]
Message-ID: <4AA6AB33.20304@vmware.com> (raw)
In-Reply-To: <20090908180402.GR30677@adacore.com>
Joel Brobecker wrote:
>> 2009-09-08 Michael Snyder <msnyder@vmware.com>
>>
>> * amd64-linux-tdep.h (enum amd64_syscall): New enum consts,
>> to replace literal consts used in amd64-linux-tdep.c
>> * linux-record.h (enum gdb_syscall): New enum consts, to replace
>> literal consts used in amd64-linux-tdep.c and linux-record.c.
>> * amd64-linux-tdep.c (amd64_canonicalize_syscall): New function,
>> translate from native amd64 Linux syscall id to internal gdb id.
>> (amd64_linux_syscall_record): Switch statement abstracted out
>> and replaced with a call to amd64_canonicalize_syscall.
>> * linux-record.c (record_linux_system_call): Replace literal
>> consts with enum consts.
>> * i386-linux-tdep.c (i386_canonicalize_syscall): New function,
>> trivially translate from native i386 Linux syscalls to gdb syscalls.
>> (i386_linux_intx80_sysenter_record):
>
> Nice! I really like this version much better. The approach you took
> with i386 made me wonder whether we really need the amd64_syscall enum
> at all - we could have used a plain int as the argument to
> amd64_canonicalize_syscall, and use plain numbers there, rather than
> having an enum that's only used there. I don't mind, though, so
> don't worry about it unless you agree as well.
Nah, the idea was to get rid of magic numbers,
plus it makes the code more readable. Self-documenting.
> Note that this should also fix the issue that Hui reported about
> building on cygwin with --enable-64-bit-bfd. So I'll remove Hui's
> patch from my list.
Yes, I broke down and included Hui's patch in this one.
> Just one comment:
>
>> +static enum gdb_syscall
>> +i386_canonicalize_syscall (int syscall)
>> +{
>> + enum { i386_syscall_max = 499 };
>> +
>> + if (syscall <= i386_syscall_max)
>> + return syscall;
>
> I thought that we should incorporate Mark's suggestion of checking
> syscall against negative values. But I now realize that if syscall
> is negative, we'll return a value that's equivalent to returning -1.
> And the check against negative values in i386_linux_intx80_sysenter_record
> should then catch it.
Correct.
So this is approved, then?
next prev parent reply other threads:[~2009-09-08 19:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-05 21:35 Michael Snyder
2009-09-06 1:56 ` Hui Zhu
2009-09-06 2:49 ` Joel Brobecker
2009-09-06 4:27 ` Hui Zhu
2009-09-08 16:49 ` Joel Brobecker
2009-09-08 17:42 ` Michael Snyder
2009-09-08 17:48 ` Michael Snyder
2009-09-08 18:04 ` Joel Brobecker
2009-09-08 19:08 ` Michael Snyder [this message]
2009-09-08 19:11 ` Tom Tromey
2009-09-08 19:31 ` Mark Kettenis
2009-09-08 20:08 ` Joel Brobecker
2009-09-08 22:51 ` Michael Snyder
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=4AA6AB33.20304@vmware.com \
--to=msnyder@vmware.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
--cc=teawater@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