+2003-05-03 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (PUSH_DUMMY_CODE): New architecture method, add
+ comments noteing that it replaces the old FIX_CALL_DUMMY code.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * d10v-tdep.c (d10v_push_dummy_code): New function.
+ (d10v_gdbarch_init): Set push_dummy_code.
+ * infcall.c (legacy_push_dummy_code): New function.
+ (generic_push_dummy_code): New function.
+ (push_dummy_code): New function.
+ (call_function_by_hand): Call push_dummy_code. Pass bp_addr,
+ instead of dummy_addr, to push_dummy_call. Move call to
+ generic_save_call_dummy_addr to outside of CALL_DUMMY_LOCATION
+ switch.
+ * sparc-tdep.c (sparc_gdbarch_init): Mention push_dummy_code.
+
2003-05-03 Andrew Cagney <cagney@redhat.com>
* disasm.h (print_insn): Declare.
}
+static CORE_ADDR
+d10v_push_dummy_code (struct gdbarch *gdbarch,
+ CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc,
+ struct value **args, int nargs,
+ struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
+{
+ /* Allocate space sufficient for a breakpoint. */
+ sp = (sp - 4) & ~3;
+ /* Store the address of that breakpoint taking care to first convert
+ it into a code (IADDR) address from a stack (DADDR) address.
+ This of course assumes that the two virtual addresses map onto
+ the same real address. */
+ (*bp_addr) = d10v_make_iaddr (d10v_convert_iaddr_to_raw (sp));
+ /* d10v always starts the call at the callee's entry point. */
+ (*real_pc) = funaddr;
+ return sp;
+}
+
static CORE_ADDR
d10v_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR dummy_addr, int nargs, struct value **args,
}
set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
+ set_gdbarch_push_dummy_code (gdbarch, d10v_push_dummy_code);
set_gdbarch_push_dummy_call (gdbarch, d10v_push_dummy_call);
set_gdbarch_store_return_value (gdbarch, d10v_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
+2003-05-03 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Document
+ push_dummy_code. Add cross references.
+
2003-05-02 Elena Zannoni <ezannoni@redhat.com>
* gdb.texinfo (Character Sets): Update to reflect new behavior of
Should be deprecated in favor of a macro that uses target-byte-ordered
data.
+This method has been replaced by @code{push_dummy_code}
+(@pxref{push_dummy_code}).
+
@item SIZEOF_CALL_DUMMY_WORDS
@findex SIZEOF_CALL_DUMMY_WORDS
The size of @code{CALL_DUMMY_WORDS}. This must return a positive value.
See also @code{CALL_DUMMY_LENGTH}.
+This method has been replaced by @code{push_dummy_code}
+(@pxref{push_dummy_code}).
+
@item CALL_DUMMY
@findex CALL_DUMMY
A static initializer for @code{CALL_DUMMY_WORDS}. Deprecated.
+This method has been replaced by @code{push_dummy_code}
+(@pxref{push_dummy_code}).
+
@item CALL_DUMMY_LOCATION
@findex CALL_DUMMY_LOCATION
See the file @file{inferior.h}.
+This method has been replaced by @code{push_dummy_code}
+(@pxref{push_dummy_code}).
+
@item DEPRECATED_CALL_DUMMY_STACK_ADJUST
@findex DEPRECATED_CALL_DUMMY_STACK_ADJUST
Stack adjustment needed when performing an inferior function call. This
This method replaces @code{DEPRECATED_PUSH_ARGUMENTS}.
+@item CORE_ADDR push_dummy_code (@var{gdbarch}, @var{sp}, @var{funaddr}, @var{using_gcc}, @var{args}, @var{nargs}, @var{value_type}, @var{real_pc}, @var{bp_addr})
+@findex push_dummy_code
+@findex FIX_CALL_DUMMY
+@anchor{push_dummy_code} Given a stack based call dummy, push the
+instruction sequence (including space for a breakpoint) to which the
+called function should return.
+
+Set @var{bp_addr} to the address at which the breakpoint instruction
+should be inserted, @var{real_pc} to the resume address when starting
+the call sequence, and return the updated inner-most stack address.
+
+By default, the stack is grown sufficient to hold a frame-aligned
+(@pxref{frame_align}) breakpoint, @var{bp_addr} is set to the address
+reserved for that breakpoint, and @var{real_pc} set to @var{funaddr}.
+
+This method replaces @code{CALL_DUMMY_WORDS},
+@code{SIZEOF_CALL_DUMMY_WORDS}, @code{CALL_DUMMY},
+@code{CALL_DUMMY_LOCATION}, @code{REGISTER_SIZE},
+@code{GDB_TARGET_IS_HPPA}, @code{CALL_DUMMY_BREAKPOINT_OFFSET}, and
+@code{FIX_CALL_DUMMY}.
+
@item DEPRECATED_PUSH_DUMMY_FRAME
@findex DEPRECATED_PUSH_DUMMY_FRAME
Used in @samp{call_function_by_hand} to create an artificial stack frame.
int sizeof_call_dummy_words;
int deprecated_call_dummy_stack_adjust;
gdbarch_fix_call_dummy_ftype *fix_call_dummy;
+ gdbarch_push_dummy_code_ftype *push_dummy_code;
gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first;
gdbarch_deprecated_init_frame_pc_ftype *deprecated_init_frame_pc;
int believe_pcc_promotion;
0,
0,
0,
+ 0,
generic_in_function_epilogue_p,
construct_inferior_arguments,
0,
/* Skip verify of sizeof_call_dummy_words, invalid_p == 0 */
/* Skip verify of deprecated_call_dummy_stack_adjust, has predicate */
/* Skip verify of fix_call_dummy, has predicate */
+ /* Skip verify of push_dummy_code, has predicate */
/* Skip verify of deprecated_init_frame_pc_first, has predicate */
/* Skip verify of deprecated_init_frame_pc, has predicate */
/* Skip verify of deprecated_get_saved_register, has predicate */
fprintf_unfiltered (file,
"gdbarch_dump: push_dummy_call = 0x%08lx\n",
(long) current_gdbarch->push_dummy_call);
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
+ gdbarch_push_dummy_code_p (current_gdbarch));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: push_dummy_code = 0x%08lx\n",
+ (long) current_gdbarch->push_dummy_code);
#ifdef REGISTER_BYTE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
gdbarch->fix_call_dummy = fix_call_dummy;
}
+int
+gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->push_dummy_code != 0;
+}
+
+CORE_ADDR
+gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->push_dummy_code == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_push_dummy_code invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_code called\n");
+ return gdbarch->push_dummy_code (gdbarch, sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr);
+}
+
+void
+set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
+ gdbarch_push_dummy_code_ftype push_dummy_code)
+{
+ gdbarch->push_dummy_code = push_dummy_code;
+}
+
int
gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch)
{
#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (gdbarch_deprecated_use_generic_dummy_frames (current_gdbarch))
#endif
+/* Replaced by push_dummy_code. */
+
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_LOCATION)
#define CALL_DUMMY_LOCATION (AT_ENTRY_POINT)
#define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch))
#endif
+/* Replaced by push_dummy_code. */
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS)
#define CALL_DUMMY_ADDRESS() (entry_point_address ())
#endif
#endif
+/* Replaced by push_dummy_code. */
+
extern CORE_ADDR gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch, CORE_ADDR call_dummy_start_offset);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_START_OFFSET)
#define CALL_DUMMY_START_OFFSET (gdbarch_call_dummy_start_offset (current_gdbarch))
#endif
+/* Replaced by push_dummy_code. */
+
extern CORE_ADDR gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, CORE_ADDR call_dummy_breakpoint_offset);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET)
#define CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_call_dummy_breakpoint_offset (current_gdbarch))
#endif
+/* Replaced by push_dummy_code. */
+
extern int gdbarch_call_dummy_length (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dummy_length);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LENGTH)
#endif
#endif
+/* Replaced by push_dummy_code. */
+
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_WORDS)
#define CALL_DUMMY_WORDS (legacy_call_dummy_words)
#define CALL_DUMMY_WORDS (gdbarch_call_dummy_words (current_gdbarch))
#endif
+/* Replaced by push_dummy_code. */
+
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (SIZEOF_CALL_DUMMY_WORDS)
#define SIZEOF_CALL_DUMMY_WORDS (legacy_sizeof_call_dummy_words)
#define SIZEOF_CALL_DUMMY_WORDS (gdbarch_sizeof_call_dummy_words (current_gdbarch))
#endif
+/* Replaced by push_dummy_code. */
+
#if defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
/* Legacy for systems yet to multi-arch DEPRECATED_CALL_DUMMY_STACK_ADJUST */
#if !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
#endif
#endif
+/* Replaced by push_dummy_code. */
+
#if defined (FIX_CALL_DUMMY)
/* Legacy for systems yet to multi-arch FIX_CALL_DUMMY */
#if !defined (FIX_CALL_DUMMY_P)
#endif
#endif
+/* This is a replacement for FIX_CALL_DUMMY et.al. */
+
+extern int gdbarch_push_dummy_code_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
+extern CORE_ADDR gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr);
+extern void set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, gdbarch_push_dummy_code_ftype *push_dummy_code);
+
#if defined (DEPRECATED_INIT_FRAME_PC_FIRST)
/* Legacy for systems yet to multi-arch DEPRECATED_INIT_FRAME_PC_FIRST */
#if !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P)
# reqires that these methods be set up from the word go. This also
# avoids any potential problems with moving beyond multi-arch partial.
v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0
+# Replaced by push_dummy_code.
v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
+# Replaced by push_dummy_code.
f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0
+# Replaced by push_dummy_code.
v::CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset
+# Replaced by push_dummy_code.
v::CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset
+# Replaced by push_dummy_code.
v::CALL_DUMMY_LENGTH:int:call_dummy_length
# NOTE: cagney/2002-11-24: This function with predicate has a valid
# (callable) initial value. As a consequence, even when the predicate
# migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(),
# doesn't need to be modified.
F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy
+# Replaced by push_dummy_code.
v::CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
+# Replaced by push_dummy_code.
v::SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0
+# Replaced by push_dummy_code.
V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0
+# Replaced by push_dummy_code.
F::FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p
+# This is a replacement for FIX_CALL_DUMMY et.al.
+M::PUSH_DUMMY_CODE:CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr:
F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev
F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev
#
breakpoint_auto_delete (*(bpstat *) arg);
}
+static CORE_ADDR
+legacy_push_dummy_code (struct gdbarch *gdbarch,
+ CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc,
+ struct value **args, int nargs,
+ struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
+{
+ /* CALL_DUMMY is an array of words (REGISTER_SIZE), but each word is
+ in host byte order. Before calling FIX_CALL_DUMMY, we byteswap
+ it and remove any extra bytes which might exist because ULONGEST
+ is bigger than REGISTER_SIZE. */
+ /* NOTE: This is pretty wierd, as the call dummy is actually a
+ sequence of instructions. But CISC machines will have to pack
+ the instructions into REGISTER_SIZE units (and so will RISC
+ machines for which INSTRUCTION_SIZE is not REGISTER_SIZE). */
+ /* NOTE: This is pretty stupid. CALL_DUMMY should be in strict
+ target byte order. */
+ CORE_ADDR start_sp;
+ ULONGEST *dummy = alloca (SIZEOF_CALL_DUMMY_WORDS);
+ int sizeof_dummy1 = (REGISTER_SIZE * SIZEOF_CALL_DUMMY_WORDS
+ / sizeof (ULONGEST));
+ char *dummy1 = alloca (sizeof_dummy1);
+ memcpy (dummy, CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS);
+ if (INNER_THAN (1, 2))
+ {
+ /* Stack grows down */
+ sp -= sizeof_dummy1;
+ start_sp = sp;
+ }
+ else
+ {
+ /* Stack grows up */
+ start_sp = sp;
+ sp += sizeof_dummy1;
+ }
+ /* NOTE: cagney/2002-09-10: Don't bother re-adjusting the stack
+ after allocating space for the call dummy. A target can specify
+ a SIZEOF_DUMMY1 (via SIZEOF_CALL_DUMMY_WORDS) such that all local
+ alignment requirements are met. */
+ /* Create a call sequence customized for this function and the
+ number of arguments for it. */
+ {
+ int i;
+ for (i = 0; i < (int) (SIZEOF_CALL_DUMMY_WORDS / sizeof (dummy[0]));
+ i++)
+ store_unsigned_integer (&dummy1[i * REGISTER_SIZE],
+ REGISTER_SIZE,
+ (ULONGEST) dummy[i]);
+ }
+ /* NOTE: cagney/2003-04-22: This computation of REAL_PC, BP_ADDR and
+ DUMMY_ADDR is pretty messed up. It comes from constant tinkering
+ with the values. Instead a FIX_CALL_DUMMY replacement
+ (PUSH_DUMMY_BREAKPOINT?) should just do everything. */
+#ifdef GDB_TARGET_IS_HPPA
+ real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
+ value_type, using_gcc);
+#else
+ if (FIX_CALL_DUMMY_P ())
+ {
+ /* gdb_assert (CALL_DUMMY_LOCATION == ON_STACK) true? */
+ FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, value_type,
+ using_gcc);
+ }
+ (*real_pc) = start_sp;
+#endif
+ /* Yes, the offset is applied to the real_pc and not the dummy addr.
+ Ulgh! Blame the HP/UX target. */
+ (*bp_addr) = (*real_pc) + CALL_DUMMY_BREAKPOINT_OFFSET;
+ /* Yes, the offset is applied to the real_pc and not the
+ dummy_addr. Ulgh! Blame the HP/UX target. */
+ (*real_pc) += CALL_DUMMY_START_OFFSET;
+ write_memory (start_sp, (char *) dummy1, sizeof_dummy1);
+ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+ generic_save_call_dummy_addr (start_sp, start_sp + sizeof_dummy1);
+ return sp;
+}
+
+static CORE_ADDR
+generic_push_dummy_code (struct gdbarch *gdbarch,
+ CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc,
+ struct value **args, int nargs,
+ struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
+{
+ /* Something here to findout the size of a breakpoint and then
+ allocate space for it on the stack. */
+ int bplen;
+ /* This code assumes frame align. */
+ gdb_assert (gdbarch_frame_align_p (gdbarch));
+ /* Force the stack's alignment. The intent is to ensure that the SP
+ is aligned to at least a breakpoint instruction's boundary. */
+ sp = gdbarch_frame_align (gdbarch, sp);
+ /* Allocate space for, and then position the breakpoint on the
+ stack. */
+ if (gdbarch_inner_than (gdbarch, 1, 2))
+ {
+ CORE_ADDR bppc = sp;
+ gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
+ sp = gdbarch_frame_align (gdbarch, sp - bplen);
+ (*bp_addr) = sp;
+ /* Should the breakpoint size/location be re-computed here? */
+ }
+ else
+ {
+ (*bp_addr) = sp;
+ gdbarch_breakpoint_from_pc (gdbarch, bp_addr, &bplen);
+ sp = gdbarch_frame_align (gdbarch, sp + bplen);
+ }
+ /* Inferior resumes at the function entry point. */
+ (*real_pc) = funaddr;
+ return sp;
+}
+
+/* Provide backward compatibility. Once FIX_CALL_DUMMY is eliminated,
+ this can be simplified. */
+
+static CORE_ADDR
+push_dummy_code (struct gdbarch *gdbarch,
+ CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc,
+ struct value **args, int nargs,
+ struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
+{
+ if (gdbarch_push_dummy_code_p (gdbarch))
+ return gdbarch_push_dummy_code (gdbarch, sp, funaddr, using_gcc,
+ args, nargs, value_type, real_pc, bp_addr);
+ else if (FIX_CALL_DUMMY_P ())
+ return legacy_push_dummy_code (gdbarch, sp, funaddr, using_gcc,
+ args, nargs, value_type, real_pc, bp_addr);
+ else
+ return generic_push_dummy_code (gdbarch, sp, funaddr, using_gcc,
+ args, nargs, value_type, real_pc, bp_addr);
+}
+
/* All this stuff with a dummy frame may seem unnecessarily complicated
(why not just save registers in GDB?). The purpose of pushing a dummy
frame which looks just like a real frame is so that if you call a
struct_return = using_struct_return (function, funaddr, value_type,
using_gcc);
+ /* Determine the location of the breakpoint (and possibly other
+ stuff) that the called function will return to. The SPARC, for a
+ function returning a structure or union, needs to make space for
+ not just the breakpoint but also an extra word containing the
+ size (?) of the structure being passed. */
+
+ /* The actual breakpoint (at BP_ADDR) is inserted separatly so there
+ is no need to write that out. */
+
switch (CALL_DUMMY_LOCATION)
{
case ON_STACK:
- {
- /* CALL_DUMMY is an array of words (REGISTER_SIZE), but each
- word is in host byte order. Before calling FIX_CALL_DUMMY,
- we byteswap it and remove any extra bytes which might exist
- because ULONGEST is bigger than REGISTER_SIZE. */
- /* NOTE: This is pretty wierd, as the call dummy is actually a
- sequence of instructions. But CISC machines will have to
- pack the instructions into REGISTER_SIZE units (and so will
- RISC machines for which INSTRUCTION_SIZE is not
- REGISTER_SIZE). */
- /* NOTE: This is pretty stupid. CALL_DUMMY should be in
- strict target byte order. */
- CORE_ADDR start_sp;
- ULONGEST *dummy = alloca (SIZEOF_CALL_DUMMY_WORDS);
- int sizeof_dummy1 = (REGISTER_SIZE * SIZEOF_CALL_DUMMY_WORDS
- / sizeof (ULONGEST));
- char *dummy1 = alloca (sizeof_dummy1);
- memcpy (dummy, CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS);
- if (INNER_THAN (1, 2))
- {
- /* Stack grows down */
- sp -= sizeof_dummy1;
- start_sp = sp;
- }
- else
- {
- /* Stack grows up */
- start_sp = sp;
- sp += sizeof_dummy1;
- }
- /* NOTE: cagney/2002-09-10: Don't bother re-adjusting the
- stack after allocating space for the call dummy. A target
- can specify a SIZEOF_DUMMY1 (via SIZEOF_CALL_DUMMY_WORDS)
- such that all local alignment requirements are met. */
- /* Create a call sequence customized for this function and the
- number of arguments for it. */
+ /* "dummy_addr" is here just to keep old targets happy. New
+ targets return that same information via "sp" and "bp_addr". */
+ if (INNER_THAN (1, 2))
{
- int i;
- for (i = 0; i < (int) (SIZEOF_CALL_DUMMY_WORDS / sizeof (dummy[0]));
- i++)
- store_unsigned_integer (&dummy1[i * REGISTER_SIZE],
- REGISTER_SIZE,
- (ULONGEST) dummy[i]);
+ sp = push_dummy_code (current_gdbarch, sp, funaddr,
+ using_gcc, args, nargs, value_type,
+ &real_pc, &bp_addr);
+ dummy_addr = sp;
}
- /* NOTE: cagney/2003-04-22: This computation of REAL_PC,
- BP_ADDR and DUMMY_ADDR is pretty messed up. It comes from
- constant tinkering with the values. Instead a
- FIX_CALL_DUMMY replacement (PUSH_DUMMY_BREAKPOINT?) should
- just do everything. */
-#ifdef GDB_TARGET_IS_HPPA
- real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
- value_type, using_gcc);
-#else
- if (FIX_CALL_DUMMY_P ())
- {
- /* gdb_assert (CALL_DUMMY_LOCATION == ON_STACK) true? */
- FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, value_type,
- using_gcc);
- }
- real_pc = start_sp;
-#endif
- dummy_addr = start_sp;
- /* Yes, the offset is applied to the real_pc and not the dummy
- addr. Ulgh! Blame the HP/UX target. */
- bp_addr = real_pc + CALL_DUMMY_BREAKPOINT_OFFSET;
- /* Yes, the offset is applied to the real_pc and not the
- dummy_addr. Ulgh! Blame the HP/UX target. */
- real_pc += CALL_DUMMY_START_OFFSET;
- write_memory (start_sp, (char *) dummy1, sizeof_dummy1);
- if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
- generic_save_call_dummy_addr (start_sp, start_sp + sizeof_dummy1);
- break;
- }
+ else
+ {
+ dummy_addr = sp;
+ sp = push_dummy_code (current_gdbarch, sp, funaddr,
+ using_gcc, args, nargs, value_type,
+ &real_pc, &bp_addr);
+ }
+ break;
case AT_ENTRY_POINT:
real_pc = funaddr;
dummy_addr = CALL_DUMMY_ADDRESS ();
/* A call dummy always consists of just a single breakpoint, so
it's address is the same as the address of the dummy. */
bp_addr = dummy_addr;
- if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
- /* NOTE: cagney/2002-04-13: The entry point is going to be
- modified with a single breakpoint. */
- generic_save_call_dummy_addr (CALL_DUMMY_ADDRESS (),
- CALL_DUMMY_ADDRESS () + 1);
break;
default:
internal_error (__FILE__, __LINE__, "bad switch");
}
+ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+ /* Save where the breakpoint is going to be inserted so that the
+ dummy-frame code is later able to re-identify it. */
+ generic_save_call_dummy_addr (bp_addr, bp_addr + 1);
+
if (nargs < TYPE_NFIELDS (ftype))
error ("too few arguments in function call");
simply error out. That would the implementation of this method
for all ABIs (which is probably a good thing). */
sp = gdbarch_push_dummy_call (current_gdbarch, current_regcache,
- dummy_addr, nargs, args, sp, struct_return,
+ bp_addr, nargs, args, sp, struct_return,
struct_addr);
else if (DEPRECATED_PUSH_ARGUMENTS_P ())
/* Keep old targets working. */
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0x30);
set_gdbarch_call_dummy_length (gdbarch, 0x38);
- /* NOTE: cagney/2002-04-26: Based from info posted by Peter
+ /* NOTE: cagney/2003-05-01: Using the just added push_dummy_code
+ architecture method, it is now possible to implement a
+ generic dummy frames based inferior function call that stores
+ the breakpoint (and struct info) on the stack. Further, by
+ treating a SIGSEG at a breakpoint as equivalent to a SIGTRAP
+ it is even possible to make this work when the stack is
+ no-execute.
+
+ NOTE: cagney/2002-04-26: Based from info posted by Peter
Schauer around Oct '99. Briefly, due to aspects of the SPARC
ABI, it isn't possible to use ON_STACK with a strictly
compliant compiler.