+Fri Apr 23 10:34:02 1993 Stu Grossman (grossman@cygnus.com)
+
+ * Fix two bugs found by deja-gnu. One is the incorrect reporting
+ of the PC being in a stack dummy when looking at a core file
+ without symbols. The other is the incorrect passing of char
+ arguments during expression evaluation (ie: p foo('a','b') would
+ mess up the passing of it's args because it wasn't coercing the
+ char's to ints).
+ * hppah-tdep.c: Rename global functions to have consistent hppa_
+ prefix. Make more functions static. Drop hp_ prefix from static
+ functions. (hppa_push_arguments): Call value_arg_coerce to cast
+ char to int args if necessary. (hppa_fix_call_dummy): Create
+ this routine from FIX_CALL_DUMMY macro in tm-hppa.h.
+ * inferior.h (PC_IN_CALL_DUMMY): Check for frame_address being
+ valid (ie: != 0) before doing comparison against PC.
+ * valops.c (call_function_by_hand): Adjust call to FIX_CALL_DUMMY
+ to reflect new arguments.
+ * config/pa/tm-hppa.h (POP_FRAME, PUSH_ARGUMENTS): Use new hppa_
+ prefix for func name. (FIX_CALL_DUMMY): Move code into
+ hppah-tdep.c.
+
+ * testsuite/gdb.t16/gdbme.c, testsuite/gdb.t17/gdbme.c: Add calls
+ to malloc() so that we can test GDB eval of dynamically created
+ arrays (like char strings in `print "foo"').
+
Fri Apr 23 01:28:14 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* printcmd.c (print_address_symbolic): Search symtabs as well as the
#include "symfile.h"
#include "objfiles.h"
+static int restore_pc_queue PARAMS ((struct frame_saved_regs *fsr));
+static int hppa_alignof PARAMS ((struct type *arg));
+
\f
/* Routines to extract various sized constants out of hppa
instructions. */
}
int
-hp_pop_frame ()
+hppa_pop_frame ()
{
register FRAME frame = get_current_frame ();
register CORE_ADDR fp;
get_frame_saved_regs (fi, &fsr);
if (fsr.regs[IPSW_REGNUM]) /* Restoring a call dummy frame */
- hp_restore_pc_queue (&fsr);
+ restore_pc_queue (&fsr);
for (regnum = 31; regnum > 0; regnum--)
if (fsr.regs[regnum])
* After returning to a dummy on the stack, restore the instruction
* queue space registers. */
-int
-hp_restore_pc_queue (fsr)
+static int
+restore_pc_queue (fsr)
struct frame_saved_regs *fsr;
{
CORE_ADDR pc = read_pc ();
}
CORE_ADDR
-hp_push_arguments (nargs, args, sp, struct_return, struct_addr)
+hppa_push_arguments (nargs, args, sp, struct_return, struct_addr)
int nargs;
value *args;
CORE_ADDR sp;
for (i = 0; i < nargs; i++)
{
+ /* Coerce chars to int & float to double if necessary */
+ args[i] = value_arg_coerce (args[i]);
+
cum += TYPE_LENGTH (VALUE_TYPE (args[i]));
/* value must go at proper alignment. Assume alignment is a
power of two.*/
- alignment = hp_alignof (VALUE_TYPE (args[i]));
+ alignment = hppa_alignof (VALUE_TYPE (args[i]));
if (cum % alignment)
cum = (cum + alignment) & -alignment;
offset[i] = -cum;
return sp + 32;
}
+/*
+ * Insert the specified number of args and function address
+ * into a call sequence of the above form stored at DUMMYNAME.
+ *
+ * On the hppa we need to call the stack dummy through $$dyncall.
+ * Therefore our version of FIX_CALL_DUMMY takes an extra argument,
+ * real_pc, which is the location where gdb should start up the
+ * inferior to do the function call.
+ */
+
+CORE_ADDR
+hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
+ REGISTER_TYPE *dummy;
+ CORE_ADDR pc;
+ CORE_ADDR fun;
+ int nargs;
+ value *args;
+ struct type *type;
+ int gcc_p;
+{
+ CORE_ADDR dyncall_addr, sr4export_addr;
+ struct minimal_symbol *msymbol;
+
+ msymbol = lookup_minimal_symbol ("$$dyncall", (struct objfile *) NULL);
+ if (msymbol == NULL)
+ error ("Can't find an address for $$dyncall trampoline");
+
+ dyncall_addr = SYMBOL_VALUE_ADDRESS (msymbol);
+
+ msymbol = lookup_minimal_symbol ("_sr4export", (struct objfile *) NULL);
+ if (msymbol == NULL)
+ error ("Can't find an address for _sr4export trampoline");
+
+ sr4export_addr = SYMBOL_VALUE_ADDRESS (msymbol);
+
+ dummy[9] = deposit_21 (fun >> 11, dummy[9]);
+ dummy[10] = deposit_14 (fun & MASK_11, dummy[10]);
+ dummy[12] = deposit_21 (sr4export_addr >> 11, dummy[12]);
+ dummy[13] = deposit_14 (sr4export_addr & MASK_11, dummy[13]);
+
+ write_register (22, pc);
+
+ return dyncall_addr;
+}
+
/* return the alignment of a type in bytes. Structures have the maximum
alignment required by their fields. */
-int
-hp_alignof (arg)
+static int
+hppa_alignof (arg)
struct type *arg;
{
int max_align, align, i;
case TYPE_CODE_FLT:
return TYPE_LENGTH (arg);
case TYPE_CODE_ARRAY:
- return hp_alignof (TYPE_FIELD_TYPE (arg, 0));
+ return hppa_alignof (TYPE_FIELD_TYPE (arg, 0));
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
max_align = 2;
/* Bit fields have no real alignment. */
if (!TYPE_FIELD_BITPOS (arg, i))
{
- align = hp_alignof (TYPE_FIELD_TYPE (arg, i));
+ align = hppa_alignof (TYPE_FIELD_TYPE (arg, i));
max_align = max (max_align, align);
}
}
/* Local functions. */
+static int
+typecmp PARAMS ((int staticp, struct type *t1[], value t2[]));
+
static CORE_ADDR
find_function_addr PARAMS ((value, struct type **));
register struct type *type;
COERCE_ENUM (arg);
+#if 1 /* FIXME: This is only a temporary patch. -fnf */
+ if (VALUE_REPEATED (arg)
+ || TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)
+ arg = value_coerce_array (arg);
+ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC)
+ arg = value_coerce_function (arg);
+#endif
type = VALUE_TYPE (arg);
SWAP_TARGET_AND_HOST (&dummy1[i], sizeof (REGISTER_TYPE));
#ifdef GDB_TARGET_IS_HPPA
- FIX_CALL_DUMMY (dummy1, start_sp, real_pc, funaddr, nargs, args,
- value_type, using_gcc);
+ real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
+ value_type, using_gcc);
#else
FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
value_type, using_gcc);