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]

[rfc[ multi-arch TARGET_VIRTUAL_FRAME_POINTER


This multi-arches the method TARGET_VIRTUAL_FRAME_POINTER.  tracepoint
people may want to take a quick look.  I'll check it in, in a few days.

Anyway, I think the comment:

- /* Macro for getting target's idea of a frame pointer.
-    FIXME: GDB's whole scheme for dealing with "frames" and
-    "frame pointers" needs a serious shakedown.  */

says it all.

enjoy,
	Andrew
2001-08-07  Andrew Cagney  <ac131313@redhat.com>

	* target.h (TARGET_VIRTUAL_FRAME_POINTER): Delete, multi-arched.
	* gdbarch.sh (TARGET_VIRTUAL_FRAME_POINTER): Add.
	* gdbarch.h, gdbarch.c: Regenerate.

	* arch-utils.h (legacy_virtual_frame_pointer): Declare.
	* arch-utils.c: Include "gdb_assert.h".
	(legacy_virtual_frame_pointer): Define.
	* Makefile.in (arch-utils.o): Depends on gdb_assert.h.

	* tracepoint.c (encode_actions): Make frame_reg an int.  Make
	frame_offset a LONGEST.
	* ax-gdb.c (gen_frame_args_address): Ditto.
	(gen_frame_locals_address): Ditto.
	* mn10300-tdep.c (mn10300_gdbarch_init): Initialize
	virtual_frame_pointer.
	(mn10300_virtual_frame_pointer): Make static.  Update parameter
	list to match function signature.
	* config/mn10300/tm-mn10300.h (TARGET_VIRTUAL_FRAME_POINTER): Delete.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.109
diff -p -r1.109 Makefile.in
*** Makefile.in	2001/08/01 18:39:22	1.109
--- Makefile.in	2001/08/08 03:34:54
*************** tracepoint.o: tracepoint.c $(defs_h) $(s
*** 1487,1493 ****
  gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h)
  
  arch-utils.o: arch-utils.c $(defs_h) $(bfd_h) $(gdbcmd_h) \
! 	$(arch_utils_h)
  
  gdbtypes.o: gdbtypes.c $(bfd_h) complaints.h $(defs_h) $(expression_h) \
  	$(gdbtypes_h) language.h objfiles.h $(symfile_h) $(symtab_h) $(target_h) \
--- 1487,1493 ----
  gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h)
  
  arch-utils.o: arch-utils.c $(defs_h) $(bfd_h) $(gdbcmd_h) \
! 	$(arch_utils_h) gdb_assert.h
  
  gdbtypes.o: gdbtypes.c $(bfd_h) complaints.h $(defs_h) $(expression_h) \
  	$(gdbtypes_h) language.h objfiles.h $(symfile_h) $(symtab_h) $(target_h) \
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.33
diff -p -r1.33 arch-utils.c
*** arch-utils.c	2001/06/16 20:00:24	1.33
--- arch-utils.c	2001/08/08 03:34:54
***************
*** 38,43 ****
--- 38,44 ----
  #include "annotate.h"
  #endif
  #include "regcache.h"
+ #include "gdb_assert.h"
  
  #include "version.h"
  
*************** int
*** 321,326 ****
--- 322,340 ----
  cannot_register_not (int regnum)
  {
    return 0;
+ }
+ 
+ /* Legacy version of target_virtual_frame_pointer().  Assumes that
+    there is an FP_REGNUM and that it is the same, cooked or raw.  */
+ 
+ void
+ legacy_virtual_frame_pointer (CORE_ADDR pc,
+ 			      int *frame_regnum,
+ 			      LONGEST *frame_offset)
+ {
+   gdb_assert (FP_REGNUM >= 0);
+   *frame_regnum = FP_REGNUM;
+   *frame_offset = 0;
  }
  
  /* Functions to manipulate the endianness of the target.  */
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.18
diff -p -r1.18 arch-utils.h
*** arch-utils.h	2001/06/16 20:00:24	1.18
--- arch-utils.h	2001/08/08 03:34:54
*************** void init_frame_pc_default (int fromleaf
*** 122,125 ****
--- 122,130 ----
  
  int cannot_register_not (int regnum);
  
+ /* Legacy version of target_virtual_frame_pointer().  Assumes that
+    there is an FP_REGNUM and that it is the same, cooked or raw.  */
+ 
+ extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer;
+ 
  #endif
Index: ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.9
diff -p -r1.9 ax-gdb.c
*** ax-gdb.c	2001/03/06 08:21:05	1.9
--- ax-gdb.c	2001/08/08 03:34:54
*************** gen_left_shift (struct agent_expr *ax, i
*** 454,460 ****
  static void
  gen_frame_args_address (struct agent_expr *ax)
  {
!   long frame_reg, frame_offset;
  
    TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
    ax_reg (ax, frame_reg);
--- 454,461 ----
  static void
  gen_frame_args_address (struct agent_expr *ax)
  {
!   int frame_reg;
!   LONGEST frame_offset;
  
    TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
    ax_reg (ax, frame_reg);
*************** gen_frame_args_address (struct agent_exp
*** 467,473 ****
  static void
  gen_frame_locals_address (struct agent_expr *ax)
  {
!   long frame_reg, frame_offset;
  
    TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
    ax_reg (ax, frame_reg);
--- 468,475 ----
  static void
  gen_frame_locals_address (struct agent_expr *ax)
  {
!   int frame_reg;
!   LONGEST frame_offset;
  
    TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
    ax_reg (ax, frame_reg);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.73
diff -p -r1.73 gdbarch.sh
*** gdbarch.sh	2001/07/10 21:24:48	1.73
--- gdbarch.sh	2001/08/08 03:34:55
*************** f::TARGET_READ_FP:CORE_ADDR:read_fp:void
*** 388,393 ****
--- 388,397 ----
  f::TARGET_WRITE_FP:void:write_fp:CORE_ADDR val:val::0:generic_target_write_fp::0
  f::TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0
  f::TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0
+ # Function for getting target's idea of a frame pointer.  FIXME: GDB's
+ # whole scheme for dealing with "frames" and "frame pointers" needs a
+ # serious shakedown.
+ f::TARGET_VIRTUAL_FRAME_POINTER:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset::0:legacy_virtual_frame_pointer::0
  #
  M:::void:register_read:int regnum, char *buf:regnum, buf:
  M:::void:register_write:int regnum, char *buf:regnum, buf:
Index: mn10300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v
retrieving revision 1.17
diff -p -r1.17 mn10300-tdep.c
*** mn10300-tdep.c	2001/05/09 05:03:01	1.17
--- mn10300-tdep.c	2001/08/08 03:34:55
*************** mn10300_frame_init_saved_regs (struct fr
*** 844,851 ****
     plus any necessary offset to be applied to the register before
     any frame pointer offsets.  */
  
! void
! mn10300_virtual_frame_pointer (CORE_ADDR pc, long *reg, long *offset)
  {
    struct frame_info *dummy = analyze_dummy_frame (pc, 0);
    /* Set up a dummy frame_info, Analyze the prolog and fill in the
--- 844,853 ----
     plus any necessary offset to be applied to the register before
     any frame pointer offsets.  */
  
! static void
! mn10300_virtual_frame_pointer (CORE_ADDR pc,
! 			       int *reg,
! 			       LONGEST *offset)
  {
    struct frame_info *dummy = analyze_dummy_frame (pc, 0);
    /* Set up a dummy frame_info, Analyze the prolog and fill in the
*************** mn10300_gdbarch_init (struct gdbarch_inf
*** 1073,1078 ****
--- 1075,1081 ----
    set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum);
    set_gdbarch_do_registers_info (gdbarch, mn10300_do_registers_info);
    set_gdbarch_fp_regnum (gdbarch, 31);
+   set_gdbarch_virtual_frame_pointer (gdbarch, mn10300_virtual_frame_pointer);
  
    /* Breakpoints.  */
    set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc);
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.19
diff -p -r1.19 target.h
*** target.h	2001/05/04 04:15:27	1.19
--- target.h	2001/08/08 03:34:56
*************** extern void push_remote_target (char *na
*** 1253,1264 ****
  /* Blank target vector entries are initialized to target_ignore. */
  void target_ignore (void);
  
- /* Macro for getting target's idea of a frame pointer.
-    FIXME: GDB's whole scheme for dealing with "frames" and
-    "frame pointers" needs a serious shakedown.  */
- #ifndef TARGET_VIRTUAL_FRAME_POINTER
- #define TARGET_VIRTUAL_FRAME_POINTER(ADDR, REGP, OFFP) \
-    do { *(REGP) = FP_REGNUM; *(OFFP) =  0; } while (0)
- #endif /* TARGET_VIRTUAL_FRAME_POINTER */
- 
  #endif /* !defined (TARGET_H) */
--- 1253,1256 ----
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.24
diff -p -r1.24 tracepoint.c
*** tracepoint.c	2001/08/02 11:58:29	1.24
--- tracepoint.c	2001/08/08 03:34:56
*************** encode_actions (struct tracepoint *t, ch
*** 1488,1494 ****
    struct collection_list *collect;
    struct cmd_list_element *cmd;
    struct agent_expr *aexpr;
!   long frame_reg, frame_offset;
  
  
    clear_collection_list (&tracepoint_list);
--- 1488,1495 ----
    struct collection_list *collect;
    struct cmd_list_element *cmd;
    struct agent_expr *aexpr;
!   int frame_reg;
!   LONGEST frame_offset;
  
  
    clear_collection_list (&tracepoint_list);
Index: config/mn10300/tm-mn10300.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mn10300/tm-mn10300.h,v
retrieving revision 1.10
diff -p -r1.10 tm-mn10300.h
*** tm-mn10300.h	2001/05/09 02:44:01	1.10
--- tm-mn10300.h	2001/08/08 03:34:56
*************** enum movm_register_bits {
*** 73,80 ****
  };
  
  #define INIT_FRAME_PC		/* Not necessary */
- 
- /* Cons up virtual frame pointer for trace */
- extern void mn10300_virtual_frame_pointer (CORE_ADDR, long *, long *);
- #define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \
- 	mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP))
--- 73,75 ----

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