/* Remote debugging interface for AMD 29000 EBMON on IBM PC, for GDB.
- Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Jim Kingdon for Cygnus.
This file is part of GDB.
#include "defs.h"
#include "gdb_string.h"
+#include "regcache.h"
#include "inferior.h"
#include "bfd.h"
#include "symfile.h"
-#include "wait.h"
#include "value.h"
#include <ctype.h>
#include <fcntl.h>
/* Read a character from the remote system, doing all the fancy
timeout stuff. */
static int
-readchar ()
+readchar (void)
{
char buf;
/* Keep discarding input from the remote system, until STRING is found.
Let the user break out immediately. */
static void
-expect (string)
- char *string;
+expect (char *string)
{
char *p = string;
- immediate_quit = 1;
+ immediate_quit++;
while (1)
{
if (readchar () == *p)
p++;
if (*p == '\0')
{
- immediate_quit = 0;
+ immediate_quit--;
return;
}
}
necessary to prevent getting into states from which we can't
recover. */
static void
-expect_prompt ()
+expect_prompt (void)
{
#if defined (LOG_FILE)
/* This is a convenient place to do this. The idea is to do it often
/* Get a hex digit from the remote system & return its value.
If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */
static int
-get_hex_digit (ignore_space)
- int ignore_space;
+get_hex_digit (int ignore_space)
{
int ch;
while (1)
/* Get a byte from eb_desc and put it in *BYT. Accept any number
leading spaces. */
static void
-get_hex_byte (byt)
- char *byt;
+get_hex_byte (char *byt)
{
int val;
/* Get N 32-bit words from remote, each preceded by a space,
and put 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;
/* Called when SIGALRM signal sent due to alarm() timeout. */
#ifndef HAVE_TERMIO
-#ifndef __STDC__
-#define volatile
-/**/
-#endif
volatile int n_alarms;
void
-eb_timer ()
+eb_timer (void)
{
#if 0
if (kiodebug)
/* This is called not only when we first attach, but also when the
user types "run" after having attached. */
static void
-eb_create_inferior (execfile, args, env)
- char *execfile;
- char *args;
- char **env;
+eb_create_inferior (char *execfile, char *args, char **env)
{
int entry_pt;
};
int
-damn_b (rate)
- int rate;
+damn_b (int rate)
{
int i;
static int baudrate = 9600;
static char *dev_name;
void
-eb_open (name, from_tty)
- char *name;
- int from_tty;
+eb_open (char *name, int from_tty)
{
TERMINAL sg;
/*EMPTY */ ;
if (prog_name != NULL)
- free (prog_name);
+ xfree (prog_name);
prog_name = savestring (p, strlen (p));
eb_close (0);
/* Close out all files and local state before this target loses control. */
static void
-eb_close (quitting)
- int quitting;
+eb_close (int quitting)
{
/* Due to a bug in Unix, fclose closes not only the stdio stream,
Use this when you want to detach and do something else
with your gdb. */
void
-eb_detach (from_tty)
- int from_tty;
+eb_detach (int from_tty)
{
pop_target (); /* calls eb_close to do the real work */
if (from_tty)
/* Tell the remote machine to resume. */
void
-eb_resume (pid, step, sig)
- int pid, step;
- enum target_signal sig;
+eb_resume (ptid_t ptid, int step, enum target_signal sig)
{
if (step)
{
/* Wait until the remote machine stops, then return,
storing status in STATUS just as `wait' would. */
-int
-eb_wait (status)
- struct target_waitstatus *status;
+ptid_t
+eb_wait (ptid_t ptid, struct target_waitstatus *status)
{
/* Strings to look for. '?' means match any single character.
Note that with the algorithm we use, the initial character
Returns a pointer to a static buffer containing the answer. */
static char *
-get_reg_name (regno)
- int regno;
+get_reg_name (int regno)
{
static char buf[80];
if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32)
/* Read the remote registers into the block REGS. */
static void
-eb_fetch_registers ()
+eb_fetch_registers (void)
{
int reg_index;
int regnum_index;
/* Fetch register REGNO, or all registers if REGNO is -1.
Returns errno value. */
void
-eb_fetch_register (regno)
- int regno;
+eb_fetch_register (int regno)
{
if (regno == -1)
eb_fetch_registers ();
/* Store the remote registers from the contents of the block REGS. */
static void
-eb_store_registers ()
+eb_store_registers (void)
{
int i, j;
fprintf (eb_stream, "s gr1,%x\n", read_register (GR1_REGNUM));
/* Store register REGNO, or all if REGNO == 0.
Return errno value. */
void
-eb_store_register (regno)
- int regno;
+eb_store_register (int regno)
{
if (regno == -1)
eb_store_registers ();
debugged. */
void
-eb_prepare_to_store ()
+eb_prepare_to_store (void)
{
/* Do nothing, since we can store individual regs */
}
+/* 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. */
-/* FIXME-someday! Merge these two. */
int
-eb_xfer_inferior_memory (memaddr, myaddr, len, write, target)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int write;
- struct target_ops *target; /* ignored */
+eb_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 eb_write_inferior_memory (memaddr, myaddr, len);
}
void
-eb_files_info ()
+eb_files_info (void)
{
printf ("\tAttached to %s at %d baud and running program %s.\n",
dev_name, baudrate, prog_name);
/* Copy LEN bytes of data from debugger memory at MYADDR
to inferior's memory at MEMADDR. Returns length moved. */
int
-eb_write_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
+eb_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
int i;
/* Read LEN bytes from inferior memory at MEMADDR. Put the result
at debugger address MYADDR. Returns length moved. */
int
-eb_read_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
+eb_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
int i;
}
static void
-eb_kill (args, from_tty)
- char *args;
- int from_tty;
+eb_kill (char *args, int from_tty)
{
return; /* Ignore attempts to kill target system */
}
instructions. */
void
-eb_mourn_inferior ()
+eb_mourn_inferior (void)
{
remove_breakpoints ();
unpush_target (&eb_ops);
eb_ops.to_thread_alive = 0; /* thread-alive */
eb_ops.to_stop = 0; /* to_stop */
eb_ops.to_pid_to_exec_file = NULL;
- eb_ops.to_core_file_to_sym_file = NULL;
eb_ops.to_stratum = process_stratum;
eb_ops.DONT_USE = 0; /* next */
eb_ops.to_has_all_memory = 1;
};
void
-_initialize_remote_eb ()
+_initialize_remote_eb (void)
{
init_eb_ops ();
add_target (&eb_ops);