aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/arch-utils.c6
-rw-r--r--gdb/arch-utils.h4
-rw-r--r--gdb/blockframe.c2
-rw-r--r--gdb/config/mips/tm-mips.h9
-rw-r--r--gdb/gdbarch.c72
-rw-r--r--gdb/gdbarch.h28
-rwxr-xr-xgdb/gdbarch.sh30
-rw-r--r--gdb/mips-tdep.c12
9 files changed, 148 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a2d08d3..ec4962f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2001-06-15 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbarch.sh: Clarify pre/post default
+ (INIT_FRAME_PC_FIRST, INIT_FRAME_PC): Multiarch.
+ * blockframe.c (get_prev_frame): Remove #ifdef from around
+ INIT_FRAME_PC_FIRST call.
+ * arch-utils.c (init_frame_pc_noop): Define.
+ * arch-utils.h (init_frame_pc_noop): Declare.
+ * config/mips/tm-mips.h (INIT_FRAME_PC_FIRST): Delete.
+ (INIT_FRAME_PC, mips_init_frame_pc_first): Ditto.
+ * mips-tdep.c (mips_init_frame_pc_first): Make static.
+ (mips_gdbarch_init): Initialize init_frame_pc_first.
+ (mips_dump_tdep): Update.
+
2001-06-15 Michael Snyder <msnyder@redhat.com>
* infrun.c (context_switch): New function. Abstract the operation
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 3300ce5..668eafe 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -300,6 +300,12 @@ generic_prepare_to_proceed (int select_it)
}
+void
+init_frame_pc_noop (int fromleaf, struct frame_info *prev)
+{
+ return;
+}
+
/* Functions to manipulate the endianness of the target. */
#ifdef TARGET_BYTE_ORDER_SELECTABLE
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 51ad1e4..69365d2 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -111,4 +111,8 @@ extern int default_prepare_to_proceed (int select_it);
extern int generic_prepare_to_proceed (int select_it);
+/* Version of init_frame_pc() that does nothing. */
+
+void init_frame_pc_noop (int fromleaf, struct frame_info *prev);
+
#endif
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 2f520d9..68da4fd 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -442,9 +442,7 @@ get_prev_frame (struct frame_info *next_frame)
Some machines won't use it.
kingdon@cygnus.com, 13Apr93, 31Jan94, 14Dec94. */
-#ifdef INIT_FRAME_PC_FIRST
INIT_FRAME_PC_FIRST (fromleaf, prev);
-#endif
#ifdef INIT_EXTRA_FRAME_INFO
INIT_EXTRA_FRAME_INFO (fromleaf, prev);
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index 8c28860..a207950 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -383,15 +383,6 @@ extern void mips_pop_frame (void);
#define CALL_DUMMY_ADDRESS() (mips_call_dummy_address ())
extern CORE_ADDR mips_call_dummy_address (void);
-/* There's a mess in stack frame creation. See comments in blockframe.c
- near reference to INIT_FRAME_PC_FIRST. */
-
-#define INIT_FRAME_PC(fromleaf, prev) /* nada */
-
-#define INIT_FRAME_PC_FIRST(fromleaf, prev) \
- mips_init_frame_pc_first(fromleaf, prev)
-extern void mips_init_frame_pc_first (int, struct frame_info *);
-
/* Special symbol found in blocks associated with routines. We can hang
mips_extra_func_info_t's off of this. */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index fcfe9ac..8dfdc84 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -190,6 +190,8 @@ struct gdbarch
int call_dummy_stack_adjust_p;
int call_dummy_stack_adjust;
gdbarch_fix_call_dummy_ftype *fix_call_dummy;
+ gdbarch_init_frame_pc_first_ftype *init_frame_pc_first;
+ gdbarch_init_frame_pc_ftype *init_frame_pc;
int believe_pcc_promotion;
int believe_pcc_promotion_type;
gdbarch_coerce_float_to_double_ftype *coerce_float_to_double;
@@ -328,6 +330,8 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
+ 0,
generic_get_saved_register,
0,
0,
@@ -460,6 +464,8 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->call_dummy_words = legacy_call_dummy_words;
gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
gdbarch->call_dummy_stack_adjust_p = -1;
+ gdbarch->init_frame_pc_first = init_frame_pc_noop;
+ gdbarch->init_frame_pc = init_frame_pc_noop;
gdbarch->coerce_float_to_double = default_coerce_float_to_double;
gdbarch->register_convertible = generic_register_convertible_not;
gdbarch->pointer_to_address = unsigned_pointer_to_address;
@@ -646,6 +652,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
&& (gdbarch->fix_call_dummy == 0))
internal_error (__FILE__, __LINE__,
"gdbarch: verify_gdbarch: fix_call_dummy invalid");
+ /* Skip verify of init_frame_pc_first, invalid_p == 0 */
+ /* Skip verify of init_frame_pc, invalid_p == 0 */
/* Skip verify of coerce_float_to_double, invalid_p == 0 */
if ((GDB_MULTI_ARCH >= 1)
&& (gdbarch->get_saved_register == 0))
@@ -1108,6 +1116,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p)",
XSTRING (FIX_CALL_DUMMY (dummy, pc, fun, nargs, args, type, gcc_p)));
#endif
+#if defined (INIT_FRAME_PC_FIRST) && GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "INIT_FRAME_PC_FIRST(fromleaf, prev)",
+ XSTRING (INIT_FRAME_PC_FIRST (fromleaf, prev)));
+#endif
+#if defined (INIT_FRAME_PC) && GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "INIT_FRAME_PC(fromleaf, prev)",
+ XSTRING (INIT_FRAME_PC (fromleaf, prev)));
+#endif
#ifdef BELIEVE_PCC_PROMOTION
fprintf_unfiltered (file,
"gdbarch_dump: BELIEVE_PCC_PROMOTION # %s\n",
@@ -1814,6 +1836,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->fix_call_dummy
/*FIX_CALL_DUMMY ()*/);
#endif
+#ifdef INIT_FRAME_PC_FIRST
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: INIT_FRAME_PC_FIRST = 0x%08lx\n",
+ (long) current_gdbarch->init_frame_pc_first
+ /*INIT_FRAME_PC_FIRST ()*/);
+#endif
+#ifdef INIT_FRAME_PC
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: INIT_FRAME_PC = 0x%08lx\n",
+ (long) current_gdbarch->init_frame_pc
+ /*INIT_FRAME_PC ()*/);
+#endif
#ifdef BELIEVE_PCC_PROMOTION
fprintf_unfiltered (file,
"gdbarch_dump: BELIEVE_PCC_PROMOTION = %ld\n",
@@ -3266,6 +3302,42 @@ set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch,
gdbarch->fix_call_dummy = fix_call_dummy;
}
+void
+gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev)
+{
+ if (gdbarch->init_frame_pc_first == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_init_frame_pc_first invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_init_frame_pc_first called\n");
+ gdbarch->init_frame_pc_first (fromleaf, prev);
+}
+
+void
+set_gdbarch_init_frame_pc_first (struct gdbarch *gdbarch,
+ gdbarch_init_frame_pc_first_ftype init_frame_pc_first)
+{
+ gdbarch->init_frame_pc_first = init_frame_pc_first;
+}
+
+void
+gdbarch_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev)
+{
+ if (gdbarch->init_frame_pc == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_init_frame_pc invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_init_frame_pc called\n");
+ gdbarch->init_frame_pc (fromleaf, prev);
+}
+
+void
+set_gdbarch_init_frame_pc (struct gdbarch *gdbarch,
+ gdbarch_init_frame_pc_ftype init_frame_pc)
+{
+ gdbarch->init_frame_pc = init_frame_pc;
+}
+
int
gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index ddea0c0..5700e37 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -789,6 +789,34 @@ extern void set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_fix_cal
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (INIT_FRAME_PC_FIRST)
+#define INIT_FRAME_PC_FIRST(fromleaf, prev) (init_frame_pc_noop (fromleaf, prev))
+#endif
+
+typedef void (gdbarch_init_frame_pc_first_ftype) (int fromleaf, struct frame_info *prev);
+extern void gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev);
+extern void set_gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, gdbarch_init_frame_pc_first_ftype *init_frame_pc_first);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_FRAME_PC_FIRST)
+#define INIT_FRAME_PC_FIRST(fromleaf, prev) (gdbarch_init_frame_pc_first (current_gdbarch, fromleaf, prev))
+#endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (INIT_FRAME_PC)
+#define INIT_FRAME_PC(fromleaf, prev) (init_frame_pc_noop (fromleaf, prev))
+#endif
+
+typedef void (gdbarch_init_frame_pc_ftype) (int fromleaf, struct frame_info *prev);
+extern void gdbarch_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev);
+extern void set_gdbarch_init_frame_pc (struct gdbarch *gdbarch, gdbarch_init_frame_pc_ftype *init_frame_pc);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_FRAME_PC)
+#define INIT_FRAME_PC(fromleaf, prev) (gdbarch_init_frame_pc (current_gdbarch, fromleaf, prev))
+#endif
+#endif
+
extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch);
extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion);
#if GDB_MULTI_ARCH
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 1fb598a..3cd4727 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -248,17 +248,19 @@ do
predefault ) : ;;
- # A initial value to assign to MEMBER of the freshly
- # malloc()ed gdbarch object. After the gdbarch object has
- # been initialized using PREDEFAULT, it is passed to the
- # target code for further updates.
+ # An initial value to assign to MEMBER of the freshly
+ # malloc()ed gdbarch object. After initialization, the
+ # freshly malloc()ed object is passed to the target
+ # architecture code for further updates.
# If PREDEFAULT is empty, zero is used.
- # When POSTDEFAULT is empty, a non-empty PREDEFAULT and a zero
- # INVALID_P will be used as default values when when
- # multi-arch is disabled. Specify a zero PREDEFAULT function
- # to make that fallback call internal_error().
+ # A non-empty PREDEFAULT, an empty POSTDEFAULT and a zero
+ # INVALID_P are specified, PREDEFAULT will be used as the
+ # default for the non- multi-arch target.
+
+ # A zero PREDEFAULT function will force the fallback to call
+ # internal_error().
# Variable declarations can refer to ``gdbarch'' which will
# contain the current architecture. Care should be taken.
@@ -266,9 +268,8 @@ do
postdefault ) : ;;
# A value to assign to MEMBER of the new gdbarch object should
- # the target code fail to change the PREDEFAULT value. Also
- # use POSTDEFAULT as the fallback value for the non-
- # multi-arch case.
+ # the target architecture code fail to change the PREDEFAULT
+ # value.
# If POSTDEFAULT is empty, no post update is performed.
@@ -276,6 +277,11 @@ do
# INVALID_P will be used to determine if MEMBER should be
# changed to POSTDEFAULT.
+ # If a non-empty POSTDEFAULT and a zero INVALID_P are
+ # specified, POSTDEFAULT will be used as the default for the
+ # non- multi-arch target (regardless of the value of
+ # PREDEFAULT).
+
# You cannot specify both a zero INVALID_P and a POSTDEFAULT.
# Variable declarations can refer to ``gdbarch'' which will
@@ -438,6 +444,8 @@ v:2:SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_
v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_dummy_stack_adjust_p::::0:-1:::0x%08lx
v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P
f:2: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:::0
+f:2:INIT_FRAME_PC_FIRST:void:init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_noop::0
+f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_noop::0
#
v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type:::::::
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 2d86b5e..bb7a6c4 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1379,7 +1379,7 @@ mips_addr_bits_remove (CORE_ADDR addr)
return addr;
}
-void
+static void
mips_init_frame_pc_first (int fromleaf, struct frame_info *prev)
{
CORE_ADDR pc, tmp;
@@ -4127,6 +4127,10 @@ mips_gdbarch_init (struct gdbarch_info info,
ensure that all 32 bit addresses are sign extended to 64 bits. */
set_gdbarch_addr_bits_remove (gdbarch, mips_addr_bits_remove);
+ /* There's a mess in stack frame creation. See comments in
+ blockframe.c near reference to INIT_FRAME_PC_FIRST. */
+ set_gdbarch_init_frame_pc_first (gdbarch, mips_init_frame_pc_first);
+
/* Map debug register numbers onto internal register numbers. */
set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
@@ -4329,12 +4333,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
"mips_dump_tdep: IGNORE_HELPER_CALL # %s\n",
XSTRING (IGNORE_HELPER_CALL (PC)));
fprintf_unfiltered (file,
- "mips_dump_tdep: INIT_FRAME_PC # %s\n",
- XSTRING (INIT_FRAME_PC (FROMLEAF, PREV)));
- fprintf_unfiltered (file,
- "mips_dump_tdep: INIT_FRAME_PC_FIRST # %s\n",
- XSTRING (INIT_FRAME_PC_FIRST (FROMLEAF, PREV)));
- fprintf_unfiltered (file,
"mips_dump_tdep: IN_SIGTRAMP # %s\n",
XSTRING (IN_SIGTRAMP (PC, NAME)));
fprintf_unfiltered (file,