projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace calls to abort() with calls to internal_error().
[deliverable/binutils-gdb.git]
/
gdb
/
ocd.c
diff --git
a/gdb/ocd.c
b/gdb/ocd.c
index e826ca0e56f8ae70dd16454fffd7bfdae4881347..240bd672f204a2be795a0d2af77ed6be9278c584 100644
(file)
--- a/
gdb/ocd.c
+++ b/
gdb/ocd.c
@@
-1,5
+1,5
@@
/* Target communications support for Macraigor Systems' On-Chip Debugging
/* Target communications support for Macraigor Systems' On-Chip Debugging
- Copyright 1996, 1997 Free Software Foundation, Inc.
+ Copyright 1996, 1997
, 2001
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-27,11
+27,9
@@
#include "bfd.h"
#include "symfile.h"
#include "target.h"
#include "bfd.h"
#include "symfile.h"
#include "target.h"
-#include "gdb_wait.h"
#include "gdbcmd.h"
#include "objfiles.h"
#include "gdb-stabs.h"
#include "gdbcmd.h"
#include "objfiles.h"
#include "gdb-stabs.h"
-#include "dcache.h"
#include <sys/types.h>
#include <signal.h>
#include "serial.h"
#include <sys/types.h>
#include <signal.h>
#include "serial.h"
@@
-39,32
+37,31
@@
/* Prototypes for local functions */
/* Prototypes for local functions */
-static int ocd_read_bytes PARAMS ((CORE_ADDR memaddr,
- char *myaddr, int len));
+static int ocd_read_bytes (CORE_ADDR memaddr, char *myaddr, int len);
-static int ocd_start_remote
PARAMS ((PTR dummy)
);
+static int ocd_start_remote
(PTR dummy
);
-static int readchar
PARAMS ((int timeout)
);
+static int readchar
(int timeout
);
-static void reset_packet
PARAMS ((void)
);
+static void reset_packet
(void
);
-static void output_packet
PARAMS ((void)
);
+static void output_packet
(void
);
-static int get_quoted_char
PARAMS ((int timeout)
);
+static int get_quoted_char
(int timeout
);
-static void put_quoted_char
PARAMS ((int c)
);
+static void put_quoted_char
(int c
);
-static void ocd_interrupt
PARAMS ((int signo)
);
+static void ocd_interrupt
(int signo
);
-static void ocd_interrupt_twice
PARAMS ((int signo)
);
+static void ocd_interrupt_twice
(int signo
);
-static void interrupt_query
PARAMS ((void)
);
+static void interrupt_query
(void
);
-static unsigned char *ocd_do_command
PARAMS ((int cmd, int *statusp, int *lenp)
);
+static unsigned char *ocd_do_command
(int cmd, int *statusp, int *lenp
);
-static void ocd_put_packet
PARAMS ((unsigned char *packet, int pktlen)
);
+static void ocd_put_packet
(unsigned char *packet, int pktlen
);
-static unsigned char *ocd_get_packet
PARAMS ((int cmd, int *pktlen, int timeout)
);
+static unsigned char *ocd_get_packet
(int cmd, int *pktlen, int timeout
);
static struct target_ops *current_ops = NULL;
static struct target_ops *current_ops = NULL;
@@
-87,9
+84,7
@@
static int remote_timeout = 2;
static serial_t ocd_desc = NULL;
\f
void
static serial_t ocd_desc = NULL;
\f
void
-ocd_error (s, error_code)
- char *s;
- int error_code;
+ocd_error (char *s, int error_code)
{
char buf[100];
{
char buf[100];
@@
-154,8
+149,7
@@
ocd_error (s, error_code)
/* Return nonzero if the thread TH is still alive on the remote system. */
int
/* Return nonzero if the thread TH is still alive on the remote system. */
int
-ocd_thread_alive (th)
- int th;
+ocd_thread_alive (int th)
{
return 1;
}
{
return 1;
}
@@
-164,8
+158,7
@@
ocd_thread_alive (th)
/* ARGSUSED */
void
/* ARGSUSED */
void
-ocd_close (quitting)
- int quitting;
+ocd_close (int quitting)
{
if (ocd_desc)
SERIAL_CLOSE (ocd_desc);
{
if (ocd_desc)
SERIAL_CLOSE (ocd_desc);
@@
-175,8
+168,7
@@
ocd_close (quitting)
/* Stub for catch_errors. */
static int
/* Stub for catch_errors. */
static int
-ocd_start_remote (dummy)
- PTR dummy;
+ocd_start_remote (PTR dummy)
{
unsigned char buf[10], *p;
int pktlen;
{
unsigned char buf[10], *p;
int pktlen;
@@
-187,7
+179,7
@@
ocd_start_remote (dummy)
target_type = *(enum ocd_target_type *) dummy;
target_type = *(enum ocd_target_type *) dummy;
- immediate_quit
= 1;
/* Allow user to interrupt it */
+ immediate_quit
++;
/* Allow user to interrupt it */
SERIAL_SEND_BREAK (ocd_desc); /* Wake up the wiggler */
SERIAL_SEND_BREAK (ocd_desc); /* Wake up the wiggler */
@@
-249,7
+241,7
@@
ocd_start_remote (dummy)
ocd_error ("OCD_SET_CTL_FLAGS:", error_code);
#endif
ocd_error ("OCD_SET_CTL_FLAGS:", error_code);
#endif
- immediate_quit
= 0
;
+ immediate_quit
--
;
/* This is really the job of start_remote however, that makes an assumption
that the target is about to print out a status message of some sort. That
/* This is really the job of start_remote however, that makes an assumption
that the target is about to print out a status message of some sort. That
@@
-279,14
+271,9
@@
ocd_start_remote (dummy)
/* Open a connection to a remote debugger.
NAME is the filename used for communication. */
/* Open a connection to a remote debugger.
NAME is the filename used for communication. */
-static DCACHE *ocd_dcache;
-
void
void
-ocd_open (name, from_tty, target_type, ops)
- char *name;
- int from_tty;
- enum ocd_target_type target_type;
- struct target_ops *ops;
+ocd_open (char *name, int from_tty, enum ocd_target_type target_type,
+ struct target_ops *ops)
{
unsigned char buf[10], *p;
int pktlen;
{
unsigned char buf[10], *p;
int pktlen;
@@
-301,8
+288,6
@@
device the OCD device is attached to (e.g. /dev/ttya).");
unpush_target (current_ops);
unpush_target (current_ops);
- ocd_dcache = dcache_init (ocd_read_bytes, ocd_write_bytes);
-
if (strncmp (name, "wiggler", 7) == 0)
{
ocd_desc = SERIAL_OPEN ("ocd");
if (strncmp (name, "wiggler", 7) == 0)
{
ocd_desc = SERIAL_OPEN ("ocd");
@@
-376,9
+361,7
@@
device the OCD device is attached to (e.g. /dev/ttya).");
die when it hits one. */
void
die when it hits one. */
void
-ocd_detach (args, from_tty)
- char *args;
- int from_tty;
+ocd_detach (char *args, int from_tty)
{
if (args)
error ("Argument given to \"detach\" when remotely debugging.");
{
if (args)
error ("Argument given to \"detach\" when remotely debugging.");
@@
-391,14
+374,10
@@
ocd_detach (args, from_tty)
/* Tell the remote machine to resume. */
void
/* Tell the remote machine to resume. */
void
-ocd_resume (pid, step, siggnal)
- int pid, step;
- enum target_signal siggnal;
+ocd_resume (int pid, int step, enum target_signal siggnal)
{
int pktlen;
{
int pktlen;
- dcache_flush (ocd_dcache);
-
if (step)
ocd_do_command (OCD_STEP, &last_run_status, &pktlen);
else
if (step)
ocd_do_command (OCD_STEP, &last_run_status, &pktlen);
else
@@
-406,7
+385,7
@@
ocd_resume (pid, step, siggnal)
}
\f
void
}
\f
void
-ocd_stop ()
+ocd_stop (
void
)
{
int status;
int pktlen;
{
int status;
int pktlen;
@@
-423,8
+402,7
@@
static volatile int ocd_interrupt_flag;
packet. */
static void
packet. */
static void
-ocd_interrupt (signo)
- int signo;
+ocd_interrupt (int signo)
{
/* If this doesn't work, try more severe steps. */
signal (signo, ocd_interrupt_twice);
{
/* If this doesn't work, try more severe steps. */
signal (signo, ocd_interrupt_twice);
@@
-446,8
+424,7
@@
static void (*ofunc) ();
/* The user typed ^C twice. */
static void
/* The user typed ^C twice. */
static void
-ocd_interrupt_twice (signo)
- int signo;
+ocd_interrupt_twice (int signo)
{
signal (signo, ofunc);
{
signal (signo, ofunc);
@@
-459,7
+436,7
@@
ocd_interrupt_twice (signo)
/* Ask the user what to do when an interrupt is received. */
static void
/* Ask the user what to do when an interrupt is received. */
static void
-interrupt_query ()
+interrupt_query (
void
)
{
target_terminal_ours ();
{
target_terminal_ours ();
@@
-482,7
+459,7
@@
static int kill_kludge;
means in the case of this target). */
int
means in the case of this target). */
int
-ocd_wait ()
+ocd_wait (
void
)
{
unsigned char *p;
int error_code;
{
unsigned char *p;
int error_code;
@@
-530,10
+507,7
@@
ocd_wait ()
Returns a pointer to a static array containing the register contents. */
unsigned char *
Returns a pointer to a static array containing the register contents. */
unsigned char *
-ocd_read_bdm_registers (first_bdm_regno, last_bdm_regno, reglen)
- int first_bdm_regno;
- int last_bdm_regno;
- int *reglen;
+ocd_read_bdm_registers (int first_bdm_regno, int last_bdm_regno, int *reglen)
{
unsigned char buf[10];
int i;
{
unsigned char buf[10];
int i;
@@
-575,8
+549,7
@@
ocd_read_bdm_registers (first_bdm_regno, last_bdm_regno, reglen)
/* Read register BDM_REGNO and returns its value ala read_register() */
CORE_ADDR
/* Read register BDM_REGNO and returns its value ala read_register() */
CORE_ADDR
-ocd_read_bdm_register (bdm_regno)
- int bdm_regno;
+ocd_read_bdm_register (int bdm_regno)
{
int reglen;
unsigned char *p;
{
int reglen;
unsigned char *p;
@@
-589,10
+562,7
@@
ocd_read_bdm_register (bdm_regno)
}
void
}
void
-ocd_write_bdm_registers (first_bdm_regno, regptr, reglen)
- int first_bdm_regno;
- unsigned char *regptr;
- int reglen;
+ocd_write_bdm_registers (int first_bdm_regno, unsigned char *regptr, int reglen)
{
unsigned char *buf;
unsigned char *p;
{
unsigned char *buf;
unsigned char *p;
@@
-621,9
+591,7
@@
ocd_write_bdm_registers (first_bdm_regno, regptr, reglen)
}
void
}
void
-ocd_write_bdm_register (bdm_regno, reg)
- int bdm_regno;
- CORE_ADDR reg;
+ocd_write_bdm_register (int bdm_regno, CORE_ADDR reg)
{
unsigned char buf[4];
{
unsigned char buf[4];
@@
-633,7
+601,7
@@
ocd_write_bdm_register (bdm_regno, reg)
}
\f
void
}
\f
void
-ocd_prepare_to_store ()
+ocd_prepare_to_store (
void
)
{
}
\f
{
}
\f
@@
-648,10
+616,7
@@
ocd_prepare_to_store ()
static int write_mem_command = OCD_WRITE_MEM;
int
static int write_mem_command = OCD_WRITE_MEM;
int
-ocd_write_bytes (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
+ocd_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
{
char buf[256 + 10];
unsigned char *p;
{
char buf[256 + 10];
unsigned char *p;
@@
-723,10
+688,7
@@
ocd_write_bytes (memaddr, myaddr, len)
Returns number of bytes transferred, or 0 for error. */
static int
Returns number of bytes transferred, or 0 for error. */
static int
-ocd_read_bytes (memaddr, myaddr, len)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
+ocd_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
{
char buf[256 + 10];
unsigned char *p;
{
char buf[256 + 10];
unsigned char *p;
@@
-791,23
+753,26
@@
ocd_read_bytes (memaddr, myaddr, len)
\f
/* Read or write LEN bytes from inferior memory at MEMADDR, transferring
to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is
\f
/* Read or write LEN bytes from inferior memory at MEMADDR, transferring
to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is
- nonzero. Returns length of data written or read; 0 for error. */
+ nonzero. Returns length of data written or read; 0 for error. TARGET
+ is ignored. */
/* ARGSUSED */
int
/* ARGSUSED */
int
-ocd_xfer_memory (memaddr, myaddr, len, should_write, target)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int should_write;
- struct target_ops *target; /* ignored */
+ocd_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
+ struct target_ops *target)
{
{
- return dcache_xfer_memory (ocd_dcache, memaddr, myaddr, len, should_write);
+ int res;
+
+ if (should_write)
+ res = ocd_write_bytes (memaddr, myaddr, len);
+ else
+ res = ocd_read_bytes (memaddr, myaddr, len);
+
+ return res;
}
\f
void
}
\f
void
-ocd_files_info (ignore)
- struct target_ops *ignore;
+ocd_files_info (struct target_ops *ignore)
{
puts_filtered ("Debugging a target over a serial line.\n");
}
{
puts_filtered ("Debugging a target over a serial line.\n");
}
@@
-818,8
+783,7
@@
ocd_files_info (ignore)
/* Read a single character from the remote side, handling wierd errors. */
static int
/* Read a single character from the remote side, handling wierd errors. */
static int
-readchar (timeout)
- int timeout;
+readchar (int timeout)
{
int ch;
{
int ch;
@@
-844,8
+808,7
@@
readchar (timeout)
mistaken for real data). */
static int
mistaken for real data). */
static int
-get_quoted_char (timeout)
- int timeout;
+get_quoted_char (int timeout)
{
int ch;
{
int ch;
@@
-870,13
+833,13
@@
get_quoted_char (timeout)
static unsigned char pkt[256 * 2 + 10], *pktp; /* Worst case */
static void
static unsigned char pkt[256 * 2 + 10], *pktp; /* Worst case */
static void
-reset_packet ()
+reset_packet (
void
)
{
pktp = pkt;
}
static void
{
pktp = pkt;
}
static void
-output_packet ()
+output_packet (
void
)
{
if (SERIAL_WRITE (ocd_desc, pkt, pktp - pkt))
perror_with_name ("output_packet: write failed");
{
if (SERIAL_WRITE (ocd_desc, pkt, pktp - pkt))
perror_with_name ("output_packet: write failed");
@@
-888,8
+851,7
@@
output_packet ()
through untouched. */
static void
through untouched. */
static void
-put_quoted_char (c)
- int c;
+put_quoted_char (int c)
{
switch (c)
{
{
switch (c)
{
@@
-912,15
+874,13
@@
put_quoted_char (c)
byte count. */
static void
byte count. */
static void
-stu_put_packet (buf, len)
- unsigned char *buf;
- int len;
+stu_put_packet (unsigned char *buf, int len)
{
unsigned char checksum;
unsigned char c;
if (len == 0 || len > 256)
{
unsigned char checksum;
unsigned char c;
if (len == 0 || len > 256)
-
abort (
); /* Can't represent 0 length packet */
+
internal_error (__FILE__, __LINE__, "failed internal consistency check"
); /* Can't represent 0 length packet */
reset_packet ();
reset_packet ();
@@
-957,9
+917,7
@@
stu_put_packet (buf, len)
byte count. */
static void
byte count. */
static void
-ocd_put_packet (buf, len)
- unsigned char *buf;
- int len;
+ocd_put_packet (unsigned char *buf, int len)
{
unsigned char checksum;
unsigned char c;
{
unsigned char checksum;
unsigned char c;
@@
-994,9
+952,7
@@
ocd_put_packet (buf, len)
*/
static unsigned char *
*/
static unsigned char *
-stu_get_packet (cmd, lenp, timeout)
- unsigned char cmd;
- int *lenp;
+stu_get_packet (unsigned char cmd, int *lenp, int timeout)
{
int ch;
int len;
{
int ch;
int len;
@@
-1059,9
+1015,7
@@
found_syn: /* Found the start of a packet */
*/
static unsigned char *
*/
static unsigned char *
-ocd_get_packet (cmd, lenp, timeout)
- int cmd;
- int *lenp;
+ocd_get_packet (int cmd, int *lenp, int timeout)
{
int ch;
int len;
{
int ch;
int len;
@@
-1208,10
+1162,7
@@
ocd_get_packet (cmd, lenp, timeout)
following the error code. */
static unsigned char *
following the error code. */
static unsigned char *
-ocd_do_command (cmd, statusp, lenp)
- int cmd;
- int *statusp;
- int *lenp;
+ocd_do_command (int cmd, int *statusp, int *lenp)
{
unsigned char buf[100], *p;
int status, error_code;
{
unsigned char buf[100], *p;
int status, error_code;
@@
-1257,7
+1208,7
@@
ocd_do_command (cmd, statusp, lenp)
}
\f
void
}
\f
void
-ocd_kill ()
+ocd_kill (
void
)
{
/* For some mysterious reason, wait_for_inferior calls kill instead of
mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */
{
/* For some mysterious reason, wait_for_inferior calls kill instead of
mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */
@@
-1274,7
+1225,7
@@
ocd_kill ()
}
void
}
void
-ocd_mourn ()
+ocd_mourn (
void
)
{
unpush_target (current_ops);
generic_mourn_inferior ();
{
unpush_target (current_ops);
generic_mourn_inferior ();
@@
-1284,10
+1235,7
@@
ocd_mourn ()
the program at that point. */
void
the program at that point. */
void
-ocd_create_inferior (exec_file, args, env)
- char *exec_file;
- char *args;
- char **env;
+ocd_create_inferior (char *exec_file, char *args, char **env)
{
if (args && (*args != '\000'))
error ("Args are not supported by BDM.");
{
if (args && (*args != '\000'))
error ("Args are not supported by BDM.");
@@
-1297,9
+1245,7
@@
ocd_create_inferior (exec_file, args, env)
}
void
}
void
-ocd_load (args, from_tty)
- char *args;
- int from_tty;
+ocd_load (char *args, int from_tty)
{
generic_load (args, from_tty);
{
generic_load (args, from_tty);
@@
-1326,9
+1272,7
@@
ocd_load (args, from_tty)
/* BDM (at least on CPU32) uses a different breakpoint */
int
/* BDM (at least on CPU32) uses a different breakpoint */
int
-ocd_insert_breakpoint (addr, contents_cache)
- CORE_ADDR addr;
- char *contents_cache;
+ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
{
static char break_insn[] = BDM_BREAKPOINT;
int val;
{
static char break_insn[] = BDM_BREAKPOINT;
int val;
@@
-1342,9
+1286,7
@@
ocd_insert_breakpoint (addr, contents_cache)
}
int
}
int
-ocd_remove_breakpoint (addr, contents_cache)
- CORE_ADDR addr;
- char *contents_cache;
+ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
{
static char break_insn[] = BDM_BREAKPOINT;
int val;
{
static char break_insn[] = BDM_BREAKPOINT;
int val;
@@
-1355,17
+1297,13
@@
ocd_remove_breakpoint (addr, contents_cache)
}
static void
}
static void
-bdm_command (args, from_tty)
- char *args;
- int from_tty;
+bdm_command (char *args, int from_tty)
{
error ("bdm command must be followed by `reset'");
}
static void
{
error ("bdm command must be followed by `reset'");
}
static void
-bdm_reset_command (args, from_tty)
- char *args;
- int from_tty;
+bdm_reset_command (char *args, int from_tty)
{
int status, pktlen;
{
int status, pktlen;
@@
-1373,14
+1311,12
@@
bdm_reset_command (args, from_tty)
error ("Not connected to OCD device.");
ocd_do_command (OCD_RESET, &status, &pktlen);
error ("Not connected to OCD device.");
ocd_do_command (OCD_RESET, &status, &pktlen);
- dcache_
flush (ocd
_dcache);
+ dcache_
invalidate (target
_dcache);
registers_changed ();
}
static void
registers_changed ();
}
static void
-bdm_restart_command (args, from_tty)
- char *args;
- int from_tty;
+bdm_restart_command (char *args, int from_tty)
{
int status, pktlen;
{
int status, pktlen;
@@
-1398,19
+1334,16
@@
bdm_restart_command (args, from_tty)
generic_load from trying to set the PC. */
static void
generic_load from trying to set the PC. */
static void
-noop_store_registers (regno)
- int regno;
+noop_store_registers (int regno)
{
}
static void
{
}
static void
-bdm_update_flash_command (args, from_tty)
- char *args;
- int from_tty;
+bdm_update_flash_command (char *args, int from_tty)
{
int status, pktlen;
struct cleanup *old_chain;
{
int status, pktlen;
struct cleanup *old_chain;
- void (*store_registers_tmp)
PARAMS ((int)
);
+ void (*store_registers_tmp)
(int
);
if (!ocd_desc)
error ("Not connected to OCD device.");
if (!ocd_desc)
error ("Not connected to OCD device.");
@@
-1439,9
+1372,7
@@
bdm_update_flash_command (args, from_tty)
}
static void
}
static void
-bdm_read_register_command (args, from_tty)
- char *args;
- int from_tty;
+bdm_read_register_command (char *args, int from_tty)
{
/* XXX repeat should go on to the next register */
{
/* XXX repeat should go on to the next register */
@@
-1454,7
+1385,7
@@
bdm_read_register_command (args, from_tty)
}
\f
void
}
\f
void
-_initialize_remote_ocd ()
+_initialize_remote_ocd (
void
)
{
extern struct cmd_list_element *cmdlist;
static struct cmd_list_element *ocd_cmd_list = NULL;
{
extern struct cmd_list_element *cmdlist;
static struct cmd_list_element *ocd_cmd_list = NULL;
This page took
0.030291 seconds
and
4
git commands to generate.