From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4807 invoked by alias); 22 Sep 2011 11:47:19 -0000 Received: (qmail 4781 invoked by uid 22791); 22 Sep 2011 11:47:18 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_EG X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Sep 2011 11:47:03 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id p8MBktHd020550; Thu, 22 Sep 2011 13:46:55 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id p8MBkrDS022332; Thu, 22 Sep 2011 13:46:53 +0200 (CEST) Date: Thu, 22 Sep 2011 13:55:00 -0000 Message-Id: <201109221146.p8MBkrDS022332@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: yao@codesourcery.com CC: gdb-patches@sourceware.org In-reply-to: <4E7A98B0.20809@codesourcery.com> (message from Yao Qi on Thu, 22 Sep 2011 10:08:48 +0800) Subject: Re: [patch, i386] Use read_memory_unsigned_integer to get address References: <4E7A98B0.20809@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00408.txt.bz2 > Date: Thu, 22 Sep 2011 10:08:48 +0800 > From: Yao Qi > > 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); > } > >