/* Memory-access and commands for remote es1800 processes, for GDB.
- Copyright (C) 1988, 1992 Free Software Foundation, Inc.
+ Copyright 1988, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is added to GDB to make it possible to do debugging via an
ES-1800 emulator. The code was originally written by Johan Holmberg
#include "frame.h"
#include "inferior.h"
#include "target.h"
-#include "gdb_wait.h"
#include "command.h"
+#include "symfile.h"
#include "remote-utils.h"
#include "gdbcore.h"
#include "serial.h"
+#include "regcache.h"
/* Prototypes for local functions */
static int
es1800_xfer_inferior_memory (CORE_ADDR, char *, int, int,
- struct target_ops *);
+ struct mem_attrib *, struct target_ops *);
static void es1800_prepare_to_store (void);
-static int es1800_wait (int, struct target_waitstatus *);
+static ptid_t es1800_wait (ptid_t, struct target_waitstatus *);
-static void es1800_resume (int, int, enum target_signal);
+static void es1800_resume (ptid_t, int, enum target_signal);
static void es1800_detach (char *, int);
}
if (savename != NULL)
{
- free (savename);
+ xfree (savename);
}
savename = NULL;
siggnal - the signal value to be given to the target (0 = no signal) */
static void
-es1800_resume (int pid, int step, enum target_signal siggnal)
+es1800_resume (ptid_t ptid, int step, enum target_signal siggnal)
{
char buf[PBUFSIZ];
storing status in STATUS just as `wait' would.
status - */
-static int
-es1800_wait (int pid, struct target_waitstatus *status)
+static ptid_t
+es1800_wait (ptid_t ptid, struct target_waitstatus *status)
{
unsigned char buf[PBUFSIZ];
int old_timeout = timeout;
}
signal (SIGINT, old_sigint);
timeout = old_timeout;
- return (0);
+ return inferior_ptid;
}
static int
es1800_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
- int write, struct target_ops *tops)
+ int write,
+ struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+ struct target_ops *target ATTRIBUTE_UNUSED)
{
int origlen = len;
int xfersize;
if (len > PBUFSIZ / 2 - 1)
{
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
}
if (len == 1) /* The emulator does not like expressions like: */
{
memory_error (status, memaddress);
}
- return (STRCMP (instr, buf));
+ return (strcmp (instr, buf));
}
return (-1);
}
static void
es1800_kill (void)
{
- if (inferior_pid != 0)
+ if (!ptid_equal (inferior_ptid, null_ptid))
{
- inferior_pid = 0;
+ inferior_ptid = null_ptid;
es1800_mourn_inferior ();
}
}
}
filename = tilde_expand (filename);
- make_cleanup (free, filename);
+ make_cleanup (xfree, filename);
switch (es1800_load_format)
{
}
breakpoint_init_inferior ();
- inferior_pid = 0;
+ inferior_ptid = null_ptid;
if (from_tty)
{
printf ("Downloading \"%s\" to the ES 1800\n", filename);
system (buf);
}
- symbol_file_command (filename, from_tty); /* reading symbol table */
+ symbol_file_add_main (filename, from_tty); /* reading symbol table */
immediate_quit--;
}
#endif
-/* Start an process on the es1800 and set inferior_pid to the new
+/* Start an process on the es1800 and set inferior_ptid to the new
process' pid.
execfile - the file to run
args - arguments passed to the program
/* The "process" (board) is already stopped awaiting our commands, and
the program is already downloaded. We just set its PC and go. */
- inferior_pid = pid; /* Needed for wait_for_inferior below */
+ inferior_ptid = pid_to_ptid (pid); /* Needed for wait_for_inferior below */
clear_proceed_status ();
pop_target ();
if (from_tty)
{
- printf ("Ending debugging the process %d.\n", inferior_pid);
+ printf ("Ending debugging the process %d.\n", PIDGET (inferior_ptid));
}
}
es1800_ops.to_thread_alive = 0;
es1800_ops.to_stop = 0;
es1800_ops.to_pid_to_exec_file = NULL;
- es1800_ops.to_core_file_to_sym_file = NULL;
es1800_ops.to_stratum = core_stratum;
es1800_ops.DONT_USE = 0;
es1800_ops.to_has_all_memory = 0;
es1800_child_ops.to_thread_alive = 0;
es1800_child_ops.to_stop = 0;
es1800_child_ops.to_pid_to_exec_file = NULL;
- es1800_child_ops.to_core_file_to_sym_file = NULL;
es1800_child_ops.to_stratum = process_stratum;
es1800_child_ops.DONT_USE = 0;
es1800_child_ops.to_has_all_memory = 1;