* [PATCH] gdbarch-ify mips_do_registers_info.
@ 2002-08-15 20:13 Michael Snyder
2002-08-16 6:12 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2002-08-15 20:13 UTC (permalink / raw)
To: gdb-patches, cagney
[-- Attachment #1: Type: text/plain, Size: 45 bytes --]
Another method down, 80 gazillion to go. <g>
[-- Attachment #2: patch14.diff --]
[-- Type: text/plain, Size: 7411 bytes --]
2002-08-15 Michael Snyder <msnyder@redhat.com>
* mips-tdep.c (mips_do_registers_info): Make static.
(mips_gdbarch_init): Insert mips_do_registers_info into gdbarch.
* config/mips/tm-mips.h (DO_REGISTERS_INFO): Delete.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.103
diff -c -3 -p -r1.103 mips-tdep.c
*** mips-tdep.c 16 Aug 2002 02:36:49 -0000 1.103
--- mips-tdep.c 16 Aug 2002 03:03:40 -0000
*************** mips_frame_chain (struct frame_info *fra
*** 2302,2312 ****
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
! /* Check if this is a call dummy frame. */
! && frame->pc != mips_call_dummy_address ())
return 0;
else
return get_frame_pointer (frame, proc_desc);
--- 2302,2310 ----
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)
return 0;
else
return get_frame_pointer (frame, proc_desc);
*************** mips_pop_frame (void)
*** 3356,3377 ****
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])
! {
! /* 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 ();
--- 3354,3366 ----
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));
! }
write_register (SP_REGNUM, new_sp);
flush_cached_frames ();
*************** do_gp_register_row (int regnum)
*** 3739,3745 ****
/* MIPS_DO_REGISTERS_INFO(): called by "info register" command */
! void
mips_do_registers_info (int regnum, int fpregs)
{
if (regnum != -1) /* do one specified register */
--- 3728,3734 ----
/* MIPS_DO_REGISTERS_INFO(): called by "info register" command */
! static void
mips_do_registers_info (int regnum, int fpregs)
{
if (regnum != -1) /* do one specified register */
*************** return_value_location (struct type *valt
*** 4098,4125 ****
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len < MIPS_SAVED_REGSIZE)
{
! 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))
{
--- 4087,4101 ----
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;
+ hi->reg_offset = 0;
hi->len = 0;
}
else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len > MIPS_SAVED_REGSIZE /* odd-size structs */
&& len < MIPS_SAVED_REGSIZE * 2
&& (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
TYPE_CODE (valtype) == TYPE_CODE_UNION))
{
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4957,4963 ****
}
}
- #undef MIPS_DEFAULT_ABI
#ifdef MIPS_DEFAULT_ABI
if (mips_abi == MIPS_ABI_UNKNOWN)
mips_abi = MIPS_DEFAULT_ABI;
--- 4933,4938 ----
*************** mips_gdbarch_init (struct gdbarch_info i
*** 5238,5244 ****
set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
! set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
set_gdbarch_register_convert_to_virtual (gdbarch,
mips_register_convert_to_virtual);
set_gdbarch_register_convert_to_raw (gdbarch,
--- 5213,5219 ----
set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
! set_gdbarch_register_convertible (gdbarch, mips_register_convertible);
set_gdbarch_register_convert_to_virtual (gdbarch,
mips_register_convert_to_virtual);
set_gdbarch_register_convert_to_raw (gdbarch,
*************** mips_gdbarch_init (struct gdbarch_info i
*** 5263,5268 ****
--- 5238,5245 ----
/* There are MIPS targets which do not yet use this since they still
define REGISTER_VIRTUAL_TYPE. */
set_gdbarch_register_virtual_type (gdbarch, mips_register_virtual_type);
+
+ set_gdbarch_do_registers_info (gdbarch, mips_do_registers_info);
/* Hook in OS ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch, osabi);
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.33
diff -c -3 -p -r1.33 tm-mips.h
*** config/mips/tm-mips.h 16 Aug 2002 02:36:49 -0000 1.33
--- config/mips/tm-mips.h 16 Aug 2002 03:03:40 -0000
*************** extern const char *mips_register_name (i
*** 141,152 ****
#define PRID_REGNUM 89 /* Processor ID */
#define LAST_EMBED_REGNUM 89 /* Last one */
- /* Define DO_REGISTERS_INFO() to do machine-specific formatting
- of register dumps. */
-
- #define DO_REGISTERS_INFO(_regnum, fp) mips_do_registers_info(_regnum, fp)
- extern void mips_do_registers_info (int, int);
-
/* Total amount of space needed to store our copies of the machine's
register state, the array `registers'. */
--- 141,146 ----
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdbarch-ify mips_do_registers_info.
2002-08-15 20:13 [PATCH] gdbarch-ify mips_do_registers_info Michael Snyder
@ 2002-08-16 6:12 ` Andrew Cagney
2002-08-16 10:57 ` Michael Snyder
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-08-16 6:12 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches, cagney
> Another method down, 80 gazillion to go. <g>
>
>
>
> 2002-08-15 Michael Snyder <msnyder@redhat.com>
>
> * mips-tdep.c (mips_do_registers_info): Make static.
> (mips_gdbarch_init): Insert mips_do_registers_info into gdbarch.
> * config/mips/tm-mips.h (DO_REGISTERS_INFO): Delete.
Michael, this again contains more than just what is listed in the change
log entry. Can you please be more careful.
For what its worth, I've found the best way to handle this to take a
copy of a master source directory and then work on that when creating
each change. I've currently got ~8 patches pending and hence have ~8
copies of GDB lying around (actually I've about 15 but lets ignore that :-)
enjoy,
Andrew
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.103
> diff -c -3 -p -r1.103 mips-tdep.c
> *** mips-tdep.c 16 Aug 2002 02:36:49 -0000 1.103
> --- mips-tdep.c 16 Aug 2002 03:03:40 -0000
> *************** mips_frame_chain (struct frame_info *fra
> *** 2302,2312 ****
> 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
> ! /* Check if this is a call dummy frame. */
> ! && frame->pc != mips_call_dummy_address ())
> return 0;
> else
> return get_frame_pointer (frame, proc_desc);
> --- 2302,2310 ----
> 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)
> return 0;
> else
> return get_frame_pointer (frame, proc_desc);
> *************** mips_pop_frame (void)
> *** 3356,3377 ****
> 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])
> ! {
> ! /* 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 ();
>
> --- 3354,3366 ----
> 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));
> ! }
> write_register (SP_REGNUM, new_sp);
> flush_cached_frames ();
>
> *************** do_gp_register_row (int regnum)
> *** 3739,3745 ****
>
> /* MIPS_DO_REGISTERS_INFO(): called by "info register" command */
>
> ! void
> mips_do_registers_info (int regnum, int fpregs)
> {
> if (regnum != -1) /* do one specified register */
> --- 3728,3734 ----
>
> /* MIPS_DO_REGISTERS_INFO(): called by "info register" command */
>
> ! static void
> mips_do_registers_info (int regnum, int fpregs)
> {
> if (regnum != -1) /* do one specified register */
> *************** return_value_location (struct type *valt
> *** 4098,4125 ****
> if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
> && len < MIPS_SAVED_REGSIZE)
> {
> ! 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))
> {
> --- 4087,4101 ----
> 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;
> + hi->reg_offset = 0;
> hi->len = 0;
> }
> else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
> && len > MIPS_SAVED_REGSIZE /* odd-size structs */
> && len < MIPS_SAVED_REGSIZE * 2
> && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
> TYPE_CODE (valtype) == TYPE_CODE_UNION))
> {
> *************** mips_gdbarch_init (struct gdbarch_info i
> *** 4957,4963 ****
> }
> }
>
> - #undef MIPS_DEFAULT_ABI
> #ifdef MIPS_DEFAULT_ABI
> if (mips_abi == MIPS_ABI_UNKNOWN)
> mips_abi = MIPS_DEFAULT_ABI;
> --- 4933,4938 ----
> *************** mips_gdbarch_init (struct gdbarch_info i
> *** 5238,5244 ****
> set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
> set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
> set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
> ! set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
> set_gdbarch_register_convert_to_virtual (gdbarch,
> mips_register_convert_to_virtual);
> set_gdbarch_register_convert_to_raw (gdbarch,
> --- 5213,5219 ----
> set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
> set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
> set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
> ! set_gdbarch_register_convertible (gdbarch, mips_register_convertible);
> set_gdbarch_register_convert_to_virtual (gdbarch,
> mips_register_convert_to_virtual);
> set_gdbarch_register_convert_to_raw (gdbarch,
> *************** mips_gdbarch_init (struct gdbarch_info i
> *** 5263,5268 ****
> --- 5238,5245 ----
> /* There are MIPS targets which do not yet use this since they still
> define REGISTER_VIRTUAL_TYPE. */
> set_gdbarch_register_virtual_type (gdbarch, mips_register_virtual_type);
> +
> + set_gdbarch_do_registers_info (gdbarch, mips_do_registers_info);
>
> /* Hook in OS ABI-specific overrides, if they have been registered. */
> gdbarch_init_osabi (info, gdbarch, osabi);
> Index: config/mips/tm-mips.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
> retrieving revision 1.33
> diff -c -3 -p -r1.33 tm-mips.h
> *** config/mips/tm-mips.h 16 Aug 2002 02:36:49 -0000 1.33
> --- config/mips/tm-mips.h 16 Aug 2002 03:03:40 -0000
> *************** extern const char *mips_register_name (i
> *** 141,152 ****
> #define PRID_REGNUM 89 /* Processor ID */
> #define LAST_EMBED_REGNUM 89 /* Last one */
>
> - /* Define DO_REGISTERS_INFO() to do machine-specific formatting
> - of register dumps. */
> -
> - #define DO_REGISTERS_INFO(_regnum, fp) mips_do_registers_info(_regnum, fp)
> - extern void mips_do_registers_info (int, int);
> -
> /* Total amount of space needed to store our copies of the machine's
> register state, the array `registers'. */
>
> --- 141,146 ----
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdbarch-ify mips_do_registers_info.
2002-08-16 6:12 ` Andrew Cagney
@ 2002-08-16 10:57 ` Michael Snyder
0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2002-08-16 10:57 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches, cagney
Andrew Cagney wrote:
>
> > Another method down, 80 gazillion to go. <g>
> >
> >
> >
> > 2002-08-15 Michael Snyder <msnyder@redhat.com>
> >
> > * mips-tdep.c (mips_do_registers_info): Make static.
> > (mips_gdbarch_init): Insert mips_do_registers_info into gdbarch.
> > * config/mips/tm-mips.h (DO_REGISTERS_INFO): Delete.
>
> Michael, this again contains more than just what is listed in the change
> log entry. Can you please be more careful.
Drat. Sorry, I worked late last night, my "procedure" must've gotten
screwed up. Again, though, I did not check in any of those extraneous
changes.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-08-16 17:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-15 20:13 [PATCH] gdbarch-ify mips_do_registers_info Michael Snyder
2002-08-16 6:12 ` Andrew Cagney
2002-08-16 10:57 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox