[commit/multiarch] setup gdbarch vector for hppa targets

Joel Brobecker brobecker@gnat.com
Fri Dec 27 10:31:00 GMT 2002


I committed the following patch. Basically, I wanted to update
hppa_gdbarch_init to setup the gdbarch vector when debugging
on a hppa target, and wrap the corresponding macros between
"#if !GDB_MULTI_ARCH ... #endif" conditionalization. I found a few
other nits that I fixed along the way (most notably, I added hppa_
prefixes to certain non-static functions to avoid the namespace
pollution).

For tm-hppa.h, we have 2 macros that will need some rework:
PUSH_DUMMY_FRAME, and FIX_CALL_DUMMY. I won't be able to set
GDB_MULTI_ARCH to partial until they are properly implemented.
Will investigate.

The following patch has been tested on hppa2.0w-hp-hpux11.00.

2002-12-26  J. Brobecker  <brobecker@gnat.com>

        Continuing work to convert the hppa targets to multiarch partil.

        * hppa-tdep.c: Add some missing forward declarations.
        (frameless_function_invocation): Prefix the function name
        by "hppa_" to avoid polluting the namespace.  Update all calls
        to use the new function name.
        (saved_pc_after_call): Ditto.
        (init_extra_frame_info): Ditto.
        (frame_chain): Ditto.
        (push_dummy_frame): Ditto.
        (target_read_pc): Ditto.
        (target_write_pc): Ditto.
        (in_solib_call_trampoline): Ditto.
        (in_solib_return_trampoline): Ditto.
        (skip_trampoline_code): Ditto.
        (hppa_read_fp): New function, renamed from target_read_fp.
        (hppa_target_read_fp): New function, using hppa_read_fp.
        This function conforms to the function profile for the
        READ_FP gdbarch method.
        (hppa_extract_struct_value_address): New function, extracted
        from the definition of the DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
        macro.
        (hppa_frame_num_args): New function.
        (hppa_gdbarch_init): Setup the gdbarch vector for the hppa target.

        * config/pa/tm-hppa.h: Wrap around all gdbarch-eligible macros
        inside "#if !GDB_MULTI_ARCH ... #endif" conditional, in preparation
        for the switch to multiarch partial.
        Update some of the macros definitions to match some changes
        described above in the name of the function they are calling.
        (PUSH_DUMMY_FRAME): Add a FIXME explaining why this macro will
        not be straightforward to convert. Do now wrap it inside
        "#if !... #endif" to remember that this macro has still not
        been taken care of.
        (FIX_CALL_DUMMY): Likewise.

-- 
Joel
-------------- next part --------------
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.42
diff -u -3 -p -r1.42 hppa-tdep.c
--- hppa-tdep.c	26 Dec 2002 09:36:41 -0000	1.42
+++ hppa-tdep.c	26 Dec 2002 19:46:17 -0000
@@ -63,6 +63,9 @@
 #include "symfile.h"
 #include "objfiles.h"
 
+/* Some local constants.  */
+static const int hppa_num_regs = 128;
+
 /* To support detection of the pseudo-initial frame
    that threads have. */
 #define THREAD_INITIAL_FRAME_SYMBOL  "__pthread_exit"
@@ -135,6 +138,11 @@ static void record_text_segment_lowaddr 
 /* FIXME: brobecker 2002-11-07: We will likely be able to make the
    following functions static, once we hppa is partially multiarched.  */
 int hppa_reg_struct_has_addr (int gcc_p, struct type *type);
+CORE_ADDR hppa_skip_prologue (CORE_ADDR pc);
+CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR pc);
+int hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name);
+int hppa_in_solib_return_trampoline (CORE_ADDR pc, char *name);
+CORE_ADDR hppa_saved_pc_after_call (struct frame_info *frame);
 int hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs);
 CORE_ADDR hppa_stack_align (CORE_ADDR sp);
 int hppa_pc_requires_run_before_use (CORE_ADDR pc);
@@ -143,10 +151,30 @@ int hppa_register_raw_size (int reg_nr);
 int hppa_register_byte (int reg_nr);
 struct type * hppa_register_virtual_type (int reg_nr);
 void hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
+void hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf);
+int hppa_use_struct_convention (int gcc_p, struct type *type);
+void hppa_store_return_value (struct type *type, char *valbuf);
+CORE_ADDR hppa_extract_struct_value_address (char *regbuf);
 int hppa_cannot_store_register (int regnum);
+void hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame);
+CORE_ADDR hppa_frame_chain (struct frame_info *frame);
+int hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe);
+int hppa_frameless_function_invocation (struct frame_info *frame);
+CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame);
 CORE_ADDR hppa_frame_args_address (struct frame_info *fi);
 CORE_ADDR hppa_frame_locals_address (struct frame_info *fi);
+int hppa_frame_num_args (struct frame_info *frame);
+void hppa_push_dummy_frame (struct inferior_status *inf_status);
+void hppa_pop_frame (void);
+CORE_ADDR hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
+                               int nargs, struct value **args,
+                               struct type *type, int gcc_p);
+CORE_ADDR hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+		               int struct_return, CORE_ADDR struct_addr);
 CORE_ADDR hppa_smash_text_address (CORE_ADDR addr);
+CORE_ADDR hppa_target_read_pc (ptid_t ptid);
+void hppa_target_write_pc (CORE_ADDR v, ptid_t ptid);
+CORE_ADDR hppa_target_read_fp (void);
 int hppa_coerce_float_to_double (struct type *formal, struct type *actual);
 
 typedef struct
@@ -817,7 +845,7 @@ rp_saved (CORE_ADDR pc)
 }
 
 int
-frameless_function_invocation (struct frame_info *frame)
+hppa_frameless_function_invocation (struct frame_info *frame)
 {
   struct unwind_table_entry *u;
 
@@ -835,7 +863,7 @@ frameless_function_invocation (struct fr
    some instructions.  */
 
 CORE_ADDR
-saved_pc_after_call (struct frame_info *frame)
+hppa_saved_pc_after_call (struct frame_info *frame)
 {
   int ret_regnum;
   CORE_ADDR pc;
@@ -901,7 +929,7 @@ hppa_frame_saved_pc (struct frame_info *
     }
 #endif
 
-  if (frameless_function_invocation (frame))
+  if (hppa_frameless_function_invocation (frame))
     {
       int ret_regnum;
 
@@ -1033,7 +1061,7 @@ hppa_frame_saved_pc (struct frame_info *
    in a system call.  */
 
 void
-init_extra_frame_info (int fromleaf, struct frame_info *frame)
+hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame)
 {
   int flags;
   int framesize;
@@ -1091,7 +1119,7 @@ init_extra_frame_info (int fromleaf, str
    a frame pointer calls code without a frame pointer.  */
 
 CORE_ADDR
-frame_chain (struct frame_info *frame)
+hppa_frame_chain (struct frame_info *frame)
 {
   int my_framesize, caller_framesize;
   struct unwind_table_entry *u;
@@ -1408,7 +1436,7 @@ hppa_frame_chain_valid (CORE_ADDR chain,
    to be aligned to a 64-byte boundary. */
 
 void
-push_dummy_frame (struct inferior_status *inf_status)
+hppa_push_dummy_frame (struct inferior_status *inf_status)
 {
   CORE_ADDR sp, pc, pcspace;
   register int regnum;
@@ -1424,7 +1452,7 @@ push_dummy_frame (struct inferior_status
      We also need a number of horrid hacks to deal with lossage in the
      PC queue registers (apparently they're not valid when the in syscall
      bit is set).  */
-  pc = target_read_pc (inferior_ptid);
+  pc = hppa_target_read_pc (inferior_ptid);
   int_buffer = read_register (FLAGS_REGNUM);
   if (int_buffer & 0x2)
     {
@@ -2401,7 +2429,7 @@ hppa_fix_call_dummy (char *dummy, CORE_A
   if (flags & 2)
     return pc;
 #ifndef GDB_TARGET_IS_PA_ELF
-  else if (som_solib_get_got_by_pc (target_read_pc (inferior_ptid)))
+  else if (som_solib_get_got_by_pc (hppa_target_read_pc (inferior_ptid)))
     return pc;
 #endif
   else
@@ -2409,14 +2437,12 @@ hppa_fix_call_dummy (char *dummy, CORE_A
 #endif
 }
 
-
-
-
 /* If the pid is in a syscall, then the FP register is not readable.
    We'll return zero in that case, rather than attempting to read it
    and cause a warning. */
+
 CORE_ADDR
-target_read_fp (int pid)
+hppa_read_fp (int pid)
 {
   int flags = read_register (FLAGS_REGNUM);
 
@@ -2430,12 +2456,17 @@ target_read_fp (int pid)
   return read_register (FP_REGNUM);
 }
 
+CORE_ADDR
+hppa_target_read_fp (void)
+{
+  return hppa_read_fp (PIDGET (inferior_ptid));
+}
 
 /* Get the PC from %r31 if currently in a syscall.  Also mask out privilege
    bits.  */
 
 CORE_ADDR
-target_read_pc (ptid_t ptid)
+hppa_target_read_pc (ptid_t ptid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, ptid);
 
@@ -2452,7 +2483,7 @@ target_read_pc (ptid_t ptid)
    PC value into %r31.  */
 
 void
-target_write_pc (CORE_ADDR v, ptid_t ptid)
+hppa_target_write_pc (CORE_ADDR v, ptid_t ptid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, ptid);
 
@@ -2890,7 +2921,7 @@ pa_strcat_fp_reg (int i, struct ui_file 
    just shared library trampolines (import, export).  */
 
 int
-in_solib_call_trampoline (CORE_ADDR pc, char *name)
+hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name)
 {
   struct minimal_symbol *minsym;
   struct unwind_table_entry *u;
@@ -3050,7 +3081,7 @@ in_solib_call_trampoline (CORE_ADDR pc, 
    just shared library trampolines (import, export).  */
 
 int
-in_solib_return_trampoline (CORE_ADDR pc, char *name)
+hppa_in_solib_return_trampoline (CORE_ADDR pc, char *name)
 {
   struct unwind_table_entry *u;
 
@@ -3123,7 +3154,7 @@ in_solib_return_trampoline (CORE_ADDR pc
    used in dynamic executables.  */
 
 CORE_ADDR
-skip_trampoline_code (CORE_ADDR pc, char *name)
+hppa_skip_trampoline_code (CORE_ADDR pc)
 {
   long orig_pc = pc;
   long prev_inst, curr_inst, loc;
@@ -4850,6 +4881,21 @@ hppa_store_struct_return (CORE_ADDR addr
   write_register (28, addr);
 }
 
+CORE_ADDR
+hppa_extract_struct_value_address (char *regbuf)
+{
+  /* Extract from an array REGBUF containing the (raw) register state
+     the address in which a function should return its structure value,
+     as a CORE_ADDR (or an expression that can be used as one).  */
+  /* FIXME: brobecker 2002-12-26.
+     The current implementation is historical, but we should eventually
+     implement it in a more robust manner as it relies on the fact that
+     the address size is equal to the size of an int* _on the host_...
+     One possible implementation that crossed my mind is to use
+     extract_address.  */
+  return (*(int *)(regbuf + REGISTER_BYTE (28)));
+}
+
 /* Return True if REGNUM is not a register available to the user
    through ptrace().  */
 
@@ -4875,6 +4921,14 @@ hppa_frame_locals_address (struct frame_
   return fi->frame;
 }
 
+int
+hppa_frame_num_args (struct frame_info *frame)
+{
+  /* We can't tell how many args there are now that the C compiler delays
+     popping them.  */
+  return -1;
+}
+
 CORE_ADDR
 hppa_smash_text_address (CORE_ADDR addr)
 {
@@ -4930,6 +4984,63 @@ hppa_gdbarch_init (struct gdbarch_info i
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch, osabi);
+
+  set_gdbarch_reg_struct_has_addr (gdbarch, hppa_reg_struct_has_addr);
+  set_gdbarch_function_start_offset (gdbarch, 0);
+  set_gdbarch_skip_prologue (gdbarch, hppa_skip_prologue);
+  set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code);
+  set_gdbarch_in_solib_call_trampoline (gdbarch, hppa_in_solib_call_trampoline);
+  set_gdbarch_in_solib_return_trampoline (gdbarch,
+                                          hppa_in_solib_return_trampoline);
+  set_gdbarch_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call);
+  set_gdbarch_inner_than (gdbarch, hppa_inner_than);
+  set_gdbarch_stack_align (gdbarch, hppa_stack_align);
+  set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
+  set_gdbarch_decr_pc_after_break (gdbarch, 0);
+  set_gdbarch_register_size (gdbarch, 4);
+  set_gdbarch_num_regs (gdbarch, hppa_num_regs);
+  set_gdbarch_fp_regnum (gdbarch, 3);
+  set_gdbarch_sp_regnum (gdbarch, 30);
+  set_gdbarch_fp0_regnum (gdbarch, 64);
+  set_gdbarch_pc_regnum (gdbarch, PCOQ_HEAD_REGNUM);
+  set_gdbarch_npc_regnum (gdbarch, PCOQ_TAIL_REGNUM);
+  set_gdbarch_register_raw_size (gdbarch, hppa_register_raw_size);
+  set_gdbarch_register_bytes (gdbarch, hppa_num_regs * 4);
+  set_gdbarch_register_byte (gdbarch, hppa_register_byte);
+  set_gdbarch_register_virtual_size (gdbarch, hppa_register_raw_size);
+  set_gdbarch_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_max_register_virtual_size (gdbarch, 8);
+  set_gdbarch_register_virtual_type (gdbarch, hppa_register_virtual_type);
+  set_gdbarch_store_struct_return (gdbarch, hppa_store_struct_return);
+  set_gdbarch_deprecated_extract_return_value (gdbarch,
+                                               hppa_extract_return_value);
+  set_gdbarch_use_struct_convention (gdbarch, hppa_use_struct_convention);
+  set_gdbarch_deprecated_store_return_value (gdbarch, hppa_store_return_value);
+  set_gdbarch_deprecated_extract_struct_value_address
+    (gdbarch, hppa_extract_struct_value_address);
+  set_gdbarch_cannot_store_register (gdbarch, hppa_cannot_store_register);
+  set_gdbarch_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info);
+  set_gdbarch_frame_chain (gdbarch, hppa_frame_chain);
+  set_gdbarch_frame_chain_valid (gdbarch, hppa_frame_chain_valid);
+  set_gdbarch_frameless_function_invocation
+    (gdbarch, hppa_frameless_function_invocation);
+  set_gdbarch_frame_saved_pc (gdbarch, hppa_frame_saved_pc);
+  set_gdbarch_frame_args_address (gdbarch, hppa_frame_args_address);
+  set_gdbarch_frame_locals_address (gdbarch, hppa_frame_locals_address);
+  set_gdbarch_frame_num_args (gdbarch, hppa_frame_num_args);
+  set_gdbarch_frame_args_skip (gdbarch, 0);
+  /* set_gdbarch_push_dummy_frame (gdbarch, hppa_push_dummy_frame);  */
+  set_gdbarch_pop_frame (gdbarch, hppa_pop_frame);
+  set_gdbarch_call_dummy_length (gdbarch, INSTRUCTION_SIZE * 28);
+  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
+  /* set_gdbarch_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */
+  set_gdbarch_push_arguments (gdbarch, hppa_push_arguments);
+  set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address);
+  set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+  set_gdbarch_read_pc (gdbarch, hppa_target_read_pc);
+  set_gdbarch_write_pc (gdbarch, hppa_target_write_pc);
+  set_gdbarch_read_fp (gdbarch, hppa_target_read_fp);
+  set_gdbarch_coerce_float_to_double (gdbarch, hppa_coerce_float_to_double);
 
   return gdbarch;
 }
Index: config/pa/tm-hppa.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/tm-hppa.h,v
retrieving revision 1.27
diff -u -3 -p -r1.27 tm-hppa.h
--- config/pa/tm-hppa.h	26 Dec 2002 09:36:42 -0000	1.27
+++ config/pa/tm-hppa.h	26 Dec 2002 19:46:17 -0000
@@ -58,47 +58,67 @@ struct inferior_status;
   ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
 #endif
 
+#if !GDB_MULTI_ARCH
 extern int hppa_reg_struct_has_addr (int gcc_p, struct type *type);
 #define REG_STRUCT_HAS_ADDR(gcc_p,type) hppa_reg_struct_has_addr (gcc_p,type)
+#endif
 
 /* Offset from address of function to start of its code.
    Zero on most machines.  */
 
+#if !GDB_MULTI_ARCH
 #define FUNCTION_START_OFFSET 0
+#endif
 
 /* Advance PC across any function entry prologue instructions
    to reach some "real" code.  */
 
+#if !GDB_MULTI_ARCH
 extern CORE_ADDR hppa_skip_prologue (CORE_ADDR);
 #define SKIP_PROLOGUE(pc) (hppa_skip_prologue (pc))
+#endif
 
 /* If PC is in some function-call trampoline code, return the PC
    where the function itself actually starts.  If not, return NULL.  */
 
-#define	SKIP_TRAMPOLINE_CODE(pc) skip_trampoline_code (pc, NULL)
-extern CORE_ADDR skip_trampoline_code (CORE_ADDR, char *);
+#if !GDB_MULTI_ARCH
+#define	SKIP_TRAMPOLINE_CODE(pc) hppa_skip_trampoline_code (pc)
+extern CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR);
+#endif
 
 /* Return non-zero if we are in an appropriate trampoline. */
 
+#if !GDB_MULTI_ARCH
 #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \
-   in_solib_call_trampoline (pc, name)
-extern int in_solib_call_trampoline (CORE_ADDR, char *);
+   hppa_in_solib_call_trampoline (pc, name)
+extern int hppa_in_solib_call_trampoline (CORE_ADDR, char *);
+#endif
 
+#if !GDB_MULTI_ARCH
 #define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) \
-  in_solib_return_trampoline (pc, name)
-extern int in_solib_return_trampoline (CORE_ADDR, char *);
+  hppa_in_solib_return_trampoline (pc, name)
+extern int hppa_in_solib_return_trampoline (CORE_ADDR, char *);
+#endif
 
+#if !GDB_MULTI_ARCH
 #undef	SAVED_PC_AFTER_CALL
-#define SAVED_PC_AFTER_CALL(frame) saved_pc_after_call (frame)
-extern CORE_ADDR saved_pc_after_call (struct frame_info *);
+#define SAVED_PC_AFTER_CALL(frame) hppa_saved_pc_after_call (frame)
+extern CORE_ADDR hppa_saved_pc_after_call (struct frame_info *);
+#endif
 
+#if !GDB_MULTI_ARCH
 extern int hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs);
 #define INNER_THAN(lhs,rhs) hppa_inner_than(lhs,rhs)
+#endif
 
+#if !GDB_MULTI_ARCH
 extern CORE_ADDR hppa_stack_align (CORE_ADDR sp);
 #define STACK_ALIGN(sp) hppa_stack_align (sp)
+#endif
 
+#if !GDB_MULTI_ARCH
 #define EXTRA_STACK_ALIGNMENT_NEEDED 0
+#endif
 
 /* Sequence of bytes for breakpoint instruction.  */
 
@@ -111,7 +131,9 @@ extern CORE_ADDR hppa_stack_align (CORE_
 
    Not on the PA-RISC */
 
+#if !GDB_MULTI_ARCH
 #define DECR_PC_AFTER_BREAK 0
+#endif
 
 extern int hppa_pc_requires_run_before_use (CORE_ADDR pc);
 #define PC_REQUIRES_RUN_BEFORE_USE(pc) hppa_pc_requires_run_before_use (pc)
@@ -120,11 +142,15 @@ extern int hppa_pc_requires_run_before_u
    used in push_word and a few other places; REGISTER_RAW_SIZE is the
    real way to know how big a register is.  */
 
+#if !GDB_MULTI_ARCH
 #define REGISTER_SIZE 4
+#endif
 
 /* Number of machine registers */
 
+#if !GDB_MULTI_ARCH
 #define NUM_REGS 128
+#endif
 
 /* Initializer for an array of names of registers.
    There should be NUM_REGS strings in this initializer.
@@ -159,9 +185,13 @@ extern int hppa_pc_requires_run_before_u
 				   other r registers.  */
 #define FLAGS_REGNUM 0		/* Various status flags */
 #define RP_REGNUM 2		/* return pointer */
+#if !GDB_MULTI_ARCH
 #define FP_REGNUM 3		/* Contains address of executing stack */
 				/* frame */
+#endif
+#if !GDB_MULTI_ARCH
 #define SP_REGNUM 30		/* Contains address of top of stack */
+#endif
 #define SAR_REGNUM 32		/* Shift Amount Register */
 #define IPSW_REGNUM 41		/* Interrupt Processor Status Word */
 #define PCOQ_HEAD_REGNUM 33	/* instruction offset queue head */
@@ -176,7 +206,9 @@ extern int hppa_pc_requires_run_before_u
 #define CCR_REGNUM 54		/* Coprocessor Configuration Register */
 #define TR0_REGNUM 57		/* Temporary Registers (cr24 -> cr31) */
 #define CR27_REGNUM 60		/* Base register for thread-local storage, cr27 */
+#if !GDB_MULTI_ARCH
 #define FP0_REGNUM 64		/* floating point reg. 0 (fspr) */
+#endif
 #define FP4_REGNUM 72
 
 #define ARG0_REGNUM 26		/* The first argument of a callee. */
@@ -185,8 +217,12 @@ extern int hppa_pc_requires_run_before_u
 #define ARG3_REGNUM 23		/* The fourth argument of a callee. */
 
 /* compatibility with the rest of gdb. */
+#if !GDB_MULTI_ARCH
 #define PC_REGNUM PCOQ_HEAD_REGNUM
+#endif
+#if !GDB_MULTI_ARCH
 #define NPC_REGNUM PCOQ_TAIL_REGNUM
+#endif
 
 /*
  * Processor Status Word Masks
@@ -240,42 +276,60 @@ extern int hppa_instruction_nullified (v
    for register N.  On the PA-RISC, all regs are 4 bytes, including
    the FP registers (they're accessed as two 4 byte halves).  */
 
+#if !GDB_MULTI_ARCH
 extern int hppa_register_raw_size (int reg_nr);
 #define REGISTER_RAW_SIZE(N) hppa_register_raw_size (N)
+#endif
 
 /* Total amount of space needed to store our copies of the machine's
    register state, the array `registers'.  */
+#if !GDB_MULTI_ARCH
 #define REGISTER_BYTES (NUM_REGS * 4)
+#endif
 
+#if !GDB_MULTI_ARCH
 extern int hppa_register_byte (int reg_nr);
 #define REGISTER_BYTE(N) hppa_register_byte (N)
+#endif
 
 /* Number of bytes of storage in the program's representation
    for register N. */
 
+#if !GDB_MULTI_ARCH
 #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
+#endif
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
+#if !GDB_MULTI_ARCH
 #define MAX_REGISTER_RAW_SIZE 4
+#endif
 
 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 
+#if !GDB_MULTI_ARCH
 #define MAX_REGISTER_VIRTUAL_SIZE 8
+#endif
 
+#if !GDB_MULTI_ARCH
 extern struct type * hppa_register_virtual_type (int reg_nr);
 #define REGISTER_VIRTUAL_TYPE(N) hppa_register_virtual_type (N)
+#endif
 
+#if !GDB_MULTI_ARCH
 extern void hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
 #define STORE_STRUCT_RETURN(ADDR, SP) hppa_store_struct_return (ADDR, SP)
+#endif
 
 /* Extract from an array REGBUF containing the (raw) register state
    a function return value of type TYPE, and copy that, in virtual format,
    into VALBUF.  */
 
+#if !GDB_MULTI_ARCH
 void hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf);
 #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
   hppa_extract_return_value (TYPE, REGBUF, VALBUF);
+#endif
 
  /* elz: decide whether the function returning a value of type type
     will put it on the stack or in the registers.
@@ -288,23 +342,25 @@ void hppa_extract_return_value (struct t
     sr1: space identifier (32-bit)
     stack: any lager than 64-bit, with the address in r28
   */
+#if !GDB_MULTI_ARCH
 extern use_struct_convention_fn hppa_use_struct_convention;
 #define USE_STRUCT_CONVENTION(gcc_p,type) hppa_use_struct_convention (gcc_p,type)
+#endif
 
 /* Write into appropriate registers a function return value
    of type TYPE, given in virtual format.  */
 
-
+#if !GDB_MULTI_ARCH
 extern void hppa_store_return_value (struct type *type, char *valbuf);
 #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \
   hppa_store_return_value (TYPE, VALBUF);
+#endif
 
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR (or an expression that can be used as one).  */
-
+#if !GDB_MULTI_ARCH
+extern CORE_ADDR hppa_extract_struct_value_address (char *regbuf);
 #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-  (*(int *)((REGBUF) + REGISTER_BYTE (28)))
+  hppa_extract_struct_value_address (REGBUF)
+#endif
 
 /* elz: Return a large value, which is stored on the stack at addr.
    This is defined only for the hppa, at this moment.  The above macro
@@ -321,11 +377,15 @@ struct value *hppa_value_returned_from_s
 #define VALUE_RETURNED_FROM_STACK(valtype,addr) \
   hppa_value_returned_from_stack (valtype, addr)
 
+#if !GDB_MULTI_ARCH
 extern int hppa_cannot_store_register (int regnum);
 #define CANNOT_STORE_REGISTER(regno) hppa_cannot_store_register (regno)
+#endif
 
-#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) init_extra_frame_info (fromleaf, frame)
-extern void init_extra_frame_info (int, struct frame_info *);
+#if !GDB_MULTI_ARCH
+#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) hppa_init_extra_frame_info (fromleaf, frame)
+extern void hppa_init_extra_frame_info (int, struct frame_info *);
+#endif
 
 /* Describe the pointer in each stack frame to the previous stack frame
    (its caller).  */
@@ -337,40 +397,50 @@ extern void init_extra_frame_info (int, 
    is the address of a 4-byte word containing the calling frame's
    address (previous FP).  */
 
-#define FRAME_CHAIN(thisframe) frame_chain (thisframe)
-extern CORE_ADDR frame_chain (struct frame_info *);
+#if !GDB_MULTI_ARCH
+#define FRAME_CHAIN(thisframe) hppa_frame_chain (thisframe)
+extern CORE_ADDR hppa_frame_chain (struct frame_info *);
+#endif
 
+#if !GDB_MULTI_ARCH
 extern int hppa_frame_chain_valid (CORE_ADDR, struct frame_info *);
 #define FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe)
+#endif
 
 /* Define other aspects of the stack frame.  */
 
 /* A macro that tells us whether the function invocation represented
    by FI does not have a frame on the stack associated with it.  If it
    does not, FRAMELESS is set to 1, else 0.  */
+#if !GDB_MULTI_ARCH
 #define FRAMELESS_FUNCTION_INVOCATION(FI) \
-  (frameless_function_invocation (FI))
-extern int frameless_function_invocation (struct frame_info *);
+  (hppa_frameless_function_invocation (FI))
+extern int hppa_frameless_function_invocation (struct frame_info *);
+#endif
 
+#if !GDB_MULTI_ARCH
 extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame);
 #define FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME)
+#endif
 
+#if !GDB_MULTI_ARCH
 extern CORE_ADDR hppa_frame_args_address (struct frame_info *fi);
 #define FRAME_ARGS_ADDRESS(fi) hppa_frame_args_address (fi)
+#endif
 
+#if !GDB_MULTI_ARCH
 extern CORE_ADDR hppa_frame_locals_address (struct frame_info *fi);
 #define FRAME_LOCALS_ADDRESS(fi) hppa_frame_locals_address (fi)
+#endif
 
-/* Set VAL to the number of args passed to frame described by FI.
-   Can set VAL to -1, meaning no way to tell.  */
-
-/* We can't tell how many args there are
-   now that the C compiler delays popping them.  */
-#define FRAME_NUM_ARGS(fi) (-1)
-
-/* Return number of bytes at start of arglist that are not really args.  */
+#if !GDB_MULTI_ARCH
+extern int hppa_frame_num_args (struct frame_info *frame);
+#define FRAME_NUM_ARGS(fi) hppa_frame_num_args (fi)
+#endif
 
+#if !GDB_MULTI_ARCH
 #define FRAME_ARGS_SKIP 0
+#endif
 
 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
   hppa_frame_find_saved_regs (frame_info, &frame_saved_regs)
@@ -382,13 +452,20 @@ hppa_frame_find_saved_regs (struct frame
 
 /* Push an empty stack frame, to record the current PC, etc. */
 
-#define PUSH_DUMMY_FRAME push_dummy_frame (inf_status)
-extern void push_dummy_frame (struct inferior_status *);
+/* FIXME: brobecker 2002-12-26.  This macro definition takes advantage
+   of the fact that PUSH_DUMMY_FRAME is called within a function where
+   a variable inf_status of type struct inferior_status * is defined.
+   Ugh!  Until this is fixed, we will not be able to move to multiarch
+   partial.  */
+#define PUSH_DUMMY_FRAME hppa_push_dummy_frame (inf_status)
+extern void hppa_push_dummy_frame (struct inferior_status *);
 
 /* Discard from the stack the innermost frame, 
    restoring all saved registers.  */
+#if !GDB_MULTI_ARCH
 #define POP_FRAME  hppa_pop_frame ()
 extern void hppa_pop_frame (void);
+#endif
 
 #define INSTRUCTION_SIZE 4
 
@@ -475,11 +552,16 @@ extern void hppa_pop_frame (void);
                     0xe6c00002, 0xe4202000, 0x6bdf3fd1, 0x00010004,\
                     0x00151820, 0xe6c00002, 0x08000240, 0x08000240}
 
+#if !GDB_MULTI_ARCH
 #define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 28)
+#endif
 #define REG_PARM_STACK_SPACE 16
 
 #else /* defined PA_LEVEL_0 */
 
+/* FIXME: brobecker 2002-12-26.  PA_LEVEL_0 is only defined for the
+   hppa-pro target, which should be obsoleted soon.  The following
+   section will therefore not be included in the multiarch conversion.  */
 /* This is the call dummy for a level 0 PA.  Level 0's don't have space
    registers (or floating point?), so we skip all that inter-space call stuff,
    and avoid touching the fp regs.
@@ -510,9 +592,11 @@ extern void hppa_pop_frame (void);
 
 #define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 12)
 
-#endif
+#endif /* defined PA_LEVEL_0 */
 
+#if !GDB_MULTI_ARCH
 #define CALL_DUMMY_START_OFFSET 0
+#endif
 
 /* If we've reached a trap instruction within the call dummy, then
    we'll consider that to mean that we've reached the call dummy's
@@ -531,23 +615,31 @@ extern void hppa_pop_frame (void);
  * inferior to do the function call.
  */
 
+/* FIXME: brobecker 2002-12-26.  This macro is going to cause us some
+   problems before we can go to multiarch partial as it has been diverted
+   on HPUX to return the value of the PC!  */
 #define FIX_CALL_DUMMY hppa_fix_call_dummy
+extern CORE_ADDR hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
+		                      struct value **, struct type *, int);
 
-extern CORE_ADDR
-hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
-		     struct value **, struct type *, int);
-
+#if !GDB_MULTI_ARCH
 #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
   (hppa_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
 extern CORE_ADDR
 hppa_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR);
+#endif
+
 
+#if !GDB_MULTI_ARCH
 extern CORE_ADDR hppa_smash_text_address (CORE_ADDR addr);
 #define SMASH_TEXT_ADDRESS(addr) hppa_smash_text_address (addr)
+#endif
 
 #define	GDB_TARGET_IS_HPPA
 
+#if !GDB_MULTI_ARCH
 #define BELIEVE_PCC_PROMOTION 1
+#endif
 
 /*
  * Unwind table and descriptor.
@@ -674,19 +766,24 @@ extern CORE_ADDR target_read_pc (int);
 extern CORE_ADDR skip_trampoline_code (CORE_ADDR, char *);
 #endif
 
-#define TARGET_READ_PC(pid) target_read_pc (pid)
-extern CORE_ADDR target_read_pc (ptid_t);
+#if !GDB_MULTI_ARCH
+#define TARGET_READ_PC(pid) hppa_target_read_pc (pid)
+extern CORE_ADDR hppa_target_read_pc (ptid_t);
+#endif
 
-#define TARGET_WRITE_PC(v,pid) target_write_pc (v,pid)
-extern void target_write_pc (CORE_ADDR, ptid_t);
+#if !GDB_MULTI_ARCH
+#define TARGET_WRITE_PC(v,pid) hppa_target_write_pc (v,pid)
+extern void hppa_target_write_pc (CORE_ADDR, ptid_t);
+#endif
 
-#define TARGET_READ_FP() target_read_fp (PIDGET (inferior_ptid))
-extern CORE_ADDR target_read_fp (int);
+#if !GDB_MULTI_ARCH
+#define TARGET_READ_FP() hppa_target_read_fp ()
+extern CORE_ADDR hppa_target_read_fp (void);
+#endif
 
 /* For a number of horrible reasons we may have to adjust the location
    of variables on the stack.  Ugh.  */
 #define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR)
-
 extern int hpread_adjust_stack_address (CORE_ADDR);
 
 /* If the current gcc for for this target does not produce correct debugging
@@ -694,10 +791,12 @@ extern int hpread_adjust_stack_address (
    define this macro.  This forces gdb to  always assume that floats are
    passed as doubles and then converted in the callee.  */
 
+#if !GDB_MULTI_ARCH
 extern int hppa_coerce_float_to_double (struct type *formal,
                                         struct type *actual);
 #define COERCE_FLOAT_TO_DOUBLE(formal, actual) \
   hppa_coerce_float_to_double (formal, actual)
+#endif
 
 /* Here's how to step off a permanent breakpoint.  */
 #define SKIP_PERMANENT_BREAKPOINT (hppa_skip_permanent_breakpoint)


More information about the Gdb-patches mailing list