This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] multi-arch INIT_FRAME_PC*; Was: New gdb 31 & 64 bit patches for S/390


Oops,

As MichaelC just pointed out to me it might work fine for my target 
(MIPS) but doesn't work fine for any other target :-(.  Back traces fail 
because blockframe.c no longer gets the default:

- #if !defined (INIT_FRAME_PC)
- #define INIT_FRAME_PC(fromleaf, prev) \
-   prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
-             prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
- #endif
-

The attached should fix the problem.  Michael, if it doesn't it may pay 
to revert this and the other patch (until I find a thinking cap that 
fits) :-/

	Andrew

2001-06-16  Andrew Cagney  <ac131313@redhat.com>

	* arch-utils.c (init_frame_pc_default): New function
	* arch-utils.h (init_frame_pc_default): Declare.
	* gdbarch.sh (INIT_FRAME_PC): Default to init_frame_pc_default and
	not init_frame_pc_noop.
	* gdbarch.h, gdbarch.c: Re-generate.
	* blockframe.c (INIT_FRAME_PC): Delete macro definition.
	* mips-tdep.c (mips_gdbarch_init): Set init_frame_pc to
	init_frame_pc_noop.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.32
diff -p -r1.32 arch-utils.c
*** arch-utils.c	2001/06/15 23:50:46	1.32
--- arch-utils.c	2001/06/16 19:27:18
*************** init_frame_pc_noop (int fromleaf, struct
*** 306,311 ****
--- 306,322 ----
    return;
  }
  
+ void
+ init_frame_pc_default (int fromleaf, struct frame_info *prev)
+ {
+   if (fromleaf)
+     prev->pc = SAVED_PC_AFTER_CALL (prev->next);
+   else if (prev->next != NULL)
+     prev->pc = FRAME_SAVED_PC (prev->next);
+   else
+     prev->pc = read_pc ();
+ }
+ 
  int
  cannot_register_not (int regnum)
  {
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.17
diff -p -r1.17 arch-utils.h
*** arch-utils.h	2001/06/15 23:50:46	1.17
--- arch-utils.h	2001/06/16 19:27:18
*************** extern int default_prepare_to_proceed (i
*** 111,119 ****
  
  extern int generic_prepare_to_proceed (int select_it);
  
! /* Version of init_frame_pc() that does nothing. */
  
  void init_frame_pc_noop (int fromleaf, struct frame_info *prev);
  
  /* Version of cannot_fetch_register() / cannot_store_register() that
     always fails. */
--- 111,121 ----
  
  extern int generic_prepare_to_proceed (int select_it);
  
! /* Versions of init_frame_pc().  Do nothing; do the default. */
  
  void init_frame_pc_noop (int fromleaf, struct frame_info *prev);
+ 
+ void init_frame_pc_default (int fromleaf, struct frame_info *prev);
  
  /* Version of cannot_fetch_register() / cannot_store_register() that
     always fails. */
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.16
diff -p -r1.16 blockframe.c
*** blockframe.c	2001/06/15 23:10:54	1.16
--- blockframe.c	2001/06/16 19:28:03
*************** frameless_look_for_prologue (struct fram
*** 304,315 ****
  
  /* Default a few macros that people seldom redefine.  */
  
- #if !defined (INIT_FRAME_PC)
- #define INIT_FRAME_PC(fromleaf, prev) \
-   prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
- 	      prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
- #endif
- 
  #ifndef FRAME_CHAIN_COMBINE
  #define	FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
  #endif
--- 304,309 ----
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.70
diff -p -r1.70 gdbarch.sh
*** gdbarch.sh	2001/06/15 23:50:46	1.70
--- gdbarch.sh	2001/06/16 19:28:19
*************** v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_d
*** 447,453 ****
  v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P
  f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0
  f:2:INIT_FRAME_PC_FIRST:void:init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_noop::0
! f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_noop::0
  #
  v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
  v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type:::::::
--- 447,453 ----
  v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P
  f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0
  f:2:INIT_FRAME_PC_FIRST:void:init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_noop::0
! f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_default::0
  #
  v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
  v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type:::::::
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.53
diff -p -r1.53 mips-tdep.c
*** mips-tdep.c	2001/06/15 23:10:55	1.53
--- mips-tdep.c	2001/06/16 19:28:34
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4130,4135 ****
--- 4130,4136 ----
    /* There's a mess in stack frame creation.  See comments in
       blockframe.c near reference to INIT_FRAME_PC_FIRST.  */
    set_gdbarch_init_frame_pc_first (gdbarch, mips_init_frame_pc_first);
+   set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop);
  
    /* Map debug register numbers onto internal register numbers. */
    set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]