From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11470 invoked by alias); 22 Sep 2011 02:09:09 -0000 Received: (qmail 11269 invoked by uid 22791); 22 Sep 2011 02:09:07 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,TW_EG X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Sep 2011 02:08:53 +0000 Received: from nat-jpt.mentorg.com ([192.94.33.2] helo=PR1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R6Yia-00008P-9k from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 21 Sep 2011 19:08:52 -0700 Received: from [172.30.38.254] ([172.30.38.254]) by PR1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Sep 2011 11:08:51 +0900 Message-ID: <4E7A98B0.20809@codesourcery.com> Date: Thu, 22 Sep 2011 10:23:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch, i386] Use read_memory_unsigned_integer to get address Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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/msg00406.txt.bz2 The address on i386 is unsigned, so we should use read_memory_unsigned_integer to fetch address from memory. OK to apply? -- Yao (齐尧) 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); }