/* Remote debugging interface for boot monitors, for GDB.
- Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "gdbcore.h"
#include "target.h"
-#include "wait.h"
+#include "gdb_wait.h"
#include <signal.h>
#include "gdb_string.h"
#include <sys/types.h>
/* Read a character from the remote system, doing all the fancy timeout stuff */
static int
-readchar (timeout)
- int timeout;
+readchar (int timeout)
{
int c;
non-zero, then discard non-matching input, else print it out.
Let the user break out immediately. */
static void
-expect (string, discard)
- char *string;
- int discard;
+expect (char *string, int discard)
{
char *p = string;
int c;
if (sr_get_debug ())
printf ("Expecting \"%s\"\n", string);
- immediate_quit = 1;
+ immediate_quit++;
while (1)
{
c = readchar (timeout);
{
if (*p == '\0')
{
- immediate_quit = 0;
+ immediate_quit--;
if (sr_get_debug ())
printf ("\nMatched\n");
return;
necessary to prevent getting into states from which we can't
recover. */
static void
-expect_prompt (discard)
- int discard;
+expect_prompt (int discard)
{
if (monitor_log)
/* 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 monitor 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;
/* This is called not only when we first attach, but also when the
user types "run" after having attached. */
static void
-rombug_create_inferior (execfile, args, env)
- char *execfile;
- char *args;
- char **env;
+rombug_create_inferior (char *execfile, char *args, char **env)
{
int entry_pt;
static char dev_name[100];
static void
-rombug_open (args, from_tty)
- char *args;
- int from_tty;
+rombug_open (char *args, int from_tty)
{
if (args == NULL)
error ("Use `target RomBug DEVICE-NAME' to use a serial port, or \n\
*/
static void
-rombug_close (quitting)
- int quitting;
+rombug_close (int quitting)
{
if (rombug_is_open)
{
}
int
-rombug_link (mod_name, text_reloc)
- char *mod_name;
- CORE_ADDR *text_reloc;
+rombug_link (char *mod_name, CORE_ADDR *text_reloc)
{
int i, j;
unsigned long val;
Use this when you want to detach and do something else
with your gdb. */
static void
-rombug_detach (from_tty)
- int from_tty;
+rombug_detach (int from_tty)
{
if (attach_flag)
{
* Tell the remote machine to resume.
*/
static void
-rombug_resume (pid, step, sig)
- int pid, step;
- enum target_signal sig;
+rombug_resume (int pid, int step, enum target_signal sig)
{
if (monitor_log)
fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig);
*/
static int
-rombug_wait (pid, status)
- int pid;
- struct target_waitstatus *status;
+rombug_wait (int pid, struct target_waitstatus *status)
{
int old_timeout = timeout;
struct section_offsets *offs;
{
if (obj_sec->objfile != symfile_objfile)
new_symfile_objfile (obj_sec->objfile, 1, 0);
- offs = ((struct section_offsets *)
- alloca (sizeof (struct section_offsets)
- + (symfile_objfile->num_sections * sizeof (offs->offsets))));
- memcpy (offs, symfile_objfile->section_offsets,
- (sizeof (struct section_offsets) +
- (symfile_objfile->num_sections * sizeof (offs->offsets))));
- ANOFFSET (offs, SECT_OFF_DATA) = addr;
- ANOFFSET (offs, SECT_OFF_BSS) = addr;
+ offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
+ memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
+ offs->offsets[SECT_OFF_DATA (symfile_objfile)] = addr;
+ offs->offsets[SECT_OFF_BSS (symfile_objfile)] = addr;
objfile_relocate (symfile_objfile, offs);
}
monitor wants. Lets take advantage of that just as long as possible! */
static char *
-get_reg_name (regno)
- int regno;
+get_reg_name (int regno)
{
static char buf[50];
char *p;
/* read the remote registers into the block regs. */
static void
-rombug_fetch_registers ()
+rombug_fetch_registers (void)
{
int regno, j, i;
long val;
/* Fetch register REGNO, or all registers if REGNO is -1.
Returns errno value. */
static void
-rombug_fetch_register (regno)
- int regno;
+rombug_fetch_register (int regno)
{
int val, j;
unsigned char b;
/* Store the remote registers from the contents of the block REGS. */
static void
-rombug_store_registers ()
+rombug_store_registers (void)
{
int regno;
/* Store register REGNO, or all if REGNO == 0.
return errno value. */
static void
-rombug_store_register (regno)
- int regno;
+rombug_store_register (int regno)
{
char *name;
debugged. */
static void
-rombug_prepare_to_store ()
+rombug_prepare_to_store (void)
{
/* Do nothing, since we can store individual regs */
}
static void
-rombug_files_info ()
+rombug_files_info (void)
{
printf ("\tAttached to %s at %d baud.\n",
dev_name, sr_get_baud_rate ());
/* Copy LEN bytes of data from debugger memory at MYADDR
to inferior's memory at MEMADDR. Returns length moved. */
static int
-rombug_write_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- unsigned char *myaddr;
- int len;
+rombug_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
{
int i;
char buf[10];
/* Read LEN bytes from inferior memory at MEMADDR. Put the result
at debugger address MYADDR. Returns length moved. */
static int
-rombug_read_inferior_memory (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
+rombug_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
int i, j;
return len;
}
-/* FIXME-someday! merge these two. */
+/* 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
-rombug_xfer_inferior_memory (memaddr, myaddr, len, write, target)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int write;
- struct target_ops *target; /* ignored */
+rombug_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 rombug_write_inferior_memory (memaddr, myaddr, len);
}
static void
-rombug_kill (args, from_tty)
- char *args;
- int from_tty;
+rombug_kill (char *args, int from_tty)
{
return; /* ignore attempts to kill target system */
}
instructions. */
static void
-rombug_mourn_inferior ()
+rombug_mourn_inferior (void)
{
remove_breakpoints ();
generic_mourn_inferior (); /* Do all the proper things now */
{0};
static int
-rombug_insert_breakpoint (addr, shadow)
- CORE_ADDR addr;
- char *shadow;
+rombug_insert_breakpoint (CORE_ADDR addr, char *shadow)
{
int i;
CORE_ADDR bp_addr = addr;
* _remove_breakpoint -- Tell the monitor to remove a breakpoint
*/
static int
-rombug_remove_breakpoint (addr, shadow)
- CORE_ADDR addr;
- char *shadow;
+rombug_remove_breakpoint (CORE_ADDR addr, char *shadow)
{
int i;
#define DOWNLOAD_LINE_SIZE 100
static void
-rombug_load (arg)
- char *arg;
+rombug_load (char *arg)
{
/* this part comment out for os9* */
#if 0
is seen. */
static void
-rombug_command (args, fromtty)
- char *args;
- int fromtty;
+rombug_command (char *args, int fromtty)
{
if (monitor_desc == NULL)
error ("monitor target not open.");
static struct ttystate ttystate;
static void
-cleanup_tty ()
+cleanup_tty (void)
{
printf ("\r\n[Exiting connect mode]\r\n");
/*SERIAL_RESTORE(0, &ttystate); */
}
static void
-connect_command (args, fromtty)
- char *args;
- int fromtty;
+connect_command (char *args, int fromtty)
{
fd_set readfds;
int numfds;
do
{
FD_SET (0, &readfds);
- FD_SET (monitor_desc, &readfds);
+ FD_SET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds);
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
}
while (numfds == 0);
}
}
- if (FD_ISSET (monitor_desc, &readfds))
+ if (FD_ISSET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds))
{
while (1)
{
}
void
-_initialize_remote_os9k ()
+_initialize_remote_os9k (void)
{
init_rombug_ops ();
add_target (&rombug_ops);