* [patch rfc] Add NUM_REGS pseudo regs to MIPS
@ 2003-06-16 15:35 Andrew Cagney
2003-06-16 15:44 ` Daniel Jacobowitz
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Andrew Cagney @ 2003-06-16 15:35 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
Hello,
Per my last post to an old thread. This adds NUM_REGS pseudo registers
to the MIPS. These pseudo registers, unlike their raw counterparts are
`sane'. They have sensible sizes, offsets, types, ...
The intent here is to put some distance between the MIPS's messed up raw
register buffer and the ABI registers. As it stands, it doesn't get
save/restore right (it works but not by using the ABI registers). That
can follow.
Tested on mips-elf.
thoughts?
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 21017 bytes --]
2003-06-15 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c: Include "reggroups.h".
(mips_register_name): Map NUM_REGS..2*NUM_REGS onto 0..NUM_REGS.
(mips_register_reggroup_p): New function.
(mips_pseudo_register_write): New function.
(mips_pseudo_register_read): New function.
(mips_register_raw_size): For NUM_REGS..2*NUM_REGS return the size
based on the registers type.
(mips_register_byte): New function. Use MIPS_REGISTER_BYTE.
(mips_register_type): Replace mips_register_virtual_type. Map
NUM_REGS..2*NUM_REGS onto 0..NUM_REGS. Use MIPS_REGISTER_TYPE
when available.
(set_reg_offset): Also save the offset in NUM_REGS..2*NUM_REGS.
(mips_print_register): Use gdbarch_register_type instead of
REGISTER_VIRTUAL_TYPE.
(print_gp_register_row, mips_print_registers_info): Ditto.
(mips_stab_reg_to_regnum): Map onto NUM_REGS..2*NUM_REGS.
(mips_dwarf_dwarf2_ecoff_reg_to_regnum): Ditto.
(mips_gdbarch_init): Set deprecated_register_byte,
register_group_p, pseudo_register_write, pseudo_register_read, and
num_pseudo_regs. Set register_type, instead of
register_virtual_type.
* Makefile.in (mips-tdep.o): Update dependencies.
* config/mips/tm-mips64.h (MIPS_REGISTER_TYPE): Rename
REGISTER_VIRTUAL_TYPE.
* config/mips/tm-mips.h (MIPS_REGISTER_TYPE): Ditto.
* config/mips/tm-irix5.h (MIPS_REGISTER_TYPE): Ditto.
* config/mips/tm-mips.h (MIPS_REGISTER_BYTE): Rename REGISTER_BYTE.
* config/mips/tm-irix6.h (MIPS_REGISTER_BYTE): Ditto.
* config/mips/tm-irix5.h (MIPS_REGISTER_BYTE): Ditto.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.406
diff -u -r1.406 Makefile.in
--- Makefile.in 15 Jun 2003 00:27:54 -0000 1.406
+++ Makefile.in 16 Jun 2003 15:21:50 -0000
@@ -1999,8 +1999,8 @@
$(frame_h) $(inferior_h) $(symtab_h) $(value_h) $(gdbcmd_h) \
$(language_h) $(gdbcore_h) $(symfile_h) $(objfiles_h) \
$(gdbtypes_h) $(target_h) $(arch_utils_h) $(regcache_h) \
- $(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \
- $(elf_mips_h) $(elf_bfd_h) $(symcat_h)
+ $(osabi_h) $(mips_tdep_h) $(block_h) $(reggroups_h) \
+ $(opcode_mips_h) $(elf_mips_h) $(elf_bfd_h) $(symcat_h)
mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h)
mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
$(mipsnbsd_tdep_h)
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.216
diff -u -r1.216 mips-tdep.c
--- mips-tdep.c 15 Jun 2003 00:27:54 -0000 1.216
+++ mips-tdep.c 16 Jun 2003 15:21:51 -0000
@@ -42,7 +42,7 @@
#include "osabi.h"
#include "mips-tdep.h"
#include "block.h"
-
+#include "reggroups.h"
#include "opcode/mips.h"
#include "elf/mips.h"
#include "elf-bfd.h"
@@ -440,21 +440,25 @@
enum mips_abi abi = mips_abi (current_gdbarch);
+ /* For moment, map [NUM_REGS .. 2*NUM_REGS) onto the same raw
+ registers. Even return the same name. */
+ int rawnum = regno % NUM_REGS;
+
/* The MIPS integer registers are always mapped from 0 to 31. The
names of the registers (which reflects the conventions regarding
register use) vary depending on the ABI. */
- if (0 <= regno && regno < 32)
+ if (0 <= rawnum && rawnum < 32)
{
if (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64)
- return mips_n32_n64_gpr_names[regno];
+ return mips_n32_n64_gpr_names[rawnum];
else
- return mips_gpr_names[regno];
+ return mips_gpr_names[rawnum];
}
- else if (32 <= regno && regno < NUM_REGS)
- return mips_processor_reg_names[regno - 32];
+ else if (32 <= rawnum && rawnum < NUM_REGS)
+ return mips_processor_reg_names[rawnum - 32];
else
internal_error (__FILE__, __LINE__,
- "mips_register_name: bad register number %d", regno);
+ "mips_register_name: bad register number %d", rawnum);
}
/* *INDENT-OFF* */
@@ -524,8 +528,66 @@
};
/* *INDENT-ON* */
+/* Return the groups that a MIPS register can be categorised into. */
+static int
+mips_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ struct reggroup *reggroup)
+{
+ int vector_p;
+ int float_p;
+ int raw_p;
+ int rawnum = regnum % NUM_REGS;
+ int pseudo = regnum / NUM_REGS;
+ if (reggroup == all_reggroup)
+ return pseudo;
+ vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
+ float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT;
+ /* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs
+ (gdbarch), as not all architectures are multi-arch. */
+ raw_p = rawnum < NUM_REGS;
+ if (REGISTER_NAME (rawnum) == NULL
+ || REGISTER_NAME (rawnum)[0] == '\0')
+ return 0;
+ if (reggroup == float_reggroup)
+ return float_p && pseudo;
+ if (reggroup == vector_reggroup)
+ return vector_p && pseudo;
+ if (reggroup == general_reggroup)
+ return (!vector_p && !float_p) && pseudo;
+ /* Save the raw registers. If the architecture reads a cooked
+ pseudo register from the raw register cache, the regcache will
+ "do the right thing" (map the cooked pseudo back onto a raw
+ register). */
+ if (reggroup == save_reggroup)
+ return raw_p && !pseudo;
+ /* Restore using the symbol table registers? Not yet. At present
+ this scrambles the code that tries to restore the registers after
+ an inferior function call. */
+ if (reggroup == restore_reggroup)
+ return raw_p && !pseudo;
+ return 0;
+}
+
+/* Map the symbol table registers which live in the range [1 *
+ NUM_REGS .. 2 * NUM_REGS) back onto the corresponding raw
+ registers. */
+
+static void
+mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ int cookednum, void *buf)
+{
+ gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS);
+ return regcache_raw_read (regcache, cookednum % NUM_REGS, buf);
+}
+static void
+mips_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int cookednum, const void *buf)
+{
+ gdb_assert (cookednum >= NUM_REGS && cookednum < 2 * NUM_REGS);
+ return regcache_raw_write (regcache, cookednum % NUM_REGS, buf);
+}
/* Table to translate MIPS16 register field to actual register number. */
static int mips16_to_32_reg[8] =
@@ -575,22 +637,73 @@
/* Number of bytes of storage in the actual machine representation for
register N. NOTE: This indirectly defines the register size
- transfered by the GDB protocol. */
+ transfered by the GDB protocol. */
static int mips64_transfers_32bit_regs_p = 0;
static int
-mips_register_raw_size (int reg_nr)
+mips_register_raw_size (int regnum)
{
- if (mips64_transfers_32bit_regs_p)
- return REGISTER_VIRTUAL_SIZE (reg_nr);
- else if (reg_nr >= FP0_REGNUM && reg_nr < FP0_REGNUM + 32
- && FP_REGISTER_DOUBLE)
- /* For MIPS_ABI_N32 (for example) we need 8 byte floating point
- registers. */
- return 8;
+ gdb_assert (regnum >= 0);
+ if (regnum < NUM_REGS)
+ {
+ /* For compatibility with old code, implemnt the broken register raw
+ size map for the raw registers.
+
+ NOTE: cagney/2003-06-15: This is so bogus. The register's
+ raw size is changing according to the ABI
+ (FP_REGISTER_DOUBLE). Also, GDB's protocol is defined by a
+ combination of REGISTER_RAW_SIZE and REGISTER_BYTE. */
+ if (mips64_transfers_32bit_regs_p)
+ return REGISTER_VIRTUAL_SIZE (regnum);
+ else if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32
+ && FP_REGISTER_DOUBLE)
+ /* For MIPS_ABI_N32 (for example) we need 8 byte floating point
+ registers. */
+ return 8;
+ else
+ return MIPS_REGSIZE;
+ }
+ else if (regnum < 2 * NUM_REGS)
+ {
+ /* For the moment map [NUM_REGS .. 2*NUM_REGS) onto the same raw
+ registers, but always return the virtual size. */
+ int rawnum = regnum % NUM_REGS;
+ return TYPE_LENGTH (MIPS_REGISTER_TYPE (rawnum));
+ }
+ else
+ internal_error (__FILE__, __LINE__, "Register %d out of range", regnum);
+}
+
+/* Register offset in a buffer for each register.
+
+ FIXME: cagney/2003-06-15: This is so bogus. Instead REGISTER_TYPE
+ should strictly return the layout of the buffer. Unfortunatly
+ remote.c and the MIPS have come to rely on a custom layout that
+ doesn't 1:1 map onto the register type. */
+
+static int
+mips_register_byte (int regnum)
+{
+ gdb_assert (regnum >= 0);
+ if (regnum < NUM_REGS)
+ /* Pick up the relevant per-tm file register byte method. */
+ return MIPS_REGISTER_BYTE (regnum);
+ else if (regnum < 2 * NUM_REGS)
+ {
+ int reg;
+ int byte;
+ /* Start with the end of the raw register buffer - assum that
+ MIPS_REGISTER_BYTE (NUM_REGS) returns that end. */
+ byte = MIPS_REGISTER_BYTE (NUM_REGS);
+ /* Add space for all the proceeding registers based on their
+ real size. */
+ for (reg = NUM_REGS; reg < regnum; reg++)
+ byte += TYPE_LENGTH (MIPS_REGISTER_TYPE ((reg % NUM_REGS)));
+ return byte;
+ }
else
- return MIPS_REGSIZE;
+ internal_error (__FILE__, __LINE__, "Register %d out of range", regnum);
}
/* Convert between RAW and VIRTUAL registers. The RAW register size
@@ -660,20 +773,20 @@
put_frame_register (frame, regnum + 1, (const char *) from + 0);
}
-/* Return the GDB type object for the "standard" data type
- of data in register REG.
-
- Note: kevinb/2002-08-01: The definition below should faithfully
- reproduce the behavior of each of the REGISTER_VIRTUAL_TYPE
- definitions found in config/mips/tm-*.h. I'm concerned about the
- ``FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM'' clause though.
- In some cases DEPRECATED_FP_REGNUM is in this range, and I doubt
- that this code is correct for the 64-bit case. */
+/* Return the GDB type object for the "standard" data type of data in
+ register REG. */
static struct type *
-mips_register_virtual_type (int reg)
+mips_register_type (struct gdbarch *gdbarch, int regnum)
{
- if (FP0_REGNUM <= reg && reg < FP0_REGNUM + 32)
+ /* For moment, map [NUM_REGS .. 2*NUM_REGS) onto the same raw
+ registers. Even return the same type. */
+ int rawnum = regnum % NUM_REGS;
+ gdb_assert (rawnum >= 0 && rawnum < NUM_REGS);
+#ifdef MIPS_REGISTER_TYPE
+ return MIPS_REGISTER_TYPE (rawnum);
+#else
+ if (FP0_REGNUM <= rawnum && rawnum < FP0_REGNUM + 32)
{
/* Floating point registers... */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
@@ -681,9 +794,9 @@
else
return builtin_type_ieee_double_little;
}
- else if (reg == PS_REGNUM /* CR */)
+ else if (rawnum == PS_REGNUM /* CR */)
return builtin_type_uint32;
- else if (FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM)
+ else if (FCRCS_REGNUM <= rawnum && rawnum <= LAST_EMBED_REGNUM)
return builtin_type_uint32;
else
{
@@ -694,6 +807,7 @@
else
return builtin_type_uint32;
}
+#endif
}
/* TARGET_READ_SP -- Remove useless bits from the stack pointer. */
@@ -1794,13 +1908,22 @@
/* Set a register's saved stack address in temp_saved_regs. If an
address has already been set for this register, do nothing; this
way we will only recognize the first save of a given register in a
- function prologue. */
+ function prologue.
+
+ For simplicity, save the address in both [0 .. NUM_REGS) and
+ [NUM_REGS .. 2*NUM_REGS). Strictly speaking, only the second range
+ is used as it is only second range (the ABI instead of ISA
+ registers) that comes into play when finding saved registers in a
+ frame. */
static void
set_reg_offset (CORE_ADDR *saved_regs, int regno, CORE_ADDR offset)
{
if (saved_regs[regno] == 0)
- saved_regs[regno] = offset;
+ {
+ saved_regs[regno + 0 * NUM_REGS] = offset;
+ saved_regs[regno + 1 * NUM_REGS] = offset;
+ }
}
@@ -4073,10 +4196,11 @@
mips_print_register (struct ui_file *file, struct frame_info *frame,
int regnum, int all)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
char raw_buffer[MAX_REGISTER_SIZE];
int offset;
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+ if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
{
mips_print_fp_register (file, frame, regnum);
return;
@@ -4105,8 +4229,7 @@
else
offset = 0;
- print_scalar_formatted (raw_buffer + offset,
- REGISTER_VIRTUAL_TYPE (regnum),
+ print_scalar_formatted (raw_buffer + offset, gdbarch_register_type (gdbarch, regnum),
'x', 0, file);
}
@@ -4130,6 +4253,7 @@
print_gp_register_row (struct ui_file *file, struct frame_info *frame,
int regnum)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
/* do values for GP (int) regs */
char raw_buffer[MAX_REGISTER_SIZE];
int ncols = (MIPS_REGSIZE == 8 ? 4 : 8); /* display cols per row */
@@ -4144,7 +4268,7 @@
{
if (*REGISTER_NAME (regnum) == '\0')
continue; /* unused register */
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+ if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
break; /* end the row: reached FP register */
fprintf_filtered (file, MIPS_REGSIZE == 8 ? "%17s" : "%9s",
REGISTER_NAME (regnum));
@@ -4160,7 +4284,7 @@
{
if (*REGISTER_NAME (regnum) == '\0')
continue; /* unused register */
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+ if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
break; /* end row: reached FP register */
/* OK: get the data in raw format. */
if (!frame_register_read (frame, regnum, raw_buffer))
@@ -4208,7 +4332,7 @@
regnum = 0;
while (regnum < NUM_REGS)
{
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+ if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
{
if (all) /* true for "INFO ALL-REGISTERS" command */
regnum = print_fp_register_row (file, frame, regnum);
@@ -5475,48 +5599,49 @@
}
-/* Convert a dbx stab register number (from `r' declaration) to a gdb
- REGNUM */
+/* Convert a dbx stab register number (from `r' declaration) to a GDB
+ [1 * NUM_REGS .. 2 * NUM_REGS) REGNUM. */
static int
mips_stab_reg_to_regnum (int num)
{
+ int regnum;
if (num >= 0 && num < 32)
- return num;
+ regnum = num;
else if (num >= 38 && num < 70)
- return num + FP0_REGNUM - 38;
+ regnum = num + FP0_REGNUM - 38;
else if (num == 70)
- return HI_REGNUM;
+ regnum = HI_REGNUM;
else if (num == 71)
- return LO_REGNUM;
+ regnum = LO_REGNUM;
else
- {
- /* This will hopefully (eventually) provoke a warning. Should
- we be calling complaint() here? */
- return NUM_REGS + NUM_PSEUDO_REGS;
- }
+ /* This will hopefully (eventually) provoke a warning. Should
+ we be calling complaint() here? */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+ return NUM_REGS + regnum;
}
-/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */
+/* Convert a dwarf, dwarf2, or ecoff register number to a GDB [1 *
+ NUM_REGS .. 2 * NUM_REGS) REGNUM. */
static int
mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num)
{
+ int regnum;
if (num >= 0 && num < 32)
- return num;
+ regnum = num;
else if (num >= 32 && num < 64)
- return num + FP0_REGNUM - 32;
+ regnum = num + FP0_REGNUM - 32;
else if (num == 64)
- return HI_REGNUM;
+ regnum = HI_REGNUM;
else if (num == 65)
- return LO_REGNUM;
+ regnum = LO_REGNUM;
else
- {
- /* This will hopefully (eventually) provoke a warning. Should
- we be calling complaint() here? */
- return NUM_REGS + NUM_PSEUDO_REGS;
- }
+ /* This will hopefully (eventually) provoke a warning. Should we
+ be calling complaint() here? */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+ return NUM_REGS + regnum;
}
@@ -5583,6 +5708,7 @@
struct gdbarch_tdep *tdep;
int elf_flags;
enum mips_abi mips_abi, found_abi, wanted_abi;
+ int num_regs;
/* Reset the disassembly info, in case it was set to something
non-default. */
@@ -5736,16 +5862,23 @@
set_gdbarch_double_bit (gdbarch, 64);
set_gdbarch_long_double_bit (gdbarch, 64);
set_gdbarch_deprecated_register_raw_size (gdbarch, mips_register_raw_size);
+ set_gdbarch_deprecated_register_byte (gdbarch, mips_register_byte);
+ set_gdbarch_register_reggroup_p (gdbarch, mips_register_reggroup_p);
+ set_gdbarch_pseudo_register_read (gdbarch, mips_pseudo_register_read);
+ set_gdbarch_pseudo_register_write (gdbarch, mips_pseudo_register_write);
tdep->found_abi = found_abi;
tdep->mips_abi = mips_abi;
set_gdbarch_elf_make_msymbol_special (gdbarch,
mips_elf_make_msymbol_special);
+
if (info.osabi == GDB_OSABI_IRIX)
- set_gdbarch_num_regs (gdbarch, 71);
+ num_regs = 71;
else
- set_gdbarch_num_regs (gdbarch, 90);
+ num_regs = 90;
+ set_gdbarch_num_regs (gdbarch, num_regs);
+ set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
switch (mips_abi)
{
@@ -5973,9 +6106,7 @@
set_gdbarch_function_start_offset (gdbarch, 0);
- /* There are MIPS targets which do not yet use this since they still
- define REGISTER_VIRTUAL_TYPE. */
- set_gdbarch_deprecated_register_virtual_type (gdbarch, mips_register_virtual_type);
+ set_gdbarch_register_type (gdbarch, mips_register_type);
set_gdbarch_print_registers_info (gdbarch, mips_print_registers_info);
set_gdbarch_pc_in_sigtramp (gdbarch, mips_pc_in_sigtramp);
Index: config/mips/tm-irix5.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-irix5.h,v
retrieving revision 1.10
diff -u -r1.10 tm-irix5.h
--- config/mips/tm-irix5.h 1 Jun 2003 15:45:57 -0000 1.10
+++ config/mips/tm-irix5.h 16 Jun 2003 15:21:51 -0000
@@ -30,16 +30,16 @@
* Irix 6 (n32 ABI) has 32-bit GP regs and 64-bit FP regs
*/
-#undef REGISTER_BYTE
-#define REGISTER_BYTE(N) \
+#undef MIPS_REGISTER_BYTE
+#define MIPS_REGISTER_BYTE(N) \
(((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \
((N) < FP0_REGNUM + 32) ? \
FP0_REGNUM * MIPS_REGSIZE + \
((N) - FP0_REGNUM) * sizeof(double) : \
32 * sizeof(double) + ((N) - 32) * MIPS_REGSIZE)
-#undef REGISTER_VIRTUAL_TYPE
-#define REGISTER_VIRTUAL_TYPE(N) \
+#undef MIPS_REGISTER_TYPE
+#define MIPS_REGISTER_TYPE(N) \
(((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_double \
: ((N) == 32 /*SR*/) ? builtin_type_uint32 \
: ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
Index: config/mips/tm-irix6.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-irix6.h,v
retrieving revision 1.13
diff -u -r1.13 tm-irix6.h
--- config/mips/tm-irix6.h 1 Jun 2003 15:45:57 -0000 1.13
+++ config/mips/tm-irix6.h 16 Jun 2003 15:21:51 -0000
@@ -62,8 +62,8 @@
#define FCRIR_REGNUM 70 /* FP implementation/revision */
-#undef REGISTER_BYTE
-#define REGISTER_BYTE(N) \
+#undef MIPS_REGISTER_BYTE
+#define MIPS_REGISTER_BYTE(N) \
(((N) < FP0_REGNUM) ? (N) * MIPS_REGSIZE : \
((N) < FP0_REGNUM + 32) ? \
FP0_REGNUM * MIPS_REGSIZE + \
@@ -94,4 +94,4 @@
#define SIGFRAME_REG_SIZE 8
/* Undefine those methods which have been multiarched. */
-#undef REGISTER_VIRTUAL_TYPE
+#undef MIPS_REGISTER_TYPE
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.50
diff -u -r1.50 tm-mips.h
--- config/mips/tm-mips.h 1 Jun 2003 15:45:57 -0000 1.50
+++ config/mips/tm-mips.h 16 Jun 2003 15:21:51 -0000
@@ -98,13 +98,13 @@
/* Index within `registers' of the first byte of the space for
register N. */
-#define REGISTER_BYTE(N) ((N) * MIPS_REGSIZE)
+#define MIPS_REGISTER_BYTE(N) ((N) * MIPS_REGSIZE)
/* Return the GDB type object for the "standard" data type of data in
register N. */
-#ifndef REGISTER_VIRTUAL_TYPE
-#define REGISTER_VIRTUAL_TYPE(N) \
+#ifndef MIPS_REGISTER_TYPE
+#define MIPS_REGISTER_TYPE(N) \
(((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_float \
: ((N) == 32 /*SR*/) ? builtin_type_uint32 \
: ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
Index: config/mips/tm-mips64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips64.h,v
retrieving revision 1.5
diff -u -r1.5 tm-mips64.h
--- config/mips/tm-mips64.h 5 Jun 2002 19:18:25 -0000 1.5
+++ config/mips/tm-mips64.h 16 Jun 2003 15:21:51 -0000
@@ -23,7 +23,7 @@
#define MIPS_REGSIZE 8
/* define 8 byte register type */
-#define REGISTER_VIRTUAL_TYPE(N) \
+#define MIPS_REGISTER_TYPE(N) \
(((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_double \
: ((N) == 32 /*SR*/) ? builtin_type_uint32 \
: ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-06-16 15:35 [patch rfc] Add NUM_REGS pseudo regs to MIPS Andrew Cagney
@ 2003-06-16 15:44 ` Daniel Jacobowitz
2003-06-18 4:32 ` Kevin Buettner
2003-06-21 18:22 ` Andrew Cagney
2 siblings, 0 replies; 13+ messages in thread
From: Daniel Jacobowitz @ 2003-06-16 15:44 UTC (permalink / raw)
To: gdb-patches
On Mon, Jun 16, 2003 at 11:35:26AM -0400, Andrew Cagney wrote:
> Hello,
>
> Per my last post to an old thread. This adds NUM_REGS pseudo registers
> to the MIPS. These pseudo registers, unlike their raw counterparts are
> `sane'. They have sensible sizes, offsets, types, ...
>
> The intent here is to put some distance between the MIPS's messed up raw
> register buffer and the ABI registers. As it stands, it doesn't get
> save/restore right (it works but not by using the ABI registers). That
> can follow.
>
> Tested on mips-elf.
>
> thoughts?
Looks reasonable... I'm not all that fond of it, but it's the best way
forward I've seen.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-06-16 15:35 [patch rfc] Add NUM_REGS pseudo regs to MIPS Andrew Cagney
2003-06-16 15:44 ` Daniel Jacobowitz
@ 2003-06-18 4:32 ` Kevin Buettner
2003-06-18 16:36 ` Andrew Cagney
2003-06-21 18:22 ` Andrew Cagney
2 siblings, 1 reply; 13+ messages in thread
From: Kevin Buettner @ 2003-06-18 4:32 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
On Jun 16, 11:35am, Andrew Cagney wrote:
> Per my last post to an old thread. This adds NUM_REGS pseudo registers
> to the MIPS. These pseudo registers, unlike their raw counterparts are
> `sane'. They have sensible sizes, offsets, types, ...
>
> The intent here is to put some distance between the MIPS's messed up raw
> register buffer and the ABI registers. As it stands, it doesn't get
> save/restore right (it works but not by using the ABI registers). That
> can follow.
>
> Tested on mips-elf.
>
> thoughts?
In light of the recent o32 ABI discussion, I believe the approach
that I used is correct for both the ABI / debug info case as well
as the cli registers case. I think you should reconsider my patch
before proceeding.
Kevin
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-06-18 4:32 ` Kevin Buettner
@ 2003-06-18 16:36 ` Andrew Cagney
2003-06-18 23:54 ` Kevin Buettner
0 siblings, 1 reply; 13+ messages in thread
From: Andrew Cagney @ 2003-06-18 16:36 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> On Jun 16, 11:35am, Andrew Cagney wrote:
>
>
>> Per my last post to an old thread. This adds NUM_REGS pseudo registers
>> to the MIPS. These pseudo registers, unlike their raw counterparts are
>> `sane'. They have sensible sizes, offsets, types, ...
>>
>> The intent here is to put some distance between the MIPS's messed up raw
>> register buffer and the ABI registers. As it stands, it doesn't get
>> save/restore right (it works but not by using the ABI registers). That
>> can follow.
>>
>> Tested on mips-elf.
>>
>> thoughts?
>
>
> In light of the recent o32 ABI discussion, I believe the approach
> that I used is correct for both the ABI / debug info case as well
> as the cli registers case. I think you should reconsider my patch
> before proceeding.
I'm constantly refering back to your original WIP patch. My current
take on those discussions, though, is that this part of that change:
@@ -1581,11 +1680,25 @@ mips_find_saved_regs (struct frame_info
for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1)
if (float_mask & 0x80000000)
{
- get_frame_saved_regs (fci)[FP0_REGNUM + ireg] = reg_position;
+ get_frame_saved_regs (fci)[raw_regnums->fp0_regnum + ireg]
+ = reg_position;
+
+ /* Now take care of the cooked register number. */
+ if (!FP_REGISTER_DOUBLE && MIPS_FPU_TYPE == MIPS_FPU_DOUBLE)
+ {
+ if ((ireg & 1) == 0)
+ get_frame_saved_regs (fci)[cooked_regnums->fp0_regnum + ireg / 2]
+ = reg_position;
+ }
+ else
+ get_frame_saved_regs (fci)[cooked_regnums->fp0_regnum + ireg]
+ = reg_position;
+
reg_position -= MIPS_SAVED_REGSIZE;
}
which lies at the core, is wrong. As I wrote:
> Ref: mips_find_saved_regs /float_mask/ at the end of the function.
> I believe that the debug info indicates that $f20/$f21 were both saved. The code comes with the comment:
>
> /* Apparently, the freg_offset gives the offset to the first 64
> bit saved.
>
> When the ABI specifies 64 bit saved registers, the FREG_OFFSET
> designates the first saved 64 bit register.
>
> When the ABI specifies 32 bit saved registers, the ``64 bit
> saved DOUBLE'' consists of two adjacent 32 bit registers, Hence
> FREG_OFFSET, designates the address of the lower register of
> the register pair. Adjust the offset so that it designates the
> upper register of the pair -- i.e., the address of the first
> saved 32 bit register. */
>
> Now, from the thread so far, it is clear that the comment is only partially correct. It should indicate that:
>
> On a big endian 32 bit ABI, the compiler spills floating-point registers as a pair and as a floating-point double. Because the target is big-endian, this leads to the register pair being stored in reverse order vis: $fN ||| $fN+1 are stored as $fN+1 and then $fN.
>
> The code doesn't do that, it gets the address of $fN correct, but $fN+1 is 8 bytes out. Outch!
>
> Given o32, GDB needs to track the location of the individual 32 bit floating point registers and not 64 bit FP pairs. By doing that, the code (mips_register_to_value):
>
> frame_read_register (frame, regnum + 0, (char *) to + 4);
> frame_read_register (frame, regnum + 1, (char *) to + 0);
>
> is able to correctly construct a double value for any frame.
Committing it will make, the already impossible task of getting the MIPS
frame code using the unwinders, even harder.
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-06-18 16:36 ` Andrew Cagney
@ 2003-06-18 23:54 ` Kevin Buettner
0 siblings, 0 replies; 13+ messages in thread
From: Kevin Buettner @ 2003-06-18 23:54 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Jun 18, 12:35pm, Andrew Cagney wrote:
> > On a big endian 32 bit ABI, the compiler spills floating-point
> > registers as a pair and as a floating-point double. Because the
> > target is big-endian, this leads to the register pair being stored
> > in reverse order vis: $fN ||| $fN+1 are stored as $fN+1 and then
> > $fN.
> >
> > The code doesn't do that, it gets the address of $fN correct, but
> > $fN+1 is 8 bytes out. Outch!
[...]
> Committing it will make, the already impossible task of getting the MIPS
> frame code using the unwinders, even harder.
Okay, I see what you mean. Proceed as you see fit.
(I'm going to step aside and let you handle the integration of whatever
portions of my patch that you wish to retain.)
Kevin
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-06-16 15:35 [patch rfc] Add NUM_REGS pseudo regs to MIPS Andrew Cagney
2003-06-16 15:44 ` Daniel Jacobowitz
2003-06-18 4:32 ` Kevin Buettner
@ 2003-06-21 18:22 ` Andrew Cagney
2 siblings, 0 replies; 13+ messages in thread
From: Andrew Cagney @ 2003-06-21 18:22 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
> Hello,
>
> Per my last post to an old thread. This adds NUM_REGS pseudo registers to the MIPS. These pseudo registers, unlike their raw counterparts are `sane'. They have sensible sizes, offsets, types, ...
>
> The intent here is to put some distance between the MIPS's messed up raw register buffer and the ABI registers. As it stands, it doesn't get save/restore right (it works but not by using the ABI registers). That can follow.
I've figured out why save/restore wasn't working. It's a cooked vs raw
thing - save the cooked registers but then manipulate the raw values.
Need to audit the code :-/
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
@ 2003-07-07 20:01 Steve Watt
2003-07-18 22:20 ` Andrew Cagney
0 siblings, 1 reply; 13+ messages in thread
From: Steve Watt @ 2003-07-07 20:01 UTC (permalink / raw)
To: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 6545 bytes --]
Andrew Cagney wrote:
> [ ... ] This adds NUM_REGS pseudo registers to the MIPS [ ... ]
OK, not a direct reply to your rfc, but it's in the right part of the
forest to be causing my problem, so...
I've built a Linux cross MIPS toolchain from a combined source tree,
checked out of the sources.redhat.com tree yesterday (6 July), and when
I attempt to do anything in the sim with the register set, I hit an
assert:
../../combined/gdb/mips-tdep.c:5669: internal-error: mips_register_sim_regno: Assertion `regnum >= 0 && regnum < NUM_REGS' failed.
Setting breakpoints and doing a nested gdb on the thing reveals that
it's trying to display register 90. The path there is kinda ugly,
but here's the trace into gdbarch_num_regs(), which is about to
return 90:
#0 gdbarch_num_regs (gdbarch=0x82fdc48) at ../../combined/gdb/gdbarch.c:3077
#1 0x080da346 in mips_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890,
frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4345
#2 0x080c9fb3 in gdbarch_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890,
frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/gdbarch.c:4007
#3 0x080b7e92 in registers_info (addr_exp=0x0, fpregs=0)
at ../../combined/gdb/infcmd.c:1620
#4 0x0807e526 in do_cfunc (c=0x82d32d8, args=0x0, from_tty=1)
at ../../combined/gdb/cli/cli-decode.c:53
#5 0x0807fd4e in cmd_func (cmd=0x82d32d8, args=0x0, from_tty=1)
at ../../combined/gdb/cli/cli-decode.c:1517
#6 0x0810e0e3 in execute_command (p=0x82c6d5e "", from_tty=1)
at ../../combined/gdb/top.c:716
#7 0x080c3a01 in command_handler (command=0x82c6d50 "info registers")
at ../../combined/gdb/event-top.c:500
#8 0x080c4041 in command_line_handler (rl=0x82c7030 " ¯\027@ ¯\027@isters")
at ../../combined/gdb/event-top.c:793
#9 0x081f426b in rl_callback_read_char () at ../../combined/readline/callback.c:123
#10 0x080c33ab in rl_callback_read_char_wrapper (client_data=0x0)
at ../../combined/gdb/event-top.c:166
#11 0x080c38e2 in stdin_event_handler (error=0, client_data=0x0)
at ../../combined/gdb/event-top.c:416
#12 0x080c2d10 in handle_file_event (event_file_desc=0)
at ../../combined/gdb/event-loop.c:721
#13 0x080c27dc in process_event () at ../../combined/gdb/event-loop.c:334
#14 0x080c2821 in gdb_do_one_event (data=0x0) at ../../combined/gdb/event-loop.c:371
#15 0x0810dd6a in do_catch_errors (uiout=0x82f4f48, data=0xbffff4c8)
at ../../combined/gdb/top.c:497
#16 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x82f4f48,
func_args=0xbffff4c8, func_val=0xbffff4c0, func_caught=0xbffff4c4,
errstring=0x8224580 "", mask=6) at ../../combined/gdb/top.c:429
#17 0x0810dda4 in catch_errors (func=0x80c27f8 <gdb_do_one_event>, func_args=0x0,
errstring=0x8224580 "", mask=6) at ../../combined/gdb/top.c:509
#18 0x080c285f in start_event_loop () at ../../combined/gdb/event-loop.c:422
#19 0x0807c547 in captured_command_loop (data=0x0) at ../../combined/gdb/main.c:97
#20 0x0810dd6a in do_catch_errors (uiout=0x82f4f48, data=0xbffff638)
at ../../combined/gdb/top.c:497
#21 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x82f4f48,
func_args=0xbffff638, func_val=0xbffff630, func_caught=0xbffff634,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:429
#22 0x0810dda4 in catch_errors (func=0x807c53c <captured_command_loop>, func_args=0x0,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:509
#23 0x0807d0eb in captured_main (data=0xbffff920) at ../../combined/gdb/main.c:811
#24 0x0810dd6a in do_catch_errors (uiout=0x829f6e0, data=0xbffff8d8)
at ../../combined/gdb/top.c:497
#25 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x829f6e0,
func_args=0xbffff8d8, func_val=0xbffff8d0, func_caught=0xbffff8d4,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:429
#26 0x0810dda4 in catch_errors (func=0x807c574 <captured_main>, func_args=0xbffff920,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:509
#27 0x0807d113 in gdb_main (args=0xbffff920) at ../../combined/gdb/main.c:820
#28 0x0807c539 in main (argc=2, argv=0xbffff9ac) at ../../combined/gdb/gdb.c:35
#29 0x4006e177 in __libc_start_main (main=0x807c510 <main>, argc=2, ubp_av=0xbffff9ac,
init=0x807b874 <_init>, fini=0x82073c0 <_fini>, rtld_fini=0x4000e184 <_dl_fini>,
stack_end=0xbffff99c) at ../sysdeps/generic/libc-start.c:129
Here's what the gdbarch structure looks like (well, the first bits, anyhow):
(top-gdb) print gdbarch
$8 = (struct gdbarch *) 0x82fdc48
(top-gdb) print *gdbarch
$9 = {initialized_p = 1, bfd_arch_info = 0x8286740, byte_order = 0,
osabi = GDB_OSABI_UNKNOWN, tdep = 0x82fdc18, dump_tdep = 0x80dcc9c <mips_dump_tdep>,
nr_data = 6, data = 0x82fded0, swap = 0x82fdef0, short_bit = 16, int_bit = 32,
long_bit = 32, long_long_bit = 64, float_bit = 32, double_bit = 64,
long_double_bit = 64, ptr_bit = 32, addr_bit = 32, bfd_vma_bit = 32, char_signed = 1,
read_pc = 0x80d53c8 <mips_read_pc>, write_pc = 0x8095214 <generic_target_write_pc>,
read_sp = 0x80d5204 <mips_read_sp>,
virtual_frame_pointer = 0x80ce958 <legacy_virtual_frame_pointer>,
pseudo_register_read = 0x80d4aec <mips_pseudo_register_read>,
pseudo_register_write = 0x80d4b78 <mips_pseudo_register_write>, num_regs = 90,
num_pseudo_regs = 90, sp_regnum = -1, pc_regnum = -1, ps_regnum = -1, fp0_regnum = -1,
npc_regnum = -1, stab_reg_to_regnum = 0x80dbda4 <mips_stab_reg_to_regnum>,
ecoff_reg_to_regnum = 0x80dbe0c <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
dwarf_reg_to_regnum = 0x80dbe0c <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
sdb_reg_to_regnum = 0x80ce8a4 <no_op_reg_to_regnum>,
dwarf2_reg_to_regnum = 0x80dbe0c <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
register_name = 0x80d48ec <mips_register_name>,
register_type = 0x80d5178 <mips_register_type>, deprecated_register_virtual_type = 0,
[ etc etc ]
Being rather weak in gdb-fu, I thought I'd defer to an expert. Or at least someone
who's generated patches in the vicinity.
If you'd like me to try some other stuff or provide more data, that can easily
be arranged.
(I'm not subscribed to gdb-patches, please cc.)
Thanks,
--
Steve Watt KD6GGD PP-ASEL-IA Email at home: steve@watt.com
Chelsio Communications http://www.chelsio.com/ work: steve@chelsio.com
510 N. Pastoria Ave Voice: +1 408 962 3627
Sunnyvale, CA, USA, 94085 Fax: +1 408 730 2580
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-07-07 20:01 Steve Watt
@ 2003-07-18 22:20 ` Andrew Cagney
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Cagney @ 2003-07-18 22:20 UTC (permalink / raw)
To: Steve Watt; +Cc: gdb-patches
> Andrew Cagney wrote:
>
>> [ ... ] This adds NUM_REGS pseudo registers to the MIPS [ ... ]
>
>
> OK, not a direct reply to your rfc, but it's in the right part of the
> forest to be causing my problem, so...
>
> I've built a Linux cross MIPS toolchain from a combined source tree,
> checked out of the sources.redhat.com tree yesterday (6 July), and when
> I attempt to do anything in the sim with the register set, I hit an
> assert:
>
> ../../combined/gdb/mips-tdep.c:5669: internal-error: mips_register_sim_regno: Assertion `regnum >= 0 && regnum < NUM_REGS' failed.
>
> Setting breakpoints and doing a nested gdb on the thing reveals that
> it's trying to display register 90. The path there is kinda ugly,
> but here's the trace into gdbarch_num_regs(), which is about to
> return 90:
Ok, I can see what is happening, but not why.
For some reason mips_register_sim_regno is being called with a pseudo
register value. I think that is just wrong.
mips_pseudo_register_read/write should have converted that pseudo into a
raw :-/
Unfortunatly the below backtrace doesn't explain why (notice how
mips_register_sim_regno doesn't appear?). Run the gdb and when it
internal errors, let it drop a core file, and then run gdb on that vis:
gdb mips-linux-gnu-gdb core. Otherwize run gdb on gdb and set the
breakpoint on `internal_error'.
Andrew
> #0 gdbarch_num_regs (gdbarch=0x82fdc48) at ../../combined/gdb/gdbarch.c:3077
> #1 0x080da346 in mips_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890,
> frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4345
> #2 0x080c9fb3 in gdbarch_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890,
> frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/gdbarch.c:4007
> #3 0x080b7e92 in registers_info (addr_exp=0x0, fpregs=0)
> at ../../combined/gdb/infcmd.c:1620
> Here's what the gdbarch structure looks like (well, the first bits, anyhow):
>
> (top-gdb) print gdbarch
> $8 = (struct gdbarch *) 0x82fdc48
> (top-gdb) print *gdbarch
> $9 = {initialized_p = 1, bfd_arch_info = 0x8286740, byte_order = 0,
> osabi = GDB_OSABI_UNKNOWN, tdep = 0x82fdc18, dump_tdep = 0x80dcc9c <mips_dump_tdep>,
> nr_data = 6, data = 0x82fded0, swap = 0x82fdef0, short_bit = 16, int_bit = 32,
> long_bit = 32, long_long_bit = 64, float_bit = 32, double_bit = 64,
> long_double_bit = 64, ptr_bit = 32, addr_bit = 32, bfd_vma_bit = 32, char_signed = 1,
> read_pc = 0x80d53c8 <mips_read_pc>, write_pc = 0x8095214 <generic_target_write_pc>,
> read_sp = 0x80d5204 <mips_read_sp>,
> virtual_frame_pointer = 0x80ce958 <legacy_virtual_frame_pointer>,
> pseudo_register_read = 0x80d4aec <mips_pseudo_register_read>,
> pseudo_register_write = 0x80d4b78 <mips_pseudo_register_write>, num_regs = 90,
> num_pseudo_regs = 90, sp_regnum = -1, pc_regnum = -1, ps_regnum = -1, fp0_regnum = -1,
> npc_regnum = -1, stab_reg_to_regnum = 0x80dbda4 <mips_stab_reg_to_regnum>,
> ecoff_reg_to_regnum = 0x80dbe0c <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
> dwarf_reg_to_regnum = 0x80dbe0c <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
> sdb_reg_to_regnum = 0x80ce8a4 <no_op_reg_to_regnum>,
> dwarf2_reg_to_regnum = 0x80dbe0c <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
> register_name = 0x80d48ec <mips_register_name>,
> register_type = 0x80d5178 <mips_register_type>, deprecated_register_virtual_type = 0,
> [ etc etc ]
>
> Being rather weak in gdb-fu, I thought I'd defer to an expert. Or at least someone
> who's generated patches in the vicinity.
>
> If you'd like me to try some other stuff or provide more data, that can easily
> be arranged.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
@ 2003-07-19 0:13 Steve Watt
2003-07-21 15:26 ` Andrew Cagney
0 siblings, 1 reply; 13+ messages in thread
From: Steve Watt @ 2003-07-19 0:13 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 12059 bytes --]
On Jul 18, 18:20, Andrew Cagney wrote:
} Subject: Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
} > Andrew Cagney wrote:
} >
} >> [ ... ] This adds NUM_REGS pseudo registers to the MIPS [ ... ]
} >
} >
} > OK, not a direct reply to your rfc, but it's in the right part of the
} > forest to be causing my problem, so...
} >
} > I've built a Linux cross MIPS toolchain from a combined source tree,
} > checked out of the sources.redhat.com tree yesterday (6 July), and when
} > I attempt to do anything in the sim with the register set, I hit an
} > assert:
} >
} > ../../combined/gdb/mips-tdep.c:5669: internal-error: mips_register_sim_regno: Assertion `regnum >= 0 && regnum < NUM_REGS' failed.
} >
} > Setting breakpoints and doing a nested gdb on the thing reveals that
} > it's trying to display register 90. The path there is kinda ugly,
} > but here's the trace into gdbarch_num_regs(), which is about to
} > return 90:
}
} Ok, I can see what is happening, but not why.
}
} For some reason mips_register_sim_regno is being called with a pseudo
} register value. I think that is just wrong.
} mips_pseudo_register_read/write should have converted that pseudo into a
} raw :-/
}
} Unfortunatly the below backtrace doesn't explain why (notice how
} mips_register_sim_regno doesn't appear?). Run the gdb and when it
} internal errors, let it drop a core file, and then run gdb on that vis:
} gdb mips-linux-gnu-gdb core. Otherwize run gdb on gdb and set the
} breakpoint on `internal_error'.
Whoops, sorry 'bout that. Trying to troubleshoot it, set the trap, but
didn't show my original data. Bad hacker, no cookie.
[ old backtrace removed ]
The whole gory thing, take 2:
(steve@mustang) 382> gdb ./gdb
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x811034a: file ../../combined/gdb/utils.c, line 807.
Breakpoint 2 at 0x8081416: file ../../combined/gdb/cli/cli-cmds.c, line 191.
(top-gdb) run /users/steve/tmp/t/hello.mips
Starting program: /users/steve/gnu-toolchain/build.mips/gdb/./gdb /users/steve/tmp/t/hello.mips
GNU gdb 2003-07-07-cvs
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=mips-elf"...
Setting up the environment for debugging gdb.
.gdbinit:5: Error in sourced command file:
Function "internal_error" not defined.
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .text, size 0x15cc vma 0xa0020000
Loading section .init, size 0x38 vma 0xa00215cc
Loading section .fini, size 0x28 vma 0xa0021604
Loading section .sdata, size 0x18 vma 0xa0021dd8
Loading section .ctors, size 0x8 vma 0xa002162c
Loading section .dtors, size 0x8 vma 0xa0021634
Loading section .eh_frame, size 0x4 vma 0xa002163c
Loading section .data, size 0x790 vma 0xa0021640
Loading section .jcr, size 0x4 vma 0xa0021dd0
Start address 0xa0020004
Transfer rate: 61280 bits in <1 sec.
(gdb) break _start
Breakpoint 1 at 0xa0020004: file ../../../../combined/libgloss/mips/crt0.S, line 74.
(gdb) run
Starting program: /users/steve/tmp/t/hello.mips
Breakpoint 1, _start () at ../../../../combined/libgloss/mips/crt0.S:74
74 li v0, STATUS_MASK
Current language: auto; currently asm
(gdb) info registers
zero at v0 v1 a0 a1 a2 a3
Breakpoint 1, internal_error (file=0x82353a0 "../../combined/gdb/mips-tdep.c",
line=5669, string=0x8235375 "%s: Assertion `%s' failed.")
at ../../combined/gdb/utils.c:807
807 va_start (ap, string);
(top-gdb) info stack
#0 internal_error (file=0x82353a0 "../../combined/gdb/mips-tdep.c", line=5669,
string=0x8235375 "%s: Assertion `%s' failed.") at ../../combined/gdb/utils.c:807
#1 0x080dbeb6 in mips_register_sim_regno (regnum=90)
at ../../combined/gdb/mips-tdep.c:5669
#2 0x080ca201 in gdbarch_register_sim_regno (gdbarch=0x82fdc48, reg_nr=90)
at ../../combined/gdb/gdbarch.c:4078
#3 0x08125173 in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
#4 0x08093e0b in legacy_read_register_gen (regnum=90,
myaddr=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ")
at ../../combined/gdb/regcache.c:727
#5 0x08113891 in frame_register_unwind (frame=0x82e0f40, regnum=90,
optimizedp=0xbffff0e8, lvalp=0xbffff0ec, addrp=0xbffff0f0, realnump=0xbffff014,
bufferp=0xbffff140) at ../../combined/gdb/frame.c:534
#6 0x080dbd82 in mips_get_saved_register (
raw_buffer=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ", optimizedp=0xbffff0e8,
addrp=0xbffff0f0, frame=0x82e0f40, regnum=90, lvalp=0xbffff0ec)
at ../../combined/gdb/mips-tdep.c:5603
#7 0x080ca968 in gdbarch_deprecated_get_saved_register (gdbarch=0x82fdc48,
raw_buffer=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ", optimized=0xbffff0e8,
addrp=0xbffff0f0, frame=0x82e0f40, regnum=90, lval=0xbffff0ec)
at ../../combined/gdb/gdbarch.c:4305
#8 0x08113aad in frame_register (frame=0x82e0f40, regnum=90, optimizedp=0xbffff0e8,
lvalp=0xbffff0ec, addrp=0xbffff0f0, realnump=0xbffff0fc, bufferp=0xbffff140)
at ../../combined/gdb/frame.c:577
#9 0x08113ee6 in frame_register_read (frame=0x82e0f40, regnum=90, myaddr=0xbffff140)
at ../../combined/gdb/frame.c:755
#10 0x080da110 in print_gp_register_row (file=0x82fc890, frame=0x82e0f40,
start_regnum=90) at ../../combined/gdb/mips-tdep.c:4302
#11 0x080da389 in mips_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890,
frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4356
#12 0x080c9fb3 in gdbarch_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890,
frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/gdbarch.c:4007
#13 0x080b7e92 in registers_info (addr_exp=0x0, fpregs=0)
at ../../combined/gdb/infcmd.c:1620
#14 0x0807e526 in do_cfunc (c=0x82d32d8, args=0x0, from_tty=1)
at ../../combined/gdb/cli/cli-decode.c:53
#15 0x0807fd4e in cmd_func (cmd=0x82d32d8, args=0x0, from_tty=1)
at ../../combined/gdb/cli/cli-decode.c:1517
#16 0x0810e0e3 in execute_command (p=0x82c6d5e "", from_tty=1)
at ../../combined/gdb/top.c:716
#17 0x080c3a01 in command_handler (command=0x82c6d50 "info registers")
at ../../combined/gdb/event-top.c:500
#18 0x080c4041 in command_line_handler (rl=0x8339e60 "info registers")
at ../../combined/gdb/event-top.c:793
#19 0x081f426b in rl_callback_read_char () at ../../combined/readline/callback.c:123
#20 0x080c33ab in rl_callback_read_char_wrapper (client_data=0x0)
at ../../combined/gdb/event-top.c:166
#21 0x080c38e2 in stdin_event_handler (error=0, client_data=0x0)
at ../../combined/gdb/event-top.c:416
#22 0x080c2d10 in handle_file_event (event_file_desc=0)
at ../../combined/gdb/event-loop.c:721
#23 0x080c27dc in process_event () at ../../combined/gdb/event-loop.c:334
#24 0x080c2821 in gdb_do_one_event (data=0x0) at ../../combined/gdb/event-loop.c:371
#25 0x0810dd6a in do_catch_errors (uiout=0x82f4f48, data=0xbffff4c8)
at ../../combined/gdb/top.c:497
#26 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x82f4f48,
func_args=0xbffff4c8, func_val=0xbffff4c0, func_caught=0xbffff4c4,
errstring=0x8224580 "", mask=6) at ../../combined/gdb/top.c:429
#27 0x0810dda4 in catch_errors (func=0x80c27f8 <gdb_do_one_event>, func_args=0x0,
errstring=0x8224580 "", mask=6) at ../../combined/gdb/top.c:509
#28 0x080c285f in start_event_loop () at ../../combined/gdb/event-loop.c:422
#29 0x0807c547 in captured_command_loop (data=0x0) at ../../combined/gdb/main.c:97
#30 0x0810dd6a in do_catch_errors (uiout=0x82f4f48, data=0xbffff638)
at ../../combined/gdb/top.c:497
#31 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x82f4f48,
func_args=0xbffff638, func_val=0xbffff630, func_caught=0xbffff634,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:429
#32 0x0810dda4 in catch_errors (func=0x807c53c <captured_command_loop>, func_args=0x0,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:509
#33 0x0807d0eb in captured_main (data=0xbffff920) at ../../combined/gdb/main.c:811
#34 0x0810dd6a in do_catch_errors (uiout=0x829f6e0, data=0xbffff8d8)
at ../../combined/gdb/top.c:497
#35 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x829f6e0,
func_args=0xbffff8d8, func_val=0xbffff8d0, func_caught=0xbffff8d4,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:429
#36 0x0810dda4 in catch_errors (func=0x807c574 <captured_main>, func_args=0xbffff920,
errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:509
#37 0x0807d113 in gdb_main (args=0xbffff920) at ../../combined/gdb/main.c:820
#38 0x0807c539 in main (argc=2, argv=0xbffff9ac) at ../../combined/gdb/gdb.c:35
#39 0x4006e177 in __libc_start_main (main=0x807c510 <main>, argc=2, ubp_av=0xbffff9ac,
init=0x807b874 <_init>, fini=0x82073c0 <_fini>, rtld_fini=0x4000e184 <_dl_fini>,
stack_end=0xbffff99c) at ../sysdeps/generic/libc-start.c:129
(top-gdb) up 9
#9 0x08113ee6 in frame_register_read (frame=0x82e0f40, regnum=90, myaddr=0xbffff140)
at ../../combined/gdb/frame.c:755
755 frame_register (frame, regnum, &optimized, &lval, &addr, &realnum, myaddr);
(top-gdb) list
750 {
751 int optimized;
752 enum lval_type lval;
753 CORE_ADDR addr;
754 int realnum;
755 frame_register (frame, regnum, &optimized, &lval, &addr, &realnum, myaddr);
756
757 /* FIXME: cagney/2002-05-15: This test, is just bogus.
758
759 It indicates that the target failed to supply a value for a
(top-gdb) up
#10 0x080da110 in print_gp_register_row (file=0x82fc890, frame=0x82e0f40,
start_regnum=90) at ../../combined/gdb/mips-tdep.c:4302
4302 if (!frame_register_read (frame, regnum, raw_buffer))
(top-gdb) list
4297 if (*REGISTER_NAME (regnum) == '\0')
4298 continue; /* unused register */
4299 if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
4300 break; /* end row: reached FP register */
4301 /* OK: get the data in raw format. */
4302 if (!frame_register_read (frame, regnum, raw_buffer))
4303 error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
4304 /* pad small registers */
4305 for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++)
4306 printf_filtered (" ");
(top-gdb) up
#11 0x080da389 in mips_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890,
frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4356
4356 regnum = print_gp_register_row (file, frame, regnum);
(top-gdb) list
4351 regnum = print_fp_register_row (file, frame, regnum);
4352 else
4353 regnum += MIPS_NUMREGS; /* skip floating point regs */
4354 }
4355 else
4356 regnum = print_gp_register_row (file, frame, regnum);
4357 }
4358 }
4359 }
4360
Puzzled,
--
Steve Watt KD6GGD PP-ASEL-IA Email at home: steve@watt.com
Chelsio Communications http://www.chelsio.com/ work: steve@chelsio.com
510 N. Pastoria Ave Voice: +1 408 962 3627
Sunnyvale, CA, USA, 94085 Fax: +1 408 730 2580
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-07-19 0:13 Steve Watt
@ 2003-07-21 15:26 ` Andrew Cagney
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Cagney @ 2003-07-21 15:26 UTC (permalink / raw)
To: Steve Watt; +Cc: gdb-patches
Sigh. Something in the backtrace is still amiss.
> #2 0x080ca201 in gdbarch_register_sim_regno (gdbarch=0x82fdc48, reg_nr=90)
> at ../../combined/gdb/gdbarch.c:4078
> #3 0x08125173 in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
> #4 0x08093e0b in legacy_read_register_gen (regnum=90,
> myaddr=0xbffff140 " ñÿ¿HÃ/\bhñÿ¿î\211\f\bHÃ/\bZ")
> at ../../combined/gdb/regcache.c:727
As far as I can tell, frame_register_unwind doesn't call
legacy_read_register_gen.
> #5 0x08113891 in frame_register_unwind (frame=0x82e0f40, regnum=90,
> optimizedp=0xbffff0e8, lvalp=0xbffff0ec, addrp=0xbffff0f0, realnump=0xbffff014,
> bufferp=0xbffff140) at ../../combined/gdb/frame.c:534
> #6 0x080dbd82 in mips_get_saved_register (
> raw_buffer=0xbffff140 " ñÿ¿HÃ/\bhñÿ¿î\211\f\bHÃ/\bZ", optimizedp=0xbffff0e8,
> addrp=0xbffff0f0, frame=0x82e0f40, regnum=90, lvalp=0xbffff0ec)
> at ../../combined/gdb/mips-tdep.c:5603
I suspect some agressive tail-call optimization by GCC is involved. Can
you update your sources (so that we both have the same code) and then
configure/build gdb using:
CFLAGS="-O -g" .../configure ....
so that -O2 is disabled (or at least should be).
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
@ 2003-07-21 18:20 Steve Watt
2003-07-21 22:38 ` Andrew Cagney
0 siblings, 1 reply; 13+ messages in thread
From: Steve Watt @ 2003-07-21 18:20 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 28332 bytes --]
On Jul 21, 11:26, Andrew Cagney wrote:
} Subject: Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
} Sigh. Something in the backtrace is still amiss.
}
}
} > #2 0x080ca201 in gdbarch_register_sim_regno (gdbarch=0x82fdc48, reg_nr=90)
} > at ../../combined/gdb/gdbarch.c:4078
} > #3 0x08125173 in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
} > #4 0x08093e0b in legacy_read_register_gen (regnum=90,
} > myaddr=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ")
} > at ../../combined/gdb/regcache.c:727
}
} As far as I can tell, frame_register_unwind doesn't call
} legacy_read_register_gen.
}
} > #5 0x08113891 in frame_register_unwind (frame=0x82e0f40, regnum=90,
} > optimizedp=0xbffff0e8, lvalp=0xbffff0ec, addrp=0xbffff0f0, realnump=0xbffff014,
} > bufferp=0xbffff140) at ../../combined/gdb/frame.c:534
} > #6 0x080dbd82 in mips_get_saved_register (
} > raw_buffer=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ", optimizedp=0xbffff0e8,
} > addrp=0xbffff0f0, frame=0x82e0f40, regnum=90, lvalp=0xbffff0ec)
} > at ../../combined/gdb/mips-tdep.c:5603
}
} I suspect some agressive tail-call optimization by GCC is involved. Can
} you update your sources (so that we both have the same code) and then
} configure/build gdb using:
}
} CFLAGS="-O -g" .../configure ....
}
} so that -O2 is disabled (or at least should be).
OK... cvs as of about 9:30PDT 21 July. Confirmed that the GDB build
was only -O -g, though some other things (newlib, mostly) got -O2.
That was quite a tail-call optimization -- looks like 3 frames
vanished. I'm a little worried about a warning I got in this
backtrace from top-gdb:
During symbol reading, debug info mismatch between compiler and debugger.
The top gdb and gcc came from RedHat 7.1. I suppose I could build a
new host gcc and gdb, but that seems like a fair amount of pain.
Anyway, here's the trace, along with a bunch of "up; list" to make sure
everything's sane looking:
(steve@mustang) 434> gdb ./gdb
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x811292a: file ../../combined/gdb/utils.c, line 807.
Breakpoint 2 at 0x80815fa: file ../../combined/gdb/cli/cli-cmds.c, line 191.
(top-gdb) run /users/steve/tmp/t/hello.mips
Starting program: /users/steve/gnu-toolchain/build.mips/gdb/./gdb /users/steve/tmp/t/hello.mips
GNU gdb 2003-07-21-cvs
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=mips-elf"...
Setting up the environment for debugging gdb.
.gdbinit:5: Error in sourced command file:
Function "internal_error" not defined.
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .text, size 0x150c vma 0xa0020000
Loading section .init, size 0x38 vma 0xa002150c
Loading section .fini, size 0x28 vma 0xa0021544
Loading section .sdata, size 0x14 vma 0xa0021d20
Loading section .ctors, size 0x8 vma 0xa002156c
Loading section .dtors, size 0x8 vma 0xa0021574
Loading section .rodata, size 0x2 vma 0xa002157c
Loading section .eh_frame, size 0x4 vma 0xa0021580
Loading section .data, size 0x790 vma 0xa0021588
Loading section .jcr, size 0x4 vma 0xa0021d18
Start address 0xa0020004
Transfer rate: 59728 bits in <1 sec.
(gdb) break _start
Breakpoint 1 at 0xa0020004: file ../../../../combined/libgloss/mips/crt0.S, line 74.
(gdb) run
Starting program: /users/steve/tmp/t/hello.mips
Breakpoint 1, _start () at ../../../../combined/libgloss/mips/crt0.S:74
74 li v0, STATUS_MASK
Current language: auto; currently asm
(gdb) info reg
zero at v0 v1 a0 a1 a2 a3
Breakpoint 1, internal_error (file=0x824e580 "../../combined/gdb/mips-tdep.c",
line=5671, string=0x824e555 "%s: Assertion `%s' failed.")
at ../../combined/gdb/utils.c:807
807 va_start (ap, string);
(top-gdb) info stack
#0 internal_error (file=0x824e580 "../../combined/gdb/mips-tdep.c", line=5671,
string=0x824e555 "%s: Assertion `%s' failed.") at ../../combined/gdb/utils.c:807
#1 0x080dd45c in mips_register_sim_regno (regnum=90)
at ../../combined/gdb/mips-tdep.c:5671
#2 0x080cb037 in gdbarch_register_sim_regno (gdbarch=0x83179d8, reg_nr=90)
at ../../combined/gdb/gdbarch.c:3983
#3 0x08127e0f in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
#4 0x08094450 in legacy_read_register_gen (regnum=90,
myaddr=0xbffff0f0 "Ððÿ¿Øy1\b\030ñÿ¿\020\227\f\bØy1\bZ")
at ../../combined/gdb/regcache.c:730
#5 0x0809453e in regcache_raw_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
at ../../combined/gdb/regcache.c:748
#6 0x0809499a in regcache_cooked_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
at ../../combined/gdb/regcache.c:838
#7 0x081553ef in sentinel_frame_prev_register (next_frame=0x82faca8,
this_prologue_cache=0x82facbc, regnum=90, optimized=0xbffff098, lvalp=0xbffff09c,
addrp=0xbffff0a0, realnum=0xbfffefd4, bufferp=0xbffff0f0)
at ../../combined/gdb/sentinel-frame.c:69
#8 0x0811622b in frame_register_unwind (frame=0x82faca8, regnum=90,
optimizedp=0xbffff098, lvalp=0xbffff09c, addrp=0xbffff0a0, realnump=0xbfffefd4,
bufferp=0xbffff0f0) at ../../combined/gdb/frame.c:532
#9 0x080dd324 in mips_get_saved_register (
raw_buffer=0xbffff0f0 "Ððÿ¿Øy1\b\030ñÿ¿\020\227\f\bØy1\bZ", optimizedp=0xbffff098,
addrp=0xbffff0a0, frame=0x82faca8, regnum=90, lvalp=0xbffff09c)
at ../../combined/gdb/mips-tdep.c:5605
#10 0x080cb7f6 in gdbarch_deprecated_get_saved_register (gdbarch=0x83179d8,
raw_buffer=0xbffff0f0 "Ððÿ¿Øy1\b\030ñÿ¿\020\227\f\bØy1\bZ", optimized=0xbffff098,
addrp=0xbffff0a0, frame=0x82faca8, regnum=90, lval=0xbffff09c)
at ../../combined/gdb/gdbarch.c:4194
#11 0x08116433 in frame_register (frame=0x82faca8, regnum=90, optimizedp=0xbffff098,
lvalp=0xbffff09c, addrp=0xbffff0a0, realnump=0xbffff0ac, bufferp=0xbffff0f0)
at ../../combined/gdb/frame.c:575
#12 0x08116846 in frame_register_read (frame=0x82faca8, regnum=90, myaddr=0xbffff0f0)
at ../../combined/gdb/frame.c:753
#13 0x080db5e6 in print_gp_register_row (file=0x8316608, frame=0x82faca8,
start_regnum=90) at ../../combined/gdb/mips-tdep.c:4304
#14 0x080db857 in mips_print_registers_info (gdbarch=0x83179d8, file=0x8316608,
frame=0x82faca8, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4358
#15 0x080cadc5 in gdbarch_print_registers_info (gdbarch=0x83179d8, file=0x8316608,
frame=0x82faca8, regnum=-1, all=0) at ../../combined/gdb/gdbarch.c:3918
#16 0x080b892b in registers_info (addr_exp=0x0, fpregs=0)
at ../../combined/gdb/infcmd.c:1620
#17 0x080b8b48 in nofp_registers_info (addr_exp=0x0, from_tty=1)
at ../../combined/gdb/infcmd.c:1720
#18 0x0807e5d2 in do_cfunc (c=0x82ed018, args=0x0, from_tty=1)
at ../../combined/gdb/cli/cli-decode.c:53
#19 0x0807fed0 in cmd_func (cmd=0x82ed018, args=0x0, from_tty=1)
at ../../combined/gdb/cli/cli-decode.c:1517
#20 0x081105e4 in execute_command (p=0x82e0a98 "", from_tty=1)
at ../../combined/gdb/top.c:716
#21 0x080c4602 in command_handler (command=0x82e0a90 "info reg")
at ../../combined/gdb/event-top.c:500
#22 0x080c4c48 in command_line_handler (rl=0x835fe40 "info reg")
at ../../combined/gdb/event-top.c:793
During symbol reading, debug info mismatch between compiler and debugger.
#23 0x0820d1e2 in rl_callback_read_char () at ../../combined/readline/callback.c:123
#24 0x080c3f37 in rl_callback_read_char_wrapper (client_data=0x0)
at ../../combined/gdb/event-top.c:166
#25 0x080c44d8 in stdin_event_handler (error=0, client_data=0x0)
at ../../combined/gdb/event-top.c:416
---Type <return> to continue, or q <return> to quit---
#26 0x080c38aa in handle_file_event (event_file_desc=0)
at ../../combined/gdb/event-loop.c:721
#27 0x080c3382 in process_event () at ../../combined/gdb/event-loop.c:334
#28 0x080c33c1 in gdb_do_one_event (data=0x0) at ../../combined/gdb/event-loop.c:371
#29 0x08110276 in do_catch_errors (uiout=0x830ecb0, data=0xbffff498)
at ../../combined/gdb/top.c:497
#30 0x0811014e in catcher (func=0x8110268 <do_catch_errors>, func_uiout=0x830ecb0,
func_args=0xbffff498, func_val=0xbffff490, func_caught=0xbffff494,
errstring=0x823dba0 "", mask=6) at ../../combined/gdb/top.c:429
#31 0x081102b0 in catch_errors (func=0x80c3398 <gdb_do_one_event>, func_args=0x0,
errstring=0x823dba0 "", mask=6) at ../../combined/gdb/top.c:509
#32 0x080c33e3 in start_event_loop () at ../../combined/gdb/event-loop.c:397
#33 0x080c401e in cli_command_loop () at ../../combined/gdb/event-top.c:198
#34 0x080c2e5e in current_interp_command_loop () at ../../combined/gdb/interps.c:279
#35 0x0807c5f7 in captured_command_loop (data=0x0) at ../../combined/gdb/main.c:97
#36 0x08110276 in do_catch_errors (uiout=0x830ecb0, data=0xbffff638)
at ../../combined/gdb/top.c:497
#37 0x0811014e in catcher (func=0x8110268 <do_catch_errors>, func_uiout=0x830ecb0,
func_args=0xbffff638, func_val=0xbffff630, func_caught=0xbffff634,
errstring=0x8220a20 "", mask=6) at ../../combined/gdb/top.c:429
#38 0x081102b0 in catch_errors (func=0x807c5ec <captured_command_loop>, func_args=0x0,
errstring=0x8220a20 "", mask=6) at ../../combined/gdb/top.c:509
#39 0x0807d1c7 in captured_main (data=0xbffff920) at ../../combined/gdb/main.c:811
#40 0x08110276 in do_catch_errors (uiout=0x82b9420, data=0xbffff8d8)
at ../../combined/gdb/top.c:497
#41 0x0811014e in catcher (func=0x8110268 <do_catch_errors>, func_uiout=0x82b9420,
func_args=0xbffff8d8, func_val=0xbffff8d0, func_caught=0xbffff8d4,
errstring=0x8220a20 "", mask=6) at ../../combined/gdb/top.c:429
#42 0x081102b0 in catch_errors (func=0x807c628 <captured_main>, func_args=0xbffff920,
errstring=0x8220a20 "", mask=6) at ../../combined/gdb/top.c:509
#43 0x0807d1ef in gdb_main (args=0xbffff920) at ../../combined/gdb/main.c:820
#44 0x0807c5e9 in main (argc=2, argv=0xbffff9ac) at ../../combined/gdb/gdb.c:35
#45 0x4006e177 in __libc_start_main (main=0x807c5c0 <main>, argc=2, ubp_av=0xbffff9ac,
init=0x807b91c <_init>, fini=0x82209d0 <_fini>, rtld_fini=0x4000e184 <_dl_fini>,
stack_end=0xbffff99c) at ../sysdeps/generic/libc-start.c:129
(top-gdb) up
#1 0x080dd45c in mips_register_sim_regno (regnum=90)
at ../../combined/gdb/mips-tdep.c:5671
5671 gdb_assert (regnum >= 0 && regnum < NUM_REGS);
(top-gdb) list
5666
5667 static int
5668 mips_register_sim_regno (int regnum)
5669 {
5670 /* Only makes sense to supply raw registers. */
5671 gdb_assert (regnum >= 0 && regnum < NUM_REGS);
5672 /* FIXME: cagney/2002-05-13: Need to look at the pseudo register to
5673 decide if it is valid. Should instead define a standard sim/gdb
5674 register numbering scheme. */
5675 if (REGISTER_NAME (NUM_REGS + regnum) != NULL
(top-gdb) up
#2 0x080cb037 in gdbarch_register_sim_regno (gdbarch=0x83179d8, reg_nr=90)
at ../../combined/gdb/gdbarch.c:3983
3983 return gdbarch->register_sim_regno (reg_nr);
(top-gdb) list
3978 {
3979 gdb_assert (gdbarch != NULL);
3980 gdb_assert (gdbarch->register_sim_regno != NULL);
3981 if (gdbarch_debug >= 2)
3982 fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n");
3983 return gdbarch->register_sim_regno (reg_nr);
3984 }
3985
3986 void
3987 set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
(top-gdb) up
#3 0x08127e0f in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
299 switch (REGISTER_SIM_REGNO (regno))
(top-gdb) list
294 for (regno = 0; regno < NUM_REGS; regno++)
295 gdbsim_fetch_register (regno);
296 return;
297 }
298
299 switch (REGISTER_SIM_REGNO (regno))
300 {
301 case LEGACY_SIM_REGNO_IGNORE:
302 break;
303 case SIM_REGNO_DOES_NOT_EXIST:
(top-gdb) up
#4 0x08094450 in legacy_read_register_gen (regnum=90,
myaddr=0xbffff0f0 "Ððÿ¿Øy1\b\030ñÿ¿\020\227\f\bØy1\bZ")
at ../../combined/gdb/regcache.c:730
730 target_fetch_registers (regnum);
(top-gdb) list
725 registers_changed ();
726 registers_ptid = inferior_ptid;
727 }
728
729 if (!register_cached (regnum))
730 target_fetch_registers (regnum);
731
732 memcpy (myaddr, register_buffer (current_regcache, regnum),
733 REGISTER_RAW_SIZE (regnum));
734 }
(top-gdb) up
#5 0x0809453e in regcache_raw_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
at ../../combined/gdb/regcache.c:748
748 legacy_read_register_gen (regnum, buf);
(top-gdb) list
743 {
744 gdb_assert (regcache == current_regcache);
745 /* For moment, just use underlying legacy code. Ulgh!!! This
746 silently and very indirectly updates the regcache's regcache
747 via the global deprecated_register_valid[]. */
748 legacy_read_register_gen (regnum, buf);
749 return;
750 }
751 /* Make certain that the register cache is up-to-date with respect
752 to the current thread. This switching shouldn't be necessary
(top-gdb) up
#6 0x0809499a in regcache_cooked_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
at ../../combined/gdb/regcache.c:838
838 regcache_raw_read (regcache, regnum, buf);
(top-gdb) list
833 regcache_cooked_read (struct regcache *regcache, int regnum, void *buf)
834 {
835 gdb_assert (regnum >= 0);
836 gdb_assert (regnum < regcache->descr->nr_cooked_registers);
837 if (regnum < regcache->descr->nr_raw_registers)
838 regcache_raw_read (regcache, regnum, buf);
839 else if (regcache->readonly_p
840 && regnum < regcache->descr->nr_cooked_registers
841 && regcache->register_valid_p[regnum])
842 /* Read-only register cache, perhaphs the cooked value was cached? */
(top-gdb) up
#7 0x081553ef in sentinel_frame_prev_register (next_frame=0x82faca8,
this_prologue_cache=0x82facbc, regnum=90, optimized=0xbffff098, lvalp=0xbffff09c,
addrp=0xbffff0a0, realnum=0xbfffefd4, bufferp=0xbffff0f0)
at ../../combined/gdb/sentinel-frame.c:69
69 regcache_cooked_read (cache->regcache, regnum, bufferp);
(top-gdb) list
64 {
65 /* Return the actual value. */
66 /* Use the regcache_cooked_read() method so that it, on the fly,
67 constructs either a raw or pseudo register from the raw
68 register cache. */
69 regcache_cooked_read (cache->regcache, regnum, bufferp);
70 }
71 }
72
73 static void
(top-gdb) up
#8 0x0811622b in frame_register_unwind (frame=0x82faca8, regnum=90,
optimizedp=0xbffff098, lvalp=0xbffff09c, addrp=0xbffff0a0, realnump=0xbfffefd4,
bufferp=0xbffff0f0) at ../../combined/gdb/frame.c:532
532 frame->unwind->prev_register (frame->next, &frame->prologue_cache, regnum,
(top-gdb) list
527 }
528
529 /* Ask this frame to unwind its register. See comment in
530 "frame-unwind.h" for why NEXT frame and this unwind cace are
531 passed in. */
532 frame->unwind->prev_register (frame->next, &frame->prologue_cache, regnum,
533 optimizedp, lvalp, addrp, realnump, bufferp);
534
535 if (frame_debug)
536 {
(top-gdb) up
#9 0x080dd324 in mips_get_saved_register (
raw_buffer=0xbffff0f0 "Ððÿ¿Øy1\b\030ñÿ¿\020\227\f\bØy1\bZ", optimizedp=0xbffff098,
addrp=0xbffff0a0, frame=0x82faca8, regnum=90, lvalp=0xbffff09c)
at ../../combined/gdb/mips-tdep.c:5605
5605 frame_register_unwind (deprecated_get_next_frame_hack (frame),
(top-gdb) list
5600 frame_register_unwind (deprecated_get_next_frame_hack (frame),
5601 regnum % NUM_REGS, optimizedp, lvalp, addrp,
5602 &realnumx, raw_buffer);
5603 else
5604 /* Get it from the next frame. */
5605 frame_register_unwind (deprecated_get_next_frame_hack (frame),
5606 regnum, optimizedp, lvalp, addrp,
5607 &realnumx, raw_buffer);
5608 }
5609
(top-gdb) up
#10 0x080cb7f6 in gdbarch_deprecated_get_saved_register (gdbarch=0x83179d8,
raw_buffer=0xbffff0f0 "Ððÿ¿Øy1\b\030ñÿ¿\020\227\f\bØy1\bZ", optimized=0xbffff098,
addrp=0xbffff0a0, frame=0x82faca8, regnum=90, lval=0xbffff09c)
at ../../combined/gdb/gdbarch.c:4194
4194 gdbarch->deprecated_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval);
(top-gdb) list
4189 {
4190 gdb_assert (gdbarch != NULL);
4191 gdb_assert (gdbarch->deprecated_get_saved_register != NULL);
4192 if (gdbarch_debug >= 2)
4193 fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_get_saved_register called\n");
4194 gdbarch->deprecated_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval);
4195 }
4196
4197 void
4198 set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch,
(top-gdb) up
#11 0x08116433 in frame_register (frame=0x82faca8, regnum=90, optimizedp=0xbffff098,
lvalp=0xbffff09c, addrp=0xbffff0a0, realnump=0xbffff0ac, bufferp=0xbffff0f0)
at ../../combined/gdb/frame.c:575
575 DEPRECATED_GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame,
(top-gdb) list
570 /* Ulgh! Old code that, for lval_register, sets ADDRP to the offset
571 of the register in the register cache. It should instead return
572 the REGNUM corresponding to that register. Translate the . */
573 if (DEPRECATED_GET_SAVED_REGISTER_P ())
574 {
575 DEPRECATED_GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame,
576 regnum, lvalp);
577 /* Compute the REALNUM if the caller wants it. */
578 if (*lvalp == lval_register)
579 {
(top-gdb) up
#12 0x08116846 in frame_register_read (frame=0x82faca8, regnum=90, myaddr=0xbffff0f0)
at ../../combined/gdb/frame.c:753
753 frame_register (frame, regnum, &optimized, &lval, &addr, &realnum, myaddr);
(top-gdb) list
748 {
749 int optimized;
750 enum lval_type lval;
751 CORE_ADDR addr;
752 int realnum;
753 frame_register (frame, regnum, &optimized, &lval, &addr, &realnum, myaddr);
754
755 /* FIXME: cagney/2002-05-15: This test, is just bogus.
756
757 It indicates that the target failed to supply a value for a
(top-gdb) up
#13 0x080db5e6 in print_gp_register_row (file=0x8316608, frame=0x82faca8,
start_regnum=90) at ../../combined/gdb/mips-tdep.c:4304
4304 if (!frame_register_read (frame, regnum, raw_buffer))
(top-gdb) list
4299 if (*REGISTER_NAME (regnum) == '\0')
4300 continue; /* unused register */
4301 if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
4302 break; /* end row: reached FP register */
4303 /* OK: get the data in raw format. */
4304 if (!frame_register_read (frame, regnum, raw_buffer))
4305 error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
4306 /* pad small registers */
4307 for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++)
4308 printf_filtered (" ");
(top-gdb) up
#14 0x080db857 in mips_print_registers_info (gdbarch=0x83179d8, file=0x8316608,
frame=0x82faca8, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4358
4358 regnum = print_gp_register_row (file, frame, regnum);
(top-gdb) list
4353 regnum = print_fp_register_row (file, frame, regnum);
4354 else
4355 regnum += MIPS_NUMREGS; /* skip floating point regs */
4356 }
4357 else
4358 regnum = print_gp_register_row (file, frame, regnum);
4359 }
4360 }
4361 }
4362
(top-gdb)
Aw heck, nothing like too much data, better than too little:
(top-gdb) print *gdbarch
$1 = {initialized_p = 1, bfd_arch_info = 0x82a0300, byte_order = 0,
osabi = GDB_OSABI_UNKNOWN, tdep = 0x83179a8, dump_tdep = 0x80de244 <mips_dump_tdep>,
nr_data = 7, data = 0x8317c60, swap = 0x8317c80, short_bit = 16, int_bit = 32,
long_bit = 32, long_long_bit = 64, float_bit = 32, double_bit = 64,
long_double_bit = 64, ptr_bit = 32, addr_bit = 32, bfd_vma_bit = 32, char_signed = 1,
read_pc = 0x80d6594 <mips_read_pc>, write_pc = 0x8095868 <generic_target_write_pc>,
read_sp = 0x80d63b8 <mips_read_sp>,
virtual_frame_pointer = 0x80cfab0 <legacy_virtual_frame_pointer>,
pseudo_register_read = 0x80d5da4 <mips_pseudo_register_read>,
pseudo_register_write = 0x80d5e24 <mips_pseudo_register_write>, num_regs = 90,
num_pseudo_regs = 90, sp_regnum = -1, pc_regnum = -1, ps_regnum = -1, fp0_regnum = -1,
npc_regnum = -1, stab_reg_to_regnum = 0x80dd340 <mips_stab_reg_to_regnum>,
ecoff_reg_to_regnum = 0x80dd3ac <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
dwarf_reg_to_regnum = 0x80dd3ac <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
sdb_reg_to_regnum = 0x80cfa04 <no_op_reg_to_regnum>,
dwarf2_reg_to_regnum = 0x80dd3ac <mips_dwarf_dwarf2_ecoff_reg_to_regnum>,
register_name = 0x80d5b8c <mips_register_name>,
register_type = 0x80d632c <mips_register_type>, deprecated_register_virtual_type = 0,
deprecated_register_bytes = 0,
deprecated_register_byte = 0x80d6048 <mips_register_byte>,
deprecated_register_raw_size = 0x80d5f50 <mips_register_raw_size>,
deprecated_register_virtual_size = 0x80cfb58 <generic_register_size>,
deprecated_max_register_raw_size = 0, deprecated_max_register_virtual_size = 0,
unwind_dummy_id = 0,
deprecated_save_dummy_frame_tos = 0x811cad0 <generic_save_dummy_frame_tos>,
deprecated_fp_regnum = -1, deprecated_target_read_fp = 0x80d63b8 <mips_read_sp>,
push_dummy_call = 0x80d9c18 <mips_o32_push_dummy_call>, deprecated_push_arguments = 0,
deprecated_use_generic_dummy_frames = 1, deprecated_push_return_address = 0,
deprecated_dummy_write_sp = 0, deprecated_register_size = 0, call_dummy_location = 4,
call_dummy_address = 0x80dd228 <mips_call_dummy_address>,
deprecated_call_dummy_start_offset = 0, deprecated_call_dummy_breakpoint_offset = 0,
deprecated_call_dummy_length = 0, deprecated_call_dummy_words = 0x82dd270,
deprecated_sizeof_call_dummy_words = 8, deprecated_call_dummy_stack_adjust = 0,
deprecated_fix_call_dummy = 0, push_dummy_code = 0, deprecated_push_dummy_frame = 0,
deprecated_extra_stack_alignment_needed = 0, deprecated_do_registers_info = 0,
print_registers_info = 0x80db768 <mips_print_registers_info>, print_float_info = 0,
print_vector_info = 0, register_sim_regno = 0x80dd418 <mips_register_sim_regno>,
register_bytes_ok = 0, cannot_fetch_register = 0x80cfaa4 <cannot_register_not>,
cannot_store_register = 0x80cfaa4 <cannot_register_not>, get_longjmp_target = 0,
deprecated_pc_in_call_dummy = 0x811c924 <generic_pc_in_call_dummy>,
deprecated_init_frame_pc_first = 0x80d7518 <mips_init_frame_pc_first>,
deprecated_init_frame_pc = 0x80cfa0c <init_frame_pc_noop>, believe_pcc_promotion = 0,
believe_pcc_promotion_type = 0,
deprecated_get_saved_register = 0x80dd254 <mips_get_saved_register>,
deprecated_register_convertible = 0x80d613c <mips_register_convertible>,
deprecated_register_convert_to_virtual = 0x80d6188 <mips_register_convert_to_virtual>,
deprecated_register_convert_to_raw = 0x80d61e4 <mips_register_convert_to_raw>,
convert_register_p = 0x80cfd1c <legacy_convert_register_p>,
register_to_value = 0x80cfd34 <legacy_register_to_value>,
value_to_register = 0x80cfd6c <legacy_value_to_register>,
pointer_to_address = 0x8092cb8 <signed_pointer_to_address>,
address_to_pointer = 0x8092cec <address_to_signed_pointer>,
integer_to_address = 0x80dd4bc <mips_integer_to_address>,
return_value_on_stack = 0x80cf84c <generic_return_value_on_stack_not>,
deprecated_pop_frame = 0x80dac90 <mips_pop_frame>, deprecated_store_struct_return = 0,
extract_return_value = 0x80dc4a0 <mips_o32_extract_return_value>,
store_return_value = 0x80cf748 <legacy_store_return_value>,
deprecated_extract_return_value = 0,
deprecated_store_return_value = 0x80dc4b8 <mips_o32_store_return_value>,
---Type <return> to continue, or q <return> to quit---
extract_struct_value_address = 0x80dc858 <mips_extract_struct_value_address>,
deprecated_extract_struct_value_address = 0,
use_struct_convention = 0x80cf7b0 <always_use_struct_convention>,
deprecated_frame_init_saved_regs = 0x80d6f10 <mips_find_saved_regs>,
deprecated_init_extra_frame_info = 0x80d8b28 <mips_init_extra_frame_info>,
skip_prologue = 0x80dbbec <mips_skip_prologue>,
prologue_frameless_p = 0x80cf8ac <generic_prologue_frameless_p>,
inner_than = 0x80cf8fc <core_addr_lessthan>,
breakpoint_from_pc = 0x80dcc74 <mips_breakpoint_from_pc>,
memory_insert_breakpoint = 0x80ec9b8 <default_memory_insert_breakpoint>,
memory_remove_breakpoint = 0x80eca24 <default_memory_remove_breakpoint>,
decr_pc_after_break = 0, function_start_offset = 0,
remote_translate_xfer_address = 0x80cf88c <generic_remote_translate_xfer_address>,
frame_args_skip = 0,
frameless_function_invocation = 0x80cf840 <generic_frameless_function_invocation_not>,
deprecated_frame_chain = 0x80d8a1c <mips_frame_chain>,
deprecated_frame_chain_valid = 0,
deprecated_frame_saved_pc = 0x80d75a4 <mips_frame_saved_pc>, unwind_pc = 0,
unwind_sp = 0, deprecated_frame_args_address = 0x8117e38 <get_frame_base>,
deprecated_frame_locals_address = 0x8117e38 <get_frame_base>,
deprecated_saved_pc_after_call = 0x80dd330 <mips_saved_pc_after_call>,
frame_num_args = 0, stack_align = 0, frame_align = 0x80d8f14 <mips_frame_align>,
reg_struct_has_addr = 0x80d6538 <mips_o32_reg_struct_has_addr>, parm_boundary = 0,
float_format = 0x82b4ac0, double_format = 0x82b4b80, long_double_format = 0x82b4b80,
convert_from_func_ptr_addr = 0x80cf9f8 <core_addr_identity>,
addr_bits_remove = 0x80d7458 <mips_addr_bits_remove>,
smash_text_address = 0x80cf9f8 <core_addr_identity>, software_single_step = 0,
print_insn = 0x80cf8e4 <legacy_print_insn>,
skip_trampoline_code = 0x80dce68 <mips_skip_stub>,
in_solib_call_trampoline = 0x80dd06c <mips_in_call_stub>,
in_solib_return_trampoline = 0x80dd104 <mips_in_return_stub>,
pc_in_sigtramp = 0x80dc874 <mips_pc_in_sigtramp>, sigtramp_start = 0,
sigtramp_end = 0, in_function_epilogue_p = 0x80cf880 <generic_in_function_epilogue_p>,
construct_inferior_arguments = 0x80b6cf0 <construct_inferior_arguments>,
elf_make_msymbol_special = 0x80d5908 <mips_elf_make_msymbol_special>,
coff_make_msymbol_special = 0x80cfa9c <default_coff_make_msymbol_special>,
name_of_malloc = 0x823dee0 "malloc", cannot_step_breakpoint = 0,
have_nonsteppable_watchpoint = 0, address_class_type_flags = 0,
address_class_type_flags_to_name = 0, address_class_name_to_type_flags = 0,
register_reggroup_p = 0x80d5c44 <mips_register_reggroup_p>, fetch_pointer_argument = 0}
Anything else?
--
Steve Watt KD6GGD PP-ASEL-IA Email at home: steve@watt.com
Chelsio Communications http://www.chelsio.com/ work: steve@chelsio.com
510 N. Pastoria Ave Voice: +1 408 962 3627
Sunnyvale, CA, USA, 94085 Fax: +1 408 730 2580
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
2003-07-21 18:20 Steve Watt
@ 2003-07-21 22:38 ` Andrew Cagney
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Cagney @ 2003-07-21 22:38 UTC (permalink / raw)
To: Steve Watt; +Cc: gdb-patches
> OK... cvs as of about 9:30PDT 21 July. Confirmed that the GDB build
> was only -O -g, though some other things (newlib, mostly) got -O2.
>
> That was quite a tail-call optimization -- looks like 3 frames
> vanished. I'm a little worried about a warning I got in this
> backtrace from top-gdb:
> During symbol reading, debug info mismatch between compiler and debugger.
>
> The top gdb and gcc came from RedHat 7.1. I suppose I could build a
> new host gcc and gdb, but that seems like a fair amount of pain.
>
> Anyway, here's the trace, along with a bunch of "up; list" to make sure
> everything's sane looking:
Yep!
> (top-gdb) info stack
> #0 internal_error (file=0x824e580 "../../combined/gdb/mips-tdep.c", line=5671,
> string=0x824e555 "%s: Assertion `%s' failed.") at ../../combined/gdb/utils.c:807
> #1 0x080dd45c in mips_register_sim_regno (regnum=90)
> at ../../combined/gdb/mips-tdep.c:5671
> #2 0x080cb037 in gdbarch_register_sim_regno (gdbarch=0x83179d8, reg_nr=90)
> at ../../combined/gdb/gdbarch.c:3983
> #3 0x08127e0f in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
> #4 0x08094450 in legacy_read_register_gen (regnum=90,
> myaddr=0xbffff0f0 "Ãðÿ¿Ãy1\b\030ñÿ¿\020\227\f\bÃy1\bZ")
> at ../../combined/gdb/regcache.c:730
> #5 0x0809453e in regcache_raw_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
> at ../../combined/gdb/regcache.c:748
> #6 0x0809499a in regcache_cooked_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
> at ../../combined/gdb/regcache.c:838
It went wrong here. It tests (regnum < ->nr_raw_registers), but for
legacy targets NR_RAW_REGISTERS == NUM_REGS + NUM_PSEUDO_REGS :-(
The correct fix is to just delete a heap of code, however ...
From regcache.c:
> if ((!gdbarch_pseudo_register_read_p (gdbarch)
> && !gdbarch_pseudo_register_write_p (gdbarch)
> && !gdbarch_register_type_p (gdbarch))
> || REGISTER_BYTE_P () || REGISTER_RAW_SIZE_P ())
> {
> descr->legacy_p = 1;
> init_legacy_regcache_descr (gdbarch, descr);
> return descr;
> }
can you try removing the two || ... clauses I added 2003-07-03?
I think my change may have fixed some legacy code but broke others :-(
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
@ 2003-07-21 22:57 Steve Watt
0 siblings, 0 replies; 13+ messages in thread
From: Steve Watt @ 2003-07-21 22:57 UTC (permalink / raw)
To: Andrew Cagney, Steve Watt; +Cc: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2381 bytes --]
On Jul 21, 18:07, Andrew Cagney wrote:
} Subject: Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
}
} > (top-gdb) info stack
} > #0 internal_error (file=0x824e580 "../../combined/gdb/mips-tdep.c", line=5671,
} > string=0x824e555 "%s: Assertion `%s' failed.") at ../../combined/gdb/utils.c:807
} > #1 0x080dd45c in mips_register_sim_regno (regnum=90)
} > at ../../combined/gdb/mips-tdep.c:5671
} > #2 0x080cb037 in gdbarch_register_sim_regno (gdbarch=0x83179d8, reg_nr=90)
} > at ../../combined/gdb/gdbarch.c:3983
} > #3 0x08127e0f in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
} > #4 0x08094450 in legacy_read_register_gen (regnum=90,
} > myaddr=0xbffff0f0 "Ððÿ¿Øy1\b\030ñÿ¿\020\227\f\bØy1\bZ")
} > at ../../combined/gdb/regcache.c:730
} > #5 0x0809453e in regcache_raw_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
} > at ../../combined/gdb/regcache.c:748
} > #6 0x0809499a in regcache_cooked_read (regcache=0x8323000, regnum=90, buf=0xbffff0f0)
} > at ../../combined/gdb/regcache.c:838
}
} It went wrong here. It tests (regnum < ->nr_raw_registers), but for
} legacy targets NR_RAW_REGISTERS == NUM_REGS + NUM_PSEUDO_REGS :-(
}
} The correct fix is to just delete a heap of code, however ...
}
} From regcache.c:
}
} > if ((!gdbarch_pseudo_register_read_p (gdbarch)
} > && !gdbarch_pseudo_register_write_p (gdbarch)
} > && !gdbarch_register_type_p (gdbarch))
} > || REGISTER_BYTE_P () || REGISTER_RAW_SIZE_P ())
} > {
} > descr->legacy_p = 1;
} > init_legacy_regcache_descr (gdbarch, descr);
} > return descr;
} > }
}
} can you try removing the two || ... clauses I added 2003-07-03?
}
} I think my change may have fixed some legacy code but broke others :-(
Well, that fixes it. That's my favorite kind of bug fix, but also my
favorite (not!) kind of repercussion.
At least I've got a toy I can play with again!
Thanks for the help, and good luck on the Right Fix. Let me know if
there's something more you want checked.
Steve
--
Steve Watt KD6GGD PP-ASEL-IA Email at home: steve@watt.com
Chelsio Communications http://www.chelsio.com/ work: steve@chelsio.com
510 N. Pastoria Ave Voice: +1 408 962 3627
Sunnyvale, CA, USA, 94085 Fax: +1 408 730 2580
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2003-07-21 22:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 15:35 [patch rfc] Add NUM_REGS pseudo regs to MIPS Andrew Cagney
2003-06-16 15:44 ` Daniel Jacobowitz
2003-06-18 4:32 ` Kevin Buettner
2003-06-18 16:36 ` Andrew Cagney
2003-06-18 23:54 ` Kevin Buettner
2003-06-21 18:22 ` Andrew Cagney
2003-07-07 20:01 Steve Watt
2003-07-18 22:20 ` Andrew Cagney
2003-07-19 0:13 Steve Watt
2003-07-21 15:26 ` Andrew Cagney
2003-07-21 18:20 Steve Watt
2003-07-21 22:38 ` Andrew Cagney
2003-07-21 22:57 Steve Watt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox