This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: Remove D10V-specific code from arch-independent modules
- To: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Subject: Re: RFA: Remove D10V-specific code from arch-independent modules
- From: David Taylor <taylor at candd dot org>
- Date: Mon, 09 Jul 2001 23:02:58 -0400
- cc: gdb-patches at sources dot redhat dot com
From: Jim Blandy <jimb@zwingli.cygnus.com>
Date: Thu, 28 Jun 2001 19:07:35 -0500 (EST)
The following patch removes the D10V-specific code from GDB's
architecture-independent modules, and generally cleans up the D10V
port.
This patch has the following effect on the test suite results:
- Fifteen failures become passes --- mostly in pointer.exp.
- "gdb.base/long_long.exp: x/a &oct" used to pass, but now fails,
because the test assumes that pointers are 32 bits long. On the
D10V, pointers are 16 bits long.
- In gdb.base/overlays.exp, five passes become failures. This is
because the overlay tests for the D10V put unloaded overlays in
memory the processor can't directly address. It's possible to fix
the test, but I didn't do this.
So the results are not universally positive. However, I still think
this change should be committed because:
- GDB and the target currently disagree on how long D10V pointers
are. This is a horrible kludge, which this patch removes.
- As a direct consequence of that horrible kludge, we currently have
D10V-specific code scattered throughout the supposedly
machine-independent portions of GDB. This patch segregates all
D10V-specific code to d10v-tdep.c, and simplifies some fundamental
functions.
2001-06-28 Jim Blandy <jimb@redhat.com>
Clean up the D10V port so that GDB and the target program no
longer disagree on how big pointers are.
* findvar.c (value_from_register): Remove special case code for D10V.
* printcmd.c (print_frame_args): Same.
* valops.c (value_at, value_fetch_lazy): Same.
* values.c (unpack_long): Same.
The findvar.c, printcmd.c, valops.c, and values.c parts are approved.
* gdbarch.sh: Changes to effect the following:
* gdbarch.h (GDB_TARGET_IS_D10V, D10V_MAKE_DADDR,
gdbarch_d10v_make_daddr_ftype, gdbarch_d10v_make_daddr,
set_gdbarch_d10v_make_daddr, D10V_MAKE_IADDR,
gdbarch_d10v_make_iaddr_ftype, gdbarch_d10v_make_iaddr,
set_gdbarch_d10v_make_iaddr, D10V_DADDR_P,
gdbarch_d10v_daddr_p_ftype, gdbarch_d10v_daddr_p,
set_gdbarch_d10v_daddr_p, D10V_IADDR_P,
gdbarch_d10v_iaddr_p_ftype, gdbarch_d10v_iaddr_p,
set_gdbarch_d10v_iaddr_p, D10V_CONVERT_DADDR_TO_RAW,
gdbarch_d10v_convert_daddr_to_raw_ftype,
gdbarch_d10v_convert_daddr_to_raw,
set_gdbarch_d10v_convert_daddr_to_raw, D10V_CONVERT_IADDR_TO_RAW,
gdbarch_d10v_convert_iaddr_to_raw_ftype,
gdbarch_d10v_convert_iaddr_to_raw,
set_gdbarch_d10v_convert_iaddr_to_raw): Delete declarations.
* gdbarch.c: Delete the corresponding definitions.
(struct gdbarch): Delete members d10v_make_daddr,
d10v_make_iaddr, d10v_daddr_p, d10v_iaddr_p,
d10v_convert_daddr_to_raw, and d10v_convert_iaddr_to_raw.
(startup_gdbarch): Remove initializers for the above.
(verify_gdbarch, gdbarch_dump): Don't verify or dump them any
more.
* d10v-tdep.c (struct gdbarch_tdep): New member: `code_ptr_type'.
(d10v_register_virtual_type): Rather that claiming the stack
pointer and PC are 32 bits long (which they aren't), say that the
stack pointer is an int16_t, and the program counter is a function
pointer. This allows the rest of GDB to make the appropriate
conversions between the code pointer format and real addresses.
And if code_ptr_type isn't initialized, do so here.
(d10v_register_convertible): Delete function; no registers are
convertible now, so we use generic_register_convertible_not instead.
(d10v_register_convert_to_virtual, d10v_register_convert_to_raw):
Report an internal error if these functions are ever called.
(d10v_address_to_pointer, d10v_pointer_to_address): New gdbarch
methods.
(d10v_frame_chain, d10v_frame_init_saved_regs, show_regs,
d10v_read_pc, d10v_write_pc, d10v_read_sp, d10v_write_sp,
d10v_write_fp, d10v_read_fp, d10v_push_return_address): Call the
(now static) functions d10v_make_daddr, d10v_make_iaddr,
d10v_convert_iaddr_to_raw, and d10v_convert_daddr_to_raw, not the
(now gone) global macros D10V_MAKE_DADDR, D10V_MAKE_IADDR,
D10V_CONVERT_IADDR_TO_RAW, and D10V_CONVERT_DADDR_TO_RAW.
(d10v_push_arguments, d10v_extract_return_value): Remove special
cases for code and data pointers.
(d10v_gdbarch_init): Set gdbarch_ptr_bit to 16, so that GDB and
the target agree on how large pointers are. Say that addresses
are 32 bits long. Register the address_to_pointer and
pointer_to_address conversion functions. Since no registers are
convertible now, register generic_register_convertible_not as the
gdbarch_register_convertible method instead of
d10v_register_convertible. Remove registrations for
gdbarch_d10v_make_daddr, gdbarch_d10v_make_iaddr,
gdbarch_d10v_daddr_p, gdbarch_d10v_iaddr_p,
gdbarch_d10v_convert_daddr_to_raw, and
gdbarch_d10v_convert_iaddr_to_raw. Use memset to zero the
gdbarch_tdep structure.