/* GDB interface to ARM RDI library.
- Copyright 1997 Free Software Foundation, Inc.
+ Copyright 1997, 1998 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "gdb_string.h"
#include "bfd.h"
#include "symfile.h"
#include "target.h"
-#include "wait.h"
+#include "gdb_wait.h"
#include "gdbcmd.h"
#include "objfiles.h"
#include "gdb-stabs.h"
#include "gdbthread.h"
#include "gdbcore.h"
+#include "breakpoint.h"
#ifdef USG
#include <sys/types.h>
#include "rdi-share/adp.h"
#include "rdi-share/hsys.h"
+extern int isascii (int);
+
/* Prototypes for local functions */
-static void arm_rdi_files_info PARAMS ((struct target_ops *ignore));
+static void arm_rdi_files_info (struct target_ops *ignore);
+
+static int arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr,
+ int len, int should_write,
+ struct target_ops *target);
-static int arm_rdi_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr,
- int len, int should_write,
- struct target_ops *target));
+static void arm_rdi_prepare_to_store (void);
-static void arm_rdi_prepare_to_store PARAMS ((void));
+static void arm_rdi_fetch_registers (int regno);
-static void arm_rdi_fetch_registers PARAMS ((int regno));
+static void arm_rdi_resume (int pid, int step, enum target_signal siggnal);
-static void arm_rdi_resume PARAMS ((int pid, int step,
- enum target_signal siggnal));
+static int arm_rdi_start_remote (char *dummy);
-static int arm_rdi_start_remote PARAMS ((char *dummy));
+static void arm_rdi_open (char *name, int from_tty);
-static void arm_rdi_open PARAMS ((char *name, int from_tty));
+static void arm_rdi_create_inferior (char *exec_file, char *args, char **env);
-static void arm_rdi_create_inferior PARAMS ((char *exec_file, char *args,
- char **env));
+static void arm_rdi_close (int quitting);
-static void arm_rdi_close PARAMS ((int quitting));
+static void arm_rdi_store_registers (int regno);
-static void arm_rdi_store_registers PARAMS ((int regno));
+static void arm_rdi_mourn (void);
-static void arm_rdi_mourn PARAMS ((void));
+static void arm_rdi_send (char *buf);
-static void arm_rdi_send PARAMS ((char *buf));
+static int arm_rdi_wait (int pid, struct target_waitstatus *status);
-static int arm_rdi_wait PARAMS ((int pid, struct target_waitstatus *status));
+static void arm_rdi_kill (void);
-static void arm_rdi_kill PARAMS ((void));
+static void arm_rdi_detach (char *args, int from_tty);
-static void arm_rdi_detach PARAMS ((char *args, int from_tty));
+static void arm_rdi_interrupt (int signo);
-static void arm_rdi_interrupt PARAMS ((int signo));
+static void arm_rdi_interrupt_twice (int signo);
-static void arm_rdi_interrupt_twice PARAMS ((int signo));
+static void interrupt_query (void);
-static void interrupt_query PARAMS ((void));
+static int arm_rdi_insert_breakpoint (CORE_ADDR, char *);
-static int arm_rdi_insert_breakpoint PARAMS ((CORE_ADDR, char *));
+static int arm_rdi_remove_breakpoint (CORE_ADDR, char *);
-static int arm_rdi_remove_breakpoint PARAMS ((CORE_ADDR, char *));
+static char *rdi_error_message (int err);
-static char *rdi_error_message PARAMS ((int err));
+static enum target_signal rdi_error_signal (int err);
-static enum target_signal rdi_error_signal PARAMS ((int err));
+/* Global variables. */
-extern struct target_ops arm_rdi_ops; /* Forward decl */
+struct target_ops arm_rdi_ops;
static struct Dbg_ConfigBlock gdb_config;
static int execute_status;
-/* A little list of breakpoints that have been set. */
+/* Send heatbeat packets? */
+static int rdi_heartbeat = 0;
-static struct local_bp_list_entry {
- CORE_ADDR addr;
- PointHandle point;
- struct local_bp_list_entry *next;
-} *local_bp_list;
+/* Target has ROM at address 0. */
+static int rom_at_zero = 0;
+/* Enable logging? */
+static int log_enable = 0;
+
+/* Name of the log file. Default is "rdi.log". */
+static char *log_filename;
+
+/* A little list of breakpoints that have been set. */
+
+static struct local_bp_list_entry
+ {
+ CORE_ADDR addr;
+ PointHandle point;
+ struct local_bp_list_entry *next;
+ }
+ *local_bp_list;
\f
+
/* Stub for catch_errors. */
static int
-arm_rdi_start_remote (dummy)
- char *dummy;
+arm_rdi_start_remote (char *dummy)
{
return 1;
}
these to forward output from the target system and so forth. */
void
-voiddummy()
+voiddummy (void *dummy)
{
- printf("void dummy\n");
+ fprintf_unfiltered (gdb_stdout, "void dummy\n");
}
static void
-myprint (arg, format, ap)
- PTR arg;
- const char *format;
- va_list ap;
+myprint (PTR arg, const char *format, va_list ap)
{
- vfprintf (stdout, format, ap);
+ vfprintf_unfiltered (gdb_stdout, format, ap);
}
static void
-mywritec (arg, c)
- PTR arg;
- int c;
+mywritec (PTR arg, int c)
{
- fputc (c, (FILE *) arg);
+ if (isascii (c))
+ fputc_unfiltered (c, gdb_stdout);
}
static int
-mywrite (arg, buffer, len)
- PTR arg;
- char const *buffer;
- int len;
+mywrite (PTR arg, char const *buffer, int len)
{
- return fwrite (buffer, 1, len, stdout);
+ int i;
+ char *e;
+
+ e = (char *) buffer;
+ for (i = 0; i < len; i++)
+ {
+ if (isascii ((int) *e))
+ {
+ fputc_unfiltered ((int) *e, gdb_stdout);
+ e++;
+ }
+ }
+
+ return len;
}
static void
-mypause (arg)
- PTR arg;
+mypause (PTR arg)
{
}
being interrupted more carefully */
static int
-myreadc (arg)
- PTR arg;
-{
+myreadc (PTR arg)
+{
return fgetc (stdin);
}
static char *
-mygets (arg, buffer, len)
- PTR arg;
- char *buffer;
- int len;
+mygets (PTR arg, char *buffer, int len)
{
- return fgets(buffer, len, stdin);
+ return fgets (buffer, len, stdin);
}
+/* Prevent multiple calls to angel_RDI_close(). */
+static int closed_already = 1;
+
/* Open a connection to a remote debugger. NAME is the filename used
for communication. */
static void
-arm_rdi_open (name, from_tty)
- char *name;
- int from_tty;
+arm_rdi_open (char *name, int from_tty)
{
int rslt, i;
unsigned long arg1, arg2;
+ char *openArgs = NULL;
+ char *devName = NULL;
+ char *p;
if (name == NULL)
error ("To open an RDI connection, you need to specify what serial\n\
device is attached to the remote system (e.g. /dev/ttya).");
+ /* split name after whitespace, pass tail as arg to open command */
+
+ devName = xstrdup (name);
+ p = strchr (devName, ' ');
+ if (p)
+ {
+ *p = '\0';
+ ++p;
+
+ while (*p == ' ')
+ ++p;
+
+ openArgs = p;
+ }
+
/* Make the basic low-level connection. */
- rslt = Adp_OpenDevice (NULL, NULL, 1);
+ arm_rdi_close (0);
+ rslt = Adp_OpenDevice (devName, openArgs, rdi_heartbeat);
if (rslt != adp_ok)
- error ("Could not open port");
+ error ("Could not open device \"%s\"", name);
- gdb_config.bytesex = 2 | (target_byte_order == BIG_ENDIAN ? 1 : 0);
+ gdb_config.bytesex = 2 | (TARGET_BYTE_ORDER == BIG_ENDIAN ? 1 : 0);
gdb_config.fpe = 1;
gdb_config.rditype = 2;
gdb_config.heartbeat_on = 1;
gdb_hostif.dbgprint = myprint;
gdb_hostif.dbgpause = mypause;
- gdb_hostif.dbgarg = stdout;
+ gdb_hostif.dbgarg = NULL;
gdb_hostif.writec = mywritec;
gdb_hostif.readc = myreadc;
gdb_hostif.write = mywrite;
gdb_hostif.gets = mygets;
- gdb_hostif.hostosarg = stdout;
+ gdb_hostif.hostosarg = NULL;
gdb_hostif.reset = voiddummy;
rslt = angel_RDI_open (10, &gdb_config, &gdb_hostif, NULL);
if (rslt == RDIError_BigEndian || rslt == RDIError_LittleEndian)
- ; /* do nothing, this is the expected return */
+ ; /* do nothing, this is the expected return */
else if (rslt)
{
printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
+ Adp_CloseDevice ();
+ error ("RDI_open failed\n");
}
rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2);
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
}
- /*
- ** There's no point asking if the target's an ICEBreaker, unless
- ** you're going to do something with the answer. All it does is provoke
- ** an error message on non-ICE targets
- rslt = angel_RDI_info (RDIInfo_Icebreaker, & arg1, & arg2);
- if (rslt)
- {
- printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
- }
- */
-
- /*
- ** There's no point asking if the target can accept a configuration download,
- ** unless you're going to do something with the answer. All it does is
- ** provoke an error message on non-ICE targets
- rslt = angel_RDI_info (RDIInfo_DownLoad, & arg1, & arg2);
- if (rslt)
- {
- printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
- }
- */
-
rslt = angel_RDI_info (RDIInfo_GetLoadSize, &arg1, &arg2);
if (rslt)
{
printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
}
- arg1 = 0x13b;
+ arg1 = rom_at_zero ? 0x0 : 0x13b;
+
rslt = angel_RDI_info (RDIVector_Catch, &arg1, &arg2);
if (rslt)
{
for (entry = local_bp_list; entry != NULL; entry = entry->next)
{
if (preventry)
- free (preventry);
+ xfree (preventry);
}
}
printf_filtered ("Connected to ARM RDI target.\n");
+ closed_already = 0;
+ inferior_pid = 42;
}
/* Start an inferior process and set inferior_pid to its pid.
user types "run" after having attached. */
static void
-arm_rdi_create_inferior (exec_file, args, env)
- char *exec_file;
- char *args;
- char **env;
+arm_rdi_create_inferior (char *exec_file, char *args, char **env)
{
int len, rslt;
unsigned long arg1, arg2;
CORE_ADDR entry_point;
if (exec_file == 0 || exec_bfd == 0)
- error ("No exec file specified.");
+ error ("No executable file specified.");
entry_point = (CORE_ADDR) bfd_get_start_address (exec_bfd);
- arm_rdi_kill ();
+ arm_rdi_kill ();
remove_breakpoints ();
init_wait_for_inferior ();
- len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop*/ 10;
+ len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
arg_buf = (char *) alloca (len);
arg_buf[0] = '\0';
strcat (arg_buf, exec_file);
strcat (arg_buf, args);
inferior_pid = 42;
- insert_breakpoints (); /* Needed to get correct instruction in cache */
+ insert_breakpoints (); /* Needed to get correct instruction in cache */
- if ( env != NULL)
+ if (env != NULL)
{
while (*env)
{
- if (strncmp(*env, "MEMSIZE=", sizeof("MEMSIZE=")-1)==0)
+ if (strncmp (*env, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0)
{
unsigned long top_of_memory;
char *end_of_num;
/* Set up memory limit */
- top_of_memory = strtoul(*env + sizeof("MEMSIZE=")-1,
- &end_of_num, 0);
- printf_filtered ("Setting top-of-memory to 0x%x\n",
+ top_of_memory = strtoul (*env + sizeof ("MEMSIZE=") - 1,
+ &end_of_num, 0);
+ printf_filtered ("Setting top-of-memory to 0x%lx\n",
top_of_memory);
-
- rslt=angel_RDI_info (RDIInfo_SetTopMem, &top_of_memory, &arg2);
+
+ rslt = angel_RDI_info (RDIInfo_SetTopMem, &top_of_memory, &arg2);
if (rslt)
{
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
}
arg1 = (unsigned long) arg_buf;
- rslt = angel_RDI_info (RDISet_Cmdline, /* &arg1 */ (unsigned long *)arg_buf, &arg2);
+ rslt = angel_RDI_info (RDISet_Cmdline, /* &arg1 */ (unsigned long *) arg_buf, &arg2);
if (rslt)
{
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
die when it hits one. */
static void
-arm_rdi_detach (args, from_tty)
- char *args;
- int from_tty;
+arm_rdi_detach (char *args, int from_tty)
{
- /* (anything to do?) */
+ pop_target ();
}
/* Clean up connection to a remote debugger. */
static void
-arm_rdi_close (quitting)
- int quitting;
+arm_rdi_close (int quitting)
{
int rslt;
- rslt = angel_RDI_close ();
- if (rslt)
+ if (!closed_already)
{
- printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt));
+ rslt = angel_RDI_close ();
+ if (rslt)
+ {
+ printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt));
+ }
+ closed_already = 1;
+ inferior_pid = 0;
+ Adp_CloseDevice ();
+ generic_mourn_inferior ();
}
}
\f
/* Tell the remote machine to resume. */
static void
-arm_rdi_resume (pid, step, siggnal)
- int pid, step;
- enum target_signal siggnal;
+arm_rdi_resume (int pid, int step, enum target_signal siggnal)
{
int rslt;
PointHandle point;
- if (0 /* turn on when hardware supports single-stepping */)
+ if (0 /* turn on when hardware supports single-stepping */ )
{
rslt = angel_RDI_step (1, &point);
if (rslt)
packet. */
static void
-arm_rdi_interrupt (signo)
- int signo;
+arm_rdi_interrupt (int signo)
{
}
-static void (*ofunc)();
+static void (*ofunc) ();
/* The user typed ^C twice. */
static void
-arm_rdi_interrupt_twice (signo)
- int signo;
+arm_rdi_interrupt_twice (int signo)
{
}
/* Ask the user what to do when an interrupt is received. */
static void
-interrupt_query ()
+interrupt_query (void)
{
}
what, if anything, that means in the case of this target). */
static int
-arm_rdi_wait (pid, status)
- int pid;
- struct target_waitstatus *status;
+arm_rdi_wait (int pid, struct target_waitstatus *status)
{
- status->kind = execute_status == RDIError_NoError ?
- TARGET_WAITKIND_EXITED : TARGET_WAITKIND_STOPPED;
+ status->kind = (execute_status == RDIError_NoError ?
+ TARGET_WAITKIND_EXITED : TARGET_WAITKIND_STOPPED);
/* convert stopped code from target into right signal */
- status->value.sig = rdi_error_signal ( execute_status );
+ status->value.sig = rdi_error_signal (execute_status);
return inferior_pid;
}
/* ARGSUSED */
static void
-arm_rdi_fetch_registers (regno)
- int regno;
+arm_rdi_fetch_registers (int regno)
{
int rslt, rdi_regmask;
unsigned long rawreg, rawregs[32];
char cookedreg[4];
- if (regno == -1)
+ if (regno == -1)
{
rslt = angel_RDI_CPUread (255, 0x27fff, rawregs);
if (rslt)
}
}
-static void
-arm_rdi_prepare_to_store ()
+static void
+arm_rdi_prepare_to_store (void)
{
/* Nothing to do. */
}
of REGISTERS. FIXME: ignores errors. */
static void
-arm_rdi_store_registers (regno)
- int regno;
+arm_rdi_store_registers (int regno)
{
int rslt, rdi_regmask;
/* These need to be able to take 'floating point register' contents */
unsigned long rawreg[3], rawerreg[3];
- if (regno == -1)
+ if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
arm_rdi_store_registers (regno);
/* 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. */
+ read; 0 for error. TARGET is unused. */
/* ARGSUSED */
static int
-arm_rdi_xfer_memory(memaddr, myaddr, len, should_write, target)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int should_write;
- struct target_ops *target; /* ignored */
+arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+ int should_write, struct target_ops *target)
{
int rslt, i;
printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt));
}
}
- else
+ else
{
rslt = angel_RDI_read (memaddr, myaddr, &len);
if (rslt)
/* Display random info collected from the target. */
static void
-arm_rdi_files_info (ignore)
- struct target_ops *ignore;
+arm_rdi_files_info (struct target_ops *ignore)
{
char *file = "nothing";
int rslt;
printf_filtered ("Target can do profiling.\n");
if (arg1 & (1 << 4))
printf_filtered ("Target is real hardware.\n");
-
+
rslt = angel_RDI_info (RDIInfo_Step, &arg1, &arg2);
if (rslt)
{
}
\f
static void
-arm_rdi_kill ()
+arm_rdi_kill (void)
{
int rslt;
}
static void
-arm_rdi_mourn_inferior ()
+arm_rdi_mourn_inferior (void)
{
+ /* We remove the inserted breakpoints in case the user wants to
+ issue another target and load commands to rerun his application;
+ This is something that wouldn't work on a native target, for instance,
+ as the process goes away when the inferior exits, but it works with
+ some remote targets like this one. That is why this is done here. */
+ remove_breakpoints();
unpush_target (&arm_rdi_ops);
generic_mourn_inferior ();
}
here. */
static int
-arm_rdi_insert_breakpoint (addr, contents_cache)
- CORE_ADDR addr;
- char *contents_cache;
+arm_rdi_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
{
int rslt;
PointHandle point;
}
static int
-arm_rdi_remove_breakpoint (addr, contents_cache)
- CORE_ADDR addr;
- char *contents_cache;
+arm_rdi_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
{
int rslt;
PointHandle point;
{
preventry->next = entry->next;
}
- free (entry);
+ xfree (entry);
}
return 0;
}
\f
static char *
-rdi_error_message (err)
- int err;
+rdi_error_message (int err)
{
switch (err)
{
- case RDIError_NoError:
+ case RDIError_NoError:
return "no error";
case RDIError_Reset:
return "debuggee reset";
case RDIError_UndefinedMessage:
return "internal error, undefined message";
default:
- return "undefined error message, should reset target";
+ return "undefined error message, should reset target";
}
}
/* Convert the ARM error messages to signals that GDB knows about. */
static enum target_signal
-rdi_error_signal (err)
- int err;
+rdi_error_signal (int err)
{
switch (err)
{
case RDIError_NoError:
return 0;
case RDIError_Reset:
- return TARGET_SIGNAL_TERM; /* ??? */
+ return TARGET_SIGNAL_TERM; /* ??? */
case RDIError_UndefinedInstruction:
return TARGET_SIGNAL_ILL;
case RDIError_SoftwareInterrupt:
case RDIError_UnimplementedMessage:
case RDIError_UndefinedMessage:
default:
- return TARGET_SIGNAL_UNKNOWN;
+ return TARGET_SIGNAL_UNKNOWN;
}
}
+
+static void
+arm_rdi_stop(void)
+{
+ angel_RDI_stop_request();
+}
+
\f
/* Define the target operations structure. */
-struct target_ops arm_rdi_ops ;
-
-static void init_rdi_ops(void)
-{
- arm_rdi_ops.to_shortname = "rdi";
- arm_rdi_ops.to_longname = "ARM RDI";
- arm_rdi_ops.to_doc = "Use a remote ARM-based computer; via the RDI library.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya)." ;
- arm_rdi_ops.to_open = arm_rdi_open;
- arm_rdi_ops.to_close = arm_rdi_close;
- arm_rdi_ops.to_attach = NULL;
- arm_rdi_ops.to_detach = arm_rdi_detach;
- arm_rdi_ops.to_resume = arm_rdi_resume;
- arm_rdi_ops.to_wait = arm_rdi_wait;
- arm_rdi_ops.to_fetch_registers = arm_rdi_fetch_registers;
- arm_rdi_ops.to_store_registers = arm_rdi_store_registers;
- arm_rdi_ops.to_prepare_to_store = arm_rdi_prepare_to_store;
- arm_rdi_ops.to_xfer_memory = arm_rdi_xfer_memory;
- arm_rdi_ops.to_files_info = arm_rdi_files_info;
- arm_rdi_ops.to_insert_breakpoint = arm_rdi_insert_breakpoint;
- arm_rdi_ops.to_remove_breakpoint = arm_rdi_remove_breakpoint;
- arm_rdi_ops.to_terminal_init = NULL;
- arm_rdi_ops.to_terminal_inferior = NULL;
- arm_rdi_ops.to_terminal_ours_for_output = NULL;
- arm_rdi_ops.to_terminal_ours = NULL;
- arm_rdi_ops.to_terminal_info = NULL;
- arm_rdi_ops.to_kill = arm_rdi_kill;
- arm_rdi_ops.to_load = generic_load;
- arm_rdi_ops.to_lookup_symbol = NULL;
- arm_rdi_ops.to_create_inferior = arm_rdi_create_inferior;
- arm_rdi_ops.to_mourn_inferior = arm_rdi_mourn_inferior;
- arm_rdi_ops.to_can_run = 0;
- arm_rdi_ops.to_notice_signals = 0;
- arm_rdi_ops.to_thread_alive = 0;
- arm_rdi_ops.to_stop = 0;
- arm_rdi_ops.to_stratum = process_stratum;
- arm_rdi_ops.DONT_USE = NULL;
- arm_rdi_ops.to_has_all_memory = 1;
- arm_rdi_ops.to_has_memory = 1;
- arm_rdi_ops.to_has_stack = 1;
- arm_rdi_ops.to_has_registers = 1;
- arm_rdi_ops.to_has_execution = 1;
- arm_rdi_ops.to_sections = NULL;
- arm_rdi_ops.to_sections_end = NULL;
- arm_rdi_ops.to_magic = OPS_MAGIC ;
+static void
+init_rdi_ops (void)
+{
+ arm_rdi_ops.to_shortname = "rdi";
+ arm_rdi_ops.to_longname = "ARM RDI";
+ arm_rdi_ops.to_doc = "Use a remote ARM-based computer; via the RDI library.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya).";
+ arm_rdi_ops.to_open = arm_rdi_open;
+ arm_rdi_ops.to_close = arm_rdi_close;
+ arm_rdi_ops.to_detach = arm_rdi_detach;
+ arm_rdi_ops.to_resume = arm_rdi_resume;
+ arm_rdi_ops.to_wait = arm_rdi_wait;
+ arm_rdi_ops.to_stop = arm_rdi_stop;
+ arm_rdi_ops.to_fetch_registers = arm_rdi_fetch_registers;
+ arm_rdi_ops.to_store_registers = arm_rdi_store_registers;
+ arm_rdi_ops.to_prepare_to_store = arm_rdi_prepare_to_store;
+ arm_rdi_ops.to_xfer_memory = arm_rdi_xfer_memory;
+ arm_rdi_ops.to_files_info = arm_rdi_files_info;
+ arm_rdi_ops.to_insert_breakpoint = arm_rdi_insert_breakpoint;
+ arm_rdi_ops.to_remove_breakpoint = arm_rdi_remove_breakpoint;
+ arm_rdi_ops.to_kill = arm_rdi_kill;
+ arm_rdi_ops.to_load = generic_load;
+ arm_rdi_ops.to_create_inferior = arm_rdi_create_inferior;
+ arm_rdi_ops.to_mourn_inferior = arm_rdi_mourn_inferior;
+ arm_rdi_ops.to_stratum = process_stratum;
+ arm_rdi_ops.to_has_all_memory = 1;
+ arm_rdi_ops.to_has_memory = 1;
+ arm_rdi_ops.to_has_stack = 1;
+ arm_rdi_ops.to_has_registers = 1;
+ arm_rdi_ops.to_has_execution = 1;
+ arm_rdi_ops.to_magic = OPS_MAGIC;
+}
+
+static void
+rdilogfile_command (char *arg, int from_tty)
+{
+ if (!arg || strlen (arg) == 0)
+ {
+ printf_filtered ("rdi log file is '%s'\n", log_filename);
+ return;
+ }
+
+ if (log_filename)
+ xfree (log_filename);
+
+ log_filename = xstrdup (arg);
+
+ Adp_SetLogfile (log_filename);
+}
+
+static void
+rdilogenable_command (char *args, int from_tty)
+{
+ if (!args || strlen (args) == 0)
+ {
+ printf_filtered ("rdi log is %s\n", log_enable ? "enabled" : "disabled");
+ return;
+ }
+
+ if (!strcasecmp (args, "1") ||
+ !strcasecmp (args, "y") ||
+ !strcasecmp (args, "yes") ||
+ !strcasecmp (args, "on") ||
+ !strcasecmp (args, "t") ||
+ !strcasecmp (args, "true"))
+ Adp_SetLogEnable (log_enable = 1);
+ else if (!strcasecmp (args, "0") ||
+ !strcasecmp (args, "n") ||
+ !strcasecmp (args, "no") ||
+ !strcasecmp (args, "off") ||
+ !strcasecmp (args, "f") ||
+ !strcasecmp (args, "false"))
+ Adp_SetLogEnable (log_enable = 0);
+ else
+ printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
+ " try y or n\n", args);
}
void
-_initialize_remote_rdi ()
+_initialize_remote_rdi (void)
{
- init_rdi_ops() ;
+ init_rdi_ops ();
add_target (&arm_rdi_ops);
+
+ log_filename = xstrdup ("rdi.log");
+ Adp_SetLogfile (log_filename);
+ Adp_SetLogEnable (log_enable);
+
+ add_cmd ("rdilogfile", class_maintenance,
+ rdilogfile_command,
+ "Set filename for ADP packet log.\n\
+This file is used to log Angel Debugger Protocol packets.\n\
+With a single argument, sets the logfile name to that value.\n\
+Without an argument, shows the current logfile name.\n\
+See also: rdilogenable\n",
+ &maintenancelist);
+
+ add_cmd ("rdilogenable", class_maintenance,
+ rdilogenable_command,
+ "Set enable logging of ADP packets.\n\
+This will log ADP packets exchanged between gdb and the\n\
+rdi target device.\n\
+An argument of 1,t,true,y,yes will enable.\n\
+An argument of 0,f,false,n,no will disabled.\n\
+Withough an argument, it will display current state.\n",
+ &maintenancelist);
+
+ add_show_from_set
+ (add_set_cmd ("rdiromatzero", no_class,
+ var_boolean, (char *) &rom_at_zero,
+ "Set target has ROM at addr 0.\n\
+A true value disables vector catching, false enables vector catching.\n\
+This is evaluated at the time the 'target rdi' command is executed\n",
+ &setlist),
+ &showlist);
+
+ add_show_from_set
+ (add_set_cmd ("rdiheartbeat", no_class,
+ var_boolean, (char *) &rdi_heartbeat,
+ "Set enable for ADP heartbeat packets.\n\
+I don't know why you would want this. If you enable them,\n\
+it will confuse ARM and EPI JTAG interface boxes as well\n\
+as the Angel Monitor.\n",
+ &setlist),
+ &showlist);
}
/* A little dummy to make linking with the library succeed. */
-Fail() {}
+int
+Fail (void)
+{
+ return 0;
+}