Re: [PATCH 1/3] Add sp_regnum_from_eax and pc_regnum_from_eax

H.J. Lu
2012-07-04T20:51:35Z

On Wed, Jul 4, 2012 at 12:53 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Tue, 3 Jul 2012 16:55:59 -0700
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>
>> On Tue, Jul 3, 2012 at 12:14 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> > On Tue, Jul 3, 2012 at 10:35 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> >> On Tue, Jul 3, 2012 at 8:54 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> >>> On Tue, Jul 3, 2012 at 7:08 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> >>>>> Date: Thu, 21 Jun 2012 11:14:52 -0700
>> >>>>> From: "H.J. Lu" <hongjiu.lu@intel.com>
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> Here are the first of the last 3 patches for x32 support in GDB.  This
>> >>>>> patch maps $pc to $eip and $sp to $esp for x32.  OK to install?
>> >>>>
>> >>>> The pseudo register handling code is getting too complex :(.  I feel
>> >>>> that hiding the set_gdbarch_pc_regnum() and set_gdbarch_sp_regnum()
>> >>>> calls in i386-tdep.c isn't the right approach.  But I haven't found a
>> >>>> better one yet :(.
>> >>>>
>> >>>
>> >>> One possibility is to set pc/sp to register name instead of regnum.
>> >>> i386_gdbarch_init can map them to regnum after all pseudo registers
>> >>> are finalized.
>> >>>
>> >>> --
>> >>> H.J.
>> >>
>> >> How about this patch? I can also change amd64 and i386
>> >> to use "rsp/"rsp"/"esp"/"eip".
>> >>
>> >
>> > This patch sets SP?PC regnums from register names.
>> >
>> >
>>
>> Here is another approach to set SP/PC regnums after
>> setting up pseudo registers.
>
> I've come to the conclusion that the speudo register handling in
> i386/amd64 needs some serious surgery.  I think your origional diff:
>
> http://sourceware.org/ml/gdb-patches/2012-06/msg00664.html
>
> is the least invasive.  Can you commit that one?
>

Done. This is the last x32 patch for now. I checked in
this patch to mention it in NEWS.

Thanks.

--
H.J.
--
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.14431
diff -u -p -r1.14431 ChangeLog
--- ChangeLog 4 Jul 2012 20:46:18 -0000 1.14431
+++ ChangeLog 4 Jul 2012 20:49:14 -0000
@@ -1,5 +1,9 @@
2012-07-04 H.J. Lu <hongjiu.lu@intel.com>

+ * NEWS: Mention x32 ABI support.
+
+2012-07-04 H.J. Lu <hongjiu.lu@intel.com>
+
* amd64-tdep.c (amd64_x32_init_abi): Set sp_regnum_from_eax to
AMD64_RSP_REGNUM and pc_regnum_from_eax to AMD64_RIP_REGNUM.

Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.532
diff -u -p -r1.532 NEWS
--- NEWS 2 Jul 2012 15:29:33 -0000 1.532
+++ NEWS 4 Jul 2012 20:49:14 -0000
@@ -3,6 +3,9 @@

*** Changes since GDB 7.4

+* GDB now supports x32 ABI. Visit <http://sites.google.com/site/x32abi/>
+ for more x32 ABI info.
+
* GDB now supports access to MIPS DSP registers on Linux targets.

* GDB now supports debugging microMIPS binaries.