Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>,
	  "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	  freephp@gmail.com
Subject: Re: [PATCH] Fix cygwin build error with i386-linux-tdep.c
Date: Sat, 05 Sep 2009 20:34:00 -0000	[thread overview]
Message-ID: <4AA2CAFA.809@vmware.com> (raw)
In-Reply-To: <daef60380908310122w5ff65266wdb1a6667bdc8407f@mail.gmail.com>

Hui Zhu wrote:

> Hi guys,
> 
> I make a new patch that change regcache_raw_read to regcache_raw_read_unsigned.
> Please help me review it.
> 
> Thanks,
> Hui
> 
> 2009-08-31  Hui Zhu  <teawater@gmail.com>
> 
> 	* i386-linux-tdep.c (i386_linux_intx80_sysenter_record): Change
> 	regcache_raw_read to regcache_raw_read_unsigned.
> 
> ---
>  i386-linux-tdep.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> --- a/i386-linux-tdep.c
> +++ b/i386-linux-tdep.c
> @@ -367,18 +367,18 @@ static int
>  i386_linux_intx80_sysenter_record (struct regcache *regcache)
>  {
>    int ret;
> -  uint32_t tmpu32;
> +  ULONGEST num;

I like Mark's suggestion of calling it "syscall".
Calling it "num" is not much better than calling it "tmp".   ;-)

Now, talking about signed vs. unsigned vs. casts...

You declared it a ULONGEST because that's what
regcache_raw_read_unsigned expects, right?  -- fair enough.
See below.

> -  regcache_raw_read (regcache, I386_EAX_REGNUM, (gdb_byte *) &tmpu32);
> +  regcache_raw_read_unsigned (regcache, I386_EAX_REGNUM, &num);
> 
> -  if (tmpu32 > 499)
> +  if (num > 499)
>      {
>        printf_unfiltered (_("Process record and replay target doesn't "
> -                           "support syscall number %u\n"), tmpu32);
> +                           "support syscall number %d\n"), (int) num);
>        return -1;
>      }
> 
> -  ret = record_linux_system_call (tmpu32, regcache,
> +  ret = record_linux_system_call ((int) num, regcache,
>  				  &i386_linux_record_tdep);

But here you cast it to int because that's what
record_linux_system_call expects, right?

And since we know at this point that the value is between
0 and 499, the cast can't really do any harm, so it seems
fair.

I could suggest casting it to (unsigned int), but it wouldn't
really make any difference, would it?  Mark -- Jiang -- would
that make you guys more comfortable?

Or would it be more correct to change the prototype of
linux-record-system-call so that it expects an unsigned int?


>    if (ret)
>      return ret;
> 


  parent reply	other threads:[~2009-09-05 20:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-30 13:56 Hui Zhu
2009-08-30 14:09 ` Mark Kettenis
2009-08-30 14:20   ` Hui Zhu
2009-08-30 15:00     ` Hui Zhu
2009-08-31  8:46       ` Hui Zhu
2009-08-31  8:49         ` Jiang Jilin
2009-08-31 12:05           ` Hui Zhu
2009-08-31 16:33             ` Mark Kettenis
2009-09-01  2:15               ` Hui Zhu
2009-09-05 20:34         ` Michael Snyder [this message]
2009-09-05 21:15           ` Joel Brobecker
2009-09-06  4:15             ` Hui Zhu
2009-09-09  2:22               ` Hui Zhu
2009-09-09  3:31                 ` Michael Snyder
2009-09-09  5:59                   ` Hui Zhu
2009-08-30 14:37   ` Andreas Schwab
2009-08-30 15:14     ` Hui Zhu
2009-08-30 15:22 ` Jiang Jilin
2009-08-30 18:00   ` Hui Zhu
2009-08-30 23:43     ` Jiang Jilin
2009-08-30 23:53       ` Hui Zhu
2009-08-31  0:32         ` Jiang Jilin
2009-08-31  2:52           ` Jiang Jilin

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=4AA2CAFA.809@vmware.com \
    --to=msnyder@vmware.com \
    --cc=freephp@gmail.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