diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5cdb1e91a9..c59ba9d3de 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +Mon Feb 16 14:05:54 1998 Andrew Cagney + + * remote-d10v.c (remote_d10v_open): Call push_remote_target + instead of open_remote_target. + + * remote.c (remote_xfer_memory): Use REMOTE_TRANSLATE_XFER_ADDRESS + to translate addr/size when defined. + (open_remote_target): Delete. + + * target.h (open_remote_target): Delete. + + * config/d10v/tm-d10v.h (REMOTE_TRANSLATE_XFER_ADDRESS): Define. + +Mon Feb 16 14:05:54 1998 Andrew Cagney + + * config/d10v/tm-d10v.h (USE_STRUCT_CONVENTION): Define. True when + sizeof type > 1. + +Mon Feb 16 14:05:54 1998 Andrew Cagney + + * config/d10v/tm-d10v.h (USE_STRUCT_CONVENTION): Define. True when + sizeof type > 1. + Sun Feb 15 16:10:50 1998 Ron Unrau * parse.c (write_dollar_variable): call new function diff --git a/gdb/config/d10v/tm-d10v.h b/gdb/config/d10v/tm-d10v.h index 67136c942c..93c634c162 100644 --- a/gdb/config/d10v/tm-d10v.h +++ b/gdb/config/d10v/tm-d10v.h @@ -178,6 +178,17 @@ extern CORE_ADDR d10v_skip_prologue (); #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ (extract_address ((REGBUF) + REGISTER_BYTE (ARG1_REGNUM), REGISTER_RAW_SIZE (ARG1_REGNUM)) | DMEM_START) + +/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of + EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc + and TYPE is the type (which is known to be struct, union or array). + + The d10v returns anything less than 8 bytes in size in + registers. */ + +#define USE_STRUCT_CONVENTION(gcc_p, type) \ + (TYPE_LENGTH (type) > 1) + /* Define other aspects of the stack frame. @@ -314,3 +325,13 @@ CORE_ADDR d10v_read_fp PARAMS ((void)); #define TARGET_PTR_BIT (4 * TARGET_CHAR_BIT) #define TARGET_DOUBLE_BIT (4 * TARGET_CHAR_BIT) #define TARGET_LONG_DOUBLE_BIT (8 * TARGET_CHAR_BIT) + + +/* For the d10v when talking to the remote d10v board, GDB addresses + need to be translated into a format that the d10v rom monitor + understands. */ + +int remote_d10v_translate_xfer_address PARAMS ((CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr)); +#define REMOTE_TRANSLATE_XFER_ADDRESS(GDB_ADDR, GDB_LEN, REM_ADDR, REM_LEN) \ +(REM_LEN) = remote_d10v_translate_xfer_address ((GDB_ADDR), (GDB_LEN), &(REM_ADDR)) + diff --git a/gdb/remote-d10v.c b/gdb/remote-d10v.c index abdacd4efc..d529b2180f 100644 --- a/gdb/remote-d10v.c +++ b/gdb/remote-d10v.c @@ -44,40 +44,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Prototypes for local functions */ -static int remote_d10v_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, - int len, int should_write, - struct target_ops *target)); - static void remote_d10v_open PARAMS ((char *name, int from_tty)); -static void remote_d10v_mourn PARAMS ((void)); - -static void initialize_remote_d10v_ops PARAMS ((int copy_remote)); - /* Define the target subroutine names */ - -struct target_ops remote_d10v_ops; -extern struct target_ops remote_ops; -extern struct target_ops extended_remote_ops; -struct target_ops *inherited_ops = &extended_remote_ops; - -void -init_remote_d10v_ops (copy_remote) - int copy_remote; -{ - printf_filtered ("Opening d10v ...\n"); - if (copy_remote) - memcpy (&remote_d10v_ops, inherited_ops, sizeof remote_d10v_ops); - remote_d10v_ops.to_shortname = "d10v"; - remote_d10v_ops.to_longname = "Remote d10v serial target in gdb-specific protocol"; - remote_d10v_ops.to_doc = "Use a remote d10v via a serial line, using a gdb-specific protocol.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - remote_d10v_ops.to_open = remote_d10v_open; - remote_d10v_ops.to_xfer_memory = remote_d10v_xfer_memory; - remote_d10v_ops.to_mourn_inferior = remote_d10v_mourn; - remote_d10v_ops.to_magic = OPS_MAGIC; -} - +static struct target_ops remote_d10v_ops; /* Open a connection to a remote debugger. NAME is the filename used for communication. */ @@ -87,38 +57,19 @@ remote_d10v_open (name, from_tty) char *name; int from_tty; { - init_remote_d10v_ops (1); - open_remote_target (name, from_tty, &remote_d10v_ops, - inherited_ops == &extended_remote_ops); + pop_target (); + push_remote_target (name, from_tty); } -/* Worker function for remote_mourn. */ -static void -remote_d10v_mourn () -{ - if (inherited_ops == &remote_ops) - { - unpush_target (&remote_d10v_ops); - generic_mourn_inferior (); - } - /* see remote.c:extended_remote_mourn() for why an extended remote - target doesn't mourn */ -} - - -/* Read or write LEN bytes from inferior memory at MEMADDR, transferring - to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is - nonzero. Returns length of data written or read; 0 for error. */ - -/* ARGSUSED */ -static int -remote_d10v_xfer_memory(memaddr, myaddr, nr_bytes, write_p, target) +/* Translate a GDB virtual ADDR/LEN into a format the remote target + understands. Returns number of bytes that can be transfered + starting at taddr, ZERO if no bytes can be transfered. */ +int +remote_d10v_translate_xfer_address (memaddr, nr_bytes, taddr) CORE_ADDR memaddr; - char *myaddr; int nr_bytes; - int write_p; - struct target_ops *target; /* ignored */ + CORE_ADDR *taddr; { CORE_ADDR phys; CORE_ADDR seg; @@ -259,21 +210,19 @@ remote_d10v_xfer_memory(memaddr, myaddr, nr_bytes, write_p, target) } - printf_unfiltered ("%s-xfer: 0x%08lx -> 0x%08lx imap0=%04x imap1=%04x, dmap=%04x, %s->%s, %d bytes\n", - (write_p ? "wr" : "rd"), - (long) memaddr, - (long) phys, - (int) imap0, (int) imap1, (int) dmap, - from, to, - (int) nr_bytes); - - return inherited_ops->to_xfer_memory (phys, myaddr, nr_bytes, write_p, target); + *taddr = phys; + return nr_bytes; } void _initialize_remote_d10v () { - init_remote_d10v_ops (0); + remote_d10v_ops.to_shortname = "d10v"; + remote_d10v_ops.to_longname = "Remote d10v serial target in gdb-specific protocol"; + remote_d10v_ops.to_doc = "Use a remote d10v via a serial line, using a gdb-specific protocol.\n\ +Specify the serial device it is connected to (e.g. /dev/ttya)."; + remote_d10v_ops.to_open = remote_d10v_open; + add_target (&remote_d10v_ops); }