/* Remote debugging interface for Hitachi E7000 ICE, for GDB
- Copyright 1993, 1994, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain for Cygnus Support.
#include "gdbarch.h"
#include "inferior.h"
#include "target.h"
-#include "gdb_wait.h"
#include "value.h"
#include "command.h"
-#include <signal.h>
#include "gdb_string.h"
#include "gdbcmd.h"
#include <sys/types.h>
#include "serial.h"
#include "remote-utils.h"
#include "symfile.h"
+#include "regcache.h"
#include <time.h>
#include <ctype.h>
/* Send data to e7000debug. */
static void
-puts_e7000debug (buf)
- char *buf;
+puts_e7000debug (char *buf)
{
if (!e7000_desc)
error ("Use \"target e7000 ...\" first.");
}
static void
-putchar_e7000 (x)
- int x;
+putchar_e7000 (int x)
{
char b[1];
}
static void
-write_e7000 (s)
- char *s;
+write_e7000 (char *s)
{
SERIAL_WRITE (e7000_desc, s, strlen (s));
}
static int
-normal (x)
- int x;
+normal (int x)
{
if (x == '\n')
return '\r';
returns -1, else returns next char. Discards chars > 127. */
static int
-readchar (timeout)
- int timeout;
+readchar (int timeout)
{
int c;
#if 0
char *
-tl (x)
+tl (int x)
{
static char b[8][10];
static int p;
out. Let the user break out immediately. */
static void
-expect (string)
- char *string;
+expect (char *string)
{
char *p = string;
int c;
into states from which we can't recover. */
static void
-expect_prompt ()
+expect_prompt (void)
{
expect (":");
}
static void
-expect_full_prompt ()
+expect_full_prompt (void)
{
expect ("\r:");
}
static int
-convert_hex_digit (ch)
- int ch;
+convert_hex_digit (int ch)
{
if (ch >= '0' && ch <= '9')
return ch - '0';
}
static int
-get_hex (start)
- int *start;
+get_hex (int *start)
{
int value = convert_hex_digit (*start);
int try;
them in registers starting at REGNO. */
static void
-get_hex_regs (n, regno)
- int n;
- int regno;
+get_hex_regs (int n, int regno)
{
long val;
int i;
user types "run" after having attached. */
static void
-e7000_create_inferior (execfile, args, env)
- char *execfile;
- char *args;
- char **env;
+e7000_create_inferior (char *execfile, char *args, char **env)
{
int entry_pt;
/* Grab the next token and buy some space for it */
static char *
-next (ptr)
- char **ptr;
+next (char **ptr)
{
char *p = *ptr;
char *s;
}
static void
-e7000_login_command (args, from_tty)
- char *args;
- int from_tty;
+e7000_login_command (char *args, int from_tty)
{
if (args)
{
/* Start an ftp transfer from the E7000 to a host */
static void
-e7000_ftp_command (args, from_tty)
- char *args;
- int from_tty;
+e7000_ftp_command (char *args, int from_tty)
{
/* FIXME: arbitrary limit on machine names and such. */
char buf[200];
}
static int
-e7000_parse_device (args, dev_name, baudrate)
- char *args;
- char *dev_name;
- int baudrate;
+e7000_parse_device (char *args, char *dev_name, int baudrate)
{
char junk[128];
int n = 0;
or \t\ttarget e7000 pc\n");
}
-#if !defined(__GO32__) && !defined(_WIN32)
+#if !defined(__GO32__) && !defined(_WIN32) && !defined(__CYGWIN__)
/* FIXME! test for ':' is ambiguous */
if (n == 1 && strchr (dev_name, ':') == 0)
{
/* Stub for catch_errors. */
static int
-e7000_start_remote (dummy)
- char *dummy;
+e7000_start_remote (void *dummy)
{
int loop;
int sync;
int try;
int quit_trying;
- immediate_quit = 1; /* Allow user to interrupt it */
+ immediate_quit++; /* Allow user to interrupt it */
/* Hello? Are you there? */
sync = 0;
if (!sync)
{
fprintf_unfiltered (gdb_stderr, "Giving up after %d tries...\n", try);
- error ("Unable to syncronize with target.\n");
+ error ("Unable to synchronize with target.\n");
}
puts_e7000debug ("\r");
puts_e7000debug ("b -\r"); /* Clear breakpoints */
expect_prompt ();
- immediate_quit = 0;
+ immediate_quit--;
/* This is really the job of start_remote however, that makes an assumption
that the target is about to print out a status message of some sort. That
}
static void
-e7000_open (args, from_tty)
- char *args;
- int from_tty;
+e7000_open (char *args, int from_tty)
{
int n;
/* Close out all files and local state before this target loses control. */
static void
-e7000_close (quitting)
- int quitting;
+e7000_close (int quitting)
{
if (e7000_desc)
{
when you want to detach and do something else with your gdb. */
static void
-e7000_detach (from_tty)
- int from_tty;
+e7000_detach (char *arg, int from_tty)
{
pop_target (); /* calls e7000_close to do the real work */
if (from_tty)
/* Tell the remote machine to resume. */
static void
-e7000_resume (pid, step, sig)
- int pid, step, sig;
+e7000_resume (int pid, int step, enum target_signal sigal)
{
if (step)
puts_e7000debug ("S\r");
R4_BANK1-R7_BANK1 %37 %38 %39 %40";
static int
-gch ()
+gch (void)
{
return readchar (timeout);
}
static unsigned int
-gbyte ()
+gbyte (void)
{
int high = convert_hex_digit (gch ());
int low = convert_hex_digit (gch ());
}
void
-fetch_regs_from_dump (nextchar, want)
- int (*nextchar) ();
- char *want;
+fetch_regs_from_dump (int (*nextchar) (), char *want)
{
int regno;
char buf[MAX_REGISTER_RAW_SIZE];
}
else
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
}
store_signed_integer (buf,
REGISTER_RAW_SIZE (regno),
- (LONGEST) get_hex (&thischar, nextchar));
+ (LONGEST) get_hex (&thischar));
supply_register (regno, buf);
break;
}
}
static void
-e7000_fetch_registers ()
+e7000_fetch_registers (void)
{
int regno;
char *wanted;
errno value. */
static void
-e7000_fetch_register (regno)
- int regno;
+e7000_fetch_register (int regno)
{
e7000_fetch_registers ();
}
/* Store the remote registers from the contents of the block REGS. */
static void
-e7000_store_registers ()
+e7000_store_registers (void)
{
int regno;
/* Store register REGNO, or all if REGNO == 0. Return errno value. */
static void
-e7000_store_register (regno)
- int regno;
+e7000_store_register (int regno)
{
char buf[200];
debugged. */
static void
-e7000_prepare_to_store ()
+e7000_prepare_to_store (void)
{
/* Do nothing, since we can store individual regs */
}
static void
-e7000_files_info ()
+e7000_files_info (struct target_ops *ops)
{
printf_unfiltered ("\tAttached to %s at %d baud.\n", dev_name, baudrate);
}
static int
-stickbyte (where, what)
- char *where;
- unsigned int what;
+stickbyte (char *where, unsigned int what)
{
static CONST char digs[] = "0123456789ABCDEF";
/* Write a small ammount of memory. */
static int
-write_small (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- unsigned char *myaddr;
- int len;
+write_small (CORE_ADDR memaddr, unsigned char *myaddr, int len)
{
int i;
char buf[200];
*/
static int
-write_large (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- unsigned char *myaddr;
- int len;
+write_large (CORE_ADDR memaddr, unsigned char *myaddr, int len)
{
int i;
#define maxstride 128
then. */
static int
-e7000_write_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- unsigned char *myaddr;
- int len;
+e7000_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
{
if (len < 16 || using_tcp || using_pc)
return write_small (memaddr, myaddr, len);
*/
static int
-e7000_read_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- unsigned char *myaddr;
- int len;
+e7000_read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
{
int count;
int c;
*/
static int
-e7000_read_inferior_memory_large (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- unsigned char *myaddr;
- int len;
+e7000_read_inferior_memory_large (CORE_ADDR memaddr, unsigned char *myaddr,
+ int len)
{
int count;
int c;
#if 0
static int
-fast_but_for_the_pause_e7000_read_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
+fast_but_for_the_pause_e7000_read_inferior_memory (CORE_ADDR memaddr,
+ char *myaddr, int len)
{
int loop;
int c;
#endif
+/* Transfer LEN bytes between GDB address MYADDR and target address
+ MEMADDR. If WRITE is non-zero, transfer them to the target,
+ otherwise transfer them from the target. TARGET is unused.
+
+ Returns the number of bytes transferred. */
+
static int
-e7000_xfer_inferior_memory (memaddr, myaddr, len, write, target)
- CORE_ADDR memaddr;
- unsigned char *myaddr;
- int len;
- int write;
- struct target_ops *target; /* ignored */
+e7000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr,
+ int len, int write,
+ struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+ struct target_ops *target ATTRIBUTE_UNUSED)
{
if (write)
return e7000_write_inferior_memory (memaddr, myaddr, len);
}
static void
-e7000_kill (args, from_tty)
- char *args;
- int from_tty;
+e7000_kill (void)
{
}
static void
-e7000_load (args, from_tty)
- char *args;
- int from_tty;
+e7000_load (char *args, int from_tty)
{
struct cleanup *old_chain;
asection *section;
instructions. */
static void
-e7000_mourn_inferior ()
+e7000_mourn_inferior (void)
{
remove_breakpoints ();
unpush_target (&e7000_ops);
{0};
static int
-e7000_insert_breakpoint (addr, shadow)
- CORE_ADDR addr;
- unsigned char *shadow;
+e7000_insert_breakpoint (CORE_ADDR addr, char *shadow)
{
int i;
char buf[200];
}
static int
-e7000_remove_breakpoint (addr, shadow)
- CORE_ADDR addr;
- unsigned char *shadow;
+e7000_remove_breakpoint (CORE_ADDR addr, char *shadow)
{
int i;
char buf[200];
is placed on the users terminal until the prompt is seen. */
static void
-e7000_command (args, fromtty)
- char *args;
- int fromtty;
+e7000_command (char *args, int fromtty)
{
/* FIXME: arbitrary limit on length of args. */
char buf[200];
static void
-e7000_drain_command (args, fromtty)
- char *args;
- int fromtty;
-
+e7000_drain_command (char *args, int fromtty)
{
int c;
#define NITEMS 7
static int
-why_stop ()
+why_stop (void)
{
static char *strings[NITEMS] =
{
otherwise echo them. */
int
-expect_n (strings)
- char **strings;
+expect_n (char **strings)
{
char *(ptr[10]);
int n;
pc, and the simulators never do. */
static void
-sub2_from_pc ()
+sub2_from_pc (void)
{
char buf[4];
char buf2[200];
STATUS just as `wait' would. */
static int
-e7000_wait (pid, status)
- int pid;
- struct target_waitstatus *status;
+e7000_wait (int pid, struct target_waitstatus *status)
{
int stop_reason;
int regno;
break;
default:
/* Get the user's attention - this should never happen. */
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
}
return 0;
/* Stop the running program. */
static void
-e7000_stop ()
+e7000_stop (void)
{
/* Sending a ^C is supposed to stop the running program. */
putchar_e7000 (CTRLC);
e7000_ops.to_thread_alive = 0;
e7000_ops.to_stop = e7000_stop;
e7000_ops.to_pid_to_exec_file = NULL;
- e7000_ops.to_core_file_to_sym_file = NULL;
e7000_ops.to_stratum = process_stratum;
e7000_ops.DONT_USE = 0;
e7000_ops.to_has_all_memory = 1;
};
void
-_initialize_remote_e7000 ()
+_initialize_remote_e7000 (void)
{
init_e7000_ops ();
add_target (&e7000_ops);