Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: PATCH: Remove amd64_linux_gregset64_reg_offset and regmap
Date: Thu, 22 Apr 2010 20:12:00 -0000	[thread overview]
Message-ID: <j2m6dc9ffc81004221312teeea67b8pf9eacd88d0a0d6b2@mail.gmail.com> (raw)
In-Reply-To: <201004221948.o3MJmAnH030821@glazunov.sibelius.xs4all.nl>

On Thu, Apr 22, 2010 at 12:48 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Wed, 21 Apr 2010 16:09:29 -0700
>> From: "H.J. Lu" <hongjiu.lu@intel.com>
>>
>> Hi,
>>
>> As we have discussed, this patch removes amd64_linux_gregset64_reg_offset
>> and regmap from i386/amd64 Linux targets.  OK to install?
>
> The amd64 bits are ok.  A small issue with the i386 bits below.
>> diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
>> index d559811..35bc3bd 100644
>> --- a/gdb/i386-linux-nat.c
>> +++ b/gdb/i386-linux-nat.c
>> @@ -245,18 +228,19 @@ void
>>  fill_gregset (const struct regcache *regcache,
>>             elf_gregset_t *gregsetp, int regno)
>>  {
>> -  elf_greg_t *regp = (elf_greg_t *) gregsetp;
>> +  gdb_byte *regp = (gdb_byte *) gregsetp;
>>    int i;
>>
>>    for (i = 0; i < I386_NUM_GREGS; i++)
>>      if (regno == -1 || regno == i)
>> -      regcache_raw_collect (regcache, i, regp + regmap[i]);
>> +      regcache_raw_collect (regcache, i,
>> +                         regp + i386_linux_gregset_reg_offset[i]);
>>
>>    if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
>>        && I386_LINUX_ORIG_EAX_REGNUM
>>          < gdbarch_num_regs (get_regcache_arch (regcache)))
>>      regcache_raw_collect (regcache, I386_LINUX_ORIG_EAX_REGNUM,
>> -                       regp + ORIG_EAX);
>> +                       regp + 4 * ORIG_EAX);
>
> I think this should use an offset from i386_linux_gregset_reg_offset[]
> as well.
>

Like this?


diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 35bc3bd..eba0b6a 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -217,7 +217,7 @@ supply_gregset (struct regcache *regcache, const
elf_gregset_t *gregsetp)
   if (I386_LINUX_ORIG_EAX_REGNUM
 	< gdbarch_num_regs (get_regcache_arch (regcache)))
     regcache_raw_supply (regcache, I386_LINUX_ORIG_EAX_REGNUM,
-			 regp + ORIG_EAX);
+			  regp + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
 }

 /* Fill register REGNO (if it is a general-purpose register) in
@@ -240,7 +240,7 @@ fill_gregset (const struct regcache *regcache,
       && I386_LINUX_ORIG_EAX_REGNUM
 	   < gdbarch_num_regs (get_regcache_arch (regcache)))
     regcache_raw_collect (regcache, I386_LINUX_ORIG_EAX_REGNUM,
-			  regp + ORIG_EAX);
+			  regp + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
 }

 #ifdef HAVE_PTRACE_GETREGS


-- 
H.J.


  reply	other threads:[~2010-04-22 20:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 23:09 H.J. Lu
2010-04-22 19:48 ` Mark Kettenis
2010-04-22 20:12   ` H.J. Lu [this message]
2010-04-22 20:21     ` Mark Kettenis
2010-04-22 20:42       ` H.J. Lu

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=j2m6dc9ffc81004221312teeea67b8pf9eacd88d0a0d6b2@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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