1 /* GDB interface to ARM RDI library.
2 Copyright 1997, 1998, 1999, 2000, 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"
39 #include <sys/types.h>
44 #include "rdi-share/ardi.h"
45 #include "rdi-share/adp.h"
46 #include "rdi-share/hsys.h"
48 extern int isascii (int);
50 /* Prototypes for local functions */
52 static void arm_rdi_files_info (struct target_ops
*ignore
);
54 static int arm_rdi_xfer_memory (CORE_ADDR memaddr
, char *myaddr
,
55 int len
, int should_write
,
56 struct mem_attrib
*attrib
,
57 struct target_ops
*target
);
59 static void arm_rdi_prepare_to_store (void);
61 static void arm_rdi_fetch_registers (int regno
);
63 static void arm_rdi_resume (int pid
, int step
, enum target_signal siggnal
);
65 static int arm_rdi_start_remote (char *dummy
);
67 static void arm_rdi_open (char *name
, int from_tty
);
69 static void arm_rdi_create_inferior (char *exec_file
, char *args
, char **env
);
71 static void arm_rdi_close (int quitting
);
73 static void arm_rdi_store_registers (int regno
);
75 static void arm_rdi_mourn (void);
77 static void arm_rdi_send (char *buf
);
79 static int arm_rdi_wait (int pid
, struct target_waitstatus
*status
);
81 static void arm_rdi_kill (void);
83 static void arm_rdi_detach (char *args
, int from_tty
);
85 static void arm_rdi_interrupt (int signo
);
87 static void arm_rdi_interrupt_twice (int signo
);
89 static void interrupt_query (void);
91 static int arm_rdi_insert_breakpoint (CORE_ADDR
, char *);
93 static int arm_rdi_remove_breakpoint (CORE_ADDR
, char *);
95 static char *rdi_error_message (int err
);
97 static enum target_signal
rdi_error_signal (int err
);
99 /* Global variables. */
101 struct target_ops arm_rdi_ops
;
103 static struct Dbg_ConfigBlock gdb_config
;
105 static struct Dbg_HostosInterface gdb_hostif
;
107 static int max_load_size
;
109 static int execute_status
;
111 /* Send heatbeat packets? */
112 static int rdi_heartbeat
= 0;
114 /* Target has ROM at address 0. */
115 static int rom_at_zero
= 0;
117 /* Enable logging? */
118 static int log_enable
= 0;
120 /* Name of the log file. Default is "rdi.log". */
121 static char *log_filename
;
123 /* A little list of breakpoints that have been set. */
125 static struct local_bp_list_entry
129 struct local_bp_list_entry
*next
;
134 /* Stub for catch_errors. */
137 arm_rdi_start_remote (char *dummy
)
142 /* Helper callbacks for the "host interface" structure. RDI functions call
143 these to forward output from the target system and so forth. */
146 voiddummy (void *dummy
)
148 fprintf_unfiltered (gdb_stdout
, "void dummy\n");
152 myprint (PTR arg
, const char *format
, va_list ap
)
154 vfprintf_unfiltered (gdb_stdout
, format
, ap
);
158 mywritec (PTR arg
, int c
)
161 fputc_unfiltered (c
, gdb_stdout
);
165 mywrite (PTR arg
, char const *buffer
, int len
)
171 for (i
= 0; i
< len
; i
++)
173 if (isascii ((int) *e
))
175 fputc_unfiltered ((int) *e
, gdb_stdout
);
188 /* These last two are tricky as we have to handle the special case of
189 being interrupted more carefully */
194 return fgetc (stdin
);
198 mygets (PTR arg
, char *buffer
, int len
)
200 return fgets (buffer
, len
, stdin
);
203 /* Prevent multiple calls to angel_RDI_close(). */
204 static int closed_already
= 1;
206 /* Open a connection to a remote debugger. NAME is the filename used
207 for communication. */
210 arm_rdi_open (char *name
, int from_tty
)
213 unsigned long arg1
, arg2
;
214 char *openArgs
= NULL
;
215 char *devName
= NULL
;
219 error ("To open an RDI connection, you need to specify what serial\n\
220 device is attached to the remote system (e.g. /dev/ttya).");
222 /* split name after whitespace, pass tail as arg to open command */
224 devName
= xstrdup (name
);
225 p
= strchr (devName
, ' ');
237 /* Make the basic low-level connection. */
240 rslt
= Adp_OpenDevice (devName
, openArgs
, rdi_heartbeat
);
243 error ("Could not open device \"%s\"", name
);
245 gdb_config
.bytesex
= 2 | (TARGET_BYTE_ORDER
== BIG_ENDIAN
? 1 : 0);
247 gdb_config
.rditype
= 2;
248 gdb_config
.heartbeat_on
= 1;
249 gdb_config
.flags
= 2;
251 gdb_hostif
.dbgprint
= myprint
;
252 gdb_hostif
.dbgpause
= mypause
;
253 gdb_hostif
.dbgarg
= NULL
;
254 gdb_hostif
.writec
= mywritec
;
255 gdb_hostif
.readc
= myreadc
;
256 gdb_hostif
.write
= mywrite
;
257 gdb_hostif
.gets
= mygets
;
258 gdb_hostif
.hostosarg
= NULL
;
259 gdb_hostif
.reset
= voiddummy
;
261 rslt
= angel_RDI_open (10, &gdb_config
, &gdb_hostif
, NULL
);
262 if (rslt
== RDIError_BigEndian
|| rslt
== RDIError_LittleEndian
)
263 ; /* do nothing, this is the expected return */
266 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
268 error ("RDI_open failed\n");
271 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
274 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
276 rslt
= angel_RDI_info (RDIInfo_Points
, &arg1
, &arg2
);
279 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
281 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
284 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
286 rslt
= angel_RDI_info (RDIInfo_CoPro
, &arg1
, &arg2
);
289 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
291 rslt
= angel_RDI_info (RDIInfo_SemiHosting
, &arg1
, &arg2
);
294 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
297 rslt
= angel_RDI_info (RDIInfo_GetLoadSize
, &arg1
, &arg2
);
300 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
302 max_load_size
= arg1
;
304 push_target (&arm_rdi_ops
);
306 target_fetch_registers (-1);
308 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
311 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
314 arg1
= rom_at_zero
? 0x0 : 0x13b;
316 rslt
= angel_RDI_info (RDIVector_Catch
, &arg1
, &arg2
);
319 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
322 arg1
= (unsigned long) "";
323 rslt
= angel_RDI_info (RDISet_Cmdline
, &arg1
, &arg2
);
326 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
329 /* Clear out any existing records of breakpoints. */
331 struct local_bp_list_entry
*entry
, *preventry
= NULL
;
333 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
340 printf_filtered ("Connected to ARM RDI target.\n");
345 /* Start an inferior process and set inferior_pid to its pid.
346 EXEC_FILE is the file to run.
347 ARGS is a string containing the arguments to the program.
348 ENV is the environment vector to pass. Errors reported with error().
349 On VxWorks and various standalone systems, we ignore exec_file. */
350 /* This is called not only when we first attach, but also when the
351 user types "run" after having attached. */
354 arm_rdi_create_inferior (char *exec_file
, char *args
, char **env
)
357 unsigned long arg1
, arg2
;
359 CORE_ADDR entry_point
;
361 if (exec_file
== 0 || exec_bfd
== 0)
362 error ("No executable file specified.");
364 entry_point
= (CORE_ADDR
) bfd_get_start_address (exec_bfd
);
367 remove_breakpoints ();
368 init_wait_for_inferior ();
370 len
= strlen (exec_file
) + 1 + strlen (args
) + 1 + /*slop */ 10;
371 arg_buf
= (char *) alloca (len
);
373 strcat (arg_buf
, exec_file
);
374 strcat (arg_buf
, " ");
375 strcat (arg_buf
, args
);
378 insert_breakpoints (); /* Needed to get correct instruction in cache */
384 if (strncmp (*env
, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0)
386 unsigned long top_of_memory
;
389 /* Set up memory limit */
390 top_of_memory
= strtoul (*env
+ sizeof ("MEMSIZE=") - 1,
392 printf_filtered ("Setting top-of-memory to 0x%lx\n",
395 rslt
= angel_RDI_info (RDIInfo_SetTopMem
, &top_of_memory
, &arg2
);
398 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
405 arg1
= (unsigned long) arg_buf
;
406 rslt
= angel_RDI_info (RDISet_Cmdline
, /* &arg1 */ (unsigned long *) arg_buf
, &arg2
);
409 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
412 proceed (entry_point
, TARGET_SIGNAL_DEFAULT
, 0);
415 /* This takes a program previously attached to and detaches it. After
416 this is done, GDB can be used to debug some other program. We
417 better not have left any breakpoints in the target program or it'll
418 die when it hits one. */
421 arm_rdi_detach (char *args
, int from_tty
)
426 /* Clean up connection to a remote debugger. */
429 arm_rdi_close (int quitting
)
435 rslt
= angel_RDI_close ();
438 printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt
));
443 generic_mourn_inferior ();
447 /* Tell the remote machine to resume. */
450 arm_rdi_resume (int pid
, int step
, enum target_signal siggnal
)
455 if (0 /* turn on when hardware supports single-stepping */ )
457 rslt
= angel_RDI_step (1, &point
);
460 printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt
));
470 pc
= read_register (PC_REGNUM
);
471 pc
= arm_get_next_pc (pc
);
472 arm_rdi_insert_breakpoint (pc
, handle
);
474 execute_status
= rslt
= angel_RDI_execute (&point
);
475 if (rslt
== RDIError_BreakpointReached
)
479 printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt
));
483 arm_rdi_remove_breakpoint (pc
, handle
);
488 /* Send ^C to target to halt it. Target will respond, and send us a
492 arm_rdi_interrupt (int signo
)
496 static void (*ofunc
) ();
498 /* The user typed ^C twice. */
500 arm_rdi_interrupt_twice (int signo
)
504 /* Ask the user what to do when an interrupt is received. */
507 interrupt_query (void)
511 /* Wait until the remote machine stops, then return, storing status in
512 STATUS just as `wait' would. Returns "pid" (though it's not clear
513 what, if anything, that means in the case of this target). */
516 arm_rdi_wait (int pid
, struct target_waitstatus
*status
)
518 status
->kind
= (execute_status
== RDIError_NoError
?
519 TARGET_WAITKIND_EXITED
: TARGET_WAITKIND_STOPPED
);
521 /* convert stopped code from target into right signal */
522 status
->value
.sig
= rdi_error_signal (execute_status
);
527 /* Read the remote registers into the block REGS. */
531 arm_rdi_fetch_registers (int regno
)
533 int rslt
, rdi_regmask
;
534 unsigned long rawreg
, rawregs
[32];
539 rslt
= angel_RDI_CPUread (255, 0x27fff, rawregs
);
542 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
545 for (regno
= 0; regno
< 15; regno
++)
547 store_unsigned_integer (cookedreg
, 4, rawregs
[regno
]);
548 supply_register (regno
, (char *) cookedreg
);
550 store_unsigned_integer (cookedreg
, 4, rawregs
[15]);
551 supply_register (PS_REGNUM
, (char *) cookedreg
);
552 arm_rdi_fetch_registers (PC_REGNUM
);
556 if (regno
== PC_REGNUM
)
557 rdi_regmask
= RDIReg_PC
;
558 else if (regno
== PS_REGNUM
)
559 rdi_regmask
= RDIReg_CPSR
;
560 else if (regno
< 0 || regno
> 15)
563 supply_register (regno
, (char *) &rawreg
);
567 rdi_regmask
= 1 << regno
;
569 rslt
= angel_RDI_CPUread (255, rdi_regmask
, &rawreg
);
572 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
574 store_unsigned_integer (cookedreg
, 4, rawreg
);
575 supply_register (regno
, (char *) cookedreg
);
580 arm_rdi_prepare_to_store (void)
585 /* Store register REGNO, or all registers if REGNO == -1, from the contents
586 of REGISTERS. FIXME: ignores errors. */
589 arm_rdi_store_registers (int regno
)
591 int rslt
, rdi_regmask
;
593 /* These need to be able to take 'floating point register' contents */
594 unsigned long rawreg
[3], rawerreg
[3];
598 for (regno
= 0; regno
< NUM_REGS
; regno
++)
599 arm_rdi_store_registers (regno
);
603 read_register_gen (regno
, (char *) rawreg
);
604 /* RDI manipulates data in host byte order, so convert now. */
605 store_unsigned_integer (rawerreg
, 4, rawreg
[0]);
607 if (regno
== PC_REGNUM
)
608 rdi_regmask
= RDIReg_PC
;
609 else if (regno
== PS_REGNUM
)
610 rdi_regmask
= RDIReg_CPSR
;
611 else if (regno
< 0 || regno
> 15)
614 rdi_regmask
= 1 << regno
;
616 rslt
= angel_RDI_CPUwrite (255, rdi_regmask
, rawerreg
);
619 printf_filtered ("RDI_CPUwrite: %s\n", rdi_error_message (rslt
));
624 /* Read or write LEN bytes from inferior memory at MEMADDR,
625 transferring to or from debugger address MYADDR. Write to inferior
626 if SHOULD_WRITE is nonzero. Returns length of data written or
627 read; 0 for error. TARGET is unused. */
631 arm_rdi_xfer_memory (CORE_ADDR memaddr
, char *myaddr
, int len
, int should_write
,
632 struct mem_attrib
*attrib ATTRIBUTE_UNUSED
,
633 struct target_ops
*target ATTRIBUTE_UNUSED
)
639 rslt
= angel_RDI_write (myaddr
, memaddr
, &len
);
642 printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt
));
647 rslt
= angel_RDI_read (memaddr
, myaddr
, &len
);
650 printf_filtered ("RDI_read: %s\n", rdi_error_message (rslt
));
657 /* Display random info collected from the target. */
660 arm_rdi_files_info (struct target_ops
*ignore
)
662 char *file
= "nothing";
664 unsigned long arg1
, arg2
;
666 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
669 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
671 if (arg1
& (1 << 15))
672 printf_filtered ("Target supports Thumb code.\n");
673 if (arg1
& (1 << 14))
674 printf_filtered ("Target can do profiling.\n");
676 printf_filtered ("Target is real hardware.\n");
678 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
681 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
683 printf_filtered ("Target can%s single-step.\n", (arg1
& 0x4 ? "" : "not"));
685 rslt
= angel_RDI_info (RDIInfo_Icebreaker
, &arg1
, &arg2
);
688 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
691 printf_filtered ("Target includes an EmbeddedICE.\n");
699 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
702 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
707 arm_rdi_mourn_inferior (void)
709 /* We remove the inserted breakpoints in case the user wants to
710 issue another target and load commands to rerun his application;
711 This is something that wouldn't work on a native target, for instance,
712 as the process goes away when the inferior exits, but it works with
713 some remote targets like this one. That is why this is done here. */
714 remove_breakpoints();
715 unpush_target (&arm_rdi_ops
);
716 generic_mourn_inferior ();
719 /* While the RDI library keeps track of its own breakpoints, we need
720 to remember "handles" so that we can delete them later. Since
721 breakpoints get used for stepping, be careful not to leak memory
725 arm_rdi_insert_breakpoint (CORE_ADDR addr
, char *contents_cache
)
729 struct local_bp_list_entry
*entry
;
730 int type
= RDIPoint_EQ
;
732 if (arm_pc_is_thumb (addr
) || arm_pc_is_thumb_dummy (addr
))
733 type
|= RDIPoint_16Bit
;
734 rslt
= angel_RDI_setbreak (addr
, type
, 0, &point
);
737 printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt
));
740 (struct local_bp_list_entry
*) xmalloc (sizeof (struct local_bp_list_entry
));
742 entry
->point
= point
;
743 entry
->next
= local_bp_list
;
744 local_bp_list
= entry
;
749 arm_rdi_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
753 struct local_bp_list_entry
*entry
, *preventry
;
755 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
757 if (entry
->addr
== addr
)
765 rslt
= angel_RDI_clearbreak (entry
->point
);
768 printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt
));
770 /* Delete the breakpoint entry locally. */
771 if (entry
== local_bp_list
)
773 local_bp_list
= entry
->next
;
777 preventry
->next
= entry
->next
;
785 rdi_error_message (int err
)
789 case RDIError_NoError
:
792 return "debuggee reset";
793 case RDIError_UndefinedInstruction
:
794 return "undefined instruction";
795 case RDIError_SoftwareInterrupt
:
796 return "SWI trapped";
797 case RDIError_PrefetchAbort
:
798 return "prefetch abort, execution ran into unmapped memory?";
799 case RDIError_DataAbort
:
800 return "data abort, no memory at specified address?";
801 case RDIError_AddressException
:
802 return "address exception, access >26bit in 26bit mode";
804 return "IRQ, interrupt trapped";
806 return "FIQ, fast interrupt trapped";
808 return "a miscellaneous type of error";
809 case RDIError_BranchThrough0
:
810 return "branch through location 0";
811 case RDIError_NotInitialised
:
812 return "internal error, RDI_open not called first";
813 case RDIError_UnableToInitialise
:
814 return "internal error, target world is broken";
815 case RDIError_WrongByteSex
:
816 return "See Operator: WrongByteSex";
817 case RDIError_UnableToTerminate
:
818 return "See Operator: Unable to Terminate";
819 case RDIError_BadInstruction
:
820 return "bad instruction, illegal to execute this instruction";
821 case RDIError_IllegalInstruction
:
822 return "illegal instruction, the effect of executing it is undefined";
823 case RDIError_BadCPUStateSetting
:
824 return "internal error, tried to set SPSR of user mode";
825 case RDIError_UnknownCoPro
:
826 return "unknown co-processor";
827 case RDIError_UnknownCoProState
:
828 return "cannot execute co-processor request";
829 case RDIError_BadCoProState
:
830 return "recognizably broken co-processor request";
831 case RDIError_BadPointType
:
832 return "internal error, bad point yype";
833 case RDIError_UnimplementedType
:
834 return "internal error, unimplemented type";
835 case RDIError_BadPointSize
:
836 return "internal error, bad point size";
837 case RDIError_UnimplementedSize
:
838 return "internal error, unimplemented size";
839 case RDIError_NoMorePoints
:
840 return "last break/watch point was used";
841 case RDIError_BreakpointReached
:
842 return "breakpoint reached";
843 case RDIError_WatchpointAccessed
:
844 return "watchpoint accessed";
845 case RDIError_NoSuchPoint
:
846 return "attempted to clear non-existent break/watch point";
847 case RDIError_ProgramFinishedInStep
:
848 return "end of the program reached while stepping";
849 case RDIError_UserInterrupt
:
850 return "you pressed Escape";
851 case RDIError_CantSetPoint
:
852 return "no more break/watch points available";
853 case RDIError_IncompatibleRDILevels
:
854 return "incompatible RDI levels";
855 case RDIError_LittleEndian
:
856 return "debuggee is little endian";
857 case RDIError_BigEndian
:
858 return "debuggee is big endian";
859 case RDIError_SoftInitialiseError
:
860 return "recoverable error in RDI initialization";
861 case RDIError_InsufficientPrivilege
:
862 return "internal error, supervisor state not accessible to monitor";
863 case RDIError_UnimplementedMessage
:
864 return "internal error, unimplemented message";
865 case RDIError_UndefinedMessage
:
866 return "internal error, undefined message";
868 return "undefined error message, should reset target";
872 /* Convert the ARM error messages to signals that GDB knows about. */
874 static enum target_signal
875 rdi_error_signal (int err
)
879 case RDIError_NoError
:
882 return TARGET_SIGNAL_TERM
; /* ??? */
883 case RDIError_UndefinedInstruction
:
884 return TARGET_SIGNAL_ILL
;
885 case RDIError_SoftwareInterrupt
:
886 case RDIError_PrefetchAbort
:
887 case RDIError_DataAbort
:
888 return TARGET_SIGNAL_TRAP
;
889 case RDIError_AddressException
:
890 return TARGET_SIGNAL_SEGV
;
893 return TARGET_SIGNAL_TRAP
;
895 return TARGET_SIGNAL_TERM
;
896 case RDIError_BranchThrough0
:
897 return TARGET_SIGNAL_TRAP
;
898 case RDIError_NotInitialised
:
899 case RDIError_UnableToInitialise
:
900 case RDIError_WrongByteSex
:
901 case RDIError_UnableToTerminate
:
902 return TARGET_SIGNAL_UNKNOWN
;
903 case RDIError_BadInstruction
:
904 case RDIError_IllegalInstruction
:
905 return TARGET_SIGNAL_ILL
;
906 case RDIError_BadCPUStateSetting
:
907 case RDIError_UnknownCoPro
:
908 case RDIError_UnknownCoProState
:
909 case RDIError_BadCoProState
:
910 case RDIError_BadPointType
:
911 case RDIError_UnimplementedType
:
912 case RDIError_BadPointSize
:
913 case RDIError_UnimplementedSize
:
914 case RDIError_NoMorePoints
:
915 return TARGET_SIGNAL_UNKNOWN
;
916 case RDIError_BreakpointReached
:
917 case RDIError_WatchpointAccessed
:
918 return TARGET_SIGNAL_TRAP
;
919 case RDIError_NoSuchPoint
:
920 case RDIError_ProgramFinishedInStep
:
921 return TARGET_SIGNAL_UNKNOWN
;
922 case RDIError_UserInterrupt
:
923 return TARGET_SIGNAL_INT
;
924 case RDIError_IncompatibleRDILevels
:
925 case RDIError_LittleEndian
:
926 case RDIError_BigEndian
:
927 case RDIError_SoftInitialiseError
:
928 case RDIError_InsufficientPrivilege
:
929 case RDIError_UnimplementedMessage
:
930 case RDIError_UndefinedMessage
:
932 return TARGET_SIGNAL_UNKNOWN
;
939 angel_RDI_stop_request();
943 /* Define the target operations structure. */
948 arm_rdi_ops
.to_shortname
= "rdi";
949 arm_rdi_ops
.to_longname
= "ARM RDI";
950 arm_rdi_ops
.to_doc
= "Use a remote ARM-based computer; via the RDI library.\n\
951 Specify the serial device it is connected to (e.g. /dev/ttya).";
952 arm_rdi_ops
.to_open
= arm_rdi_open
;
953 arm_rdi_ops
.to_close
= arm_rdi_close
;
954 arm_rdi_ops
.to_detach
= arm_rdi_detach
;
955 arm_rdi_ops
.to_resume
= arm_rdi_resume
;
956 arm_rdi_ops
.to_wait
= arm_rdi_wait
;
957 arm_rdi_ops
.to_stop
= arm_rdi_stop
;
958 arm_rdi_ops
.to_fetch_registers
= arm_rdi_fetch_registers
;
959 arm_rdi_ops
.to_store_registers
= arm_rdi_store_registers
;
960 arm_rdi_ops
.to_prepare_to_store
= arm_rdi_prepare_to_store
;
961 arm_rdi_ops
.to_xfer_memory
= arm_rdi_xfer_memory
;
962 arm_rdi_ops
.to_files_info
= arm_rdi_files_info
;
963 arm_rdi_ops
.to_insert_breakpoint
= arm_rdi_insert_breakpoint
;
964 arm_rdi_ops
.to_remove_breakpoint
= arm_rdi_remove_breakpoint
;
965 arm_rdi_ops
.to_kill
= arm_rdi_kill
;
966 arm_rdi_ops
.to_load
= generic_load
;
967 arm_rdi_ops
.to_create_inferior
= arm_rdi_create_inferior
;
968 arm_rdi_ops
.to_mourn_inferior
= arm_rdi_mourn_inferior
;
969 arm_rdi_ops
.to_stratum
= process_stratum
;
970 arm_rdi_ops
.to_has_all_memory
= 1;
971 arm_rdi_ops
.to_has_memory
= 1;
972 arm_rdi_ops
.to_has_stack
= 1;
973 arm_rdi_ops
.to_has_registers
= 1;
974 arm_rdi_ops
.to_has_execution
= 1;
975 arm_rdi_ops
.to_magic
= OPS_MAGIC
;
979 rdilogfile_command (char *arg
, int from_tty
)
981 if (!arg
|| strlen (arg
) == 0)
983 printf_filtered ("rdi log file is '%s'\n", log_filename
);
988 xfree (log_filename
);
990 log_filename
= xstrdup (arg
);
992 Adp_SetLogfile (log_filename
);
996 rdilogenable_command (char *args
, int from_tty
)
998 if (!args
|| strlen (args
) == 0)
1000 printf_filtered ("rdi log is %s\n", log_enable
? "enabled" : "disabled");
1004 if (!strcasecmp (args
, "1") ||
1005 !strcasecmp (args
, "y") ||
1006 !strcasecmp (args
, "yes") ||
1007 !strcasecmp (args
, "on") ||
1008 !strcasecmp (args
, "t") ||
1009 !strcasecmp (args
, "true"))
1010 Adp_SetLogEnable (log_enable
= 1);
1011 else if (!strcasecmp (args
, "0") ||
1012 !strcasecmp (args
, "n") ||
1013 !strcasecmp (args
, "no") ||
1014 !strcasecmp (args
, "off") ||
1015 !strcasecmp (args
, "f") ||
1016 !strcasecmp (args
, "false"))
1017 Adp_SetLogEnable (log_enable
= 0);
1019 printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
1020 " try y or n\n", args
);
1024 _initialize_remote_rdi (void)
1026 struct cmd_list_element
*c
;
1029 add_target (&arm_rdi_ops
);
1031 log_filename
= xstrdup ("rdi.log");
1032 Adp_SetLogfile (log_filename
);
1033 Adp_SetLogEnable (log_enable
);
1035 c
= add_cmd ("rdilogfile", class_maintenance
,
1037 "Set filename for ADP packet log.\n\
1038 This file is used to log Angel Debugger Protocol packets.\n\
1039 With a single argument, sets the logfile name to that value.\n\
1040 Without an argument, shows the current logfile name.\n\
1041 See also: rdilogenable\n",
1043 c
->completer
= filename_completer
;
1045 add_cmd ("rdilogenable", class_maintenance
,
1046 rdilogenable_command
,
1047 "Set enable logging of ADP packets.\n\
1048 This will log ADP packets exchanged between gdb and the\n\
1049 rdi target device.\n\
1050 An argument of 1,t,true,y,yes will enable.\n\
1051 An argument of 0,f,false,n,no will disabled.\n\
1052 Withough an argument, it will display current state.\n",
1056 (add_set_cmd ("rdiromatzero", no_class
,
1057 var_boolean
, (char *) &rom_at_zero
,
1058 "Set target has ROM at addr 0.\n\
1059 A true value disables vector catching, false enables vector catching.\n\
1060 This is evaluated at the time the 'target rdi' command is executed\n",
1065 (add_set_cmd ("rdiheartbeat", no_class
,
1066 var_boolean
, (char *) &rdi_heartbeat
,
1067 "Set enable for ADP heartbeat packets.\n\
1068 I don't know why you would want this. If you enable them,\n\
1069 it will confuse ARM and EPI JTAG interface boxes as well\n\
1070 as the Angel Monitor.\n",
1075 /* A little dummy to make linking with the library succeed. */