From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14683 invoked by alias); 25 May 2012 16:52:45 -0000 Received: (qmail 14669 invoked by uid 22791); 25 May 2012 16:52:40 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_EG X-Spam-Check-By: sourceware.org Received: from mail-qa0-f41.google.com (HELO mail-qa0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 May 2012 16:52:26 +0000 Received: by qabg27 with SMTP id g27so5884185qab.0 for ; Fri, 25 May 2012 09:52:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.185.204 with SMTP id cp12mr15843135qab.42.1337964743714; Fri, 25 May 2012 09:52:23 -0700 (PDT) Received: by 10.229.169.130 with HTTP; Fri, 25 May 2012 09:52:23 -0700 (PDT) In-Reply-To: References: <20120511181737.GP29339@adacore.com> <201205202043.q4KKhRGw022215@glazunov.sibelius.xs4all.nl> <201205202138.q4KLcWBf011913@glazunov.sibelius.xs4all.nl> Date: Fri, 25 May 2012 16:52:00 -0000 Message-ID: Subject: Re: Three weeks to branching (gdb 7.5 release) From: "H.J. Lu" To: Mark Kettenis Cc: brobecker@adacore.com, gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2012-05/txt/msg00971.txt.bz2 On Sun, May 20, 2012 at 3:48 PM, H.J. Lu wrote: >> I don't think that's true. =A0Here tdesc comes from info.target_desc, >> not tdep->tdesc, so the check should still do the right thing. =A0In >> fact it must do the right thing, since amd64_linux_init_abi() does the >> same thing already. > > Does this one look OK. =A0I extracted x32_init_abi from amd64_x32_init_abi > since amd64_x32_linux_init_abi can't call amd64_init_abi after > calling amd64_linux_init_abi. > > Thanks. Hi Mark, Can you take a look at this? Thanks. H.J. > -- > H.J. > --- > 2012-05-20 =A0Mark Kettenis =A0 > =A0 =A0 =A0 =A0 =A0 =A0H.J. Lu =A0 > > =A0 =A0 =A0 =A0* amd64-linux-tdep.c (amd64_x32_linux_init_abi): New funct= iom. > =A0 =A0 =A0 =A0(_initialize_amd64_linux_tdep): Register bfd_mach_x64_32 w= ith > =A0 =A0 =A0 =A0amd64_x32_linux_init_abi. > > =A0 =A0 =A0 =A0* amd64-tdep.c (amd64_x32_pseudo_register_type): New funct= ion. > =A0 =A0 =A0 =A0(amd64_x32_pseudo_register_name): Likewise. > =A0 =A0 =A0 =A0(x32_init_abi): Likewise. > =A0 =A0 =A0 =A0(amd64_x32_init_abi): Likewise. > > =A0 =A0 =A0 =A0* amd64-tdep.h (amd64_x32_init_abi): New prototype. > =A0 =A0 =A0 =A0(x32_init_abi): Likewise. > > =A0 =A0 =A0 =A0* i386-tdep.c (i386_pseudo_register_type): Make it global. > =A0 =A0 =A0 =A0(i386_gdbarch_init): Initialize sp_regnum_from_eax and > =A0 =A0 =A0 =A0pc_regnum_from_eax to -1. =A0Update SP regnum from > =A0 =A0 =A0 =A0sp_regnum_from_eax and PC regnum from pc_regnum_from_eax if > =A0 =A0 =A0 =A0needed. > > =A0 =A0 =A0 =A0* i386-tdep.h (gdbarch_tdep): Add sp_regnum_from_eax and > =A0 =A0 =A0 =A0pc_regnum_from_eax. > =A0 =A0 =A0 =A0(i386_pseudo_register_type): New prototype. > > diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c > index 22a3464..470680d 100644 > --- a/gdb/amd64-linux-tdep.c > +++ b/gdb/amd64-linux-tdep.c > @@ -1543,6 +1558,26 @@ amd64_linux_init_abi (struct gdbarch_info info, > struct gdbarch *gdbarch) > > =A0 tdep->i386_syscall_record =3D amd64_linux_syscall_record; > =A0} > + > +static void > +amd64_x32_linux_init_abi (struct gdbarch_info info, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct gdbarch *gdba= rch) > +{ > + =A0struct gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); > + =A0const struct target_desc *tdesc =3D info.target_desc; > + > + =A0amd64_linux_init_abi (info, gdbarch); > + > + =A0if (! tdesc_has_registers (tdesc)) > + =A0 =A0tdesc =3D tdesc_amd64_linux; > + =A0tdep->tdesc =3D tdesc; > + > + =A0x32_init_abi (gdbarch); > + > + =A0 /* GNU/Linux uses SVR4-style shared libraries. =A0*/ > + =A0set_solib_svr4_fetch_link_map_offsets > + =A0 =A0(gdbarch, svr4_ilp32_fetch_link_map_offsets); > +} > > > > =A0/* Provide a prototype to silence -Wmissing-prototypes. =A0*/ > @@ -1553,6 +1588,8 @@ _initialize_amd64_linux_tdep (void) > =A0{ > =A0 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0GDB_OSABI_LINUX, amd64= _linux_init_abi); > + =A0gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 GDB_OSABI_LINUX, amd64_= x32_linux_init_abi); > > =A0 /* Initialize the Linux target description. =A0*/ > =A0 initialize_tdesc_amd64_linux (); > diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c > index df91a51..efa9f5e 100644 > --- a/gdb/amd64-tdep.c > +++ b/gdb/amd64-tdep.c > @@ -261,6 +261,28 @@ static const char *amd64_dword_names[] =3D > =A0 "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" > =A0}; > > +/* Return the GDB type object for the "standard" data type of data in > + =A0 register REGNUM. =A0Only used for x32. =A0*/ > + > +static struct type * > +amd64_x32_pseudo_register_type (struct gdbarch *gdbarch, int regnum) > +{ > + =A0/* Use pointer types for ebp, esp and eip registers in x32. =A0*/ > + =A0struct gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); > + =A0switch (regnum - tdep->eax_regnum) > + =A0 =A0{ > + =A0 =A0default: > + =A0 =A0 =A0break; > + =A0 =A0case AMD64_RBP_REGNUM: =A0 =A0 /* ebp =A0*/ > + =A0 =A0case AMD64_RSP_REGNUM: =A0 =A0 /* esp =A0*/ > + =A0 =A0 =A0return builtin_type (gdbarch)->builtin_data_ptr; > + =A0 =A0case AMD64_RIP_REGNUM: =A0 =A0 /* eip */ > + =A0 =A0 =A0return builtin_type (gdbarch)->builtin_func_ptr; > + =A0 =A0} > + > + =A0return i386_pseudo_register_type (gdbarch, regnum); > +} > + > =A0/* Return the name of register REGNUM. =A0*/ > > =A0static const char * > @@ -279,6 +301,17 @@ amd64_pseudo_register_name (struct gdbarch > *gdbarch, int regnum) > =A0 =A0 return i386_pseudo_register_name (gdbarch, regnum); > =A0} > > +/* Return the name of register REGNUM. =A0Only used for x32. =A0*/ > + > +static const char * > +amd64_x32_pseudo_register_name (struct gdbarch *gdbarch, int regnum) > +{ > + =A0struct gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); > + =A0if ((regnum - tdep->eax_regnum) =3D=3D AMD64_RIP_REGNUM) > + =A0 =A0return "eip"; > + =A0return amd64_pseudo_register_name (gdbarch, regnum); > +} > + > =A0static struct value * > =A0amd64_pseudo_register_read_value (struct gdbarch *gdbarch, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct= regcache *regcache, > @@ -2730,6 +2803,37 @@ amd64_init_abi (struct gdbarch_info info, > struct gdbarch *gdbarch) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0i386_stap_parse_special_token); > =A0} > > +void > +x32_init_abi (struct gdbarch *gdbarch) > +{ > + =A0struct gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); > + > + =A0tdep->num_dword_regs =3D 17; > + =A0tdep->sp_regnum_from_eax =3D AMD64_RSP_REGNUM; > + =A0tdep->pc_regnum_from_eax =3D AMD64_RIP_REGNUM; > + > + =A0set_tdesc_pseudo_register_type (gdbarch, amd64_x32_pseudo_register_t= ype); > + =A0set_tdesc_pseudo_register_name (gdbarch, amd64_x32_pseudo_register_n= ame); > + > + =A0set_gdbarch_long_bit (gdbarch, 32); > + =A0set_gdbarch_ptr_bit (gdbarch, 32); > +} > + > +void > +amd64_x32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > +{ > + =A0struct gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); > + =A0const struct target_desc *tdesc =3D info.target_desc; > + > + =A0amd64_init_abi (info, gdbarch); > + > + =A0if (! tdesc_has_registers (tdesc)) > + =A0 =A0tdesc =3D tdesc_x32; > + =A0tdep->tdesc =3D tdesc; > + > + =A0x32_init_abi (gdbarch); > +} > + > =A0/* Provide a prototype to silence -Wmissing-prototypes. =A0*/ > =A0void _initialize_amd64_tdep (void); > > diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h > index 1ed109c..401b379 100644 > --- a/gdb/amd64-tdep.h > +++ b/gdb/amd64-tdep.h > @@ -80,6 +80,9 @@ extern void amd64_displaced_step_fixup (struct > gdbarch *gdbarch, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0struct regcache *regs); > > =A0extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *= gdbarch); > +extern void amd64_x32_init_abi (struct gdbarch_info info, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct gdba= rch *gdbarch); > +extern void x32_init_abi (struct gdbarch *gdbarch); > > =A0/* Fill register REGNUM in REGCACHE with the appropriate > =A0 =A0floating-point or SSE register value from *FXSAVE. =A0If REGNUM is > diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c > index 5b04505..9cc2e30 100644 > --- a/gdb/i386-tdep.c > +++ b/gdb/i386-tdep.c > @@ -2780,7 +2780,7 @@ i386_mmx_type (struct gdbarch *gdbarch) > =A0/* Return the GDB type object for the "standard" data type of data in > =A0 =A0register REGNUM. =A0*/ > > -static struct type * > +struct type * > =A0i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum) > =A0{ > =A0 if (i386_mmx_regnum_p (gdbarch, regnum)) > @@ -7787,6 +7787,9 @@ i386_gdbarch_init (struct gdbarch_info info, > struct gdbarch_list *arches) > =A0 tdep->num_mmx_regs =3D 8; > =A0 tdep->num_ymm_regs =3D 0; > > + =A0tdep->sp_regnum_from_eax =3D -1; > + =A0tdep->pc_regnum_from_eax =3D -1; > + > =A0 tdesc_data =3D tdesc_data_alloc (); > > =A0 set_gdbarch_relocate_instruction (gdbarch, i386_relocate_instruction); > @@ -7831,6 +7834,14 @@ i386_gdbarch_init (struct gdbarch_info info, > struct gdbarch_list *arches) > =A0 =A0 =A0 /* Support dword pseudo-register if it hasn't been disabled. = =A0*/ > =A0 =A0 =A0 tdep->eax_regnum =3D ymm0_regnum; > =A0 =A0 =A0 ymm0_regnum +=3D tdep->num_dword_regs; > + =A0 =A0 =A0if (tdep->sp_regnum_from_eax !=3D -1) > + =A0 =A0 =A0 set_gdbarch_sp_regnum (gdbarch, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(tdep->eax_r= egnum > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 + tdep->sp_= regnum_from_eax)); > + =A0 =A0 =A0if (tdep->pc_regnum_from_eax !=3D -1) > + =A0 =A0 =A0 set_gdbarch_pc_regnum (gdbarch, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(tdep->eax_r= egnum > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 + tdep->pc_= regnum_from_eax)); > =A0 =A0 } > =A0 else > =A0 =A0 tdep->eax_regnum =3D -1; > diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h > index f297ae7..e1f7c44 100644 > --- a/gdb/i386-tdep.h > +++ b/gdb/i386-tdep.h > @@ -149,6 +149,14 @@ struct gdbarch_tdep > =A0 =A0 =A0of pseudo dword register support. =A0*/ > =A0 int eax_regnum; > > + =A0/* Register number for SP, relative to %eax. =A0Set this to -1 to > + =A0 =A0 indicate the absence of pseudo SP register support. =A0*/ > + =A0int sp_regnum_from_eax; > + > + =A0/* Register number for PC, relative to %eax. =A0Set this to -1 to > + =A0 =A0 indicate the absence of pseudo PC register support. =A0*/ > + =A0int pc_regnum_from_eax; > + > =A0 /* Number of core registers. =A0*/ > =A0 int num_core_regs; > > @@ -307,6 +315,7 @@ extern int i386_dword_regnum_p (struct gdbarch > *gdbarch, int regnum); > =A0extern int i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum); > =A0extern int i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum); > > +extern struct type *i386_pseudo_register_type (struct gdbarch *, int); > =A0extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0int regnum); --=20 H.J.