1 /* GDB interface to ARM RDI library.
2 Copyright 1997, 1998, 2001 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 #include "gdb_string.h"
31 #include "gdb-stabs.h"
32 #include "gdbthread.h"
34 #include "breakpoint.h"
35 #include "completer.h"
38 #include <sys/types.h>
43 #include "rdi-share/ardi.h"
44 #include "rdi-share/adp.h"
45 #include "rdi-share/hsys.h"
47 extern int isascii (int);
49 /* Prototypes for local functions */
51 static void arm_rdi_files_info (struct target_ops
*ignore
);
53 static int arm_rdi_xfer_memory (CORE_ADDR memaddr
, char *myaddr
,
54 int len
, int should_write
,
55 struct mem_attrib
*attrib
,
56 struct target_ops
*target
);
58 static void arm_rdi_prepare_to_store (void);
60 static void arm_rdi_fetch_registers (int regno
);
62 static void arm_rdi_resume (int pid
, int step
, enum target_signal siggnal
);
64 static int arm_rdi_start_remote (char *dummy
);
66 static void arm_rdi_open (char *name
, int from_tty
);
68 static void arm_rdi_create_inferior (char *exec_file
, char *args
, char **env
);
70 static void arm_rdi_close (int quitting
);
72 static void arm_rdi_store_registers (int regno
);
74 static void arm_rdi_mourn (void);
76 static void arm_rdi_send (char *buf
);
78 static int arm_rdi_wait (int pid
, struct target_waitstatus
*status
);
80 static void arm_rdi_kill (void);
82 static void arm_rdi_detach (char *args
, int from_tty
);
84 static void arm_rdi_interrupt (int signo
);
86 static void arm_rdi_interrupt_twice (int signo
);
88 static void interrupt_query (void);
90 static int arm_rdi_insert_breakpoint (CORE_ADDR
, char *);
92 static int arm_rdi_remove_breakpoint (CORE_ADDR
, char *);
94 static char *rdi_error_message (int err
);
96 static enum target_signal
rdi_error_signal (int err
);
98 /* Global variables. */
100 struct target_ops arm_rdi_ops
;
102 static struct Dbg_ConfigBlock gdb_config
;
104 static struct Dbg_HostosInterface gdb_hostif
;
106 static int max_load_size
;
108 static int execute_status
;
110 /* Send heatbeat packets? */
111 static int rdi_heartbeat
= 0;
113 /* Target has ROM at address 0. */
114 static int rom_at_zero
= 0;
116 /* Enable logging? */
117 static int log_enable
= 0;
119 /* Name of the log file. Default is "rdi.log". */
120 static char *log_filename
;
122 /* A little list of breakpoints that have been set. */
124 static struct local_bp_list_entry
128 struct local_bp_list_entry
*next
;
133 /* Stub for catch_errors. */
136 arm_rdi_start_remote (char *dummy
)
141 /* Helper callbacks for the "host interface" structure. RDI functions call
142 these to forward output from the target system and so forth. */
145 voiddummy (void *dummy
)
147 fprintf_unfiltered (gdb_stdout
, "void dummy\n");
151 myprint (PTR arg
, const char *format
, va_list ap
)
153 vfprintf_unfiltered (gdb_stdout
, format
, ap
);
157 mywritec (PTR arg
, int c
)
160 fputc_unfiltered (c
, gdb_stdout
);
164 mywrite (PTR arg
, char const *buffer
, int len
)
170 for (i
= 0; i
< len
; i
++)
172 if (isascii ((int) *e
))
174 fputc_unfiltered ((int) *e
, gdb_stdout
);
187 /* These last two are tricky as we have to handle the special case of
188 being interrupted more carefully */
193 return fgetc (stdin
);
197 mygets (PTR arg
, char *buffer
, int len
)
199 return fgets (buffer
, len
, stdin
);
202 /* Prevent multiple calls to angel_RDI_close(). */
203 static int closed_already
= 1;
205 /* Open a connection to a remote debugger. NAME is the filename used
206 for communication. */
209 arm_rdi_open (char *name
, int from_tty
)
212 unsigned long arg1
, arg2
;
213 char *openArgs
= NULL
;
214 char *devName
= NULL
;
218 error ("To open an RDI connection, you need to specify what serial\n\
219 device is attached to the remote system (e.g. /dev/ttya).");
221 /* split name after whitespace, pass tail as arg to open command */
223 devName
= xstrdup (name
);
224 p
= strchr (devName
, ' ');
236 /* Make the basic low-level connection. */
239 rslt
= Adp_OpenDevice (devName
, openArgs
, rdi_heartbeat
);
242 error ("Could not open device \"%s\"", name
);
244 gdb_config
.bytesex
= 2 | (TARGET_BYTE_ORDER
== BIG_ENDIAN
? 1 : 0);
246 gdb_config
.rditype
= 2;
247 gdb_config
.heartbeat_on
= 1;
248 gdb_config
.flags
= 2;
250 gdb_hostif
.dbgprint
= myprint
;
251 gdb_hostif
.dbgpause
= mypause
;
252 gdb_hostif
.dbgarg
= NULL
;
253 gdb_hostif
.writec
= mywritec
;
254 gdb_hostif
.readc
= myreadc
;
255 gdb_hostif
.write
= mywrite
;
256 gdb_hostif
.gets
= mygets
;
257 gdb_hostif
.hostosarg
= NULL
;
258 gdb_hostif
.reset
= voiddummy
;
260 rslt
= angel_RDI_open (10, &gdb_config
, &gdb_hostif
, NULL
);
261 if (rslt
== RDIError_BigEndian
|| rslt
== RDIError_LittleEndian
)
262 ; /* do nothing, this is the expected return */
265 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
267 error ("RDI_open failed\n");
270 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
273 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
275 rslt
= angel_RDI_info (RDIInfo_Points
, &arg1
, &arg2
);
278 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
280 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
283 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
285 rslt
= angel_RDI_info (RDIInfo_CoPro
, &arg1
, &arg2
);
288 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
290 rslt
= angel_RDI_info (RDIInfo_SemiHosting
, &arg1
, &arg2
);
293 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
296 rslt
= angel_RDI_info (RDIInfo_GetLoadSize
, &arg1
, &arg2
);
299 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
301 max_load_size
= arg1
;
303 push_target (&arm_rdi_ops
);
305 target_fetch_registers (-1);
307 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
310 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
313 arg1
= rom_at_zero
? 0x0 : 0x13b;
315 rslt
= angel_RDI_info (RDIVector_Catch
, &arg1
, &arg2
);
318 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
321 arg1
= (unsigned long) "";
322 rslt
= angel_RDI_info (RDISet_Cmdline
, &arg1
, &arg2
);
325 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
328 /* Clear out any existing records of breakpoints. */
330 struct local_bp_list_entry
*entry
, *preventry
= NULL
;
332 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
339 printf_filtered ("Connected to ARM RDI target.\n");
344 /* Start an inferior process and set inferior_pid to its pid.
345 EXEC_FILE is the file to run.
346 ARGS is a string containing the arguments to the program.
347 ENV is the environment vector to pass. Errors reported with error().
348 On VxWorks and various standalone systems, we ignore exec_file. */
349 /* This is called not only when we first attach, but also when the
350 user types "run" after having attached. */
353 arm_rdi_create_inferior (char *exec_file
, char *args
, char **env
)
356 unsigned long arg1
, arg2
;
358 CORE_ADDR entry_point
;
360 if (exec_file
== 0 || exec_bfd
== 0)
361 error ("No executable file specified.");
363 entry_point
= (CORE_ADDR
) bfd_get_start_address (exec_bfd
);
366 remove_breakpoints ();
367 init_wait_for_inferior ();
369 len
= strlen (exec_file
) + 1 + strlen (args
) + 1 + /*slop */ 10;
370 arg_buf
= (char *) alloca (len
);
372 strcat (arg_buf
, exec_file
);
373 strcat (arg_buf
, " ");
374 strcat (arg_buf
, args
);
377 insert_breakpoints (); /* Needed to get correct instruction in cache */
383 if (strncmp (*env
, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0)
385 unsigned long top_of_memory
;
388 /* Set up memory limit */
389 top_of_memory
= strtoul (*env
+ sizeof ("MEMSIZE=") - 1,
391 printf_filtered ("Setting top-of-memory to 0x%lx\n",
394 rslt
= angel_RDI_info (RDIInfo_SetTopMem
, &top_of_memory
, &arg2
);
397 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
404 arg1
= (unsigned long) arg_buf
;
405 rslt
= angel_RDI_info (RDISet_Cmdline
, /* &arg1 */ (unsigned long *) arg_buf
, &arg2
);
408 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
411 proceed (entry_point
, TARGET_SIGNAL_DEFAULT
, 0);
414 /* This takes a program previously attached to and detaches it. After
415 this is done, GDB can be used to debug some other program. We
416 better not have left any breakpoints in the target program or it'll
417 die when it hits one. */
420 arm_rdi_detach (char *args
, int from_tty
)
425 /* Clean up connection to a remote debugger. */
428 arm_rdi_close (int quitting
)
434 rslt
= angel_RDI_close ();
437 printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt
));
442 generic_mourn_inferior ();
446 /* Tell the remote machine to resume. */
449 arm_rdi_resume (int pid
, int step
, enum target_signal siggnal
)
454 if (0 /* turn on when hardware supports single-stepping */ )
456 rslt
= angel_RDI_step (1, &point
);
459 printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt
));
469 pc
= read_register (PC_REGNUM
);
470 pc
= arm_get_next_pc (pc
);
471 arm_rdi_insert_breakpoint (pc
, handle
);
473 execute_status
= rslt
= angel_RDI_execute (&point
);
474 if (rslt
== RDIError_BreakpointReached
)
478 printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt
));
482 arm_rdi_remove_breakpoint (pc
, handle
);
487 /* Send ^C to target to halt it. Target will respond, and send us a
491 arm_rdi_interrupt (int signo
)
495 static void (*ofunc
) ();
497 /* The user typed ^C twice. */
499 arm_rdi_interrupt_twice (int signo
)
503 /* Ask the user what to do when an interrupt is received. */
506 interrupt_query (void)
510 /* Wait until the remote machine stops, then return, storing status in
511 STATUS just as `wait' would. Returns "pid" (though it's not clear
512 what, if anything, that means in the case of this target). */
515 arm_rdi_wait (int pid
, struct target_waitstatus
*status
)
517 status
->kind
= (execute_status
== RDIError_NoError
?
518 TARGET_WAITKIND_EXITED
: TARGET_WAITKIND_STOPPED
);
520 /* convert stopped code from target into right signal */
521 status
->value
.sig
= rdi_error_signal (execute_status
);
526 /* Read the remote registers into the block REGS. */
530 arm_rdi_fetch_registers (int regno
)
532 int rslt
, rdi_regmask
;
533 unsigned long rawreg
, rawregs
[32];
538 rslt
= angel_RDI_CPUread (255, 0x27fff, rawregs
);
541 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
544 for (regno
= 0; regno
< 15; regno
++)
546 store_unsigned_integer (cookedreg
, 4, rawregs
[regno
]);
547 supply_register (regno
, (char *) cookedreg
);
549 store_unsigned_integer (cookedreg
, 4, rawregs
[15]);
550 supply_register (PS_REGNUM
, (char *) cookedreg
);
551 arm_rdi_fetch_registers (PC_REGNUM
);
555 if (regno
== PC_REGNUM
)
556 rdi_regmask
= RDIReg_PC
;
557 else if (regno
== PS_REGNUM
)
558 rdi_regmask
= RDIReg_CPSR
;
559 else if (regno
< 0 || regno
> 15)
562 supply_register (regno
, (char *) &rawreg
);
566 rdi_regmask
= 1 << regno
;
568 rslt
= angel_RDI_CPUread (255, rdi_regmask
, &rawreg
);
571 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
573 store_unsigned_integer (cookedreg
, 4, rawreg
);
574 supply_register (regno
, (char *) cookedreg
);
579 arm_rdi_prepare_to_store (void)
584 /* Store register REGNO, or all registers if REGNO == -1, from the contents
585 of REGISTERS. FIXME: ignores errors. */
588 arm_rdi_store_registers (int regno
)
590 int rslt
, rdi_regmask
;
592 /* These need to be able to take 'floating point register' contents */
593 unsigned long rawreg
[3], rawerreg
[3];
597 for (regno
= 0; regno
< NUM_REGS
; regno
++)
598 arm_rdi_store_registers (regno
);
602 read_register_gen (regno
, (char *) rawreg
);
603 /* RDI manipulates data in host byte order, so convert now. */
604 store_unsigned_integer (rawerreg
, 4, rawreg
[0]);
606 if (regno
== PC_REGNUM
)
607 rdi_regmask
= RDIReg_PC
;
608 else if (regno
== PS_REGNUM
)
609 rdi_regmask
= RDIReg_CPSR
;
610 else if (regno
< 0 || regno
> 15)
613 rdi_regmask
= 1 << regno
;
615 rslt
= angel_RDI_CPUwrite (255, rdi_regmask
, rawerreg
);
618 printf_filtered ("RDI_CPUwrite: %s\n", rdi_error_message (rslt
));
623 /* Read or write LEN bytes from inferior memory at MEMADDR,
624 transferring to or from debugger address MYADDR. Write to inferior
625 if SHOULD_WRITE is nonzero. Returns length of data written or
626 read; 0 for error. TARGET is unused. */
630 arm_rdi_xfer_memory (CORE_ADDR memaddr
, char *myaddr
, int len
, int should_write
,
631 struct mem_attrib
*attrib ATTRIBUTE_UNUSED
,
632 struct target_ops
*target ATTRIBUTE_UNUSED
)
638 rslt
= angel_RDI_write (myaddr
, memaddr
, &len
);
641 printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt
));
646 rslt
= angel_RDI_read (memaddr
, myaddr
, &len
);
649 printf_filtered ("RDI_read: %s\n", rdi_error_message (rslt
));
656 /* Display random info collected from the target. */
659 arm_rdi_files_info (struct target_ops
*ignore
)
661 char *file
= "nothing";
663 unsigned long arg1
, arg2
;
665 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
668 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
670 if (arg1
& (1 << 15))
671 printf_filtered ("Target supports Thumb code.\n");
672 if (arg1
& (1 << 14))
673 printf_filtered ("Target can do profiling.\n");
675 printf_filtered ("Target is real hardware.\n");
677 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
680 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
682 printf_filtered ("Target can%s single-step.\n", (arg1
& 0x4 ? "" : "not"));
684 rslt
= angel_RDI_info (RDIInfo_Icebreaker
, &arg1
, &arg2
);
687 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
690 printf_filtered ("Target includes an EmbeddedICE.\n");
698 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
701 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
706 arm_rdi_mourn_inferior (void)
708 /* We remove the inserted breakpoints in case the user wants to
709 issue another target and load commands to rerun his application;
710 This is something that wouldn't work on a native target, for instance,
711 as the process goes away when the inferior exits, but it works with
712 some remote targets like this one. That is why this is done here. */
713 remove_breakpoints();
714 unpush_target (&arm_rdi_ops
);
715 generic_mourn_inferior ();
718 /* While the RDI library keeps track of its own breakpoints, we need
719 to remember "handles" so that we can delete them later. Since
720 breakpoints get used for stepping, be careful not to leak memory
724 arm_rdi_insert_breakpoint (CORE_ADDR addr
, char *contents_cache
)
728 struct local_bp_list_entry
*entry
;
729 int type
= RDIPoint_EQ
;
731 if (arm_pc_is_thumb (addr
) || arm_pc_is_thumb_dummy (addr
))
732 type
|= RDIPoint_16Bit
;
733 rslt
= angel_RDI_setbreak (addr
, type
, 0, &point
);
736 printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt
));
739 (struct local_bp_list_entry
*) xmalloc (sizeof (struct local_bp_list_entry
));
741 entry
->point
= point
;
742 entry
->next
= local_bp_list
;
743 local_bp_list
= entry
;
748 arm_rdi_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
752 struct local_bp_list_entry
*entry
, *preventry
;
754 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
756 if (entry
->addr
== addr
)
764 rslt
= angel_RDI_clearbreak (entry
->point
);
767 printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt
));
769 /* Delete the breakpoint entry locally. */
770 if (entry
== local_bp_list
)
772 local_bp_list
= entry
->next
;
776 preventry
->next
= entry
->next
;
784 rdi_error_message (int err
)
788 case RDIError_NoError
:
791 return "debuggee reset";
792 case RDIError_UndefinedInstruction
:
793 return "undefined instruction";
794 case RDIError_SoftwareInterrupt
:
795 return "SWI trapped";
796 case RDIError_PrefetchAbort
:
797 return "prefetch abort, execution ran into unmapped memory?";
798 case RDIError_DataAbort
:
799 return "data abort, no memory at specified address?";
800 case RDIError_AddressException
:
801 return "address exception, access >26bit in 26bit mode";
803 return "IRQ, interrupt trapped";
805 return "FIQ, fast interrupt trapped";
807 return "a miscellaneous type of error";
808 case RDIError_BranchThrough0
:
809 return "branch through location 0";
810 case RDIError_NotInitialised
:
811 return "internal error, RDI_open not called first";
812 case RDIError_UnableToInitialise
:
813 return "internal error, target world is broken";
814 case RDIError_WrongByteSex
:
815 return "See Operator: WrongByteSex";
816 case RDIError_UnableToTerminate
:
817 return "See Operator: Unable to Terminate";
818 case RDIError_BadInstruction
:
819 return "bad instruction, illegal to execute this instruction";
820 case RDIError_IllegalInstruction
:
821 return "illegal instruction, the effect of executing it is undefined";
822 case RDIError_BadCPUStateSetting
:
823 return "internal error, tried to set SPSR of user mode";
824 case RDIError_UnknownCoPro
:
825 return "unknown co-processor";
826 case RDIError_UnknownCoProState
:
827 return "cannot execute co-processor request";
828 case RDIError_BadCoProState
:
829 return "recognizably broken co-processor request";
830 case RDIError_BadPointType
:
831 return "internal error, bad point yype";
832 case RDIError_UnimplementedType
:
833 return "internal error, unimplemented type";
834 case RDIError_BadPointSize
:
835 return "internal error, bad point size";
836 case RDIError_UnimplementedSize
:
837 return "internal error, unimplemented size";
838 case RDIError_NoMorePoints
:
839 return "last break/watch point was used";
840 case RDIError_BreakpointReached
:
841 return "breakpoint reached";
842 case RDIError_WatchpointAccessed
:
843 return "watchpoint accessed";
844 case RDIError_NoSuchPoint
:
845 return "attempted to clear non-existent break/watch point";
846 case RDIError_ProgramFinishedInStep
:
847 return "end of the program reached while stepping";
848 case RDIError_UserInterrupt
:
849 return "you pressed Escape";
850 case RDIError_CantSetPoint
:
851 return "no more break/watch points available";
852 case RDIError_IncompatibleRDILevels
:
853 return "incompatible RDI levels";
854 case RDIError_LittleEndian
:
855 return "debuggee is little endian";
856 case RDIError_BigEndian
:
857 return "debuggee is big endian";
858 case RDIError_SoftInitialiseError
:
859 return "recoverable error in RDI initialization";
860 case RDIError_InsufficientPrivilege
:
861 return "internal error, supervisor state not accessible to monitor";
862 case RDIError_UnimplementedMessage
:
863 return "internal error, unimplemented message";
864 case RDIError_UndefinedMessage
:
865 return "internal error, undefined message";
867 return "undefined error message, should reset target";
871 /* Convert the ARM error messages to signals that GDB knows about. */
873 static enum target_signal
874 rdi_error_signal (int err
)
878 case RDIError_NoError
:
881 return TARGET_SIGNAL_TERM
; /* ??? */
882 case RDIError_UndefinedInstruction
:
883 return TARGET_SIGNAL_ILL
;
884 case RDIError_SoftwareInterrupt
:
885 case RDIError_PrefetchAbort
:
886 case RDIError_DataAbort
:
887 return TARGET_SIGNAL_TRAP
;
888 case RDIError_AddressException
:
889 return TARGET_SIGNAL_SEGV
;
892 return TARGET_SIGNAL_TRAP
;
894 return TARGET_SIGNAL_TERM
;
895 case RDIError_BranchThrough0
:
896 return TARGET_SIGNAL_TRAP
;
897 case RDIError_NotInitialised
:
898 case RDIError_UnableToInitialise
:
899 case RDIError_WrongByteSex
:
900 case RDIError_UnableToTerminate
:
901 return TARGET_SIGNAL_UNKNOWN
;
902 case RDIError_BadInstruction
:
903 case RDIError_IllegalInstruction
:
904 return TARGET_SIGNAL_ILL
;
905 case RDIError_BadCPUStateSetting
:
906 case RDIError_UnknownCoPro
:
907 case RDIError_UnknownCoProState
:
908 case RDIError_BadCoProState
:
909 case RDIError_BadPointType
:
910 case RDIError_UnimplementedType
:
911 case RDIError_BadPointSize
:
912 case RDIError_UnimplementedSize
:
913 case RDIError_NoMorePoints
:
914 return TARGET_SIGNAL_UNKNOWN
;
915 case RDIError_BreakpointReached
:
916 case RDIError_WatchpointAccessed
:
917 return TARGET_SIGNAL_TRAP
;
918 case RDIError_NoSuchPoint
:
919 case RDIError_ProgramFinishedInStep
:
920 return TARGET_SIGNAL_UNKNOWN
;
921 case RDIError_UserInterrupt
:
922 return TARGET_SIGNAL_INT
;
923 case RDIError_IncompatibleRDILevels
:
924 case RDIError_LittleEndian
:
925 case RDIError_BigEndian
:
926 case RDIError_SoftInitialiseError
:
927 case RDIError_InsufficientPrivilege
:
928 case RDIError_UnimplementedMessage
:
929 case RDIError_UndefinedMessage
:
931 return TARGET_SIGNAL_UNKNOWN
;
938 angel_RDI_stop_request();
942 /* Define the target operations structure. */
947 arm_rdi_ops
.to_shortname
= "rdi";
948 arm_rdi_ops
.to_longname
= "ARM RDI";
949 arm_rdi_ops
.to_doc
= "Use a remote ARM-based computer; via the RDI library.\n\
950 Specify the serial device it is connected to (e.g. /dev/ttya).";
951 arm_rdi_ops
.to_open
= arm_rdi_open
;
952 arm_rdi_ops
.to_close
= arm_rdi_close
;
953 arm_rdi_ops
.to_detach
= arm_rdi_detach
;
954 arm_rdi_ops
.to_resume
= arm_rdi_resume
;
955 arm_rdi_ops
.to_wait
= arm_rdi_wait
;
956 arm_rdi_ops
.to_stop
= arm_rdi_stop
;
957 arm_rdi_ops
.to_fetch_registers
= arm_rdi_fetch_registers
;
958 arm_rdi_ops
.to_store_registers
= arm_rdi_store_registers
;
959 arm_rdi_ops
.to_prepare_to_store
= arm_rdi_prepare_to_store
;
960 arm_rdi_ops
.to_xfer_memory
= arm_rdi_xfer_memory
;
961 arm_rdi_ops
.to_files_info
= arm_rdi_files_info
;
962 arm_rdi_ops
.to_insert_breakpoint
= arm_rdi_insert_breakpoint
;
963 arm_rdi_ops
.to_remove_breakpoint
= arm_rdi_remove_breakpoint
;
964 arm_rdi_ops
.to_kill
= arm_rdi_kill
;
965 arm_rdi_ops
.to_load
= generic_load
;
966 arm_rdi_ops
.to_create_inferior
= arm_rdi_create_inferior
;
967 arm_rdi_ops
.to_mourn_inferior
= arm_rdi_mourn_inferior
;
968 arm_rdi_ops
.to_stratum
= process_stratum
;
969 arm_rdi_ops
.to_has_all_memory
= 1;
970 arm_rdi_ops
.to_has_memory
= 1;
971 arm_rdi_ops
.to_has_stack
= 1;
972 arm_rdi_ops
.to_has_registers
= 1;
973 arm_rdi_ops
.to_has_execution
= 1;
974 arm_rdi_ops
.to_magic
= OPS_MAGIC
;
978 rdilogfile_command (char *arg
, int from_tty
)
980 if (!arg
|| strlen (arg
) == 0)
982 printf_filtered ("rdi log file is '%s'\n", log_filename
);
987 xfree (log_filename
);
989 log_filename
= xstrdup (arg
);
991 Adp_SetLogfile (log_filename
);
995 rdilogenable_command (char *args
, int from_tty
)
997 if (!args
|| strlen (args
) == 0)
999 printf_filtered ("rdi log is %s\n", log_enable
? "enabled" : "disabled");
1003 if (!strcasecmp (args
, "1") ||
1004 !strcasecmp (args
, "y") ||
1005 !strcasecmp (args
, "yes") ||
1006 !strcasecmp (args
, "on") ||
1007 !strcasecmp (args
, "t") ||
1008 !strcasecmp (args
, "true"))
1009 Adp_SetLogEnable (log_enable
= 1);
1010 else if (!strcasecmp (args
, "0") ||
1011 !strcasecmp (args
, "n") ||
1012 !strcasecmp (args
, "no") ||
1013 !strcasecmp (args
, "off") ||
1014 !strcasecmp (args
, "f") ||
1015 !strcasecmp (args
, "false"))
1016 Adp_SetLogEnable (log_enable
= 0);
1018 printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
1019 " try y or n\n", args
);
1023 _initialize_remote_rdi (void)
1025 struct cmd_list_element
*c
;
1028 add_target (&arm_rdi_ops
);
1030 log_filename
= xstrdup ("rdi.log");
1031 Adp_SetLogfile (log_filename
);
1032 Adp_SetLogEnable (log_enable
);
1034 c
= add_cmd ("rdilogfile", class_maintenance
,
1036 "Set filename for ADP packet log.\n\
1037 This file is used to log Angel Debugger Protocol packets.\n\
1038 With a single argument, sets the logfile name to that value.\n\
1039 Without an argument, shows the current logfile name.\n\
1040 See also: rdilogenable\n",
1042 c
->completer
= filename_completer
;
1044 add_cmd ("rdilogenable", class_maintenance
,
1045 rdilogenable_command
,
1046 "Set enable logging of ADP packets.\n\
1047 This will log ADP packets exchanged between gdb and the\n\
1048 rdi target device.\n\
1049 An argument of 1,t,true,y,yes will enable.\n\
1050 An argument of 0,f,false,n,no will disabled.\n\
1051 Withough an argument, it will display current state.\n",
1055 (add_set_cmd ("rdiromatzero", no_class
,
1056 var_boolean
, (char *) &rom_at_zero
,
1057 "Set target has ROM at addr 0.\n\
1058 A true value disables vector catching, false enables vector catching.\n\
1059 This is evaluated at the time the 'target rdi' command is executed\n",
1064 (add_set_cmd ("rdiheartbeat", no_class
,
1065 var_boolean
, (char *) &rdi_heartbeat
,
1066 "Set enable for ADP heartbeat packets.\n\
1067 I don't know why you would want this. If you enable them,\n\
1068 it will confuse ARM and EPI JTAG interface boxes as well\n\
1069 as the Angel Monitor.\n",
1074 /* A little dummy to make linking with the library succeed. */