#include "inferior.h"
#include "value.h"
#include "regcache.h"
+#include "completer.h"
/* For argument passing to the inferior */
#include "symtab.h"
extern int exception_catchpoints_are_fragile;
/* This is defined in valops.c. */
-extern value_ptr find_function_in_inferior (char *);
+extern struct value *find_function_in_inferior (char *);
/* Should call_function allocate stack space for a struct return? */
int
to the callee, so we do that too. */
CORE_ADDR
-hppa_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* array of arguments' offsets */
arguments into registers as needed by the ABI. */
CORE_ADDR
-hppa_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* array of arguments' offsets */
target. */
bytes_reserved = (lengths[i] + REGISTER_SIZE - 1) & -REGISTER_SIZE;
- offset[i] = cum_bytes_reserved + lengths[i];
+ offset[i] = (cum_bytes_reserved
+ + (lengths[i] > 4 ? bytes_reserved : lengths[i]));
/* If the argument is a double word argument, then it needs to be
double word aligned. */
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. */
-value_ptr
+struct value *
hppa_value_returned_from_stack (register struct type *valtype, CORE_ADDR addr)
{
- register value_ptr val;
+ register struct value *val;
val = allocate_value (valtype);
CHECK_TYPEDEF (valtype);
struct symbol *get_sym, *symbol2;
struct minimal_symbol *buff_minsym, *msymbol;
struct type *ftype;
- value_ptr *args;
- value_ptr funcval, val;
+ struct value **args;
+ struct value *funcval;
+ struct value *val;
int x, namelen, err_value, tmp = -1;
CORE_ADDR endo_buff_addr, value_return_addr, errno_return_addr;
CORE_ADDR stub_addr;
- args = (value_ptr *) alloca (sizeof (value_ptr) * 8); /* 6 for the arguments and one null one??? */
+ args = alloca (sizeof (struct value *) * 8); /* 6 for the arguments and one null one??? */
funcval = find_function_in_inferior ("__d_shl_get");
get_sym = lookup_symbol ("__d_shl_get", NULL, VAR_NAMESPACE, NULL, NULL);
buff_minsym = lookup_minimal_symbol ("__buffer", NULL, NULL);
CORE_ADDR
hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
- value_ptr *args, struct type *type, int gcc_p)
+ struct value **args, struct type *type, int gcc_p)
{
CORE_ADDR dyncall_addr;
struct minimal_symbol *msymbol;
if (!is_pa_2)
{
- printf_unfiltered ("%s %x\n", REGISTER_NAME (regnum), reg_val[1]);
+ printf_unfiltered ("%s %lx\n", REGISTER_NAME (regnum), reg_val[1]);
}
else
{
/* Fancy % formats to prevent leading zeros. */
if (reg_val[0] == 0)
- printf_unfiltered ("%s %x\n", REGISTER_NAME (regnum), reg_val[1]);
+ printf_unfiltered ("%s %lx\n", REGISTER_NAME (regnum), reg_val[1]);
else
- printf_unfiltered ("%s %x%8.8x\n", REGISTER_NAME (regnum),
+ printf_unfiltered ("%s %lx%8.8lx\n", REGISTER_NAME (regnum),
reg_val[0], reg_val[1]);
}
}
if (!is_pa_2)
{
- fprintf_unfiltered (stream, "%s %x", REGISTER_NAME (regnum), reg_val[1]);
+ fprintf_unfiltered (stream, "%s %lx", REGISTER_NAME (regnum), reg_val[1]);
}
else
{
/* Fancy % formats to prevent leading zeros. */
if (reg_val[0] == 0)
- fprintf_unfiltered (stream, "%s %x", REGISTER_NAME (regnum),
+ fprintf_unfiltered (stream, "%s %lx", REGISTER_NAME (regnum),
reg_val[1]);
else
- fprintf_unfiltered (stream, "%s %x%8.8x", REGISTER_NAME (regnum),
+ fprintf_unfiltered (stream, "%s %lx%8.8lx", REGISTER_NAME (regnum),
reg_val[0], reg_val[1]);
}
}
/* Being big-endian, on this machine the low bits
(the ones we want to look at) are in the second longword. */
long_val = extract_signed_integer (&raw_val[1], 4);
- printf_filtered ("%10.10s: %8x ",
+ printf_filtered ("%10.10s: %8lx ",
REGISTER_NAME (regnum), long_val);
}
else
{
/* raw_val = extract_signed_integer(&raw_val, 8); */
if (raw_val[0] == 0)
- printf_filtered ("%10.10s: %8x ",
+ printf_filtered ("%10.10s: %8lx ",
REGISTER_NAME (regnum), raw_val[1]);
else
- printf_filtered ("%10.10s: %8x%8.8x ",
+ printf_filtered ("%10.10s: %8lx%8.8lx ",
REGISTER_NAME (regnum),
raw_val[0], raw_val[1]);
}
/* Being big-endian, on this machine the low bits
(the ones we want to look at) are in the second longword. */
long_val = extract_signed_integer (&raw_val[1], 4);
- fprintf_filtered (stream, "%8.8s: %8x ", REGISTER_NAME (i + (j * 18)), long_val);
+ fprintf_filtered (stream, "%8.8s: %8lx ",
+ REGISTER_NAME (i + (j * 18)), long_val);
}
else
{
/* raw_val = extract_signed_integer(&raw_val, 8); */
if (raw_val[0] == 0)
- fprintf_filtered (stream, "%8.8s: %8x ", REGISTER_NAME (i + (j * 18)),
- raw_val[1]);
+ fprintf_filtered (stream, "%8.8s: %8lx ",
+ REGISTER_NAME (i + (j * 18)), raw_val[1]);
else
- fprintf_filtered (stream, "%8.8s: %8x%8.8x ", REGISTER_NAME (i + (j * 18)),
- raw_val[0], raw_val[1]);
+ fprintf_filtered (stream, "%8.8s: %8lx%8.8lx ",
+ REGISTER_NAME (i + (j * 18)), raw_val[0],
+ raw_val[1]);
}
}
fprintf_unfiltered (stream, "\n");
stubsym = lookup_minimal_symbol_by_pc (loc);
if (stubsym == NULL)
{
- warning ("Unable to find symbol for 0x%x", loc);
+ warning ("Unable to find symbol for 0x%lx", loc);
return orig_pc == pc ? 0 : pc & ~0x3;
}
if (!eh_notify_callback_addr)
{
/* We can get here either if there is no plabel in the export list
- for the main image, or if something strange happened (??) */
+ for the main image, or if something strange happened (?) */
warning ("Couldn't find a plabel (indirect function label) for the exception callback.");
warning ("GDB will not be able to intercept exception events.");
return 0;
return;
}
- printf_unfiltered ("unwind_table_entry (0x%x):\n", u);
+ printf_unfiltered ("unwind_table_entry (0x%s):\n",
+ paddr_nz (host_pointer_to_address (u)));
printf_unfiltered ("\tregion_start = ");
print_address (u->region_start, gdb_stdout);
putting the BPT instruction in and taking it out.
Note that this implementation is potentially redundant now that
- default_prepare_to_proceed() has been added. */
+ default_prepare_to_proceed() has been added.
+
+ FIXME This may not support switching threads after Ctrl-C
+ correctly. The default implementation does support this. */
int
hppa_prepare_to_proceed (void)
{
void
_initialize_hppa_tdep (void)
{
+ struct cmd_list_element *c;
+ void break_at_finish_command (char *arg, int from_tty);
+ void tbreak_at_finish_command (char *arg, int from_tty);
+ void break_at_finish_at_depth_command (char *arg, int from_tty);
+
tm_print_insn = print_insn_hppa;
add_cmd ("unwind", class_maintenance, unwind_command,
"Print unwind table entry at given address.",
&maintenanceprintlist);
+
+ deprecate_cmd (add_com ("xbreak", class_breakpoint,
+ break_at_finish_command,
+ concat ("Set breakpoint at procedure exit. \n\
+Argument may be function name, or \"*\" and an address.\n\
+If function is specified, break at end of code for that function.\n\
+If an address is specified, break at the end of the function that contains \n\
+that exact address.\n",
+ "With no arg, uses current execution address of selected stack frame.\n\
+This is useful for breaking on return to a stack frame.\n\
+\n\
+Multiple breakpoints at one place are permitted, and useful if conditional.\n\
+\n\
+Do \"help breakpoints\" for info on other commands dealing with breakpoints.", NULL)), NULL);
+ deprecate_cmd (add_com_alias ("xb", "xbreak", class_breakpoint, 1), NULL);
+ deprecate_cmd (add_com_alias ("xbr", "xbreak", class_breakpoint, 1), NULL);
+ deprecate_cmd (add_com_alias ("xbre", "xbreak", class_breakpoint, 1), NULL);
+ deprecate_cmd (add_com_alias ("xbrea", "xbreak", class_breakpoint, 1), NULL);
+
+ deprecate_cmd (c = add_com ("txbreak", class_breakpoint,
+ tbreak_at_finish_command,
+"Set temporary breakpoint at procedure exit. Either there should\n\
+be no argument or the argument must be a depth.\n"), NULL);
+ c->completer = location_completer;
+
+ if (xdb_commands)
+ deprecate_cmd (add_com ("bx", class_breakpoint,
+ break_at_finish_at_depth_command,
+"Set breakpoint at procedure exit. Either there should\n\
+be no argument or the argument must be a depth.\n"), NULL);
+}
+
+/* Copy the function value from VALBUF into the proper location
+ for a function return.
+
+ Called only in the context of the "return" command. */
+
+void
+hppa_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,
+ so we always store the value into the integer registers.
+
+ If its a float value, then we also store it into the floating
+ point registers. */
+ write_register_bytes (REGISTER_BYTE (28)
+ + (TYPE_LENGTH (type) > 4
+ ? (8 - TYPE_LENGTH (type))
+ : (4 - TYPE_LENGTH (type))),
+ valbuf,
+ TYPE_LENGTH (type));
+ if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT)
+ write_register_bytes (REGISTER_BYTE (FP4_REGNUM),
+ valbuf,
+ TYPE_LENGTH (type));
+}
+
+/* Copy the function's return value into VALBUF.
+
+ This function is called only in the context of "target function calls",
+ ie. when the debugger forces a function to be called in the child, and
+ when the debugger forces a fucntion to return prematurely via the
+ "return" command. */
+
+void
+hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+{
+ if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT)
+ memcpy (valbuf,
+ (char *)regbuf + REGISTER_BYTE (FP4_REGNUM),
+ TYPE_LENGTH (type));
+ else
+ memcpy (valbuf,
+ ((char *)regbuf
+ + REGISTER_BYTE (28)
+ + (TYPE_LENGTH (type) > 4
+ ? (8 - TYPE_LENGTH (type))
+ : (4 - TYPE_LENGTH (type)))),
+ TYPE_LENGTH (type));
}