/* For argument passing to the inferior */
#include "symtab.h"
#include "infcall.h"
+#include "dis-asm.h"
#ifdef USG
#include <sys/types.h>
#include "target.h"
#include "symfile.h"
#include "objfiles.h"
+#include "hppa-tdep.h"
/* Some local constants. */
-static const int hppa_num_regs = 128;
+static const int hppa32_num_regs = 128;
+static const int hppa64_num_regs = 96;
+
+static const int hppa64_call_dummy_breakpoint_offset = 22 * 4;
+
+/* DEPRECATED_CALL_DUMMY_LENGTH is computed based on the size of a
+ word on the target machine, not the size of an instruction. Since
+ a word on this target holds two instructions we have to divide the
+ instruction size by two to get the word size of the dummy. */
+static const int hppa32_call_dummy_length = INSTRUCTION_SIZE * 28;
+static const int hppa64_call_dummy_length = INSTRUCTION_SIZE * 26 / 2;
/* Get at various relevent fields of an instruction word. */
#define MASK_5 0x1f
static int hppa_alignof (struct type *);
-/* To support multi-threading and stepping. */
-int hppa_prepare_to_proceed ();
-
static int prologue_inst_adjust_sp (unsigned long);
static int is_branch (unsigned long);
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);
+CORE_ADDR hppa32_stack_align (CORE_ADDR sp);
+CORE_ADDR hppa64_stack_align (CORE_ADDR sp);
int hppa_pc_requires_run_before_use (CORE_ADDR pc);
int hppa_instruction_nullified (void);
int hppa_register_raw_size (int reg_nr);
int hppa_register_byte (int reg_nr);
-struct type * hppa_register_virtual_type (int reg_nr);
+struct type * hppa32_register_virtual_type (int reg_nr);
+struct type * hppa64_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);
+void hppa32_extract_return_value (struct type *type, char *regbuf,
+ char *valbuf);
+void hppa64_extract_return_value (struct type *type, char *regbuf,
+ char *valbuf);
+int hppa32_use_struct_convention (int gcc_p, struct type *type);
+int hppa64_use_struct_convention (int gcc_p, struct type *type);
+void hppa32_store_return_value (struct type *type, char *valbuf);
+void hppa64_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);
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 (void);
void hppa_pop_frame (void);
/* Should call_function allocate stack space for a struct return? */
int
-hppa_use_struct_convention (int gcc_p, struct type *type)
+hppa32_use_struct_convention (int gcc_p, struct type *type)
{
return (TYPE_LENGTH (type) > 2 * DEPRECATED_REGISTER_SIZE);
}
-\f
+
+/* Same as hppa32_use_struct_convention() for the PA64 ABI. */
+
+int
+hppa64_use_struct_convention (int gcc_p, struct type *type)
+{
+ /* RM: struct upto 128 bits are returned in registers */
+ return TYPE_LENGTH (type) > 16;
+}
/* Routines to extract various sized constants out of hppa
instructions. */
return breakpoint;
}
+/* Return the name of a register. */
+
+const char *
+hppa32_register_name (int i)
+{
+ static char *names[] = {
+ "flags", "r1", "rp", "r3",
+ "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19",
+ "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "dp",
+ "ret0", "ret1", "sp", "r31",
+ "sar", "pcoqh", "pcsqh", "pcoqt",
+ "pcsqt", "eiem", "iir", "isr",
+ "ior", "ipsw", "goto", "sr4",
+ "sr0", "sr1", "sr2", "sr3",
+ "sr5", "sr6", "sr7", "cr0",
+ "cr8", "cr9", "ccr", "cr12",
+ "cr13", "cr24", "cr25", "cr26",
+ "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad",
+ "fpsr", "fpe1", "fpe2", "fpe3",
+ "fpe4", "fpe5", "fpe6", "fpe7",
+ "fr4", "fr4R", "fr5", "fr5R",
+ "fr6", "fr6R", "fr7", "fr7R",
+ "fr8", "fr8R", "fr9", "fr9R",
+ "fr10", "fr10R", "fr11", "fr11R",
+ "fr12", "fr12R", "fr13", "fr13R",
+ "fr14", "fr14R", "fr15", "fr15R",
+ "fr16", "fr16R", "fr17", "fr17R",
+ "fr18", "fr18R", "fr19", "fr19R",
+ "fr20", "fr20R", "fr21", "fr21R",
+ "fr22", "fr22R", "fr23", "fr23R",
+ "fr24", "fr24R", "fr25", "fr25R",
+ "fr26", "fr26R", "fr27", "fr27R",
+ "fr28", "fr28R", "fr29", "fr29R",
+ "fr30", "fr30R", "fr31", "fr31R"
+ };
+ if (i < 0 || i >= (sizeof (names) / sizeof (*names)))
+ return NULL;
+ else
+ return names[i];
+}
+
+const char *
+hppa64_register_name (int i)
+{
+ static char *names[] = {
+ "flags", "r1", "rp", "r3",
+ "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19",
+ "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "dp",
+ "ret0", "ret1", "sp", "r31",
+ "sar", "pcoqh", "pcsqh", "pcoqt",
+ "pcsqt", "eiem", "iir", "isr",
+ "ior", "ipsw", "goto", "sr4",
+ "sr0", "sr1", "sr2", "sr3",
+ "sr5", "sr6", "sr7", "cr0",
+ "cr8", "cr9", "ccr", "cr12",
+ "cr13", "cr24", "cr25", "cr26",
+ "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad",
+ "fpsr", "fpe1", "fpe2", "fpe3",
+ "fr4", "fr5", "fr6", "fr7",
+ "fr8", "fr9", "fr10", "fr11",
+ "fr12", "fr13", "fr14", "fr15",
+ "fr16", "fr17", "fr18", "fr19",
+ "fr20", "fr21", "fr22", "fr23",
+ "fr24", "fr25", "fr26", "fr27",
+ "fr28", "fr29", "fr30", "fr31"
+ };
+ if (i < 0 || i >= (sizeof (names) / sizeof (*names)))
+ return NULL;
+ else
+ return names[i];
+}
+
+
+
/* Return the adjustment necessary to make for addresses on the stack
as presented by hpread.c.
{
CORE_ADDR *saved_regs;
hppa_frame_init_saved_regs (get_next_frame (frame));
- saved_regs = get_frame_saved_regs (get_next_frame (frame));
+ saved_regs = deprecated_get_frame_saved_regs (get_next_frame (frame));
if (read_memory_integer (saved_regs[FLAGS_REGNUM],
TARGET_PTR_BIT / 8) & 0x2)
{
{
CORE_ADDR *saved_regs;
hppa_frame_init_saved_regs (get_next_frame (frame));
- saved_regs = get_frame_saved_regs (get_next_frame (frame));
+ saved_regs = deprecated_get_frame_saved_regs (get_next_frame (frame));
if (read_memory_integer (saved_regs[FLAGS_REGNUM],
TARGET_PTR_BIT / 8) & 0x2)
{
in optimized code, GCC often doesn't actually save r3.
We'll discover this if we look at the prologue. */
hppa_frame_init_saved_regs (tmp_frame);
- saved_regs = get_frame_saved_regs (tmp_frame);
+ saved_regs = deprecated_get_frame_saved_regs (tmp_frame);
saved_regs_frame = tmp_frame;
/* If we have an address for r3, that's good. */
if (tmp_frame != saved_regs_frame)
{
hppa_frame_init_saved_regs (tmp_frame);
- saved_regs = get_frame_saved_regs (tmp_frame);
+ saved_regs = deprecated_get_frame_saved_regs (tmp_frame);
}
/* Abominable hack. */
if (tmp_frame != saved_regs_frame)
{
hppa_frame_init_saved_regs (tmp_frame);
- saved_regs = get_frame_saved_regs (tmp_frame);
+ saved_regs = deprecated_get_frame_saved_regs (tmp_frame);
}
/* Abominable hack. See above. */
hppa_push_dummy_frame (void)
{
CORE_ADDR sp, pc, pcspace;
- register int regnum;
+ int regnum;
CORE_ADDR int_buffer;
double freg_buffer;
for (regnum = FP0_REGNUM; regnum < NUM_REGS; regnum++)
{
- deprecated_read_register_bytes (REGISTER_BYTE (regnum),
+ deprecated_read_register_bytes (DEPRECATED_REGISTER_BYTE (regnum),
(char *) &freg_buffer, 8);
sp = push_bytes (sp, (char *) &freg_buffer, 8);
}
void
hppa_pop_frame (void)
{
- register struct frame_info *frame = get_current_frame ();
- register CORE_ADDR fp, npc, target_pc;
- register int regnum;
+ struct frame_info *frame = get_current_frame ();
+ CORE_ADDR fp, npc, target_pc;
+ int regnum;
CORE_ADDR *fsr;
double freg_buffer;
fp = get_frame_base (frame);
hppa_frame_init_saved_regs (frame);
- fsr = get_frame_saved_regs (frame);
+ fsr = deprecated_get_frame_saved_regs (frame);
#ifndef NO_PC_SPACE_QUEUE_RESTORE
if (fsr[IPSW_REGNUM]) /* Restoring a call dummy frame */
if (fsr[regnum])
{
read_memory (fsr[regnum], (char *) &freg_buffer, 8);
- deprecated_write_register_bytes (REGISTER_BYTE (regnum),
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (regnum),
(char *) &freg_buffer, 8);
}
/* The value of SP as it was passed into this function after
aligning. */
- CORE_ADDR orig_sp = STACK_ALIGN (sp);
+ CORE_ADDR orig_sp = DEPRECATED_STACK_ALIGN (sp);
/* The number of stack bytes occupied by the current argument. */
int bytes_reserved;
The ABIs also mandate minimum stack alignments which we must
preserve. */
- cum_bytes_aligned = STACK_ALIGN (cum_bytes_reserved);
+ cum_bytes_aligned = DEPRECATED_STACK_ALIGN (cum_bytes_reserved);
sp += max (cum_bytes_aligned, REG_PARM_STACK_SPACE);
/* Now write each of the args at the proper offset down the stack. */
The ABI also mandates minimum stack alignments which we must
preserve. */
- cum_bytes_aligned = STACK_ALIGN (cum_bytes_reserved);
+ cum_bytes_aligned = DEPRECATED_STACK_ALIGN (cum_bytes_reserved);
sp += max (cum_bytes_aligned, REG_PARM_STACK_SPACE);
/* Now write each of the args at the proper offset down the stack.
#endif
-/* elz: this function returns a value which is built looking at the given address.
- It is called from call_function_by_hand, in case we need to return a
- value which is larger than 64 bits, and it is stored in the stack rather than
- in the registers r28 and r29 or fr4.
- This function does the same stuff as value_being_returned in values.c, but
- gets the value from the stack rather than from the buffer where all the
- registers were saved when the function called completed. */
-struct value *
-hppa_value_returned_from_stack (register struct type *valtype, CORE_ADDR addr)
-{
- register struct value *val;
-
- val = allocate_value (valtype);
- CHECK_TYPEDEF (valtype);
- target_read_memory (addr, VALUE_CONTENTS_RAW (val), TYPE_LENGTH (valtype));
-
- return val;
-}
-
-
-
/* elz: Used to lookup a symbol in the shared libraries.
This function calls shl_findsym, indirectly through a
call to __d_shl_get. __d_shl_get is in end.c, which is always
{
stub_symbol
= lookup_minimal_symbol_solib_trampoline
- (DEPRECATED_SYMBOL_NAME (funsymbol), NULL, objfile);
+ (DEPRECATED_SYMBOL_NAME (funsymbol), objfile);
if (!stub_symbol)
stub_symbol = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (funsymbol),
write_register_pid (31, v | 0x3, ptid);
write_register_pid (PC_REGNUM, v, ptid);
- write_register_pid (NPC_REGNUM, v + 4, ptid);
+ write_register_pid (DEPRECATED_NPC_REGNUM, v + 4, ptid);
}
/* return the alignment of a type in bytes. Structures have the maximum
/* Make a copy of gdb's save area (may cause actual
reads from the target). */
for (i = 0; i < NUM_REGS; i++)
- frame_register_read (deprecated_selected_frame, i, raw_regs + REGISTER_BYTE (i));
+ frame_register_read (deprecated_selected_frame, i,
+ raw_regs + DEPRECATED_REGISTER_BYTE (i));
if (regnum == -1)
pa_print_registers (raw_regs, regnum, fpregs);
/* Make a copy of gdb's save area (may cause actual
reads from the target). */
for (i = 0; i < NUM_REGS; i++)
- frame_register_read (deprecated_selected_frame, i, raw_regs + REGISTER_BYTE (i));
+ frame_register_read (deprecated_selected_frame, i,
+ raw_regs + DEPRECATED_REGISTER_BYTE (i));
if (regnum == -1)
pa_strcat_registers (raw_regs, regnum, fpregs, stream);
int regaddr;
unsigned int offset;
- register int i;
+ int i;
int start;
if (!is_pa_2)
{
- raw_val[1] = *(long *) (raw_regs + REGISTER_BYTE (regnum));
+ raw_val[1] = *(long *) (raw_regs + DEPRECATED_REGISTER_BYTE (regnum));
return;
}
frame_register_read (deprecated_selected_frame, i, raw_buffer);
/* Put it in the buffer. No conversions are ever necessary. */
- memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i));
+ memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (i));
fputs_filtered (REGISTER_NAME (i), gdb_stdout);
print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), gdb_stdout);
fputs_filtered ("(single precision) ", gdb_stdout);
- val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, gdb_stdout, 0,
+ val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, gdb_stdout, 0,
1, 0, Val_pretty_default);
printf_filtered ("\n");
frame_register_read (deprecated_selected_frame, i + 1, raw_buffer);
/* Copy it into the appropriate part of the virtual buffer. */
- memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buffer,
- REGISTER_RAW_SIZE (i));
+ memcpy (virtual_buffer + DEPRECATED_REGISTER_RAW_SIZE (i), raw_buffer,
+ DEPRECATED_REGISTER_RAW_SIZE (i));
/* Dump it as a double. */
fputs_filtered (REGISTER_NAME (i), gdb_stdout);
frame_register_read (deprecated_selected_frame, i, raw_buffer);
/* Put it in the buffer. No conversions are ever necessary. */
- memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i));
+ memcpy (virtual_buffer, raw_buffer, DEPRECATED_REGISTER_RAW_SIZE (i));
if (precision == double_precision && (i % 2) == 0)
{
frame_register_read (deprecated_selected_frame, i + 1, raw_buf);
/* Copy it into the appropriate part of the virtual buffer. */
- memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buf, REGISTER_RAW_SIZE (i));
+ memcpy (virtual_buffer + DEPRECATED_REGISTER_RAW_SIZE (i), raw_buf,
+ DEPRECATED_REGISTER_RAW_SIZE (i));
val_print (builtin_type_double, virtual_buffer, 0, 0, stream, 0,
1, 0, Val_pretty_default);
}
else
{
- val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, stream, 0,
+ val_print (DEPRECATED_REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, stream, 0,
1, 0, Val_pretty_default);
}
sec = SYMBOL_BFD_SECTION (minsym);
- if (sec->vma <= pc
- && sec->vma + sec->_cooked_size < pc)
+ if (bfd_get_section_vma (sec->owner, sec) <= pc
+ && pc < (bfd_get_section_vma (sec->owner, sec)
+ + bfd_section_size (sec->owner, sec)))
return 0;
/* We might be in a stub. Peek at the instructions. Stubs are 3
ALL_MSYMBOLS (objfile, msymbol)
{
if (MSYMBOL_TYPE (msymbol) == mst_text
- && STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (msym)))
+ && DEPRECATED_STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (msym)))
{
function_found = 1;
break;
void
hppa_frame_init_saved_regs (struct frame_info *frame)
{
- if (get_frame_saved_regs (frame) == NULL)
+ if (deprecated_get_frame_saved_regs (frame) == NULL)
frame_saved_regs_zalloc (frame);
- hppa_frame_find_saved_regs (frame, get_frame_saved_regs (frame));
+ hppa_frame_find_saved_regs (frame, deprecated_get_frame_saved_regs (frame));
}
/* Exception handling support for the HP-UX ANSI C++ compiler.
Called only in the context of the "return" command. */
void
-hppa_store_return_value (struct type *type, char *valbuf)
+hppa32_store_return_value (struct type *type, char *valbuf)
{
/* For software floating point, the return value goes into the
integer registers. But we do not have any flag to key this on,
If its a float value, then we also store it into the floating
point registers. */
- deprecated_write_register_bytes (REGISTER_BYTE (28)
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (28)
+ (TYPE_LENGTH (type) > 4
? (8 - TYPE_LENGTH (type))
: (4 - TYPE_LENGTH (type))),
valbuf, TYPE_LENGTH (type));
if (TYPE_CODE (type) == TYPE_CODE_FLT)
- deprecated_write_register_bytes (REGISTER_BYTE (FP4_REGNUM),
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (FP4_REGNUM),
valbuf, TYPE_LENGTH (type));
}
+/* Same as hppa32_store_return_value(), but for the PA64 ABI. */
+
+void
+hppa64_store_return_value (struct type *type, char *valbuf)
+{
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ deprecated_write_register_bytes
+ (DEPRECATED_REGISTER_BYTE (FP4_REGNUM)
+ + DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (type),
+ valbuf, TYPE_LENGTH (type));
+ else if (is_integral_type(type))
+ deprecated_write_register_bytes
+ (DEPRECATED_REGISTER_BYTE (28)
+ + DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (type),
+ valbuf, TYPE_LENGTH (type));
+ else if (TYPE_LENGTH (type) <= 8)
+ deprecated_write_register_bytes
+ (DEPRECATED_REGISTER_BYTE (28),valbuf, TYPE_LENGTH (type));
+ else if (TYPE_LENGTH (type) <= 16)
+ {
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (28),valbuf, 8);
+ deprecated_write_register_bytes
+ (DEPRECATED_REGISTER_BYTE (29), valbuf + 8, TYPE_LENGTH (type) - 8);
+ }
+}
+
/* Copy the function's return value into VALBUF.
This function is called only in the context of "target function calls",
"return" command. */
void
-hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+hppa32_extract_return_value (struct type *type, char *regbuf, char *valbuf)
{
if (TYPE_CODE (type) == TYPE_CODE_FLT)
- memcpy (valbuf,
- (char *)regbuf + REGISTER_BYTE (FP4_REGNUM),
- TYPE_LENGTH (type));
+ memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (FP4_REGNUM), TYPE_LENGTH (type));
else
memcpy (valbuf,
- ((char *)regbuf
- + REGISTER_BYTE (28)
+ (regbuf
+ + DEPRECATED_REGISTER_BYTE (28)
+ (TYPE_LENGTH (type) > 4
? (8 - TYPE_LENGTH (type))
: (4 - TYPE_LENGTH (type)))),
TYPE_LENGTH (type));
}
+/* Same as hppa32_extract_return_value but for the PA64 ABI case. */
+
+void
+hppa64_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+{
+ /* RM: Floats are returned in FR4R, doubles in FR4.
+ Integral values are in r28, padded on the left.
+ Aggregates less that 65 bits are in r28, right padded.
+ Aggregates upto 128 bits are in r28 and r29, right padded. */
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ memcpy (valbuf,
+ regbuf + DEPRECATED_REGISTER_BYTE (FP4_REGNUM)
+ + DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (type),
+ TYPE_LENGTH (type));
+ else if (is_integral_type(type))
+ memcpy (valbuf,
+ regbuf + DEPRECATED_REGISTER_BYTE (28)
+ + DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (type),
+ TYPE_LENGTH (type));
+ else if (TYPE_LENGTH (type) <= 8)
+ memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (28),
+ TYPE_LENGTH (type));
+ else if (TYPE_LENGTH (type) <= 16)
+ {
+ memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (28), 8);
+ memcpy (valbuf + 8, regbuf + DEPRECATED_REGISTER_BYTE (29),
+ TYPE_LENGTH (type) - 8);
+ }
+}
+
int
hppa_reg_struct_has_addr (int gcc_p, struct type *type)
{
}
CORE_ADDR
-hppa_stack_align (CORE_ADDR sp)
+hppa32_stack_align (CORE_ADDR sp)
{
/* elz: adjust the quantity to the next highest value which is
64-bit aligned. This is used in valops.c, when the sp is adjusted.
return ((sp % 8) ? (sp + 7) & -8 : sp);
}
+CORE_ADDR
+hppa64_stack_align (CORE_ADDR sp)
+{
+ /* The PA64 ABI mandates a 16 byte stack alignment. */
+ return ((sp % 16) ? (sp + 15) & -16 : sp);
+}
+
int
hppa_pc_requires_run_before_use (CORE_ADDR pc)
{
int
hppa_register_byte (int reg_nr)
{
- return reg_nr * 4;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ return reg_nr * tdep->bytes_per_address;
}
/* Return the GDB type object for the "standard" data type of data
in register N. */
struct type *
-hppa_register_virtual_type (int reg_nr)
+hppa32_register_virtual_type (int reg_nr)
{
if (reg_nr < FP4_REGNUM)
return builtin_type_int;
return builtin_type_float;
}
+/* Return the GDB type object for the "standard" data type of data
+ in register N. hppa64 version. */
+
+struct type *
+hppa64_register_virtual_type (int reg_nr)
+{
+ if (reg_nr < FP4_REGNUM)
+ return builtin_type_unsigned_long_long;
+ else
+ return builtin_type_double;
+}
+
/* Store the address of the place in which to copy the structure the
subroutine will return. This is called from call_function. */
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)));
+ /* FIXME: cagney/2003-09-27: This function can probably go. ELZ
+ writes: We cannot assume on the pa that r28 still contains the
+ address of the returned structure. Usually this will be
+ overwritten by the callee. */
+ return (*(int *)(regbuf + DEPRECATED_REGISTER_BYTE (28)));
}
/* Return True if REGNUM is not a register available to the user
}
-CORE_ADDR
-hppa_frame_args_address (struct frame_info *fi)
-{
- return get_frame_base (fi);
-}
-
-CORE_ADDR
-hppa_frame_locals_address (struct frame_info *fi)
-{
- return get_frame_base (fi);
-}
-
CORE_ADDR
hppa_smash_text_address (CORE_ADDR addr)
{
struct type *type)
{
CORE_ADDR addr;
- frame_read_register (frame, R0_REGNUM + 26 - argi, &addr);
+ get_frame_register (frame, R0_REGNUM + 26 - argi, &addr);
return addr;
}
static struct gdbarch *
hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
+ struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
/* Try to determine the ABI of the object we are loading. */
return (arches->gdbarch);
/* If none found, then allocate and initialize one. */
- gdbarch = gdbarch_alloc (&info, NULL);
+ tdep = XMALLOC (struct gdbarch_tdep);
+ gdbarch = gdbarch_alloc (&info, tdep);
+
+ /* Determine from the bfd_arch_info structure if we are dealing with
+ a 32 or 64 bits architecture. If the bfd_arch_info is not available,
+ then default to a 32bit machine. */
+ if (info.bfd_arch_info != NULL)
+ tdep->bytes_per_address =
+ info.bfd_arch_info->bits_per_address / info.bfd_arch_info->bits_per_byte;
+ else
+ tdep->bytes_per_address = 4;
- /* Hook in ABI-specific overrides, if they have been registered. */
- gdbarch_init_osabi (info, gdbarch);
+ /* Some parts of the gdbarch vector depend on whether we are running
+ on a 32 bits or 64 bits target. */
+ switch (tdep->bytes_per_address)
+ {
+ case 4:
+ set_gdbarch_num_regs (gdbarch, hppa32_num_regs);
+ set_gdbarch_register_name (gdbarch, hppa32_register_name);
+ set_gdbarch_deprecated_register_virtual_type
+ (gdbarch, hppa32_register_virtual_type);
+ set_gdbarch_deprecated_call_dummy_length
+ (gdbarch, hppa32_call_dummy_length);
+ set_gdbarch_deprecated_stack_align (gdbarch, hppa32_stack_align);
+ set_gdbarch_deprecated_reg_struct_has_addr
+ (gdbarch, hppa_reg_struct_has_addr);
+ set_gdbarch_deprecated_extract_return_value
+ (gdbarch, hppa32_extract_return_value);
+ set_gdbarch_use_struct_convention
+ (gdbarch, hppa32_use_struct_convention);
+ set_gdbarch_deprecated_store_return_value
+ (gdbarch, hppa32_store_return_value);
+ break;
+ case 8:
+ set_gdbarch_num_regs (gdbarch, hppa64_num_regs);
+ set_gdbarch_register_name (gdbarch, hppa64_register_name);
+ set_gdbarch_deprecated_register_virtual_type
+ (gdbarch, hppa64_register_virtual_type);
+ set_gdbarch_deprecated_call_dummy_breakpoint_offset
+ (gdbarch, hppa64_call_dummy_breakpoint_offset);
+ set_gdbarch_deprecated_call_dummy_length
+ (gdbarch, hppa64_call_dummy_length);
+ set_gdbarch_deprecated_stack_align (gdbarch, hppa64_stack_align);
+ set_gdbarch_deprecated_extract_return_value
+ (gdbarch, hppa64_extract_return_value);
+ set_gdbarch_use_struct_convention
+ (gdbarch, hppa64_use_struct_convention);
+ set_gdbarch_deprecated_store_return_value
+ (gdbarch, hppa64_store_return_value);
+ break;
+ default:
+ internal_error (__FILE__, __LINE__, "Unsupported address size: %d",
+ tdep->bytes_per_address);
+ }
+
+ /* The following gdbarch vector elements depend on other parts of this
+ vector which have been set above, depending on the ABI. */
+ set_gdbarch_deprecated_register_bytes
+ (gdbarch, gdbarch_num_regs (gdbarch) * tdep->bytes_per_address);
+ set_gdbarch_long_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
+ set_gdbarch_long_long_bit (gdbarch, 64);
+ set_gdbarch_ptr_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
- set_gdbarch_reg_struct_has_addr (gdbarch, hppa_reg_struct_has_addr);
+ /* The following gdbarch vector elements do not depend on the address
+ size, or in any other gdbarch element previously set. */
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);
hppa_in_solib_return_trampoline);
set_gdbarch_deprecated_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_decr_pc_after_break (gdbarch, 0);
- set_gdbarch_deprecated_register_size (gdbarch, 4);
- set_gdbarch_num_regs (gdbarch, hppa_num_regs);
+ set_gdbarch_deprecated_register_size (gdbarch, tdep->bytes_per_address);
set_gdbarch_deprecated_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_deprecated_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_deprecated_max_register_raw_size (gdbarch, 4);
+ set_gdbarch_deprecated_npc_regnum (gdbarch, PCOQ_TAIL_REGNUM);
+ set_gdbarch_deprecated_register_raw_size (gdbarch, hppa_register_raw_size);
+ set_gdbarch_deprecated_register_byte (gdbarch, hppa_register_byte);
+ set_gdbarch_deprecated_register_virtual_size (gdbarch, hppa_register_raw_size);
+ set_gdbarch_deprecated_max_register_raw_size (gdbarch, tdep->bytes_per_address);
set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
- set_gdbarch_register_virtual_type (gdbarch, hppa_register_virtual_type);
set_gdbarch_deprecated_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_frameless_function_invocation
(gdbarch, hppa_frameless_function_invocation);
set_gdbarch_deprecated_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_args_skip (gdbarch, 0);
set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame);
set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame);
- set_gdbarch_deprecated_call_dummy_length (gdbarch, INSTRUCTION_SIZE * 28);
/* set_gdbarch_deprecated_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */
set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments);
+ set_gdbarch_addr_bits_remove (gdbarch, hppa_smash_text_address);
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);
/* Helper for function argument information. */
set_gdbarch_fetch_pointer_argument (gdbarch, hppa_fetch_pointer_argument);
+ set_gdbarch_print_insn (gdbarch, print_insn_hppa);
+
+ /* When a hardware watchpoint triggers, we'll move the inferior past
+ it by removing all eventpoints; stepping past the instruction
+ that caused the trigger; reinserting eventpoints; and checking
+ whether any watched location changed. */
+ set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
+
+ /* Hook in ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch);
+
return gdbarch;
}
void break_at_finish_at_depth_command (char *arg, int from_tty);
gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep);
- deprecated_tm_print_insn = print_insn_hppa;
add_cmd ("unwind", class_maintenance, unwind_command,
"Print unwind table entry at given address.",