1999-04-16 01:35:26 +00:00
|
|
|
|
/* GDB interface to ARM RDI library.
|
2002-01-19 03:32:43 +00:00
|
|
|
|
|
|
|
|
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software
|
|
|
|
|
Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include "frame.h"
|
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "bfd.h"
|
|
|
|
|
#include "symfile.h"
|
|
|
|
|
#include "target.h"
|
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
|
#include "objfiles.h"
|
|
|
|
|
#include "gdb-stabs.h"
|
|
|
|
|
#include "gdbthread.h"
|
|
|
|
|
#include "gdbcore.h"
|
2000-02-01 03:19:29 +00:00
|
|
|
|
#include "breakpoint.h"
|
2001-02-19 11:47:16 +00:00
|
|
|
|
#include "completer.h"
|
2001-03-01 01:39:22 +00:00
|
|
|
|
#include "regcache.h"
|
Argh! These should also have been committed along with:
* arm-tdep.h: New file.
* arm-tdep.c: Include arm-tdep.h.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Make static.
(arm_software_single_step): Similarly. Fix types in declaration.
(arm_register_byte, arm_register_raw_size, arm_register_virtual_size)
(arm_store_return_value, arm_store_struct_return): New functions.
(arm_gdbarch_init): Register the above functions. Also register
call_dummy_start_offset, sizeof_call_dummy_words,
function_start_offset, inner_than, decr_pc_after_break, fp_regnum,
sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size,
max_register_virtual_size, register_size. Set up
prologue_cache.saved_regs here, rather than ...
(_initialize_arm_tdep): ... here.
* config/arm/tm-arm.h (struct type, struct value): Delete forward
declarations.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Delete declarations.
(SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET)
(SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC)
(DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS)
(REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE)
(MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN)
(EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS)
(SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY)
(SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP)
(ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete.
(arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc)
(arm_get_next_pc): No-longer static -- these are needed by the RDI
interface.
* arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h.
* remote-rdi.c remote-rdp.c: Likewise.
* Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o)
(armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies.
* config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus
definition.
* arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM)
(ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM)
(ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed
from non-ARM_ prefixed definitions.
* arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update
all uses of above.
* remote-rdi.c remote-rdp.c: Likewise.
* arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-13 16:24:59 +00:00
|
|
|
|
#include "arm-tdep.h"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#ifdef USG
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
|
|
#include "rdi-share/ardi.h"
|
|
|
|
|
#include "rdi-share/adp.h"
|
|
|
|
|
#include "rdi-share/hsys.h"
|
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
extern int isascii (int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Prototypes for local functions */
|
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_files_info (struct target_ops *ignore);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static int arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr,
|
|
|
|
|
int len, int should_write,
|
* exec.c (xfer_memory): Add attrib argument.
* infptrace.c (child_xfer_memory): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
* remote-adapt.c (adapt_xfer_inferior_memory): Likewise.
* remote-array.c (array_xfer_memory): Likewise.
* remote-bug.c (bug_xfer_memory): Likewise.
* remote-e7000.c (e7000_xfer_inferior_memory): Likewise.
* remote-eb.c (eb_xfer_inferior_memory): Likewise.
* remote-es.c (es1800_xfer_inferior_memory): Likewise.
* remote-mips.c (mips_xfer_memory): Likewise.
* remote-mm.c (mm_xfer_inferior_memory): Likewise.
* remote-nindy.c (nindy_xfer_inferior_memory): Likewise.
* remote-os9k.c (rombug_xfer_inferior_memory): Likewise.
* remote-rdi.c (arm_rdi_xfer_memory): Likewise.
* remote-rdp.c (remote_rdp_xfer_inferior_memory): Likewise.
* remote-sds.c (sds_xfer_memory): Likewise.
* remote-sim.c (gdbsim_xfer_inferior_memory): Likewise.
* remote-st.c (st2000_xfer_inferior_memory): Likewise.
* remote-udi.c (udi_xfer_inferior_memory): Likewise.
* remote-vx.c (vx_xfer_memory): Likewise.
* remote.c (remote_xfer_memory): Likewise.
* target.c (debug_to_xfer_memory, do_xfer_memory): Likewise.
* target.h (child_xfer_memory, do_xfer_memory, xfer_memory): Likewise.
* target.h (#include "memattr.h"): Added.
(target_ops.to_xfer_memory): Add attrib argument.
* wince.c (_initialize_inftarg): Removed call to set_dcache_state.
* dcache.h (set_dcache_state): Removed declaration.
* dcache.c (set_dcache_state): Removed definition
* dcache.c: Update module comment, as dcache is now enabled and
disabled with memory region attributes instead of by the global
variable "remotecache". Add comment describing the interaction
between dcache and memory region attributes.
(dcache_xfer_memory): Add comment describing benefits of moving
cache writeback to a higher level.
(dcache_struct): Removed cache_has_stuff field. This was used to
record whether the cache had been accessed in order to invalidate
it when it was disabled. However, this is not needed because the
cache is write through and the code that enables, disables, and
deletes memory regions invalidate the cache. Add comment which
suggests that we could be more selective and only invalidate those
cache lines containing data from those memory regions.
(dcache_invalidate): Updated.
(dcache_xfer_memory): Updated.
(dcache_alloc): Don't abort() if dcache_enabled_p is clear.
(dcache_xfer_memory): Removed code that called do_xfer_memory() to
perform a uncached transfer if dcache_enabled_p was clear. This
function is now only called if caching is enabled for the memory
region.
(dcache_info): Always print cache info.
* target.c (do_xfer_memory): Add attrib argument.
(target_xfer_memory, target_xfer_memory_partial): Break transfer
into chunks defined by memory regions, pass region attributes to
do_xfer_memory().
* dcache.c (dcache_read_line, dcache_write_line): Likewise.
* Makefile.in (SFILES): Add memattr.c.
(COMMON_OBS): Add memattr.o.
(dcache.o): Add target.h to dependencies.
* memattr.c: New file.
* memattr.h: Likewise.
2001-01-23 22:48:56 +00:00
|
|
|
|
struct mem_attrib *attrib,
|
2000-05-28 01:12:42 +00:00
|
|
|
|
struct target_ops *target);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_prepare_to_store (void);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_fetch_registers (int regno);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
static void arm_rdi_resume (ptid_t pid, int step,
|
|
|
|
|
enum target_signal siggnal);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_open (char *name, int from_tty);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_create_inferior (char *exec_file, char *args, char **env);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_close (int quitting);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_store_registers (int regno);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2001-06-24 13:46:09 +00:00
|
|
|
|
static ptid_t arm_rdi_wait (ptid_t ptid, struct target_waitstatus *status);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_kill (void);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static void arm_rdi_detach (char *args, int from_tty);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static int arm_rdi_insert_breakpoint (CORE_ADDR, char *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static int arm_rdi_remove_breakpoint (CORE_ADDR, char *);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static char *rdi_error_message (int err);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
|
static enum target_signal rdi_error_signal (int err);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Global variables. */
|
|
|
|
|
|
|
|
|
|
struct target_ops arm_rdi_ops;
|
|
|
|
|
|
|
|
|
|
static struct Dbg_ConfigBlock gdb_config;
|
|
|
|
|
|
|
|
|
|
static struct Dbg_HostosInterface gdb_hostif;
|
|
|
|
|
|
|
|
|
|
static int max_load_size;
|
|
|
|
|
|
|
|
|
|
static int execute_status;
|
|
|
|
|
|
1999-11-02 04:44:47 +00:00
|
|
|
|
/* Send heatbeat packets? */
|
1999-11-17 02:31:06 +00:00
|
|
|
|
static int rdi_heartbeat = 0;
|
1999-11-02 04:44:47 +00:00
|
|
|
|
|
|
|
|
|
/* Target has ROM at address 0. */
|
|
|
|
|
static int rom_at_zero = 0;
|
|
|
|
|
|
|
|
|
|
/* Enable logging? */
|
1999-11-17 02:31:06 +00:00
|
|
|
|
static int log_enable = 0;
|
1999-11-02 04:44:47 +00:00
|
|
|
|
|
|
|
|
|
/* Name of the log file. Default is "rdi.log". */
|
|
|
|
|
static char *log_filename;
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* A little list of breakpoints that have been set. */
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static struct local_bp_list_entry
|
|
|
|
|
{
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
PointHandle point;
|
|
|
|
|
struct local_bp_list_entry *next;
|
|
|
|
|
}
|
|
|
|
|
*local_bp_list;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Helper callbacks for the "host interface" structure. RDI functions call
|
|
|
|
|
these to forward output from the target system and so forth. */
|
|
|
|
|
|
2003-06-11 13:16:30 +00:00
|
|
|
|
static void
|
2000-09-06 23:39:15 +00:00
|
|
|
|
voiddummy (void *dummy)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
fprintf_unfiltered (gdb_stdout, "void dummy\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
myprint (void *arg, const char *format, va_list ap)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
vfprintf_unfiltered (gdb_stdout, format, ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
mywritec (void *arg, int c)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
if (isascii (c))
|
|
|
|
|
fputc_unfiltered (c, gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
mywrite (void *arg, char const *buffer, int len)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
char *e;
|
|
|
|
|
|
|
|
|
|
e = (char *) buffer;
|
|
|
|
|
for (i = 0; i < len; i++)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (isascii ((int) *e))
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{
|
|
|
|
|
fputc_unfiltered ((int) *e, gdb_stdout);
|
|
|
|
|
e++;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
mypause (void *arg)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* These last two are tricky as we have to handle the special case of
|
|
|
|
|
being interrupted more carefully */
|
|
|
|
|
|
|
|
|
|
static int
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
myreadc (void *arg)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return fgetc (stdin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
mygets (void *arg, char *buffer, int len)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return fgets (buffer, len, stdin);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 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
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_open (char *name, int from_tty)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt, i;
|
|
|
|
|
unsigned long arg1, arg2;
|
1999-11-02 04:44:47 +00:00
|
|
|
|
char *openArgs = NULL;
|
|
|
|
|
char *devName = NULL;
|
|
|
|
|
char *p;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
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).");
|
|
|
|
|
|
1999-11-02 04:44:47 +00:00
|
|
|
|
/* split name after whitespace, pass tail as arg to open command */
|
|
|
|
|
|
1999-12-07 03:56:43 +00:00
|
|
|
|
devName = xstrdup (name);
|
1999-11-17 02:31:06 +00:00
|
|
|
|
p = strchr (devName, ' ');
|
1999-11-02 04:44:47 +00:00
|
|
|
|
if (p)
|
|
|
|
|
{
|
|
|
|
|
*p = '\0';
|
|
|
|
|
++p;
|
|
|
|
|
|
|
|
|
|
while (*p == ' ')
|
|
|
|
|
++p;
|
|
|
|
|
|
|
|
|
|
openArgs = p;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Make the basic low-level connection. */
|
|
|
|
|
|
2000-01-18 00:55:13 +00:00
|
|
|
|
arm_rdi_close (0);
|
1999-11-02 04:44:47 +00:00
|
|
|
|
rslt = Adp_OpenDevice (devName, openArgs, rdi_heartbeat);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (rslt != adp_ok)
|
|
|
|
|
error ("Could not open device \"%s\"", name);
|
|
|
|
|
|
2002-01-05 04:30:46 +00:00
|
|
|
|
gdb_config.bytesex = 2 | (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 1 : 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
gdb_config.fpe = 1;
|
|
|
|
|
gdb_config.rditype = 2;
|
|
|
|
|
gdb_config.heartbeat_on = 1;
|
|
|
|
|
gdb_config.flags = 2;
|
|
|
|
|
|
|
|
|
|
gdb_hostif.dbgprint = myprint;
|
|
|
|
|
gdb_hostif.dbgpause = mypause;
|
|
|
|
|
gdb_hostif.dbgarg = NULL;
|
|
|
|
|
gdb_hostif.writec = mywritec;
|
|
|
|
|
gdb_hostif.readc = myreadc;
|
|
|
|
|
gdb_hostif.write = mywrite;
|
|
|
|
|
gdb_hostif.gets = mygets;
|
|
|
|
|
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)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
; /* do nothing, this is the expected return */
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
else if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
|
1999-10-05 23:13:56 +00:00
|
|
|
|
Adp_CloseDevice ();
|
2000-09-12 20:07:54 +00:00
|
|
|
|
error ("RDI_open failed\n");
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_Points, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_Step, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_CoPro, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_SemiHosting, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_GetLoadSize, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
max_load_size = arg1;
|
|
|
|
|
|
|
|
|
|
push_target (&arm_rdi_ops);
|
|
|
|
|
|
|
|
|
|
target_fetch_registers (-1);
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_open (1, &gdb_config, NULL, NULL);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-02 04:44:47 +00:00
|
|
|
|
arg1 = rom_at_zero ? 0x0 : 0x13b;
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
rslt = angel_RDI_info (RDIVector_Catch, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
arg1 = (unsigned long) "";
|
|
|
|
|
rslt = angel_RDI_info (RDISet_Cmdline, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear out any existing records of breakpoints. */
|
|
|
|
|
{
|
|
|
|
|
struct local_bp_list_entry *entry, *preventry = NULL;
|
|
|
|
|
|
|
|
|
|
for (entry = local_bp_list; entry != NULL; entry = entry->next)
|
|
|
|
|
{
|
|
|
|
|
if (preventry)
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (preventry);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf_filtered ("Connected to ARM RDI target.\n");
|
|
|
|
|
closed_already = 0;
|
2001-05-04 04:15:33 +00:00
|
|
|
|
inferior_ptid = pid_to_ptid (42);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
/* Start an inferior process and set inferior_ptid to its pid.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
EXEC_FILE is the file to run.
|
|
|
|
|
ARGS is a string containing the arguments to the program.
|
|
|
|
|
ENV is the environment vector to pass. Errors reported with error().
|
|
|
|
|
On VxWorks and various standalone systems, we ignore exec_file. */
|
|
|
|
|
/* This is called not only when we first attach, but also when the
|
|
|
|
|
user types "run" after having attached. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_create_inferior (char *exec_file, char *args, char **env)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int len, rslt;
|
|
|
|
|
unsigned long arg1, arg2;
|
|
|
|
|
char *arg_buf;
|
|
|
|
|
CORE_ADDR entry_point;
|
|
|
|
|
|
|
|
|
|
if (exec_file == 0 || exec_bfd == 0)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
error ("No executable file specified.");
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
entry_point = (CORE_ADDR) bfd_get_start_address (exec_bfd);
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
arm_rdi_kill ();
|
1999-04-16 01:35:26 +00:00
|
|
|
|
remove_breakpoints ();
|
|
|
|
|
init_wait_for_inferior ();
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
arg_buf = (char *) alloca (len);
|
|
|
|
|
arg_buf[0] = '\0';
|
|
|
|
|
strcat (arg_buf, exec_file);
|
|
|
|
|
strcat (arg_buf, " ");
|
|
|
|
|
strcat (arg_buf, args);
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
inferior_ptid = pid_to_ptid (42);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (env != NULL)
|
|
|
|
|
{
|
|
|
|
|
while (*env)
|
|
|
|
|
{
|
|
|
|
|
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);
|
1999-09-09 00:02:17 +00:00
|
|
|
|
printf_filtered ("Setting top-of-memory to 0x%lx\n",
|
1999-04-16 01:35:26 +00:00
|
|
|
|
top_of_memory);
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
rslt = angel_RDI_info (RDIInfo_SetTopMem, &top_of_memory, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
env++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
arg1 = (unsigned long) arg_buf;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
rslt = angel_RDI_info (RDISet_Cmdline, /* &arg1 */ (unsigned long *) arg_buf, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This takes a program previously attached to and detaches it. After
|
|
|
|
|
this is done, GDB can be used to debug some other program. We
|
|
|
|
|
better not have left any breakpoints in the target program or it'll
|
|
|
|
|
die when it hits one. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_detach (char *args, int from_tty)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
pop_target ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clean up connection to a remote debugger. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_close (int quitting)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (!closed_already)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
rslt = angel_RDI_close ();
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
closed_already = 1;
|
2001-05-04 04:15:33 +00:00
|
|
|
|
inferior_ptid = null_ptid;
|
1999-08-09 21:36:23 +00:00
|
|
|
|
Adp_CloseDevice ();
|
2000-03-01 11:25:51 +00:00
|
|
|
|
generic_mourn_inferior ();
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Tell the remote machine to resume. */
|
|
|
|
|
|
|
|
|
|
static void
|
2001-05-04 04:15:33 +00:00
|
|
|
|
arm_rdi_resume (ptid_t ptid, int step, enum target_signal siggnal)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt;
|
|
|
|
|
PointHandle point;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (0 /* turn on when hardware supports single-stepping */ )
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
rslt = angel_RDI_step (1, &point);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
|
|
|
|
printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char handle[4];
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
CORE_ADDR pc = 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
if (step)
|
|
|
|
|
{
|
Argh! These should also have been committed along with:
* arm-tdep.h: New file.
* arm-tdep.c: Include arm-tdep.h.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Make static.
(arm_software_single_step): Similarly. Fix types in declaration.
(arm_register_byte, arm_register_raw_size, arm_register_virtual_size)
(arm_store_return_value, arm_store_struct_return): New functions.
(arm_gdbarch_init): Register the above functions. Also register
call_dummy_start_offset, sizeof_call_dummy_words,
function_start_offset, inner_than, decr_pc_after_break, fp_regnum,
sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size,
max_register_virtual_size, register_size. Set up
prologue_cache.saved_regs here, rather than ...
(_initialize_arm_tdep): ... here.
* config/arm/tm-arm.h (struct type, struct value): Delete forward
declarations.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Delete declarations.
(SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET)
(SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC)
(DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS)
(REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE)
(MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN)
(EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS)
(SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY)
(SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP)
(ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete.
(arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc)
(arm_get_next_pc): No-longer static -- these are needed by the RDI
interface.
* arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h.
* remote-rdi.c remote-rdp.c: Likewise.
* Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o)
(armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies.
* config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus
definition.
* arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM)
(ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM)
(ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed
from non-ARM_ prefixed definitions.
* arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update
all uses of above.
* remote-rdi.c remote-rdp.c: Likewise.
* arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-13 16:24:59 +00:00
|
|
|
|
pc = read_register (ARM_PC_REGNUM);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
pc = arm_get_next_pc (pc);
|
|
|
|
|
arm_rdi_insert_breakpoint (pc, handle);
|
|
|
|
|
}
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
execute_status = rslt = angel_RDI_execute (&point);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError && rslt != RDIError_BreakpointReached)
|
|
|
|
|
printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt));
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (step)
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
arm_rdi_remove_breakpoint (pc, handle);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Wait until the remote machine stops, then return, storing status in
|
|
|
|
|
STATUS just as `wait' would. Returns "pid" (though it's not clear
|
|
|
|
|
what, if anything, that means in the case of this target). */
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
static ptid_t
|
|
|
|
|
arm_rdi_wait (ptid_t ptid, struct target_waitstatus *status)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
status->kind = (execute_status == RDIError_NoError ?
|
1999-07-07 20:19:36 +00:00
|
|
|
|
TARGET_WAITKIND_EXITED : TARGET_WAITKIND_STOPPED);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* convert stopped code from target into right signal */
|
|
|
|
|
status->value.sig = rdi_error_signal (execute_status);
|
|
|
|
|
|
2001-05-04 04:15:33 +00:00
|
|
|
|
return inferior_ptid;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the remote registers into the block REGS. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_fetch_registers (int regno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt, rdi_regmask;
|
|
|
|
|
unsigned long rawreg, rawregs[32];
|
|
|
|
|
char cookedreg[4];
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (regno == -1)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
rslt = angel_RDI_CPUread (255, 0x27fff, rawregs);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (regno = 0; regno < 15; regno++)
|
|
|
|
|
{
|
|
|
|
|
store_unsigned_integer (cookedreg, 4, rawregs[regno]);
|
|
|
|
|
supply_register (regno, (char *) cookedreg);
|
|
|
|
|
}
|
|
|
|
|
store_unsigned_integer (cookedreg, 4, rawregs[15]);
|
Argh! These should also have been committed along with:
* arm-tdep.h: New file.
* arm-tdep.c: Include arm-tdep.h.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Make static.
(arm_software_single_step): Similarly. Fix types in declaration.
(arm_register_byte, arm_register_raw_size, arm_register_virtual_size)
(arm_store_return_value, arm_store_struct_return): New functions.
(arm_gdbarch_init): Register the above functions. Also register
call_dummy_start_offset, sizeof_call_dummy_words,
function_start_offset, inner_than, decr_pc_after_break, fp_regnum,
sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size,
max_register_virtual_size, register_size. Set up
prologue_cache.saved_regs here, rather than ...
(_initialize_arm_tdep): ... here.
* config/arm/tm-arm.h (struct type, struct value): Delete forward
declarations.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Delete declarations.
(SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET)
(SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC)
(DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS)
(REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE)
(MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN)
(EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS)
(SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY)
(SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP)
(ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete.
(arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc)
(arm_get_next_pc): No-longer static -- these are needed by the RDI
interface.
* arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h.
* remote-rdi.c remote-rdp.c: Likewise.
* Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o)
(armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies.
* config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus
definition.
* arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM)
(ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM)
(ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed
from non-ARM_ prefixed definitions.
* arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update
all uses of above.
* remote-rdi.c remote-rdp.c: Likewise.
* arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-13 16:24:59 +00:00
|
|
|
|
supply_register (ARM_PS_REGNUM, (char *) cookedreg);
|
|
|
|
|
arm_rdi_fetch_registers (ARM_PC_REGNUM);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
Argh! These should also have been committed along with:
* arm-tdep.h: New file.
* arm-tdep.c: Include arm-tdep.h.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Make static.
(arm_software_single_step): Similarly. Fix types in declaration.
(arm_register_byte, arm_register_raw_size, arm_register_virtual_size)
(arm_store_return_value, arm_store_struct_return): New functions.
(arm_gdbarch_init): Register the above functions. Also register
call_dummy_start_offset, sizeof_call_dummy_words,
function_start_offset, inner_than, decr_pc_after_break, fp_regnum,
sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size,
max_register_virtual_size, register_size. Set up
prologue_cache.saved_regs here, rather than ...
(_initialize_arm_tdep): ... here.
* config/arm/tm-arm.h (struct type, struct value): Delete forward
declarations.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Delete declarations.
(SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET)
(SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC)
(DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS)
(REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE)
(MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN)
(EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS)
(SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY)
(SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP)
(ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete.
(arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc)
(arm_get_next_pc): No-longer static -- these are needed by the RDI
interface.
* arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h.
* remote-rdi.c remote-rdp.c: Likewise.
* Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o)
(armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies.
* config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus
definition.
* arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM)
(ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM)
(ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed
from non-ARM_ prefixed definitions.
* arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update
all uses of above.
* remote-rdi.c remote-rdp.c: Likewise.
* arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-13 16:24:59 +00:00
|
|
|
|
if (regno == ARM_PC_REGNUM)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
rdi_regmask = RDIReg_PC;
|
Argh! These should also have been committed along with:
* arm-tdep.h: New file.
* arm-tdep.c: Include arm-tdep.h.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Make static.
(arm_software_single_step): Similarly. Fix types in declaration.
(arm_register_byte, arm_register_raw_size, arm_register_virtual_size)
(arm_store_return_value, arm_store_struct_return): New functions.
(arm_gdbarch_init): Register the above functions. Also register
call_dummy_start_offset, sizeof_call_dummy_words,
function_start_offset, inner_than, decr_pc_after_break, fp_regnum,
sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size,
max_register_virtual_size, register_size. Set up
prologue_cache.saved_regs here, rather than ...
(_initialize_arm_tdep): ... here.
* config/arm/tm-arm.h (struct type, struct value): Delete forward
declarations.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Delete declarations.
(SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET)
(SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC)
(DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS)
(REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE)
(MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN)
(EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS)
(SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY)
(SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP)
(ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete.
(arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc)
(arm_get_next_pc): No-longer static -- these are needed by the RDI
interface.
* arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h.
* remote-rdi.c remote-rdp.c: Likewise.
* Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o)
(armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies.
* config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus
definition.
* arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM)
(ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM)
(ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed
from non-ARM_ prefixed definitions.
* arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update
all uses of above.
* remote-rdi.c remote-rdp.c: Likewise.
* arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-13 16:24:59 +00:00
|
|
|
|
else if (regno == ARM_PS_REGNUM)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
rdi_regmask = RDIReg_CPSR;
|
|
|
|
|
else if (regno < 0 || regno > 15)
|
|
|
|
|
{
|
|
|
|
|
rawreg = 0;
|
|
|
|
|
supply_register (regno, (char *) &rawreg);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
rdi_regmask = 1 << regno;
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_CPUread (255, rdi_regmask, &rawreg);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
store_unsigned_integer (cookedreg, 4, rawreg);
|
|
|
|
|
supply_register (regno, (char *) cookedreg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_prepare_to_store (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* Nothing to do. */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Store register REGNO, or all registers if REGNO == -1, from the contents
|
|
|
|
|
of REGISTERS. FIXME: ignores errors. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_store_registers (int regno)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt, rdi_regmask;
|
|
|
|
|
|
|
|
|
|
/* These need to be able to take 'floating point register' contents */
|
|
|
|
|
unsigned long rawreg[3], rawerreg[3];
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
if (regno == -1)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
for (regno = 0; regno < NUM_REGS; regno++)
|
|
|
|
|
arm_rdi_store_registers (regno);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-11-02 14:59:10 +00:00
|
|
|
|
deprecated_read_register_gen (regno, (char *) rawreg);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* RDI manipulates data in host byte order, so convert now. */
|
|
|
|
|
store_unsigned_integer (rawerreg, 4, rawreg[0]);
|
|
|
|
|
|
Argh! These should also have been committed along with:
* arm-tdep.h: New file.
* arm-tdep.c: Include arm-tdep.h.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Make static.
(arm_software_single_step): Similarly. Fix types in declaration.
(arm_register_byte, arm_register_raw_size, arm_register_virtual_size)
(arm_store_return_value, arm_store_struct_return): New functions.
(arm_gdbarch_init): Register the above functions. Also register
call_dummy_start_offset, sizeof_call_dummy_words,
function_start_offset, inner_than, decr_pc_after_break, fp_regnum,
sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size,
max_register_virtual_size, register_size. Set up
prologue_cache.saved_regs here, rather than ...
(_initialize_arm_tdep): ... here.
* config/arm/tm-arm.h (struct type, struct value): Delete forward
declarations.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Delete declarations.
(SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET)
(SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC)
(DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS)
(REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE)
(MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN)
(EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS)
(SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY)
(SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP)
(ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete.
(arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc)
(arm_get_next_pc): No-longer static -- these are needed by the RDI
interface.
* arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h.
* remote-rdi.c remote-rdp.c: Likewise.
* Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o)
(armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies.
* config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus
definition.
* arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM)
(ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM)
(ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed
from non-ARM_ prefixed definitions.
* arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update
all uses of above.
* remote-rdi.c remote-rdp.c: Likewise.
* arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-13 16:24:59 +00:00
|
|
|
|
if (regno == ARM_PC_REGNUM)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
rdi_regmask = RDIReg_PC;
|
Argh! These should also have been committed along with:
* arm-tdep.h: New file.
* arm-tdep.c: Include arm-tdep.h.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Make static.
(arm_software_single_step): Similarly. Fix types in declaration.
(arm_register_byte, arm_register_raw_size, arm_register_virtual_size)
(arm_store_return_value, arm_store_struct_return): New functions.
(arm_gdbarch_init): Register the above functions. Also register
call_dummy_start_offset, sizeof_call_dummy_words,
function_start_offset, inner_than, decr_pc_after_break, fp_regnum,
sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size,
max_register_virtual_size, register_size. Set up
prologue_cache.saved_regs here, rather than ...
(_initialize_arm_tdep): ... here.
* config/arm/tm-arm.h (struct type, struct value): Delete forward
declarations.
(arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call)
(arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy)
(arm_print_float_info, arm_register_type, convert_to_extended)
(arm_elf_make_msymbols_special, arm_coff_make_msymbol_special)
(arm_extract_return_value, arm_register_name): Delete declarations.
(SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET)
(SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC)
(DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS)
(REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE)
(MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN)
(EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS)
(SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY)
(SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP)
(ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete.
(arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc)
(arm_get_next_pc): No-longer static -- these are needed by the RDI
interface.
* arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h.
* remote-rdi.c remote-rdp.c: Likewise.
* Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o)
(armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies.
* config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus
definition.
* arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM)
(ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM)
(ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed
from non-ARM_ prefixed definitions.
* arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update
all uses of above.
* remote-rdi.c remote-rdp.c: Likewise.
* arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-13 16:24:59 +00:00
|
|
|
|
else if (regno == ARM_PS_REGNUM)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
rdi_regmask = RDIReg_CPSR;
|
|
|
|
|
else if (regno < 0 || regno > 15)
|
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
rdi_regmask = 1 << regno;
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_CPUwrite (255, rdi_regmask, rawerreg);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_CPUwrite: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 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
|
2000-10-10 05:17:25 +00:00
|
|
|
|
read; 0 for error. TARGET is unused. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
static int
|
2002-01-19 03:32:43 +00:00
|
|
|
|
arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
|
|
|
|
|
int should_write, struct mem_attrib *attrib,
|
|
|
|
|
struct target_ops *target)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt, i;
|
|
|
|
|
|
|
|
|
|
if (should_write)
|
|
|
|
|
{
|
|
|
|
|
rslt = angel_RDI_write (myaddr, memaddr, &len);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
|
else
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
rslt = angel_RDI_read (memaddr, myaddr, &len);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_read: %s\n", rdi_error_message (rslt));
|
|
|
|
|
len = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Display random info collected from the target. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_files_info (struct target_ops *ignore)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
char *file = "nothing";
|
|
|
|
|
int rslt;
|
|
|
|
|
unsigned long arg1, arg2;
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
if (arg1 & (1 << 15))
|
|
|
|
|
printf_filtered ("Target supports Thumb code.\n");
|
|
|
|
|
if (arg1 & (1 << 14))
|
|
|
|
|
printf_filtered ("Target can do profiling.\n");
|
|
|
|
|
if (arg1 & (1 << 4))
|
|
|
|
|
printf_filtered ("Target is real hardware.\n");
|
1999-07-07 20:19:36 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
rslt = angel_RDI_info (RDIInfo_Step, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
printf_filtered ("Target can%s single-step.\n", (arg1 & 0x4 ? "" : "not"));
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_info (RDIInfo_Icebreaker, &arg1, &arg2);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf_filtered ("Target includes an EmbeddedICE.\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_kill (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt;
|
|
|
|
|
|
|
|
|
|
rslt = angel_RDI_open (1, &gdb_config, NULL, NULL);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_mourn_inferior (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2000-02-01 03:19:29 +00:00
|
|
|
|
/* 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();
|
1999-04-16 01:35:26 +00:00
|
|
|
|
unpush_target (&arm_rdi_ops);
|
|
|
|
|
generic_mourn_inferior ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* While the RDI library keeps track of its own breakpoints, we need
|
|
|
|
|
to remember "handles" so that we can delete them later. Since
|
|
|
|
|
breakpoints get used for stepping, be careful not to leak memory
|
|
|
|
|
here. */
|
|
|
|
|
|
|
|
|
|
static int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt;
|
|
|
|
|
PointHandle point;
|
|
|
|
|
struct local_bp_list_entry *entry;
|
|
|
|
|
int type = RDIPoint_EQ;
|
|
|
|
|
|
|
|
|
|
if (arm_pc_is_thumb (addr) || arm_pc_is_thumb_dummy (addr))
|
|
|
|
|
type |= RDIPoint_16Bit;
|
|
|
|
|
rslt = angel_RDI_setbreak (addr, type, 0, &point);
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
if (rslt != RDIError_NoError)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt));
|
|
|
|
|
}
|
|
|
|
|
entry =
|
|
|
|
|
(struct local_bp_list_entry *) xmalloc (sizeof (struct local_bp_list_entry));
|
|
|
|
|
entry->addr = addr;
|
|
|
|
|
entry->point = point;
|
|
|
|
|
entry->next = local_bp_list;
|
|
|
|
|
local_bp_list = entry;
|
|
|
|
|
return rslt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2000-07-30 01:48:28 +00:00
|
|
|
|
arm_rdi_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
int rslt;
|
|
|
|
|
PointHandle point;
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
struct local_bp_list_entry **entryp, *dead;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
for (entryp = &local_bp_list; *entryp != NULL; entryp = &(*entryp)->next)
|
|
|
|
|
if ((*entryp)->addr == addr)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (*entryp)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
dead = *entryp;
|
|
|
|
|
rslt = angel_RDI_clearbreak (dead->point);
|
|
|
|
|
if (rslt != RDIError_NoError)
|
|
|
|
|
printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt));
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
/* Delete the breakpoint entry locally. */
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
*entryp = dead->next;
|
|
|
|
|
xfree (dead);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
* remote-rdi.c (myprint): Replace 'PTR' with 'void *'.
(mywrite, mywritec, mypause, myreadc, mygets): Likewise.
(_initialize_remote_rdi): Use add_set_boolean_cmd to register
commands that set boolean values.
(arm_rdi_remove_breakpoint): Rewrite to avoid uninitialized warning.
(arm_rdi_resume): Always initialize PC.
(arm_rdi_open): Don't use rslt as a boolean.
(arm_rdi_create_inferior, arm_rdi_close, arm_rdi_resume)
(arm_rdi_fetch_registers, arm_rdi_store_registers)
(arm_rdi_xfer_memory, arm_rdi_files_info, arm_rdi_kill)
(arm_rdi_insert_breakpoint, arm_rdi_remove_breakpoint): Likewise.
2002-03-07 15:29:53 +00:00
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
static char *
|
2000-07-30 01:48:28 +00:00
|
|
|
|
rdi_error_message (int err)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
switch (err)
|
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
case RDIError_NoError:
|
1999-04-16 01:35:26 +00:00
|
|
|
|
return "no error";
|
|
|
|
|
case RDIError_Reset:
|
|
|
|
|
return "debuggee reset";
|
|
|
|
|
case RDIError_UndefinedInstruction:
|
|
|
|
|
return "undefined instruction";
|
|
|
|
|
case RDIError_SoftwareInterrupt:
|
|
|
|
|
return "SWI trapped";
|
|
|
|
|
case RDIError_PrefetchAbort:
|
|
|
|
|
return "prefetch abort, execution ran into unmapped memory?";
|
|
|
|
|
case RDIError_DataAbort:
|
|
|
|
|
return "data abort, no memory at specified address?";
|
|
|
|
|
case RDIError_AddressException:
|
|
|
|
|
return "address exception, access >26bit in 26bit mode";
|
|
|
|
|
case RDIError_IRQ:
|
|
|
|
|
return "IRQ, interrupt trapped";
|
|
|
|
|
case RDIError_FIQ:
|
|
|
|
|
return "FIQ, fast interrupt trapped";
|
|
|
|
|
case RDIError_Error:
|
|
|
|
|
return "a miscellaneous type of error";
|
|
|
|
|
case RDIError_BranchThrough0:
|
|
|
|
|
return "branch through location 0";
|
|
|
|
|
case RDIError_NotInitialised:
|
|
|
|
|
return "internal error, RDI_open not called first";
|
|
|
|
|
case RDIError_UnableToInitialise:
|
|
|
|
|
return "internal error, target world is broken";
|
|
|
|
|
case RDIError_WrongByteSex:
|
|
|
|
|
return "See Operator: WrongByteSex";
|
|
|
|
|
case RDIError_UnableToTerminate:
|
|
|
|
|
return "See Operator: Unable to Terminate";
|
|
|
|
|
case RDIError_BadInstruction:
|
|
|
|
|
return "bad instruction, illegal to execute this instruction";
|
|
|
|
|
case RDIError_IllegalInstruction:
|
|
|
|
|
return "illegal instruction, the effect of executing it is undefined";
|
|
|
|
|
case RDIError_BadCPUStateSetting:
|
|
|
|
|
return "internal error, tried to set SPSR of user mode";
|
|
|
|
|
case RDIError_UnknownCoPro:
|
|
|
|
|
return "unknown co-processor";
|
|
|
|
|
case RDIError_UnknownCoProState:
|
|
|
|
|
return "cannot execute co-processor request";
|
|
|
|
|
case RDIError_BadCoProState:
|
|
|
|
|
return "recognizably broken co-processor request";
|
|
|
|
|
case RDIError_BadPointType:
|
|
|
|
|
return "internal error, bad point yype";
|
|
|
|
|
case RDIError_UnimplementedType:
|
|
|
|
|
return "internal error, unimplemented type";
|
|
|
|
|
case RDIError_BadPointSize:
|
|
|
|
|
return "internal error, bad point size";
|
|
|
|
|
case RDIError_UnimplementedSize:
|
|
|
|
|
return "internal error, unimplemented size";
|
|
|
|
|
case RDIError_NoMorePoints:
|
|
|
|
|
return "last break/watch point was used";
|
|
|
|
|
case RDIError_BreakpointReached:
|
|
|
|
|
return "breakpoint reached";
|
|
|
|
|
case RDIError_WatchpointAccessed:
|
|
|
|
|
return "watchpoint accessed";
|
|
|
|
|
case RDIError_NoSuchPoint:
|
|
|
|
|
return "attempted to clear non-existent break/watch point";
|
|
|
|
|
case RDIError_ProgramFinishedInStep:
|
|
|
|
|
return "end of the program reached while stepping";
|
|
|
|
|
case RDIError_UserInterrupt:
|
|
|
|
|
return "you pressed Escape";
|
|
|
|
|
case RDIError_CantSetPoint:
|
|
|
|
|
return "no more break/watch points available";
|
|
|
|
|
case RDIError_IncompatibleRDILevels:
|
|
|
|
|
return "incompatible RDI levels";
|
|
|
|
|
case RDIError_LittleEndian:
|
|
|
|
|
return "debuggee is little endian";
|
|
|
|
|
case RDIError_BigEndian:
|
|
|
|
|
return "debuggee is big endian";
|
|
|
|
|
case RDIError_SoftInitialiseError:
|
|
|
|
|
return "recoverable error in RDI initialization";
|
|
|
|
|
case RDIError_InsufficientPrivilege:
|
|
|
|
|
return "internal error, supervisor state not accessible to monitor";
|
|
|
|
|
case RDIError_UnimplementedMessage:
|
|
|
|
|
return "internal error, unimplemented message";
|
|
|
|
|
case RDIError_UndefinedMessage:
|
|
|
|
|
return "internal error, undefined message";
|
|
|
|
|
default:
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return "undefined error message, should reset target";
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert the ARM error messages to signals that GDB knows about. */
|
|
|
|
|
|
|
|
|
|
static enum target_signal
|
2000-07-30 01:48:28 +00:00
|
|
|
|
rdi_error_signal (int err)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
switch (err)
|
|
|
|
|
{
|
|
|
|
|
case RDIError_NoError:
|
|
|
|
|
return 0;
|
|
|
|
|
case RDIError_Reset:
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return TARGET_SIGNAL_TERM; /* ??? */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
case RDIError_UndefinedInstruction:
|
|
|
|
|
return TARGET_SIGNAL_ILL;
|
|
|
|
|
case RDIError_SoftwareInterrupt:
|
|
|
|
|
case RDIError_PrefetchAbort:
|
|
|
|
|
case RDIError_DataAbort:
|
|
|
|
|
return TARGET_SIGNAL_TRAP;
|
|
|
|
|
case RDIError_AddressException:
|
|
|
|
|
return TARGET_SIGNAL_SEGV;
|
|
|
|
|
case RDIError_IRQ:
|
|
|
|
|
case RDIError_FIQ:
|
|
|
|
|
return TARGET_SIGNAL_TRAP;
|
|
|
|
|
case RDIError_Error:
|
|
|
|
|
return TARGET_SIGNAL_TERM;
|
|
|
|
|
case RDIError_BranchThrough0:
|
|
|
|
|
return TARGET_SIGNAL_TRAP;
|
|
|
|
|
case RDIError_NotInitialised:
|
|
|
|
|
case RDIError_UnableToInitialise:
|
|
|
|
|
case RDIError_WrongByteSex:
|
|
|
|
|
case RDIError_UnableToTerminate:
|
|
|
|
|
return TARGET_SIGNAL_UNKNOWN;
|
|
|
|
|
case RDIError_BadInstruction:
|
|
|
|
|
case RDIError_IllegalInstruction:
|
|
|
|
|
return TARGET_SIGNAL_ILL;
|
|
|
|
|
case RDIError_BadCPUStateSetting:
|
|
|
|
|
case RDIError_UnknownCoPro:
|
|
|
|
|
case RDIError_UnknownCoProState:
|
|
|
|
|
case RDIError_BadCoProState:
|
|
|
|
|
case RDIError_BadPointType:
|
|
|
|
|
case RDIError_UnimplementedType:
|
|
|
|
|
case RDIError_BadPointSize:
|
|
|
|
|
case RDIError_UnimplementedSize:
|
|
|
|
|
case RDIError_NoMorePoints:
|
|
|
|
|
return TARGET_SIGNAL_UNKNOWN;
|
|
|
|
|
case RDIError_BreakpointReached:
|
|
|
|
|
case RDIError_WatchpointAccessed:
|
|
|
|
|
return TARGET_SIGNAL_TRAP;
|
|
|
|
|
case RDIError_NoSuchPoint:
|
|
|
|
|
case RDIError_ProgramFinishedInStep:
|
|
|
|
|
return TARGET_SIGNAL_UNKNOWN;
|
|
|
|
|
case RDIError_UserInterrupt:
|
|
|
|
|
return TARGET_SIGNAL_INT;
|
|
|
|
|
case RDIError_IncompatibleRDILevels:
|
|
|
|
|
case RDIError_LittleEndian:
|
|
|
|
|
case RDIError_BigEndian:
|
|
|
|
|
case RDIError_SoftInitialiseError:
|
|
|
|
|
case RDIError_InsufficientPrivilege:
|
|
|
|
|
case RDIError_UnimplementedMessage:
|
|
|
|
|
case RDIError_UndefinedMessage:
|
|
|
|
|
default:
|
1999-07-07 20:19:36 +00:00
|
|
|
|
return TARGET_SIGNAL_UNKNOWN;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-10-12 22:56:31 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
arm_rdi_stop(void)
|
|
|
|
|
{
|
|
|
|
|
angel_RDI_stop_request();
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
/* Define the target operations structure. */
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
init_rdi_ops (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
|
arm_rdi_ops.to_shortname = "rdi";
|
1999-04-16 01:35:26 +00:00
|
|
|
|
arm_rdi_ops.to_longname = "ARM RDI";
|
|
|
|
|
arm_rdi_ops.to_doc = "Use a remote ARM-based computer; via the RDI library.\n\
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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;
|
2000-10-12 22:56:31 +00:00
|
|
|
|
arm_rdi_ops.to_stop = arm_rdi_stop;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
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;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
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;
|
1999-07-07 20:19:36 +00:00
|
|
|
|
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;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-17 02:31:06 +00:00
|
|
|
|
static void
|
|
|
|
|
rdilogfile_command (char *arg, int from_tty)
|
1999-11-02 04:44:47 +00:00
|
|
|
|
{
|
|
|
|
|
if (!arg || strlen (arg) == 0)
|
|
|
|
|
{
|
|
|
|
|
printf_filtered ("rdi log file is '%s'\n", log_filename);
|
|
|
|
|
return;
|
|
|
|
|
}
|
1999-11-17 02:31:06 +00:00
|
|
|
|
|
1999-11-02 04:44:47 +00:00
|
|
|
|
if (log_filename)
|
2000-12-15 01:01:51 +00:00
|
|
|
|
xfree (log_filename);
|
1999-11-17 02:31:06 +00:00
|
|
|
|
|
1999-12-07 03:56:43 +00:00
|
|
|
|
log_filename = xstrdup (arg);
|
1999-11-02 04:44:47 +00:00
|
|
|
|
|
|
|
|
|
Adp_SetLogfile (log_filename);
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-17 02:31:06 +00:00
|
|
|
|
static void
|
|
|
|
|
rdilogenable_command (char *args, int from_tty)
|
1999-11-02 04:44:47 +00:00
|
|
|
|
{
|
|
|
|
|
if (!args || strlen (args) == 0)
|
|
|
|
|
{
|
|
|
|
|
printf_filtered ("rdi log is %s\n", log_enable ? "enabled" : "disabled");
|
|
|
|
|
return;
|
|
|
|
|
}
|
1999-11-17 02:31:06 +00:00
|
|
|
|
|
|
|
|
|
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);
|
1999-11-02 04:44:47 +00:00
|
|
|
|
else
|
|
|
|
|
printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
|
1999-11-17 02:31:06 +00:00
|
|
|
|
" try y or n\n", args);
|
1999-11-02 04:44:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-11 13:16:30 +00:00
|
|
|
|
extern initialize_file_ftype _initialize_remote_rdi; /* -Wmissing-prototypes */
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
|
_initialize_remote_rdi (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
2001-02-19 11:47:16 +00:00
|
|
|
|
struct cmd_list_element *c;
|
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
init_rdi_ops ();
|
1999-04-16 01:35:26 +00:00
|
|
|
|
add_target (&arm_rdi_ops);
|
1999-11-02 04:44:47 +00:00
|
|
|
|
|
1999-12-07 03:56:43 +00:00
|
|
|
|
log_filename = xstrdup ("rdi.log");
|
1999-11-17 02:31:06 +00:00
|
|
|
|
Adp_SetLogfile (log_filename);
|
|
|
|
|
Adp_SetLogEnable (log_enable);
|
1999-11-02 04:44:47 +00:00
|
|
|
|
|
2001-02-19 11:47:16 +00:00
|
|
|
|
c = add_cmd ("rdilogfile", class_maintenance,
|
|
|
|
|
rdilogfile_command,
|
2002-05-08 15:59:52 +00:00
|
|
|
|
"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);
|
2002-03-06 06:28:35 +00:00
|
|
|
|
set_cmd_completer (c, filename_completer);
|
1999-11-02 04:44:47 +00:00
|
|
|
|
|
1999-11-17 02:31:06 +00:00
|
|
|
|
add_cmd ("rdilogenable", class_maintenance,
|
1999-11-02 04:44:47 +00:00
|
|
|
|
rdilogenable_command,
|
2002-05-08 15:59:52 +00:00
|
|
|
|
"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 or yes will enable.\n"
|
|
|
|
|
"An argument of 0, f, false, n or no will disabled.\n"
|
|
|
|
|
"Withough an argument, it will display current state.\n",
|
1999-11-02 04:44:47 +00:00
|
|
|
|
&maintenancelist);
|
|
|
|
|
|
2002-06-15 21:07:59 +00:00
|
|
|
|
add_setshow_boolean_cmd
|
|
|
|
|
("rdiromatzero", no_class, &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",
|
|
|
|
|
"Show if target has ROM at addr 0.\n",
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
&setlist, &showlist);
|
|
|
|
|
|
|
|
|
|
add_setshow_boolean_cmd
|
|
|
|
|
("rdiheartbeat", no_class, &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",
|
|
|
|
|
"Show enable for ADP heartbeat packets.\n",
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
&setlist, &showlist);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A little dummy to make linking with the library succeed. */
|
|
|
|
|
|
2003-06-15 00:27:54 +00:00
|
|
|
|
void
|
2003-06-15 12:30:56 +00:00
|
|
|
|
Fail (const char *ignored, ...)
|
1999-07-07 20:19:36 +00:00
|
|
|
|
{
|
2003-06-15 00:27:54 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
}
|