/* Remote target communications for serial-line targets using SDS' protocol.
- Copyright 1997 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GDB.
#include "bfd.h"
#include "symfile.h"
#include "target.h"
-#include "gdb_wait.h"
#include "gdbcmd.h"
#include "objfiles.h"
#include "gdb-stabs.h"
#include "gdbthread.h"
#include "gdbcore.h"
-#include "dcache.h"
+#include "regcache.h"
#ifdef USG
#include <sys/types.h>
static void sds_files_info (struct target_ops *ignore);
-static int sds_xfer_memory (CORE_ADDR, char *, int, int, struct target_ops *);
+static int sds_xfer_memory (CORE_ADDR, char *, int, int,
+ struct mem_attrib *, struct target_ops *);
static void sds_prepare_to_store (void);
static void sds_fetch_registers (int);
-static void sds_resume (int, int, enum target_signal);
+static void sds_resume (ptid_t, int, enum target_signal);
static int sds_start_remote (PTR);
static int readchar (int);
-static int sds_wait (int, struct target_waitstatus *);
+static ptid_t sds_wait (ptid_t, struct target_waitstatus *);
static void sds_kill (void);
static int
sds_start_remote (PTR dummy)
{
- char c;
+ int c;
unsigned char buf[200];
immediate_quit++; /* Allow user to interrupt it */
/* Open a connection to a remote debugger.
NAME is the filename used for communication. */
-static DCACHE *sds_dcache;
-
static void
sds_open (char *name, int from_tty)
{
unpush_target (&sds_ops);
- if (!sds_dcache)
- sds_dcache = dcache_init (sds_read_bytes, sds_write_bytes);
- else
- dcache_invd (sds_dcache);
-
sds_desc = SERIAL_OPEN (name);
if (!sds_desc)
perror_with_name (name);
int last_sent_step;
static void
-sds_resume (int pid, int step, enum target_signal siggnal)
+sds_resume (ptid_t ptid, int step, enum target_signal siggnal)
{
unsigned char buf[PBUFSIZ];
- dcache_invd (sds_dcache);
-
last_sent_signal = siggnal;
last_sent_step = step;
STATUS just as `wait' would. Returns "pid" (though it's not clear
what, if anything, that means in the case of this target). */
-static int
-sds_wait (int pid, struct target_waitstatus *status)
+static ptid_t
+sds_wait (ptid_t ptid, struct target_waitstatus *status)
{
unsigned char buf[PBUFSIZ];
int retlen;
{
just_started = 0;
status->kind = TARGET_WAITKIND_STOPPED;
- return inferior_pid;
+ return inferior_ptid;
}
while (1)
}
}
got_status:
- return inferior_pid;
+ return inferior_ptid;
}
static unsigned char sprs[16];
/* ARGSUSED */
static int
sds_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
- struct target_ops *target)
+ struct mem_attrib *attrib ATTRIBUTE_UNUSED,
+ struct target_ops *target ATTRIBUTE_UNUSED)
{
- return dcache_xfer_memory (sds_dcache, memaddr, myaddr, len, should_write);
+ int res;
+
+ if (should_write)
+ res = sds_write_bytes (memaddr, myaddr, len);
+ else
+ res = sds_read_bytes (memaddr, myaddr, len);
+
+ return res;
}
\f
and giving it a checksum. */
if (len > 170) /* Prosanity check */
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
if (remote_debug)
{
static void
sds_create_inferior (char *exec_file, char *args, char **env)
{
- inferior_pid = 42000;
+ inferior_ptid = pid_to_ptid (42000);
/* Clean up from the last time we were running. */
clear_proceed_status ();
{
generic_load (filename, from_tty);
- inferior_pid = 0;
+ inferior_ptid = null_ptid;
}
\f
/* The SDS monitor has commands for breakpoint insertion, although it