Re: PATCH: Add x86 xml files

H.J. Lu
2010-02-07T21:50:40Z

On Sun, Feb 7, 2010 at 1:29 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Thu, 4 Feb 2010 16:00:52 -0800
>> From: "H.J. Lu" <hongjiu.lu@intel.com>
>>
>> On Thu, Feb 04, 2010 at 03:59:52PM -0800, H.J. Lu wrote:
>> > Hi,
>> >
>> > Here is the first patch to move x86 targets to xml. They aren't used
>> > until the rest of x86 xml support is checked in.
>> >
>> > OK to install?
>> >
>> > Thanks.
>> >
>> >
>> > H.J.
>> > ---
>> > 2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
>> >
>> >     * features/Makefile (WHICH): Add i386/i386, i386/i386-linux,
>> >     i386/x86-64 and i386/x86-64-linux.
>> >     (i386/i386-expedite): New.
>> >     (i386/i386-linux-expedite): Likewise.
>> >     (i386/x86-64-expedite):Likewise.
>> >     (i386/x86-64-linux-expedite): Likewise.
>> >     (I386-XMLTOC): Likewise.
>> >     (I386-CFILES): Likewise.
>> >     (i386-cfiles): Likewise.
>> >     ($(outdir)/i386/i386.dat): New dependency.
>> >     ($(outdir)/i386/i386-linux.dat): Likewise.
>> >     ($(outdir)/i386/x86-64.dat): Likewise.
>> >     ($(outdir)/i386/x86-64-linux.dat): Likewise.
>> >
>> >     * features/i386/32bit-core.xml: New.
>> >     * features/i386/32bit-linux.xml: Likewise.
>> >     * features/i386/32bit-sse.xml: Likewise.
>> >     * features/i386/64bit-core.xml: Likewise.
>> >     * features/i386/64bit-linux.xml: Likewise.
>> >     * features/i386/64bit-sse.xml: Likewise.
>> >     * features/i386/i386-linux.xml: Likewise.
>> >     * features/i386/i386.xml: Likewise.
>> >     * features/i386/x86-64-linux.xml: Likewise.
>> >     * features/i386/x86-64.xml: Likewise.
>> >     * features/i386/i386-linux.c: Likewise.
>> >     * features/i386/i386.c: Likewise.
>> >     * features/i386/x86-64-linux.c: Likewise.
>> >     * features/i386/x86-64.c: Likewise.
>>
>> Here is the patch.
>>
>>
>> H.J.
>> ---
>> diff --git a/gdb/features/Makefile b/gdb/features/Makefile
>> index 8aa553e..c54df74 100644
>> --- a/gdb/features/Makefile
>> +++ b/gdb/features/Makefile
>> @@ -31,6 +31,8 @@
>>  #   make GDB=/path/to/gdb XMLTOC="xml files" cfiles
>>
>>  WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \
>> +     i386/i386 i386/i386-linux \
>> +     i386/x86-64 i386/x86-64-linux \
>>       mips-linux mips64-linux \
>>       rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \
>>       rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \
>> @@ -39,6 +41,10 @@ WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \
>>
>>  # Record which registers should be sent to GDB by default after stop.
>>  arm-expedite = r11,sp,pc
>> +i386/i386-expedite = ebp,esp,eip
>> +i386/i386-linux-expedite = ebp,esp,eip
>> +i386/x86-64-expedite = rbp,rsp,rip
>> +i386/x86-64-linux-expedite = rbp,rsp,rip
>>  mips-expedite = r29,pc
>>  mips64-expedite = r29,pc
>>  powerpc-expedite = r1,pc
>> @@ -57,6 +63,9 @@ XMLTOC =
>>  CFILES = $(patsubst %.xml,%.c,$(XMLTOC))
>>  GDB = false
>>
>> +I386-XMLTOC = $(addsuffix .xml, $(filter i386/%, $(WHICH)))
>> +I386-CFILES = $(patsubst %.xml,%.c,$(I386-XMLTOC))
>
> Why are you introducing these variables?

They are used by the new "i386-cfiles" target.

>>  all: $(OUTPUTS)
>>
>>  $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
>> @@ -71,6 +80,8 @@ $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
>>       sh ../../move-if-change $(outdir)/$*.tmp $(outdir)/$*.dat
>>
>>  cfiles: $(CFILES)
>> +i386-cfiles: $(I386-CFILES)
>
> And this target?

You need a working gdb for your target with XML support to generate
those C files for gdbserver. That is why XMLTOC is empty and GDB
is false. To generate those C files, you have to do

# make cfiles GDB="your new GDB" XMLTOC="your XML files"

I added this target so that I can do

# make i386-cfiles GDB="my new GDB"

to generate i386 C files for gdbserver without specifying XMLTOC at
command line. It is very convenience for maintenance.

> Otherwise this diff looks reasonable to me.  However, I think it would
> be good if Daniel had a look at this as well; I'm not too familiar
> with the target description framework, and I think XML is a
> consipiracy by the computer industry to make people buy more hardware
> ;).
>

Thanks.

--
H.J.