aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2002-08-16 02:36:49 +0000
committerMichael Snyder <msnyder@vmware.com>2002-08-16 02:36:49 +0000
commitbcb0cc15ad5617f4d1f5b158ababf3f5141eafa7 (patch)
treedc35fc4421d18a6ff49acb4c8a230a988407df3e /gdb
parent466d7106f65b1d5afaee478a1cd8f2a7557690fc (diff)
downloadgdb-bcb0cc15ad5617f4d1f5b158ababf3f5141eafa7.zip
gdb-bcb0cc15ad5617f4d1f5b158ababf3f5141eafa7.tar.gz
gdb-bcb0cc15ad5617f4d1f5b158ababf3f5141eafa7.tar.bz2
2002-08-15 Michael Snyder <msnyder@redhat.com>
* mips-tdep.c (mips_gdbarch_init): Set gdbarch read_sp to mips_read_sp. * config/mips/tm-mips.h (TARGET_READ_SP): Delete.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/config/mips/tm-mips.h4
-rw-r--r--gdb/mips-tdep.c63
3 files changed, 51 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f7c3e51..bf15e89 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -7,9 +7,12 @@
* config/mips/tm-mips.h (REGISTER_CONVERT_TO_VIRTUAL,
REGISTER_CONVERT_TO_RAW, REGISTER_CONVERTIBLE,
MAX_REGISTER_RAW_SIZE, MAX_REGISTER_VIRTUAL_SIZE): Delete.
+ (TARGET_READ_SP): Delete.
* mips-tdep.c (mips_gdbarch_init): Set the above in the gdbarch.
(mips_register_convertible, mips_register_convert_to_virtual,
mips_register_convert_to_raw): Make static.
+ (mips_read_sp): New function.
+ (mips_gdbarch_init): Set gdbarch read_sp to mips_read_sp.
2002-08-15 Andrew Cagney <ac131313@redhat.com>
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index 7e667b7..4552d96 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -51,10 +51,6 @@ struct value;
#define DEFAULT_MIPS_TYPE "generic"
-/* Remove useless bits from the stack pointer. */
-
-#define TARGET_READ_SP() ADDR_BITS_REMOVE (read_register (SP_REGNUM))
-
/* Offset from address of function to start of its code.
Zero on most machines. */
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index a054c13..478be20 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -513,6 +513,14 @@ mips_register_virtual_type (int reg)
}
}
+/* TARGET_READ_SP -- Remove useless bits from the stack pointer. */
+
+static CORE_ADDR
+mips_read_sp (void)
+{
+ return ADDR_BITS_REMOVE (read_register (SP_REGNUM));
+}
+
/* Should the upper word of 64-bit addresses be zeroed? */
enum auto_boolean mask_address_var = AUTO_BOOLEAN_AUTO;
@@ -2294,9 +2302,11 @@ mips_frame_chain (struct frame_info *frame)
we loop forever if we see a zero size frame. */
if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
&& PROC_FRAME_OFFSET (proc_desc) == 0
- /* The previous frame from a sigtramp frame might be frameless
- and have frame size zero. */
- && !frame->signal_handler_caller)
+ /* The previous frame from a sigtramp frame might be frameless
+ and have frame size zero. */
+ && !frame->signal_handler_caller
+ /* Check if this is a call dummy frame. */
+ && frame->pc != mips_call_dummy_address ())
return 0;
else
return get_frame_pointer (frame, proc_desc);
@@ -2959,7 +2969,7 @@ mips_o32o64_push_arguments (int nargs,
argreg = A0_REGNUM;
float_argreg = FPA0_REGNUM;
- /* the struct_return pointer occupies the first parameter-passing reg */
+ /* The struct_return pointer occupies the first parameter-passing reg. */
if (struct_return)
{
if (mips_debug)
@@ -3346,13 +3356,22 @@ mips_pop_frame (void)
if (frame->saved_regs == NULL)
FRAME_INIT_SAVED_REGS (frame);
for (regnum = 0; regnum < NUM_REGS; regnum++)
- {
- if (regnum != SP_REGNUM && regnum != PC_REGNUM
- && frame->saved_regs[regnum])
- write_register (regnum,
- read_memory_integer (frame->saved_regs[regnum],
- MIPS_SAVED_REGSIZE));
- }
+ if (regnum != SP_REGNUM && regnum != PC_REGNUM
+ && frame->saved_regs[regnum])
+ {
+ /* Floating point registers must not be sign extended,
+ in case MIPS_SAVED_REGSIZE = 4 but sizeof (FP0_REGNUM) == 8. */
+
+ if (FP0_REGNUM <= regnum && regnum < FP0_REGNUM + 32)
+ write_register (regnum,
+ read_memory_unsigned_integer (frame->saved_regs[regnum],
+ MIPS_SAVED_REGSIZE));
+ else
+ write_register (regnum,
+ read_memory_integer (frame->saved_regs[regnum],
+ MIPS_SAVED_REGSIZE));
+ }
+
write_register (SP_REGNUM, new_sp);
flush_cached_frames ();
@@ -4079,15 +4098,28 @@ return_value_location (struct type *valtype,
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len < MIPS_SAVED_REGSIZE)
{
- /* "un-left-justify" the value in the low register */
- lo->reg_offset = MIPS_SAVED_REGSIZE - len;
- lo->len = len;
+ if ((gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N32
+ || gdbarch_tdep (current_gdbarch) -> mips_abi == MIPS_ABI_N64)
+ && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
+ || TYPE_CODE (valtype) == TYPE_CODE_UNION))
+ {
+ /* Values are already aligned in the low register. */
+ lo->reg_offset = 0;
+ }
+ else
+ {
+ /* "un-left-justify" the value in the low register */
+ lo->reg_offset = MIPS_SAVED_REGSIZE - len;
+ }
hi->reg_offset = 0;
+ lo->len = len;
hi->len = 0;
}
else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len > MIPS_SAVED_REGSIZE /* odd-size structs */
&& len < MIPS_SAVED_REGSIZE * 2
+ && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N32
+ && gdbarch_tdep (current_gdbarch) -> mips_abi != MIPS_ABI_N64
&& (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
TYPE_CODE (valtype) == TYPE_CODE_UNION))
{
@@ -4925,6 +4957,7 @@ mips_gdbarch_init (struct gdbarch_info info,
}
}
+#undef MIPS_DEFAULT_ABI
#ifdef MIPS_DEFAULT_ABI
if (mips_abi == MIPS_ABI_UNKNOWN)
mips_abi = MIPS_DEFAULT_ABI;
@@ -5170,7 +5203,7 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_read_pc (gdbarch, mips_read_pc);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
- set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
+ set_gdbarch_read_sp (gdbarch, mips_read_sp);
set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
/* Add/remove bits from an address. The MIPS needs be careful to