projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2004-02-15 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git]
/
gdb
/
remote-sds.c
diff --git
a/gdb/remote-sds.c
b/gdb/remote-sds.c
index 224032715b8aa6cfcea32f2f301c528682ae320d..d74fd7db2420b17ed48b27e68ea13767f35b3c0b 100644
(file)
--- a/
gdb/remote-sds.c
+++ b/
gdb/remote-sds.c
@@
-1,5
+1,7
@@
/* Remote target communications for serial-line targets using SDS' protocol.
/* Remote target communications for serial-line targets using SDS' protocol.
- Copyright 1997, 2001 Free Software Foundation, Inc.
+
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-36,6
+38,7
@@
#include "gdb-stabs.h"
#include "gdbthread.h"
#include "gdbcore.h"
#include "gdb-stabs.h"
#include "gdbthread.h"
#include "gdbcore.h"
+#include "regcache.h"
#ifdef USG
#include <sys/types.h>
#ifdef USG
#include <sys/types.h>
@@
-61,9
+64,9
@@
static void sds_prepare_to_store (void);
static void sds_fetch_registers (int);
static void sds_fetch_registers (int);
-static void sds_resume (
in
t, int, enum target_signal);
+static void sds_resume (
ptid_
t, int, enum target_signal);
-static int sds_start_remote (
PTR
);
+static int sds_start_remote (
void *
);
static void sds_open (char *, int);
static void sds_open (char *, int);
@@
-85,12
+88,10
@@
static int sds_send (unsigned char *, int);
static int readchar (int);
static int readchar (int);
-static
int sds_wait (in
t, struct target_waitstatus *);
+static
ptid_t sds_wait (ptid_
t, struct target_waitstatus *);
static void sds_kill (void);
static void sds_kill (void);
-static int tohex (int);
-
static int fromhex (int);
static void sds_detach (char *, int);
static int fromhex (int);
static void sds_detach (char *, int);
@@
-126,7
+127,7
@@
static int sds_timeout = 2;
that sds_open knows that we don't have a file open when the program
starts. */
that sds_open knows that we don't have a file open when the program
starts. */
-static s
erial_t
sds_desc = NULL;
+static s
truct serial *
sds_desc = NULL;
/* This limit comes from the monitor. */
/* This limit comes from the monitor. */
@@
-145,28
+146,27
@@
static int message_pending;
/* Clean up connection to a remote debugger. */
/* Clean up connection to a remote debugger. */
-/* ARGSUSED */
static void
sds_close (int quitting)
{
if (sds_desc)
static void
sds_close (int quitting)
{
if (sds_desc)
-
SERIAL_CLOSE
(sds_desc);
+
serial_close
(sds_desc);
sds_desc = NULL;
}
/* Stub for catch_errors. */
static int
sds_desc = NULL;
}
/* Stub for catch_errors. */
static int
-sds_start_remote (
PTR
dummy)
+sds_start_remote (
void *
dummy)
{
{
-
char
c;
+
int
c;
unsigned char buf[200];
immediate_quit++; /* Allow user to interrupt it */
/* Ack any packet which the remote side has already sent. */
unsigned char buf[200];
immediate_quit++; /* Allow user to interrupt it */
/* Ack any packet which the remote side has already sent. */
-
SERIAL_WRITE
(sds_desc, "{#*\r\n", 5);
-
SERIAL_WRITE
(sds_desc, "{#}\r\n", 5);
+
serial_write
(sds_desc, "{#*\r\n", 5);
+
serial_write
(sds_desc, "{#}\r\n", 5);
while ((c = readchar (1)) >= 0)
printf_unfiltered ("%c", c);
while ((c = readchar (1)) >= 0)
printf_unfiltered ("%c", c);
@@
-200,25
+200,25
@@
device is attached to the remote system (e.g. /dev/ttya).");
unpush_target (&sds_ops);
unpush_target (&sds_ops);
- sds_desc =
SERIAL_OPEN
(name);
+ sds_desc =
serial_open
(name);
if (!sds_desc)
perror_with_name (name);
if (baud_rate != -1)
{
if (!sds_desc)
perror_with_name (name);
if (baud_rate != -1)
{
- if (
SERIAL_SETBAUDRATE
(sds_desc, baud_rate))
+ if (
serial_setbaudrate
(sds_desc, baud_rate))
{
{
-
SERIAL_CLOSE
(sds_desc);
+
serial_close
(sds_desc);
perror_with_name (name);
}
}
perror_with_name (name);
}
}
-
SERIAL_RAW
(sds_desc);
+
serial_raw
(sds_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
-
SERIAL_FLUSH_INPUT
(sds_desc);
+
serial_flush_input
(sds_desc);
if (from_tty)
{
if (from_tty)
{
@@
-276,17
+276,6
@@
fromhex (int a)
error ("Reply contains invalid hex digit %d", a);
}
error ("Reply contains invalid hex digit %d", a);
}
-/* Convert number NIB to a hex digit. */
-
-static int
-tohex (int nib)
-{
- if (nib < 10)
- return '0' + nib;
- else
- return 'a' + nib - 10;
-}
-
static int
tob64 (unsigned char *inbuf, char *outbuf, int len)
{
static int
tob64 (unsigned char *inbuf, char *outbuf, int len)
{
@@
-346,7
+335,7
@@
static enum target_signal last_sent_signal = TARGET_SIGNAL_0;
int last_sent_step;
static void
int last_sent_step;
static void
-sds_resume (
int p
id, int step, enum target_signal siggnal)
+sds_resume (
ptid_t pt
id, int step, enum target_signal siggnal)
{
unsigned char buf[PBUFSIZ];
{
unsigned char buf[PBUFSIZ];
@@
-402,7
+391,7
@@
interrupt_query (void)
Give up (and stop debugging it)? "))
{
target_mourn_inferior ();
Give up (and stop debugging it)? "))
{
target_mourn_inferior ();
-
return_to_top_level
(RETURN_QUIT);
+
throw_exception
(RETURN_QUIT);
}
target_terminal_inferior ();
}
target_terminal_inferior ();
@@
-415,8
+404,8
@@
int kill_kludge;
STATUS just as `wait' would. Returns "pid" (though it's not clear
what, if anything, that means in the case of this target). */
STATUS just as `wait' would. Returns "pid" (though it's not clear
what, if anything, that means in the case of this target). */
-static
in
t
-sds_wait (
int p
id, struct target_waitstatus *status)
+static
ptid_
t
+sds_wait (
ptid_t pt
id, struct target_waitstatus *status)
{
unsigned char buf[PBUFSIZ];
int retlen;
{
unsigned char buf[PBUFSIZ];
int retlen;
@@
-432,7
+421,7
@@
sds_wait (int pid, struct target_waitstatus *status)
{
just_started = 0;
status->kind = TARGET_WAITKIND_STOPPED;
{
just_started = 0;
status->kind = TARGET_WAITKIND_STOPPED;
- return inferior_pid;
+ return inferior_p
t
id;
}
while (1)
}
while (1)
@@
-456,7
+445,7
@@
sds_wait (int pid, struct target_waitstatus *status)
}
}
got_status:
}
}
got_status:
- return inferior_pid;
+ return inferior_p
t
id;
}
static unsigned char sprs[16];
}
static unsigned char sprs[16];
@@
-464,16
+453,15
@@
static unsigned char sprs[16];
/* Read the remote registers into the block REGS. */
/* Currently we just read all the registers, so we don't use regno. */
/* Read the remote registers into the block REGS. */
/* Currently we just read all the registers, so we don't use regno. */
-/* ARGSUSED */
static void
sds_fetch_registers (int regno)
{
unsigned char buf[PBUFSIZ];
int i, retlen;
static void
sds_fetch_registers (int regno)
{
unsigned char buf[PBUFSIZ];
int i, retlen;
- char
regs[REGISTER_BYTES]
;
+ char
*regs = alloca (DEPRECATED_REGISTER_BYTES)
;
/* Unimplemented registers read as all bits zero. */
/* Unimplemented registers read as all bits zero. */
- memset (regs, 0, REGISTER_BYTES);
+ memset (regs, 0,
DEPRECATED_
REGISTER_BYTES);
buf[0] = 18;
buf[1] = 1;
buf[0] = 18;
buf[1] = 1;
@@
-496,7
+484,7
@@
sds_fetch_registers (int regno)
/* (should warn about reply too short) */
for (i = 0; i < NUM_REGS; i++)
/* (should warn about reply too short) */
for (i = 0; i < NUM_REGS; i++)
- supply_register (i, ®s[REGISTER_BYTE (i)]);
+ supply_register (i, ®s[
DEPRECATED_
REGISTER_BYTE (i)]);
}
/* Prepare to store registers. Since we may send them all, we have to
}
/* Prepare to store registers. Since we may send them all, we have to
@@
-506,7
+494,7
@@
static void
sds_prepare_to_store (void)
{
/* Make sure the entire registers array is valid. */
sds_prepare_to_store (void)
{
/* Make sure the entire registers array is valid. */
-
read_register_bytes (0, (char *) NULL,
REGISTER_BYTES);
+
deprecated_read_register_bytes (0, (char *) NULL, DEPRECATED_
REGISTER_BYTES);
}
/* Store register REGNO, or all registers if REGNO == -1, from the contents
}
/* Store register REGNO, or all registers if REGNO == -1, from the contents
@@
-525,7
+513,7
@@
sds_store_registers (int regno)
*p++ = 0;
*p++ = 0;
for (i = 0; i < 4 * 6; i++)
*p++ = 0;
*p++ = 0;
for (i = 0; i < 4 * 6; i++)
- *p++ = registers[i + 4 * 32 + 8 * 32];
+ *p++ =
deprecated_
registers[i + 4 * 32 + 8 * 32];
for (i = 0; i < 4 * 1; i++)
*p++ = 0;
for (i = 0; i < 4 * 4; i++)
for (i = 0; i < 4 * 1; i++)
*p++ = 0;
for (i = 0; i < 4 * 4; i++)
@@
-540,7
+528,7
@@
sds_store_registers (int regno)
*p++ = 0;
*p++ = 0;
for (i = 0; i < 4 * 32; i++)
*p++ = 0;
*p++ = 0;
for (i = 0; i < 4 * 32; i++)
- *p++ = registers[i];
+ *p++ =
deprecated_
registers[i];
sds_send (buf, p - buf);
sds_send (buf, p - buf);
@@
-654,11
+642,9
@@
sds_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
if SHOULD_WRITE is nonzero. Returns length of data written or
read; 0 for error. TARGET is unused. */
if SHOULD_WRITE is nonzero. Returns length of data written or
read; 0 for error. TARGET is unused. */
-/* ARGSUSED */
static int
sds_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
static int
sds_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
- struct mem_attrib *attrib ATTRIBUTE_UNUSED,
- struct target_ops *target ATTRIBUTE_UNUSED)
+ struct mem_attrib *attrib, struct target_ops *target)
{
int res;
{
int res;
@@
-687,7
+673,7
@@
readchar (int timeout)
{
int ch;
{
int ch;
- ch =
SERIAL_READCHAR
(sds_desc, timeout);
+ ch =
serial_readchar
(sds_desc, timeout);
if (remote_debug > 1 && ch >= 0)
fprintf_unfiltered (gdb_stdlog, "%c(%x)", ch, ch);
if (remote_debug > 1 && ch >= 0)
fprintf_unfiltered (gdb_stdlog, "%c(%x)", ch, ch);
@@
-746,7
+732,7
@@
putmessage (unsigned char *buf, int len)
and giving it a checksum. */
if (len > 170) /* Prosanity check */
and giving it a checksum. */
if (len > 170) /* Prosanity check */
-
abort (
);
+
internal_error (__FILE__, __LINE__, "failed internal consistency check"
);
if (remote_debug)
{
if (remote_debug)
{
@@
-798,7
+784,7
@@
putmessage (unsigned char *buf, int len)
header[0], header[1], header[2]);
gdb_flush (gdb_stdlog);
}
header[0], header[1], header[2]);
gdb_flush (gdb_stdlog);
}
- if (
SERIAL_WRITE
(sds_desc, buf2, p - buf2))
+ if (
serial_write
(sds_desc, buf2, p - buf2))
perror_with_name ("putmessage: write failed");
return 1;
perror_with_name ("putmessage: write failed");
return 1;
@@
-976,6
+962,7
@@
getmessage (unsigned char *buf, int forever)
/* Try the whole thing again. */
retry:
/* need to do something here */
/* Try the whole thing again. */
retry:
/* need to do something here */
+ ;
}
/* We have tried hard enough, and just can't receive the packet. Give up. */
}
/* We have tried hard enough, and just can't receive the packet. Give up. */
@@
-1000,7
+987,7
@@
sds_mourn (void)
static void
sds_create_inferior (char *exec_file, char *args, char **env)
{
static void
sds_create_inferior (char *exec_file, char *args, char **env)
{
- inferior_p
id = 42000
;
+ inferior_p
tid = pid_to_ptid (42000)
;
/* Clean up from the last time we were running. */
clear_proceed_status ();
/* Clean up from the last time we were running. */
clear_proceed_status ();
@@
-1014,7
+1001,7
@@
sds_load (char *filename, int from_tty)
{
generic_load (filename, from_tty);
{
generic_load (filename, from_tty);
- inferior_p
id = 0
;
+ inferior_p
tid = null_ptid
;
}
\f
/* The SDS monitor has commands for breakpoint insertion, although it
}
\f
/* The SDS monitor has commands for breakpoint insertion, although it
This page took
0.028016 seconds
and
4
git commands to generate.