Fix for gdb.base/pc-fp.exp.

Message ID 1471969030.4102.52.camel@us.ibm.com
State New, archived
Headers

Commit Message

Carl Love Aug. 23, 2016, 4:17 p.m. UTC
  On Tue, 2016-08-23 at 00:17 +0100, Pedro Alves wrote:
> Can you provide more details?
> 
> E.g.:
> 
> What's was wrong?  What failed?  Why is removing this line the
> right fix?
> 
> I'm not suggesting that the fix is wrong (or right, I have no
> idea).  Just pointing out that context is missing.
> 
> Thanks,
> Pedro Alves
> 



Here is an updated patch with the missing detail.
--------------------------------------------------------------------------
Fix for gdb.base/pc-fp.exp.

It is my understanding that GDB used to require each architecture to
define a Frame Pointer (fp).  However, this functionality was deprecated
some time ago so the call to setup the fp_reg was changed to deprecated
(set_gdbarch_deprecated_fp_regnum).  It should have been removed from the
Power code.

That said, the code "set_gdbarch_deprecated_fp_regnum
(gdbarch, PPC_R0_REGNUM + 1);" sets up register r1 as the frame pointer.
Register r1 is no longer used to hold the frame pointer on Power.  By
removing the fp definition for Power in GDB, it causes GDB to fall back
to the call get_frame_base_address (frame) which returns the correct value
depending on the specific senario but most of the time is the DWARF
canonical frame address.

gdb/ChangeLog

2016-08-22  Carl Love  <cel@us.ibm.com>

	* rs6000-tdep.c (rs6000_gdbarch_init): Remove deprecated call set_gdbarch_deprecated_fp_regnum()
	from Power architecture initialization function.
---
 gdb/rs6000-tdep.c | 1 -
 1 file changed, 1 deletion(-)
  

Comments

Luis Machado Aug. 23, 2016, 4:26 p.m. UTC | #1
On 08/23/2016 11:17 AM, Carl E. Love wrote:
> On Tue, 2016-08-23 at 00:17 +0100, Pedro Alves wrote:
>> Can you provide more details?
>>
>> E.g.:
>>
>> What's was wrong?  What failed?  Why is removing this line the
>> right fix?
>>
>> I'm not suggesting that the fix is wrong (or right, I have no
>> idea).  Just pointing out that context is missing.
>>
>> Thanks,
>> Pedro Alves
>>
>
>
>
> Here is an updated patch with the missing detail.
> --------------------------------------------------------------------------
> Fix for gdb.base/pc-fp.exp.
>
> It is my understanding that GDB used to require each architecture to
> define a Frame Pointer (fp).  However, this functionality was deprecated
> some time ago so the call to setup the fp_reg was changed to deprecated
> (set_gdbarch_deprecated_fp_regnum).  It should have been removed from the
> Power code.
>
> That said, the code "set_gdbarch_deprecated_fp_regnum
> (gdbarch, PPC_R0_REGNUM + 1);" sets up register r1 as the frame pointer.
> Register r1 is no longer used to hold the frame pointer on Power.  By
> removing the fp definition for Power in GDB, it causes GDB to fall back
> to the call get_frame_base_address (frame) which returns the correct value
> depending on the specific senario but most of the time is the DWARF
> canonical frame address.

Is this the case for all Power ABI's or only server? I wonder what the 
impact would be on Power embedded.
  

Patch

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index a616cbe..db63be0 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -5957,7 +5957,6 @@  rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_pc_regnum (gdbarch, PPC_PC_REGNUM);
   set_gdbarch_sp_regnum (gdbarch, PPC_R0_REGNUM + 1);
-  set_gdbarch_deprecated_fp_regnum (gdbarch, PPC_R0_REGNUM + 1);
   set_gdbarch_fp0_regnum (gdbarch, tdep->ppc_fp0_regnum);
   set_gdbarch_register_sim_regno (gdbarch, rs6000_register_sim_regno);