* gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate.
* gdbarch.h, gdbarch.c: Re-generate.
* arch-utils.h (frame_num_args_unknown): Delete both declarations.
* arch-utils.c (frame_num_args_unknown): Delete function.
* stack.c (print_args_stub): Use FRAME_NUM_ARGS_P.
(frame_info): Use FRAME_NUM_ARGS_P.
* arm-tdep.c (arm_frame_num_args): Delete function.
(arm_gdbarch_init): Do not set frame_num_args.
* config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete.
* hppa-tdep.c (hppa_frame_num_args): Delete function.
(hppa_gdbarch_init): Do not set frame_num_args.
* config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
frame_num_args to default frame_num_args_unknown.
* v850-tdep.c (v850_gdbarch_init): Ditto.
* sparc-tdep.c (sparc_gdbarch_init): Ditto.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* s390-tdep.c (s390_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
* mips-tdep.c (mips_gdbarch_init): Ditto.
* mcore-tdep.c (mcore_gdbarch_init): Ditto.
* m68k-tdep.c (m68k_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
* ia64-tdep.c (ia64_gdbarch_init): Ditto.
* i386-tdep.c (i386_gdbarch_init): Ditto.
* h8300-tdep.c (h8300_gdbarch_init): Ditto.
* frv-tdep.c (frv_gdbarch_init): Ditto.
* d10v-tdep.c (d10v_gdbarch_init): Ditto.
* cris-tdep.c (cris_gdbarch_init): Ditto.
* avr-tdep.c (avr_gdbarch_init): Ditto.
* alpha-tdep.c (alpha_gdbarch_init): Ditto.
+2003-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * arch-utils.h (frame_num_args_unknown): Delete both declarations.
+ * arch-utils.c (frame_num_args_unknown): Delete function.
+ * stack.c (print_args_stub): Use FRAME_NUM_ARGS_P.
+ (frame_info): Use FRAME_NUM_ARGS_P.
+ * arm-tdep.c (arm_frame_num_args): Delete function.
+ (arm_gdbarch_init): Do not set frame_num_args.
+ * config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete.
+ * hppa-tdep.c (hppa_frame_num_args): Delete function.
+ (hppa_gdbarch_init): Do not set frame_num_args.
+ * config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
+ frame_num_args to default frame_num_args_unknown.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * mips-tdep.c (mips_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * m68k-tdep.c (m68k_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+ * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * frv-tdep.c (frv_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * avr-tdep.c (avr_gdbarch_init): Ditto.
+ * alpha-tdep.c (alpha_gdbarch_init): Ditto.
+
2003-06-09 Andrew Cagney <cagney@redhat.com>
* printcmd.c (print_frame_nameless_args): Moved to "stack.c".
set_gdbarch_print_insn (gdbarch, print_insn_alpha);
/* Call info. */
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
/* Misc helper functions for targets. */
-int
-frame_num_args_unknown (struct frame_info *fi)
-{
- return -1;
-}
-
-
int
generic_register_convertible_not (int num)
{
extern CORE_ADDR generic_cannot_extract_struct_value_address (char *dummy);
-/* Helper function for targets that don't know how my arguments are
- being passed */
-extern gdbarch_frame_num_args_ftype frame_num_args_unknown;
-
/* Implementation of extract return value that grubs around in the
register cache. */
extern gdbarch_extract_return_value_ftype legacy_extract_return_value;
extern const struct floatformat *default_float_format (struct gdbarch *gdbarch);
extern const struct floatformat *default_double_format (struct gdbarch *gdbarch);
-/* Helper function for targets that don't know how my arguments are
- being passed */
-extern int frame_num_args_unknown (struct frame_info *fi);
-
-
/* The following DEPRECATED interfaces are for pre- multi-arch legacy
targets. */
return get_frame_base (fi);
}
-/* The number of arguments being passed in the frame. */
-static int
-arm_frame_num_args (struct frame_info *fi)
-{
- /* We have no way of knowing. */
- return -1;
-}
-
/* A typical Thumb prologue looks like this:
push {r7, lr}
add sp, sp, #-28
set_gdbarch_deprecated_frame_saved_pc (gdbarch, arm_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, arm_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, arm_frame_locals_address);
- set_gdbarch_frame_num_args (gdbarch, arm_frame_num_args);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, arm_frame_init_saved_regs);
set_gdbarch_deprecated_pop_frame (gdbarch, arm_pop_frame);
set_gdbarch_frame_args_address (gdbarch, avr_frame_address);
set_gdbarch_frame_locals_address (gdbarch, avr_frame_address);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, avr_saved_pc_after_call);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_convert_from_func_ptr_addr (gdbarch,
avr_convert_from_func_ptr_addr);
#define FRAME_LOCALS_ADDRESS(fi) hppa_frame_locals_address (fi)
#endif
-#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
/* 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. */
#define FRAME_ARGS_SKIP 68
set_gdbarch_deprecated_frame_saved_pc (gdbarch, cris_frame_saved_pc);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, cris_saved_pc_after_call);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
-
/* Helpful for backtracing and returning in a call dummy. */
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frame_align (gdbarch, d10v_frame_align);
set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno);
set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue);
set_gdbarch_breakpoint_from_pc (gdbarch, frv_breakpoint_from_pc);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation);
/* Skip verify of frame_args_address, invalid_p == 0 */
/* Skip verify of frame_locals_address, invalid_p == 0 */
/* Skip verify of deprecated_saved_pc_after_call, has predicate */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->frame_num_args == 0))
- fprintf_unfiltered (log, "\n\tframe_num_args");
+ /* Skip verify of frame_num_args, has predicate */
/* Skip verify of stack_align, has predicate */
/* Skip verify of frame_align, has predicate */
/* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */
(long) current_gdbarch->frame_locals_address
/*FRAME_LOCALS_ADDRESS ()*/);
#endif
+#ifdef FRAME_NUM_ARGS_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FRAME_NUM_ARGS_P()",
+ XSTRING (FRAME_NUM_ARGS_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: FRAME_NUM_ARGS_P() = %d\n",
+ FRAME_NUM_ARGS_P ());
+#endif
#ifdef FRAME_NUM_ARGS
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
gdbarch->deprecated_saved_pc_after_call = deprecated_saved_pc_after_call;
}
+int
+gdbarch_frame_num_args_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->frame_num_args != 0;
+}
+
int
gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame)
{
#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) (gdbarch_deprecated_saved_pc_after_call (current_gdbarch, frame))
#endif
+#if defined (FRAME_NUM_ARGS)
+/* Legacy for systems yet to multi-arch FRAME_NUM_ARGS */
+#if !defined (FRAME_NUM_ARGS_P)
+#define FRAME_NUM_ARGS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (FRAME_NUM_ARGS_P)
+#define FRAME_NUM_ARGS_P() (0)
+#endif
+
+extern int gdbarch_frame_num_args_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_NUM_ARGS_P)
+#error "Non multi-arch definition of FRAME_NUM_ARGS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_NUM_ARGS_P)
+#define FRAME_NUM_ARGS_P() (gdbarch_frame_num_args_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (FRAME_NUM_ARGS)
+#define FRAME_NUM_ARGS(frame) (internal_error (__FILE__, __LINE__, "FRAME_NUM_ARGS"), 0)
+#endif
+
typedef int (gdbarch_frame_num_args_ftype) (struct frame_info *frame);
extern int gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame);
extern void set_gdbarch_frame_num_args (struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args);
f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:get_frame_base::0
f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:get_frame_base::0
F::DEPRECATED_SAVED_PC_AFTER_CALL:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame
-f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0
+F:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame
#
F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0
M:::CORE_ADDR:frame_align:CORE_ADDR address:address
set_gdbarch_function_start_offset (gdbarch, 0);
/* This value is almost never non-zero... */
set_gdbarch_frame_args_skip (gdbarch, 0);
- /* OK to default this value to 'unknown'. */
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frameless_function_invocation (gdbarch,
frameless_look_for_prologue);
return get_frame_base (fi);
}
-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)
{
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_num_args (gdbarch, hppa_frame_num_args);
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_function_start_offset (gdbarch, 0);
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp);
/* Wire in the MMX registers. */
set_gdbarch_skip_prologue (gdbarch, ia64_skip_prologue);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frameless_function_invocation (gdbarch, ia64_frameless_function_invocation);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call);
set_gdbarch_frame_args_address (gdbarch, m68hc11_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, m68hc11_frame_locals_address);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs);
set_gdbarch_frameless_function_invocation (gdbarch,
m68k_frameless_function_invocation);
- /* OK to default this value to 'unknown'. */
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frame_args_skip (gdbarch, 8);
set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frame_args_address (gdbarch, mcore_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, mcore_frame_locals_address);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_deprecated_pop_frame (gdbarch, mcore_pop_frame);
set_gdbarch_virtual_frame_pointer (gdbarch, mcore_virtual_frame_pointer);
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
set_gdbarch_deprecated_frame_saved_pc (gdbarch, mips_frame_saved_pc);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_deprecated_get_saved_register (gdbarch, mips_get_saved_register);
set_gdbarch_deprecated_pop_frame (gdbarch, mn10300_pop_frame);
set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue);
set_gdbarch_frame_args_skip (gdbarch, 0);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
/* That's right, we're using the stack pointer as our frame pointer. */
set_gdbarch_deprecated_target_read_fp (gdbarch, mn10300_read_fp);
/* Helpers for function argument information. */
set_gdbarch_fetch_pointer_argument (gdbarch, rs6000_fetch_pointer_argument);
- /* We can't tell how many args there are
- now that the C compiler delays popping them. */
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
-
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs);
set_gdbarch_frame_locals_address (gdbarch, s390_frame_args_address);
- /* We can't do this */
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_deprecated_store_struct_return (gdbarch, s390_store_struct_return);
set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value);
set_gdbarch_deprecated_store_return_value (gdbarch, s390_store_return_value);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
set_gdbarch_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sh_saved_pc_after_call);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
/* Hook in ABI-specific overrides, if they have been registered. */
set_gdbarch_fp0_regnum (gdbarch, SPARC_FP0_REGNUM);
set_gdbarch_deprecated_frame_chain (gdbarch, sparc_frame_chain);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs);
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_deprecated_frame_saved_pc (gdbarch, sparc_frame_saved_pc);
set_gdbarch_frameless_function_invocation (gdbarch,
frameless_look_for_prologue);
int numargs;
struct print_args_args *p = (struct print_args_args *) args;
- numargs = FRAME_NUM_ARGS (p->fi);
+ if (FRAME_NUM_ARGS_P ())
+ {
+ numargs = FRAME_NUM_ARGS (p->fi);
+ gdb_assert (numargs >= 0);
+ }
+ else
+ numargs = -1;
print_frame_args (p->func, p->fi, numargs, p->stream);
return 0;
}
print_address_numeric (arg_list, 1, gdb_stdout);
printf_filtered (",");
- numargs = FRAME_NUM_ARGS (fi);
- if (numargs < 0)
- puts_filtered (" args: ");
- else if (numargs == 0)
- puts_filtered (" no args.");
- else if (numargs == 1)
- puts_filtered (" 1 arg: ");
+ if (!FRAME_NUM_ARGS_P ())
+ {
+ numargs = -1;
+ puts_filtered (" args: ");
+ }
else
- printf_filtered (" %d args: ", numargs);
+ {
+ numargs = FRAME_NUM_ARGS (fi);
+ gdb_assert (numargs >= 0);
+ if (numargs == 0)
+ puts_filtered (" no args.");
+ else if (numargs == 1)
+ puts_filtered (" 1 arg: ");
+ else
+ printf_filtered (" %d args: ", numargs);
+ }
print_frame_args (func, fi, numargs, gdb_stdout);
puts_filtered ("\n");
}
set_gdbarch_function_start_offset (gdbarch, 0);
/* This value is almost never non-zero... */
set_gdbarch_frame_args_skip (gdbarch, 0);
- /* OK to default this value to 'unknown'. */
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
/*
* Call Dummies
set_gdbarch_function_start_offset (gdbarch, 0);
/* This value is almost never non-zero... */
set_gdbarch_frame_args_skip (gdbarch, 0);
- /* OK to default this value to 'unknown'. */
- set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
/*
* Call Dummies