1 /* GDB interface to ARM RDI library.
3 Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 #include "gdb_string.h"
33 #include "gdb-stabs.h"
34 #include "gdbthread.h"
36 #include "breakpoint.h"
37 #include "completer.h"
41 #include <sys/types.h>
46 #include "rdi-share/ardi.h"
47 #include "rdi-share/adp.h"
48 #include "rdi-share/hsys.h"
50 extern int isascii (int);
52 /* Prototypes for local functions */
54 static void arm_rdi_files_info (struct target_ops
*ignore
);
56 static int arm_rdi_xfer_memory (CORE_ADDR memaddr
, char *myaddr
,
57 int len
, int should_write
,
58 struct mem_attrib
*attrib
,
59 struct target_ops
*target
);
61 static void arm_rdi_prepare_to_store (void);
63 static void arm_rdi_fetch_registers (int regno
);
65 static void arm_rdi_resume (ptid_t pid
, int step
,
66 enum target_signal siggnal
);
68 static int arm_rdi_start_remote (char *dummy
);
70 static void arm_rdi_open (char *name
, int from_tty
);
72 static void arm_rdi_create_inferior (char *exec_file
, char *args
, char **env
);
74 static void arm_rdi_close (int quitting
);
76 static void arm_rdi_store_registers (int regno
);
78 static void arm_rdi_mourn (void);
80 static void arm_rdi_send (char *buf
);
82 static ptid_t
arm_rdi_wait (ptid_t ptid
, struct target_waitstatus
*status
);
84 static void arm_rdi_kill (void);
86 static void arm_rdi_detach (char *args
, int from_tty
);
88 static void arm_rdi_interrupt (int signo
);
90 static void arm_rdi_interrupt_twice (int signo
);
92 static void interrupt_query (void);
94 static int arm_rdi_insert_breakpoint (CORE_ADDR
, char *);
96 static int arm_rdi_remove_breakpoint (CORE_ADDR
, char *);
98 static char *rdi_error_message (int err
);
100 static enum target_signal
rdi_error_signal (int err
);
102 /* Global variables. */
104 struct target_ops arm_rdi_ops
;
106 static struct Dbg_ConfigBlock gdb_config
;
108 static struct Dbg_HostosInterface gdb_hostif
;
110 static int max_load_size
;
112 static int execute_status
;
114 /* Send heatbeat packets? */
115 static int rdi_heartbeat
= 0;
117 /* Target has ROM at address 0. */
118 static int rom_at_zero
= 0;
120 /* Enable logging? */
121 static int log_enable
= 0;
123 /* Name of the log file. Default is "rdi.log". */
124 static char *log_filename
;
126 /* A little list of breakpoints that have been set. */
128 static struct local_bp_list_entry
132 struct local_bp_list_entry
*next
;
137 /* Stub for catch_errors. */
140 arm_rdi_start_remote (char *dummy
)
145 /* Helper callbacks for the "host interface" structure. RDI functions call
146 these to forward output from the target system and so forth. */
149 voiddummy (void *dummy
)
151 fprintf_unfiltered (gdb_stdout
, "void dummy\n");
155 myprint (PTR arg
, const char *format
, va_list ap
)
157 vfprintf_unfiltered (gdb_stdout
, format
, ap
);
161 mywritec (PTR arg
, int c
)
164 fputc_unfiltered (c
, gdb_stdout
);
168 mywrite (PTR arg
, char const *buffer
, int len
)
174 for (i
= 0; i
< len
; i
++)
176 if (isascii ((int) *e
))
178 fputc_unfiltered ((int) *e
, gdb_stdout
);
191 /* These last two are tricky as we have to handle the special case of
192 being interrupted more carefully */
197 return fgetc (stdin
);
201 mygets (PTR arg
, char *buffer
, int len
)
203 return fgets (buffer
, len
, stdin
);
206 /* Prevent multiple calls to angel_RDI_close(). */
207 static int closed_already
= 1;
209 /* Open a connection to a remote debugger. NAME is the filename used
210 for communication. */
213 arm_rdi_open (char *name
, int from_tty
)
216 unsigned long arg1
, arg2
;
217 char *openArgs
= NULL
;
218 char *devName
= NULL
;
222 error ("To open an RDI connection, you need to specify what serial\n\
223 device is attached to the remote system (e.g. /dev/ttya).");
225 /* split name after whitespace, pass tail as arg to open command */
227 devName
= xstrdup (name
);
228 p
= strchr (devName
, ' ');
240 /* Make the basic low-level connection. */
243 rslt
= Adp_OpenDevice (devName
, openArgs
, rdi_heartbeat
);
246 error ("Could not open device \"%s\"", name
);
248 gdb_config
.bytesex
= 2 | (TARGET_BYTE_ORDER
== BFD_ENDIAN_BIG
? 1 : 0);
250 gdb_config
.rditype
= 2;
251 gdb_config
.heartbeat_on
= 1;
252 gdb_config
.flags
= 2;
254 gdb_hostif
.dbgprint
= myprint
;
255 gdb_hostif
.dbgpause
= mypause
;
256 gdb_hostif
.dbgarg
= NULL
;
257 gdb_hostif
.writec
= mywritec
;
258 gdb_hostif
.readc
= myreadc
;
259 gdb_hostif
.write
= mywrite
;
260 gdb_hostif
.gets
= mygets
;
261 gdb_hostif
.hostosarg
= NULL
;
262 gdb_hostif
.reset
= voiddummy
;
264 rslt
= angel_RDI_open (10, &gdb_config
, &gdb_hostif
, NULL
);
265 if (rslt
== RDIError_BigEndian
|| rslt
== RDIError_LittleEndian
)
266 ; /* do nothing, this is the expected return */
269 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
271 error ("RDI_open failed\n");
274 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
277 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
279 rslt
= angel_RDI_info (RDIInfo_Points
, &arg1
, &arg2
);
282 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
284 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
287 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
289 rslt
= angel_RDI_info (RDIInfo_CoPro
, &arg1
, &arg2
);
292 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
294 rslt
= angel_RDI_info (RDIInfo_SemiHosting
, &arg1
, &arg2
);
297 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
300 rslt
= angel_RDI_info (RDIInfo_GetLoadSize
, &arg1
, &arg2
);
303 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
305 max_load_size
= arg1
;
307 push_target (&arm_rdi_ops
);
309 target_fetch_registers (-1);
311 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
314 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
317 arg1
= rom_at_zero
? 0x0 : 0x13b;
319 rslt
= angel_RDI_info (RDIVector_Catch
, &arg1
, &arg2
);
322 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
325 arg1
= (unsigned long) "";
326 rslt
= angel_RDI_info (RDISet_Cmdline
, &arg1
, &arg2
);
329 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
332 /* Clear out any existing records of breakpoints. */
334 struct local_bp_list_entry
*entry
, *preventry
= NULL
;
336 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
343 printf_filtered ("Connected to ARM RDI target.\n");
345 inferior_ptid
= pid_to_ptid (42);
348 /* Start an inferior process and set inferior_ptid to its pid.
349 EXEC_FILE is the file to run.
350 ARGS is a string containing the arguments to the program.
351 ENV is the environment vector to pass. Errors reported with error().
352 On VxWorks and various standalone systems, we ignore exec_file. */
353 /* This is called not only when we first attach, but also when the
354 user types "run" after having attached. */
357 arm_rdi_create_inferior (char *exec_file
, char *args
, char **env
)
360 unsigned long arg1
, arg2
;
362 CORE_ADDR entry_point
;
364 if (exec_file
== 0 || exec_bfd
== 0)
365 error ("No executable file specified.");
367 entry_point
= (CORE_ADDR
) bfd_get_start_address (exec_bfd
);
370 remove_breakpoints ();
371 init_wait_for_inferior ();
373 len
= strlen (exec_file
) + 1 + strlen (args
) + 1 + /*slop */ 10;
374 arg_buf
= (char *) alloca (len
);
376 strcat (arg_buf
, exec_file
);
377 strcat (arg_buf
, " ");
378 strcat (arg_buf
, args
);
380 inferior_ptid
= pid_to_ptid (42);
381 insert_breakpoints (); /* Needed to get correct instruction in cache */
387 if (strncmp (*env
, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0)
389 unsigned long top_of_memory
;
392 /* Set up memory limit */
393 top_of_memory
= strtoul (*env
+ sizeof ("MEMSIZE=") - 1,
395 printf_filtered ("Setting top-of-memory to 0x%lx\n",
398 rslt
= angel_RDI_info (RDIInfo_SetTopMem
, &top_of_memory
, &arg2
);
401 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
408 arg1
= (unsigned long) arg_buf
;
409 rslt
= angel_RDI_info (RDISet_Cmdline
, /* &arg1 */ (unsigned long *) arg_buf
, &arg2
);
412 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
415 proceed (entry_point
, TARGET_SIGNAL_DEFAULT
, 0);
418 /* This takes a program previously attached to and detaches it. After
419 this is done, GDB can be used to debug some other program. We
420 better not have left any breakpoints in the target program or it'll
421 die when it hits one. */
424 arm_rdi_detach (char *args
, int from_tty
)
429 /* Clean up connection to a remote debugger. */
432 arm_rdi_close (int quitting
)
438 rslt
= angel_RDI_close ();
441 printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt
));
444 inferior_ptid
= null_ptid
;
446 generic_mourn_inferior ();
450 /* Tell the remote machine to resume. */
453 arm_rdi_resume (ptid_t ptid
, int step
, enum target_signal siggnal
)
458 if (0 /* turn on when hardware supports single-stepping */ )
460 rslt
= angel_RDI_step (1, &point
);
463 printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt
));
473 pc
= read_register (PC_REGNUM
);
474 pc
= arm_get_next_pc (pc
);
475 arm_rdi_insert_breakpoint (pc
, handle
);
477 execute_status
= rslt
= angel_RDI_execute (&point
);
478 if (rslt
== RDIError_BreakpointReached
)
482 printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt
));
486 arm_rdi_remove_breakpoint (pc
, handle
);
491 /* Send ^C to target to halt it. Target will respond, and send us a
495 arm_rdi_interrupt (int signo
)
499 static void (*ofunc
) ();
501 /* The user typed ^C twice. */
503 arm_rdi_interrupt_twice (int signo
)
507 /* Ask the user what to do when an interrupt is received. */
510 interrupt_query (void)
514 /* Wait until the remote machine stops, then return, storing status in
515 STATUS just as `wait' would. Returns "pid" (though it's not clear
516 what, if anything, that means in the case of this target). */
519 arm_rdi_wait (ptid_t ptid
, struct target_waitstatus
*status
)
521 status
->kind
= (execute_status
== RDIError_NoError
?
522 TARGET_WAITKIND_EXITED
: TARGET_WAITKIND_STOPPED
);
524 /* convert stopped code from target into right signal */
525 status
->value
.sig
= rdi_error_signal (execute_status
);
527 return inferior_ptid
;
530 /* Read the remote registers into the block REGS. */
534 arm_rdi_fetch_registers (int regno
)
536 int rslt
, rdi_regmask
;
537 unsigned long rawreg
, rawregs
[32];
542 rslt
= angel_RDI_CPUread (255, 0x27fff, rawregs
);
545 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
548 for (regno
= 0; regno
< 15; regno
++)
550 store_unsigned_integer (cookedreg
, 4, rawregs
[regno
]);
551 supply_register (regno
, (char *) cookedreg
);
553 store_unsigned_integer (cookedreg
, 4, rawregs
[15]);
554 supply_register (PS_REGNUM
, (char *) cookedreg
);
555 arm_rdi_fetch_registers (PC_REGNUM
);
559 if (regno
== PC_REGNUM
)
560 rdi_regmask
= RDIReg_PC
;
561 else if (regno
== PS_REGNUM
)
562 rdi_regmask
= RDIReg_CPSR
;
563 else if (regno
< 0 || regno
> 15)
566 supply_register (regno
, (char *) &rawreg
);
570 rdi_regmask
= 1 << regno
;
572 rslt
= angel_RDI_CPUread (255, rdi_regmask
, &rawreg
);
575 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
577 store_unsigned_integer (cookedreg
, 4, rawreg
);
578 supply_register (regno
, (char *) cookedreg
);
583 arm_rdi_prepare_to_store (void)
588 /* Store register REGNO, or all registers if REGNO == -1, from the contents
589 of REGISTERS. FIXME: ignores errors. */
592 arm_rdi_store_registers (int regno
)
594 int rslt
, rdi_regmask
;
596 /* These need to be able to take 'floating point register' contents */
597 unsigned long rawreg
[3], rawerreg
[3];
601 for (regno
= 0; regno
< NUM_REGS
; regno
++)
602 arm_rdi_store_registers (regno
);
606 read_register_gen (regno
, (char *) rawreg
);
607 /* RDI manipulates data in host byte order, so convert now. */
608 store_unsigned_integer (rawerreg
, 4, rawreg
[0]);
610 if (regno
== PC_REGNUM
)
611 rdi_regmask
= RDIReg_PC
;
612 else if (regno
== PS_REGNUM
)
613 rdi_regmask
= RDIReg_CPSR
;
614 else if (regno
< 0 || regno
> 15)
617 rdi_regmask
= 1 << regno
;
619 rslt
= angel_RDI_CPUwrite (255, rdi_regmask
, rawerreg
);
622 printf_filtered ("RDI_CPUwrite: %s\n", rdi_error_message (rslt
));
627 /* Read or write LEN bytes from inferior memory at MEMADDR,
628 transferring to or from debugger address MYADDR. Write to inferior
629 if SHOULD_WRITE is nonzero. Returns length of data written or
630 read; 0 for error. TARGET is unused. */
634 arm_rdi_xfer_memory (CORE_ADDR memaddr
, char *myaddr
, int len
,
635 int should_write
, struct mem_attrib
*attrib
,
636 struct target_ops
*target
)
642 rslt
= angel_RDI_write (myaddr
, memaddr
, &len
);
645 printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt
));
650 rslt
= angel_RDI_read (memaddr
, myaddr
, &len
);
653 printf_filtered ("RDI_read: %s\n", rdi_error_message (rslt
));
660 /* Display random info collected from the target. */
663 arm_rdi_files_info (struct target_ops
*ignore
)
665 char *file
= "nothing";
667 unsigned long arg1
, arg2
;
669 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
672 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
674 if (arg1
& (1 << 15))
675 printf_filtered ("Target supports Thumb code.\n");
676 if (arg1
& (1 << 14))
677 printf_filtered ("Target can do profiling.\n");
679 printf_filtered ("Target is real hardware.\n");
681 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
684 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
686 printf_filtered ("Target can%s single-step.\n", (arg1
& 0x4 ? "" : "not"));
688 rslt
= angel_RDI_info (RDIInfo_Icebreaker
, &arg1
, &arg2
);
691 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
694 printf_filtered ("Target includes an EmbeddedICE.\n");
702 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
705 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
710 arm_rdi_mourn_inferior (void)
712 /* We remove the inserted breakpoints in case the user wants to
713 issue another target and load commands to rerun his application;
714 This is something that wouldn't work on a native target, for instance,
715 as the process goes away when the inferior exits, but it works with
716 some remote targets like this one. That is why this is done here. */
717 remove_breakpoints();
718 unpush_target (&arm_rdi_ops
);
719 generic_mourn_inferior ();
722 /* While the RDI library keeps track of its own breakpoints, we need
723 to remember "handles" so that we can delete them later. Since
724 breakpoints get used for stepping, be careful not to leak memory
728 arm_rdi_insert_breakpoint (CORE_ADDR addr
, char *contents_cache
)
732 struct local_bp_list_entry
*entry
;
733 int type
= RDIPoint_EQ
;
735 if (arm_pc_is_thumb (addr
) || arm_pc_is_thumb_dummy (addr
))
736 type
|= RDIPoint_16Bit
;
737 rslt
= angel_RDI_setbreak (addr
, type
, 0, &point
);
740 printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt
));
743 (struct local_bp_list_entry
*) xmalloc (sizeof (struct local_bp_list_entry
));
745 entry
->point
= point
;
746 entry
->next
= local_bp_list
;
747 local_bp_list
= entry
;
752 arm_rdi_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
756 struct local_bp_list_entry
*entry
, *preventry
;
758 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
760 if (entry
->addr
== addr
)
768 rslt
= angel_RDI_clearbreak (entry
->point
);
771 printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt
));
773 /* Delete the breakpoint entry locally. */
774 if (entry
== local_bp_list
)
776 local_bp_list
= entry
->next
;
780 preventry
->next
= entry
->next
;
788 rdi_error_message (int err
)
792 case RDIError_NoError
:
795 return "debuggee reset";
796 case RDIError_UndefinedInstruction
:
797 return "undefined instruction";
798 case RDIError_SoftwareInterrupt
:
799 return "SWI trapped";
800 case RDIError_PrefetchAbort
:
801 return "prefetch abort, execution ran into unmapped memory?";
802 case RDIError_DataAbort
:
803 return "data abort, no memory at specified address?";
804 case RDIError_AddressException
:
805 return "address exception, access >26bit in 26bit mode";
807 return "IRQ, interrupt trapped";
809 return "FIQ, fast interrupt trapped";
811 return "a miscellaneous type of error";
812 case RDIError_BranchThrough0
:
813 return "branch through location 0";
814 case RDIError_NotInitialised
:
815 return "internal error, RDI_open not called first";
816 case RDIError_UnableToInitialise
:
817 return "internal error, target world is broken";
818 case RDIError_WrongByteSex
:
819 return "See Operator: WrongByteSex";
820 case RDIError_UnableToTerminate
:
821 return "See Operator: Unable to Terminate";
822 case RDIError_BadInstruction
:
823 return "bad instruction, illegal to execute this instruction";
824 case RDIError_IllegalInstruction
:
825 return "illegal instruction, the effect of executing it is undefined";
826 case RDIError_BadCPUStateSetting
:
827 return "internal error, tried to set SPSR of user mode";
828 case RDIError_UnknownCoPro
:
829 return "unknown co-processor";
830 case RDIError_UnknownCoProState
:
831 return "cannot execute co-processor request";
832 case RDIError_BadCoProState
:
833 return "recognizably broken co-processor request";
834 case RDIError_BadPointType
:
835 return "internal error, bad point yype";
836 case RDIError_UnimplementedType
:
837 return "internal error, unimplemented type";
838 case RDIError_BadPointSize
:
839 return "internal error, bad point size";
840 case RDIError_UnimplementedSize
:
841 return "internal error, unimplemented size";
842 case RDIError_NoMorePoints
:
843 return "last break/watch point was used";
844 case RDIError_BreakpointReached
:
845 return "breakpoint reached";
846 case RDIError_WatchpointAccessed
:
847 return "watchpoint accessed";
848 case RDIError_NoSuchPoint
:
849 return "attempted to clear non-existent break/watch point";
850 case RDIError_ProgramFinishedInStep
:
851 return "end of the program reached while stepping";
852 case RDIError_UserInterrupt
:
853 return "you pressed Escape";
854 case RDIError_CantSetPoint
:
855 return "no more break/watch points available";
856 case RDIError_IncompatibleRDILevels
:
857 return "incompatible RDI levels";
858 case RDIError_LittleEndian
:
859 return "debuggee is little endian";
860 case RDIError_BigEndian
:
861 return "debuggee is big endian";
862 case RDIError_SoftInitialiseError
:
863 return "recoverable error in RDI initialization";
864 case RDIError_InsufficientPrivilege
:
865 return "internal error, supervisor state not accessible to monitor";
866 case RDIError_UnimplementedMessage
:
867 return "internal error, unimplemented message";
868 case RDIError_UndefinedMessage
:
869 return "internal error, undefined message";
871 return "undefined error message, should reset target";
875 /* Convert the ARM error messages to signals that GDB knows about. */
877 static enum target_signal
878 rdi_error_signal (int err
)
882 case RDIError_NoError
:
885 return TARGET_SIGNAL_TERM
; /* ??? */
886 case RDIError_UndefinedInstruction
:
887 return TARGET_SIGNAL_ILL
;
888 case RDIError_SoftwareInterrupt
:
889 case RDIError_PrefetchAbort
:
890 case RDIError_DataAbort
:
891 return TARGET_SIGNAL_TRAP
;
892 case RDIError_AddressException
:
893 return TARGET_SIGNAL_SEGV
;
896 return TARGET_SIGNAL_TRAP
;
898 return TARGET_SIGNAL_TERM
;
899 case RDIError_BranchThrough0
:
900 return TARGET_SIGNAL_TRAP
;
901 case RDIError_NotInitialised
:
902 case RDIError_UnableToInitialise
:
903 case RDIError_WrongByteSex
:
904 case RDIError_UnableToTerminate
:
905 return TARGET_SIGNAL_UNKNOWN
;
906 case RDIError_BadInstruction
:
907 case RDIError_IllegalInstruction
:
908 return TARGET_SIGNAL_ILL
;
909 case RDIError_BadCPUStateSetting
:
910 case RDIError_UnknownCoPro
:
911 case RDIError_UnknownCoProState
:
912 case RDIError_BadCoProState
:
913 case RDIError_BadPointType
:
914 case RDIError_UnimplementedType
:
915 case RDIError_BadPointSize
:
916 case RDIError_UnimplementedSize
:
917 case RDIError_NoMorePoints
:
918 return TARGET_SIGNAL_UNKNOWN
;
919 case RDIError_BreakpointReached
:
920 case RDIError_WatchpointAccessed
:
921 return TARGET_SIGNAL_TRAP
;
922 case RDIError_NoSuchPoint
:
923 case RDIError_ProgramFinishedInStep
:
924 return TARGET_SIGNAL_UNKNOWN
;
925 case RDIError_UserInterrupt
:
926 return TARGET_SIGNAL_INT
;
927 case RDIError_IncompatibleRDILevels
:
928 case RDIError_LittleEndian
:
929 case RDIError_BigEndian
:
930 case RDIError_SoftInitialiseError
:
931 case RDIError_InsufficientPrivilege
:
932 case RDIError_UnimplementedMessage
:
933 case RDIError_UndefinedMessage
:
935 return TARGET_SIGNAL_UNKNOWN
;
942 angel_RDI_stop_request();
946 /* Define the target operations structure. */
951 arm_rdi_ops
.to_shortname
= "rdi";
952 arm_rdi_ops
.to_longname
= "ARM RDI";
953 arm_rdi_ops
.to_doc
= "Use a remote ARM-based computer; via the RDI library.\n\
954 Specify the serial device it is connected to (e.g. /dev/ttya).";
955 arm_rdi_ops
.to_open
= arm_rdi_open
;
956 arm_rdi_ops
.to_close
= arm_rdi_close
;
957 arm_rdi_ops
.to_detach
= arm_rdi_detach
;
958 arm_rdi_ops
.to_resume
= arm_rdi_resume
;
959 arm_rdi_ops
.to_wait
= arm_rdi_wait
;
960 arm_rdi_ops
.to_stop
= arm_rdi_stop
;
961 arm_rdi_ops
.to_fetch_registers
= arm_rdi_fetch_registers
;
962 arm_rdi_ops
.to_store_registers
= arm_rdi_store_registers
;
963 arm_rdi_ops
.to_prepare_to_store
= arm_rdi_prepare_to_store
;
964 arm_rdi_ops
.to_xfer_memory
= arm_rdi_xfer_memory
;
965 arm_rdi_ops
.to_files_info
= arm_rdi_files_info
;
966 arm_rdi_ops
.to_insert_breakpoint
= arm_rdi_insert_breakpoint
;
967 arm_rdi_ops
.to_remove_breakpoint
= arm_rdi_remove_breakpoint
;
968 arm_rdi_ops
.to_kill
= arm_rdi_kill
;
969 arm_rdi_ops
.to_load
= generic_load
;
970 arm_rdi_ops
.to_create_inferior
= arm_rdi_create_inferior
;
971 arm_rdi_ops
.to_mourn_inferior
= arm_rdi_mourn_inferior
;
972 arm_rdi_ops
.to_stratum
= process_stratum
;
973 arm_rdi_ops
.to_has_all_memory
= 1;
974 arm_rdi_ops
.to_has_memory
= 1;
975 arm_rdi_ops
.to_has_stack
= 1;
976 arm_rdi_ops
.to_has_registers
= 1;
977 arm_rdi_ops
.to_has_execution
= 1;
978 arm_rdi_ops
.to_magic
= OPS_MAGIC
;
982 rdilogfile_command (char *arg
, int from_tty
)
984 if (!arg
|| strlen (arg
) == 0)
986 printf_filtered ("rdi log file is '%s'\n", log_filename
);
991 xfree (log_filename
);
993 log_filename
= xstrdup (arg
);
995 Adp_SetLogfile (log_filename
);
999 rdilogenable_command (char *args
, int from_tty
)
1001 if (!args
|| strlen (args
) == 0)
1003 printf_filtered ("rdi log is %s\n", log_enable
? "enabled" : "disabled");
1007 if (!strcasecmp (args
, "1") ||
1008 !strcasecmp (args
, "y") ||
1009 !strcasecmp (args
, "yes") ||
1010 !strcasecmp (args
, "on") ||
1011 !strcasecmp (args
, "t") ||
1012 !strcasecmp (args
, "true"))
1013 Adp_SetLogEnable (log_enable
= 1);
1014 else if (!strcasecmp (args
, "0") ||
1015 !strcasecmp (args
, "n") ||
1016 !strcasecmp (args
, "no") ||
1017 !strcasecmp (args
, "off") ||
1018 !strcasecmp (args
, "f") ||
1019 !strcasecmp (args
, "false"))
1020 Adp_SetLogEnable (log_enable
= 0);
1022 printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
1023 " try y or n\n", args
);
1027 _initialize_remote_rdi (void)
1029 struct cmd_list_element
*c
;
1032 add_target (&arm_rdi_ops
);
1034 log_filename
= xstrdup ("rdi.log");
1035 Adp_SetLogfile (log_filename
);
1036 Adp_SetLogEnable (log_enable
);
1038 c
= add_cmd ("rdilogfile", class_maintenance
,
1040 "Set filename for ADP packet log.\n\
1041 This file is used to log Angel Debugger Protocol packets.\n\
1042 With a single argument, sets the logfile name to that value.\n\
1043 Without an argument, shows the current logfile name.\n\
1044 See also: rdilogenable\n",
1046 c
->completer
= filename_completer
;
1048 add_cmd ("rdilogenable", class_maintenance
,
1049 rdilogenable_command
,
1050 "Set enable logging of ADP packets.\n\
1051 This will log ADP packets exchanged between gdb and the\n\
1052 rdi target device.\n\
1053 An argument of 1,t,true,y,yes will enable.\n\
1054 An argument of 0,f,false,n,no will disabled.\n\
1055 Withough an argument, it will display current state.\n",
1059 (add_set_cmd ("rdiromatzero", no_class
,
1060 var_boolean
, (char *) &rom_at_zero
,
1061 "Set target has ROM at addr 0.\n\
1062 A true value disables vector catching, false enables vector catching.\n\
1063 This is evaluated at the time the 'target rdi' command is executed\n",
1068 (add_set_cmd ("rdiheartbeat", no_class
,
1069 var_boolean
, (char *) &rdi_heartbeat
,
1070 "Set enable for ADP heartbeat packets.\n\
1071 I don't know why you would want this. If you enable them,\n\
1072 it will confuse ARM and EPI JTAG interface boxes as well\n\
1073 as the Angel Monitor.\n",
1078 /* A little dummy to make linking with the library succeed. */