This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Stop mips register_raw_size internal error
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 09 Dec 2001 20:52:38 -0800
- Subject: [patch] Stop mips register_raw_size internal error
Hello,
The attached (hopefully) fixes the internal error problems Daniel J
noticed with the MIPS target. Briefly:
o for the dummy static target used during
initial startup, the function register_raw_size()
is now defined (so that the regcache.c code can
use it).
o For the mips, the macro REGISTER_RAW_SIZE()
is no longer defined, instead multi-arch is used.
The basic mips-elf, is now capable of starting up.
Andrew
2001-12-09 Andrew Cagney <ac131313@redhat.com>
* arch-utils.c (generic_register_raw_size): New function.
* gdbarch.sh (REGISTER_RAW_SIZE): Use generic_register_raw_size as
the static default.
* gdbarch.c: Regenerate.
* arch-utils.h (generic_register_raw_size): Declare.
* config/mips/tm-mips.h (REGISTER_RAW_SIZE): Delete macro.
* mips-tdep.c (mips_register_raw_size): Make function static.
(mips_gdbarch_init): Initialize register_raw_size.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.39
diff -p -r1.39 arch-utils.c
*** arch-utils.c 2001/11/29 22:24:42 1.39
--- arch-utils.c 2001/12/10 04:42:01
*************** legacy_virtual_frame_pointer (CORE_ADDR
*** 376,381 ****
--- 376,392 ----
*frame_regnum = FP_REGNUM;
*frame_offset = 0;
}
+
+ /* Assume the world is flat. Every register is large enough to fit a
+ target integer. */
+
+ int
+ generic_register_raw_size (int regnum)
+ {
+ gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
+ return TARGET_INT_BIT / HOST_CHAR_BIT;
+ }
+
/* Functions to manipulate the endianness of the target. */
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.24
diff -p -r1.24 arch-utils.h
*** arch-utils.h 2001/11/29 22:24:42 1.24
--- arch-utils.h 2001/12/10 04:42:01
*************** extern int generic_in_solib_call_trampol
*** 138,141 ****
--- 138,145 ----
extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc);
+ /* Assume all registers are the same size and a size identical to that
+ of the integer type. */
+ extern int generic_register_raw_size (int regnum);
+
#endif
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.90
diff -p -r1.90 gdbarch.c
*** gdbarch.c 2001/12/07 12:10:15 1.90
--- gdbarch.c 2001/12/10 04:42:02
*************** struct gdbarch startup_gdbarch =
*** 312,318 ****
0,
0,
0,
! 0,
0,
0,
0,
--- 312,318 ----
0,
0,
0,
! generic_register_raw_size,
0,
0,
0,
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.95
diff -p -r1.95 gdbarch.sh
*** gdbarch.sh 2001/12/07 12:10:15 1.95
--- gdbarch.sh 2001/12/10 04:42:03
*************** f:2:REGISTER_NAME:char *:register_name:i
*** 427,433 ****
v:2:REGISTER_SIZE:int:register_size::::0:-1
v:2:REGISTER_BYTES:int:register_bytes::::0:-1
f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
! f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::0:0
v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::0:0
v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
--- 427,433 ----
v:2:REGISTER_SIZE:int:register_size::::0:-1
v:2:REGISTER_BYTES:int:register_bytes::::0:-1
f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
! f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size:0
v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::0:0
v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.61
diff -p -r1.61 mips-tdep.c
*** mips-tdep.c 2001/11/19 23:15:31 1.61
--- mips-tdep.c 2001/12/10 04:42:07
*************** mips_print_extra_frame_info (struct fram
*** 410,417 ****
paddr_d (fi->extra_info->proc_desc->pdr.frameoffset));
}
! /* Convert between RAW and VIRTUAL registers. The RAW register size
! defines the remote-gdb packet. */
static int mips64_transfers_32bit_regs_p = 0;
--- 410,418 ----
paddr_d (fi->extra_info->proc_desc->pdr.frameoffset));
}
! /* 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. */
static int mips64_transfers_32bit_regs_p = 0;
*************** mips_register_raw_size (int reg_nr)
*** 429,434 ****
--- 430,438 ----
return MIPS_REGSIZE;
}
+ /* Convert between RAW and VIRTUAL registers. The RAW register size
+ defines the remote-gdb packet. */
+
int
mips_register_convertible (int reg_nr)
{
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4075,4086 ****
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
! /* Initially set everything according to the ABI. */
set_gdbarch_short_bit (gdbarch, 16);
set_gdbarch_int_bit (gdbarch, 32);
set_gdbarch_float_bit (gdbarch, 32);
set_gdbarch_double_bit (gdbarch, 64);
set_gdbarch_long_double_bit (gdbarch, 64);
tdep->mips_abi = mips_abi;
switch (mips_abi)
--- 4079,4091 ----
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
! /* Initially set everything according to the default ABI/ISA. */
set_gdbarch_short_bit (gdbarch, 16);
set_gdbarch_int_bit (gdbarch, 32);
set_gdbarch_float_bit (gdbarch, 32);
set_gdbarch_double_bit (gdbarch, 64);
set_gdbarch_long_double_bit (gdbarch, 64);
+ set_gdbarch_register_raw_size (gdbarch, mips_register_raw_size);
tdep->mips_abi = mips_abi;
switch (mips_abi)
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.22
diff -p -r1.22 tm-mips.h
*** tm-mips.h 2001/10/15 18:18:30 1.22
--- tm-mips.h 2001/12/10 04:42:08
*************** extern void mips_do_registers_info (int,
*** 175,188 ****
#define REGISTER_BYTE(N) ((N) * MIPS_REGSIZE)
- /* 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. */
-
- extern int mips_register_raw_size (int reg_nr);
- #define REGISTER_RAW_SIZE(N) (mips_register_raw_size ((N)))
-
-
/* Covert between the RAW and VIRTUAL registers.
Some MIPS (SR, FSR, FIR) have a `raw' size of MIPS_REGSIZE but are
--- 175,180 ----