From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: yao@codesourcery.com
Cc: gdb-patches@sourceware.org
Subject: Re: [patch, i386] Use read_memory_unsigned_integer to get address
Date: Thu, 22 Sep 2011 13:55:00 -0000 [thread overview]
Message-ID: <201109221146.p8MBkrDS022332@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <4E7A98B0.20809@codesourcery.com> (message from Yao Qi on Thu, 22 Sep 2011 10:08:48 +0800)
> Date: Thu, 22 Sep 2011 10:08:48 +0800
> From: Yao Qi <yao@codesourcery.com>
>
> The address on i386 is unsigned, so we should use
> read_memory_unsigned_integer to fetch address from memory.
That depends on your point of view...
> OK to apply?
No. On OpenBSD, the structure members that are assigned have type
'int', so they're signed. So I consider using read_memory_integer()
appropriate here.
The Linux bit is ok.
> gdb/
> * i386-linux-nat.c (i386_linux_resume): Use read_memory_unsigned_integer
> to get address.
> * i386obsd-nat.c (i386obsd_supply_pcb): Likewise.
>
> diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
> index e32a119..6257931 100644
> --- a/gdb/i386-linux-nat.c
> +++ b/gdb/i386-linux-nat.c
> @@ -893,7 +893,8 @@ i386_linux_resume (struct target_ops *ops,
>
> regcache_cooked_read_unsigned (regcache, I386_ESP_REGNUM, &sp);
> if (syscall == SYS_rt_sigreturn)
> - addr = read_memory_integer (sp + 8, 4, byte_order) + 20;
> + addr = read_memory_unsigned_integer (sp + 8, 4, byte_order)
> + + 20;
> else
> addr = sp;
>
> diff --git a/gdb/i386obsd-nat.c b/gdb/i386obsd-nat.c
> index db1f693..1c0d047 100644
> --- a/gdb/i386obsd-nat.c
> +++ b/gdb/i386obsd-nat.c
> @@ -78,8 +78,8 @@ i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
> {
> /* No, the pcb must have been last updated by savectx(). */
> pcb->pcb_esp = pcb->pcb_ebp;
> - pcb->pcb_ebp = read_memory_integer(pcb->pcb_esp, 4, byte_order);
> - sf.sf_eip = read_memory_integer(pcb->pcb_esp + 4, 4, byte_order);
> + pcb->pcb_ebp = read_memory_unsigned_integer (pcb->pcb_esp, 4, byte_order);
> + sf.sf_eip = read_memory_unsigned_integer (pcb->pcb_esp + 4, 4, byte_order);
> regcache_raw_supply (regcache, I386_EIP_REGNUM, &sf.sf_eip);
> }
>
>
next prev parent reply other threads:[~2011-09-22 11:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-22 10:23 Yao Qi
2011-09-22 13:55 ` Mark Kettenis [this message]
2011-09-23 8:11 ` [committed]: " Yao Qi
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=201109221146.p8MBkrDS022332@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=yao@codesourcery.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