1 /* GDB interface to ARM RDI library.
2 Copyright 1997, 1998 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"
32 #include "gdb-stabs.h"
33 #include "gdbthread.h"
37 #include <sys/types.h>
42 #include "rdi-share/ardi.h"
43 #include "rdi-share/adp.h"
44 #include "rdi-share/hsys.h"
46 extern int isascii
PARAMS ((int));
48 /* Prototypes for local functions */
50 static void arm_rdi_files_info
PARAMS ((struct target_ops
* ignore
));
52 static int arm_rdi_xfer_memory
PARAMS ((CORE_ADDR memaddr
, char *myaddr
,
53 int len
, int should_write
,
54 struct target_ops
* target
));
56 static void arm_rdi_prepare_to_store
PARAMS ((void));
58 static void arm_rdi_fetch_registers
PARAMS ((int regno
));
60 static void arm_rdi_resume
PARAMS ((int pid
, int step
,
61 enum target_signal siggnal
));
63 static int arm_rdi_start_remote
PARAMS ((char *dummy
));
65 static void arm_rdi_open
PARAMS ((char *name
, int from_tty
));
67 static void arm_rdi_create_inferior
PARAMS ((char *exec_file
, char *args
,
70 static void arm_rdi_close
PARAMS ((int quitting
));
72 static void arm_rdi_store_registers
PARAMS ((int regno
));
74 static void arm_rdi_mourn
PARAMS ((void));
76 static void arm_rdi_send
PARAMS ((char *buf
));
78 static int arm_rdi_wait
PARAMS ((int pid
, struct target_waitstatus
* status
));
80 static void arm_rdi_kill
PARAMS ((void));
82 static void arm_rdi_detach
PARAMS ((char *args
, int from_tty
));
84 static void arm_rdi_interrupt
PARAMS ((int signo
));
86 static void arm_rdi_interrupt_twice
PARAMS ((int signo
));
88 static void interrupt_query
PARAMS ((void));
90 static int arm_rdi_insert_breakpoint
PARAMS ((CORE_ADDR
, char *));
92 static int arm_rdi_remove_breakpoint
PARAMS ((CORE_ADDR
, char *));
94 static char *rdi_error_message
PARAMS ((int err
));
96 static enum target_signal rdi_error_signal
PARAMS ((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 (dummy
)
142 /* Helper callbacks for the "host interface" structure. RDI functions call
143 these to forward output from the target system and so forth. */
148 fprintf_unfiltered (gdb_stdout
, "void dummy\n");
152 myprint (arg
, format
, ap
)
157 vfprintf_unfiltered (gdb_stdout
, format
, ap
);
166 fputc_unfiltered (c
, gdb_stdout
);
170 mywrite (arg
, buffer
, len
)
179 for (i
= 0; i
< len
; i
++)
181 if (isascii ((int) *e
))
183 fputc_unfiltered ((int) *e
, gdb_stdout
);
197 /* These last two are tricky as we have to handle the special case of
198 being interrupted more carefully */
204 return fgetc (stdin
);
208 mygets (arg
, buffer
, len
)
213 return fgets (buffer
, len
, stdin
);
216 /* Prevent multiple calls to angel_RDI_close(). */
217 static int closed_already
= 1;
219 /* Open a connection to a remote debugger. NAME is the filename used
220 for communication. */
223 arm_rdi_open (name
, from_tty
)
228 unsigned long arg1
, arg2
;
229 char *openArgs
= NULL
;
230 char *devName
= NULL
;
234 error ("To open an RDI connection, you need to specify what serial\n\
235 device is attached to the remote system (e.g. /dev/ttya).");
237 /* split name after whitespace, pass tail as arg to open command */
239 devName
= strdup(name
);
240 p
= strchr(devName
,' ');
252 /* Make the basic low-level connection. */
255 rslt
= Adp_OpenDevice (devName
, openArgs
, rdi_heartbeat
);
258 error ("Could not open device \"%s\"", name
);
260 gdb_config
.bytesex
= 2 | (TARGET_BYTE_ORDER
== BIG_ENDIAN
? 1 : 0);
262 gdb_config
.rditype
= 2;
263 gdb_config
.heartbeat_on
= 1;
264 gdb_config
.flags
= 2;
266 gdb_hostif
.dbgprint
= myprint
;
267 gdb_hostif
.dbgpause
= mypause
;
268 gdb_hostif
.dbgarg
= NULL
;
269 gdb_hostif
.writec
= mywritec
;
270 gdb_hostif
.readc
= myreadc
;
271 gdb_hostif
.write
= mywrite
;
272 gdb_hostif
.gets
= mygets
;
273 gdb_hostif
.hostosarg
= NULL
;
274 gdb_hostif
.reset
= voiddummy
;
276 rslt
= angel_RDI_open (10, &gdb_config
, &gdb_hostif
, NULL
);
277 if (rslt
== RDIError_BigEndian
|| rslt
== RDIError_LittleEndian
)
278 ; /* do nothing, this is the expected return */
281 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
283 error("RID_open failed\n");
286 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
289 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
291 rslt
= angel_RDI_info (RDIInfo_Points
, &arg1
, &arg2
);
294 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
296 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
299 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
301 rslt
= angel_RDI_info (RDIInfo_CoPro
, &arg1
, &arg2
);
304 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
306 rslt
= angel_RDI_info (RDIInfo_SemiHosting
, &arg1
, &arg2
);
309 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
312 rslt
= angel_RDI_info (RDIInfo_GetLoadSize
, &arg1
, &arg2
);
315 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
317 max_load_size
= arg1
;
319 push_target (&arm_rdi_ops
);
321 target_fetch_registers (-1);
323 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
326 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
329 arg1
= rom_at_zero
? 0x0 : 0x13b;
331 rslt
= angel_RDI_info (RDIVector_Catch
, &arg1
, &arg2
);
334 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
337 arg1
= (unsigned long) "";
338 rslt
= angel_RDI_info (RDISet_Cmdline
, &arg1
, &arg2
);
341 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
344 /* Clear out any existing records of breakpoints. */
346 struct local_bp_list_entry
*entry
, *preventry
= NULL
;
348 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
355 printf_filtered ("Connected to ARM RDI target.\n");
360 /* Start an inferior process and set inferior_pid to its pid.
361 EXEC_FILE is the file to run.
362 ARGS is a string containing the arguments to the program.
363 ENV is the environment vector to pass. Errors reported with error().
364 On VxWorks and various standalone systems, we ignore exec_file. */
365 /* This is called not only when we first attach, but also when the
366 user types "run" after having attached. */
369 arm_rdi_create_inferior (exec_file
, args
, env
)
375 unsigned long arg1
, arg2
;
377 CORE_ADDR entry_point
;
379 if (exec_file
== 0 || exec_bfd
== 0)
380 error ("No executable file specified.");
382 entry_point
= (CORE_ADDR
) bfd_get_start_address (exec_bfd
);
385 remove_breakpoints ();
386 init_wait_for_inferior ();
388 len
= strlen (exec_file
) + 1 + strlen (args
) + 1 + /*slop */ 10;
389 arg_buf
= (char *) alloca (len
);
391 strcat (arg_buf
, exec_file
);
392 strcat (arg_buf
, " ");
393 strcat (arg_buf
, args
);
396 insert_breakpoints (); /* Needed to get correct instruction in cache */
402 if (strncmp (*env
, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0)
404 unsigned long top_of_memory
;
407 /* Set up memory limit */
408 top_of_memory
= strtoul (*env
+ sizeof ("MEMSIZE=") - 1,
410 printf_filtered ("Setting top-of-memory to 0x%lx\n",
413 rslt
= angel_RDI_info (RDIInfo_SetTopMem
, &top_of_memory
, &arg2
);
416 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
423 arg1
= (unsigned long) arg_buf
;
424 rslt
= angel_RDI_info (RDISet_Cmdline
, /* &arg1 */ (unsigned long *) arg_buf
, &arg2
);
427 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
430 proceed (entry_point
, TARGET_SIGNAL_DEFAULT
, 0);
433 /* This takes a program previously attached to and detaches it. After
434 this is done, GDB can be used to debug some other program. We
435 better not have left any breakpoints in the target program or it'll
436 die when it hits one. */
439 arm_rdi_detach (args
, from_tty
)
446 /* Clean up connection to a remote debugger. */
449 arm_rdi_close (quitting
)
456 rslt
= angel_RDI_close ();
459 printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt
));
467 /* Tell the remote machine to resume. */
470 arm_rdi_resume (pid
, step
, siggnal
)
472 enum target_signal siggnal
;
477 if (0 /* turn on when hardware supports single-stepping */ )
479 rslt
= angel_RDI_step (1, &point
);
482 printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt
));
492 pc
= read_register (PC_REGNUM
);
493 pc
= arm_get_next_pc (pc
);
494 arm_rdi_insert_breakpoint (pc
, handle
);
496 execute_status
= rslt
= angel_RDI_execute (&point
);
497 if (rslt
== RDIError_BreakpointReached
)
501 printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt
));
505 arm_rdi_remove_breakpoint (pc
, handle
);
510 /* Send ^C to target to halt it. Target will respond, and send us a
514 arm_rdi_interrupt (signo
)
519 static void (*ofunc
) ();
521 /* The user typed ^C twice. */
523 arm_rdi_interrupt_twice (signo
)
528 /* Ask the user what to do when an interrupt is received. */
535 /* Wait until the remote machine stops, then return, storing status in
536 STATUS just as `wait' would. Returns "pid" (though it's not clear
537 what, if anything, that means in the case of this target). */
540 arm_rdi_wait (pid
, status
)
542 struct target_waitstatus
*status
;
544 status
->kind
= (execute_status
== RDIError_NoError
?
545 TARGET_WAITKIND_EXITED
: TARGET_WAITKIND_STOPPED
);
547 /* convert stopped code from target into right signal */
548 status
->value
.sig
= rdi_error_signal (execute_status
);
553 /* Read the remote registers into the block REGS. */
557 arm_rdi_fetch_registers (regno
)
560 int rslt
, rdi_regmask
;
561 unsigned long rawreg
, rawregs
[32];
566 rslt
= angel_RDI_CPUread (255, 0x27fff, rawregs
);
569 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
572 for (regno
= 0; regno
< 15; regno
++)
574 store_unsigned_integer (cookedreg
, 4, rawregs
[regno
]);
575 supply_register (regno
, (char *) cookedreg
);
577 store_unsigned_integer (cookedreg
, 4, rawregs
[15]);
578 supply_register (PS_REGNUM
, (char *) cookedreg
);
579 arm_rdi_fetch_registers (PC_REGNUM
);
583 if (regno
== PC_REGNUM
)
584 rdi_regmask
= RDIReg_PC
;
585 else if (regno
== PS_REGNUM
)
586 rdi_regmask
= RDIReg_CPSR
;
587 else if (regno
< 0 || regno
> 15)
590 supply_register (regno
, (char *) &rawreg
);
594 rdi_regmask
= 1 << regno
;
596 rslt
= angel_RDI_CPUread (255, rdi_regmask
, &rawreg
);
599 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt
));
601 store_unsigned_integer (cookedreg
, 4, rawreg
);
602 supply_register (regno
, (char *) cookedreg
);
607 arm_rdi_prepare_to_store ()
612 /* Store register REGNO, or all registers if REGNO == -1, from the contents
613 of REGISTERS. FIXME: ignores errors. */
616 arm_rdi_store_registers (regno
)
619 int rslt
, rdi_regmask
;
621 /* These need to be able to take 'floating point register' contents */
622 unsigned long rawreg
[3], rawerreg
[3];
626 for (regno
= 0; regno
< NUM_REGS
; regno
++)
627 arm_rdi_store_registers (regno
);
631 read_register_gen (regno
, (char *) rawreg
);
632 /* RDI manipulates data in host byte order, so convert now. */
633 store_unsigned_integer (rawerreg
, 4, rawreg
[0]);
635 if (regno
== PC_REGNUM
)
636 rdi_regmask
= RDIReg_PC
;
637 else if (regno
== PS_REGNUM
)
638 rdi_regmask
= RDIReg_CPSR
;
639 else if (regno
< 0 || regno
> 15)
642 rdi_regmask
= 1 << regno
;
644 rslt
= angel_RDI_CPUwrite (255, rdi_regmask
, rawerreg
);
647 printf_filtered ("RDI_CPUwrite: %s\n", rdi_error_message (rslt
));
652 /* Read or write LEN bytes from inferior memory at MEMADDR,
653 transferring to or from debugger address MYADDR. Write to inferior
654 if SHOULD_WRITE is nonzero. Returns length of data written or
655 read; 0 for error. */
659 arm_rdi_xfer_memory (memaddr
, myaddr
, len
, should_write
, target
)
664 struct target_ops
*target
; /* ignored */
670 rslt
= angel_RDI_write (myaddr
, memaddr
, &len
);
673 printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt
));
678 rslt
= angel_RDI_read (memaddr
, myaddr
, &len
);
681 printf_filtered ("RDI_read: %s\n", rdi_error_message (rslt
));
688 /* Display random info collected from the target. */
691 arm_rdi_files_info (ignore
)
692 struct target_ops
*ignore
;
694 char *file
= "nothing";
696 unsigned long arg1
, arg2
;
698 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
701 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
703 if (arg1
& (1 << 15))
704 printf_filtered ("Target supports Thumb code.\n");
705 if (arg1
& (1 << 14))
706 printf_filtered ("Target can do profiling.\n");
708 printf_filtered ("Target is real hardware.\n");
710 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
713 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
715 printf_filtered ("Target can%s single-step.\n", (arg1
& 0x4 ? "" : "not"));
717 rslt
= angel_RDI_info (RDIInfo_Icebreaker
, &arg1
, &arg2
);
720 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
723 printf_filtered ("Target includes an EmbeddedICE.\n");
731 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
734 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
739 arm_rdi_mourn_inferior ()
741 unpush_target (&arm_rdi_ops
);
742 generic_mourn_inferior ();
745 /* While the RDI library keeps track of its own breakpoints, we need
746 to remember "handles" so that we can delete them later. Since
747 breakpoints get used for stepping, be careful not to leak memory
751 arm_rdi_insert_breakpoint (addr
, contents_cache
)
753 char *contents_cache
;
757 struct local_bp_list_entry
*entry
;
758 int type
= RDIPoint_EQ
;
760 if (arm_pc_is_thumb (addr
) || arm_pc_is_thumb_dummy (addr
))
761 type
|= RDIPoint_16Bit
;
762 rslt
= angel_RDI_setbreak (addr
, type
, 0, &point
);
765 printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt
));
768 (struct local_bp_list_entry
*) xmalloc (sizeof (struct local_bp_list_entry
));
770 entry
->point
= point
;
771 entry
->next
= local_bp_list
;
772 local_bp_list
= entry
;
777 arm_rdi_remove_breakpoint (addr
, contents_cache
)
779 char *contents_cache
;
783 struct local_bp_list_entry
*entry
, *preventry
;
785 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
787 if (entry
->addr
== addr
)
795 rslt
= angel_RDI_clearbreak (entry
->point
);
798 printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt
));
800 /* Delete the breakpoint entry locally. */
801 if (entry
== local_bp_list
)
803 local_bp_list
= entry
->next
;
807 preventry
->next
= entry
->next
;
815 rdi_error_message (err
)
820 case RDIError_NoError
:
823 return "debuggee reset";
824 case RDIError_UndefinedInstruction
:
825 return "undefined instruction";
826 case RDIError_SoftwareInterrupt
:
827 return "SWI trapped";
828 case RDIError_PrefetchAbort
:
829 return "prefetch abort, execution ran into unmapped memory?";
830 case RDIError_DataAbort
:
831 return "data abort, no memory at specified address?";
832 case RDIError_AddressException
:
833 return "address exception, access >26bit in 26bit mode";
835 return "IRQ, interrupt trapped";
837 return "FIQ, fast interrupt trapped";
839 return "a miscellaneous type of error";
840 case RDIError_BranchThrough0
:
841 return "branch through location 0";
842 case RDIError_NotInitialised
:
843 return "internal error, RDI_open not called first";
844 case RDIError_UnableToInitialise
:
845 return "internal error, target world is broken";
846 case RDIError_WrongByteSex
:
847 return "See Operator: WrongByteSex";
848 case RDIError_UnableToTerminate
:
849 return "See Operator: Unable to Terminate";
850 case RDIError_BadInstruction
:
851 return "bad instruction, illegal to execute this instruction";
852 case RDIError_IllegalInstruction
:
853 return "illegal instruction, the effect of executing it is undefined";
854 case RDIError_BadCPUStateSetting
:
855 return "internal error, tried to set SPSR of user mode";
856 case RDIError_UnknownCoPro
:
857 return "unknown co-processor";
858 case RDIError_UnknownCoProState
:
859 return "cannot execute co-processor request";
860 case RDIError_BadCoProState
:
861 return "recognizably broken co-processor request";
862 case RDIError_BadPointType
:
863 return "internal error, bad point yype";
864 case RDIError_UnimplementedType
:
865 return "internal error, unimplemented type";
866 case RDIError_BadPointSize
:
867 return "internal error, bad point size";
868 case RDIError_UnimplementedSize
:
869 return "internal error, unimplemented size";
870 case RDIError_NoMorePoints
:
871 return "last break/watch point was used";
872 case RDIError_BreakpointReached
:
873 return "breakpoint reached";
874 case RDIError_WatchpointAccessed
:
875 return "watchpoint accessed";
876 case RDIError_NoSuchPoint
:
877 return "attempted to clear non-existent break/watch point";
878 case RDIError_ProgramFinishedInStep
:
879 return "end of the program reached while stepping";
880 case RDIError_UserInterrupt
:
881 return "you pressed Escape";
882 case RDIError_CantSetPoint
:
883 return "no more break/watch points available";
884 case RDIError_IncompatibleRDILevels
:
885 return "incompatible RDI levels";
886 case RDIError_LittleEndian
:
887 return "debuggee is little endian";
888 case RDIError_BigEndian
:
889 return "debuggee is big endian";
890 case RDIError_SoftInitialiseError
:
891 return "recoverable error in RDI initialization";
892 case RDIError_InsufficientPrivilege
:
893 return "internal error, supervisor state not accessible to monitor";
894 case RDIError_UnimplementedMessage
:
895 return "internal error, unimplemented message";
896 case RDIError_UndefinedMessage
:
897 return "internal error, undefined message";
899 return "undefined error message, should reset target";
903 /* Convert the ARM error messages to signals that GDB knows about. */
905 static enum target_signal
906 rdi_error_signal (err
)
911 case RDIError_NoError
:
914 return TARGET_SIGNAL_TERM
; /* ??? */
915 case RDIError_UndefinedInstruction
:
916 return TARGET_SIGNAL_ILL
;
917 case RDIError_SoftwareInterrupt
:
918 case RDIError_PrefetchAbort
:
919 case RDIError_DataAbort
:
920 return TARGET_SIGNAL_TRAP
;
921 case RDIError_AddressException
:
922 return TARGET_SIGNAL_SEGV
;
925 return TARGET_SIGNAL_TRAP
;
927 return TARGET_SIGNAL_TERM
;
928 case RDIError_BranchThrough0
:
929 return TARGET_SIGNAL_TRAP
;
930 case RDIError_NotInitialised
:
931 case RDIError_UnableToInitialise
:
932 case RDIError_WrongByteSex
:
933 case RDIError_UnableToTerminate
:
934 return TARGET_SIGNAL_UNKNOWN
;
935 case RDIError_BadInstruction
:
936 case RDIError_IllegalInstruction
:
937 return TARGET_SIGNAL_ILL
;
938 case RDIError_BadCPUStateSetting
:
939 case RDIError_UnknownCoPro
:
940 case RDIError_UnknownCoProState
:
941 case RDIError_BadCoProState
:
942 case RDIError_BadPointType
:
943 case RDIError_UnimplementedType
:
944 case RDIError_BadPointSize
:
945 case RDIError_UnimplementedSize
:
946 case RDIError_NoMorePoints
:
947 return TARGET_SIGNAL_UNKNOWN
;
948 case RDIError_BreakpointReached
:
949 case RDIError_WatchpointAccessed
:
950 return TARGET_SIGNAL_TRAP
;
951 case RDIError_NoSuchPoint
:
952 case RDIError_ProgramFinishedInStep
:
953 return TARGET_SIGNAL_UNKNOWN
;
954 case RDIError_UserInterrupt
:
955 return TARGET_SIGNAL_INT
;
956 case RDIError_IncompatibleRDILevels
:
957 case RDIError_LittleEndian
:
958 case RDIError_BigEndian
:
959 case RDIError_SoftInitialiseError
:
960 case RDIError_InsufficientPrivilege
:
961 case RDIError_UnimplementedMessage
:
962 case RDIError_UndefinedMessage
:
964 return TARGET_SIGNAL_UNKNOWN
;
968 /* Define the target operations structure. */
973 arm_rdi_ops
.to_shortname
= "rdi";
974 arm_rdi_ops
.to_longname
= "ARM RDI";
975 arm_rdi_ops
.to_doc
= "Use a remote ARM-based computer; via the RDI library.\n\
976 Specify the serial device it is connected to (e.g. /dev/ttya).";
977 arm_rdi_ops
.to_open
= arm_rdi_open
;
978 arm_rdi_ops
.to_close
= arm_rdi_close
;
979 arm_rdi_ops
.to_detach
= arm_rdi_detach
;
980 arm_rdi_ops
.to_resume
= arm_rdi_resume
;
981 arm_rdi_ops
.to_wait
= arm_rdi_wait
;
982 arm_rdi_ops
.to_fetch_registers
= arm_rdi_fetch_registers
;
983 arm_rdi_ops
.to_store_registers
= arm_rdi_store_registers
;
984 arm_rdi_ops
.to_prepare_to_store
= arm_rdi_prepare_to_store
;
985 arm_rdi_ops
.to_xfer_memory
= arm_rdi_xfer_memory
;
986 arm_rdi_ops
.to_files_info
= arm_rdi_files_info
;
987 arm_rdi_ops
.to_insert_breakpoint
= arm_rdi_insert_breakpoint
;
988 arm_rdi_ops
.to_remove_breakpoint
= arm_rdi_remove_breakpoint
;
989 arm_rdi_ops
.to_kill
= arm_rdi_kill
;
990 arm_rdi_ops
.to_load
= generic_load
;
991 arm_rdi_ops
.to_create_inferior
= arm_rdi_create_inferior
;
992 arm_rdi_ops
.to_mourn_inferior
= arm_rdi_mourn_inferior
;
993 arm_rdi_ops
.to_stratum
= process_stratum
;
994 arm_rdi_ops
.to_has_all_memory
= 1;
995 arm_rdi_ops
.to_has_memory
= 1;
996 arm_rdi_ops
.to_has_stack
= 1;
997 arm_rdi_ops
.to_has_registers
= 1;
998 arm_rdi_ops
.to_has_execution
= 1;
999 arm_rdi_ops
.to_magic
= OPS_MAGIC
;
1002 static void rdilogfile_command (char *arg
, int from_tty
)
1004 if (!arg
|| strlen (arg
) == 0)
1006 printf_filtered ("rdi log file is '%s'\n", log_filename
);
1011 free (log_filename
);
1013 log_filename
= strdup (arg
);
1015 Adp_SetLogfile (log_filename
);
1018 static void rdilogenable_command (char *args
, int from_tty
)
1020 if (!args
|| strlen (args
) == 0)
1022 printf_filtered ("rdi log is %s\n", log_enable
? "enabled" : "disabled");
1026 if (!strcasecmp (args
,"1") ||
1027 !strcasecmp (args
,"y") ||
1028 !strcasecmp (args
,"yes") ||
1029 !strcasecmp (args
,"on") ||
1030 !strcasecmp (args
,"t") ||
1031 !strcasecmp (args
,"true"))
1032 Adp_SetLogEnable (log_enable
=1);
1033 else if (!strcasecmp (args
,"0") ||
1034 !strcasecmp (args
,"n") ||
1035 !strcasecmp (args
,"no") ||
1036 !strcasecmp (args
,"off") ||
1037 !strcasecmp (args
,"f") ||
1038 !strcasecmp (args
,"false"))
1039 Adp_SetLogEnable (log_enable
=0);
1041 printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
1042 " try y or n\n",args
);
1046 _initialize_remote_rdi ()
1049 add_target (&arm_rdi_ops
);
1051 log_filename
= strdup("rdi.log");
1052 Adp_SetLogfile(log_filename
);
1053 Adp_SetLogEnable(log_enable
);
1055 add_cmd ("rdilogfile", class_maintenance
,
1057 "Set filename for ADP packet log.\n\
1058 This file is used to log Angel Debugger Protocol packets.\n\
1059 With a single argument, sets the logfile name to that value.\n\
1060 Without an argument, shows the current logfile name.\n\
1061 See also: rdilogenable\n",
1064 add_cmd("rdilogenable", class_maintenance
,
1065 rdilogenable_command
,
1066 "Set enable logging of ADP packets.\n\
1067 This will log ADP packets exchanged between gdb and the\n\
1068 rdi target device.\n\
1069 An argument of 1,t,true,y,yes will enable.\n\
1070 An argument of 0,f,false,n,no will disabled.\n\
1071 Withough an argument, it will display current state.\n",
1075 (add_set_cmd ("rdiromatzero", no_class
,
1076 var_boolean
, (char *) &rom_at_zero
,
1077 "Set target has ROM at addr 0.\n\
1078 A true value disables vector catching, false enables vector catching.\n\
1079 This is evaluated at the time the 'target rdi' command is executed\n",
1084 (add_set_cmd ("rdiheartbeat", no_class
,
1085 var_boolean
, (char *) &rdi_heartbeat
,
1086 "Set enable for ADP heartbeat packets.\n\
1087 I don't know why you would want this. If you enable them,\n\
1088 it will confuse ARM and EPI JTAG interface boxes as well\n\
1089 as the Angel Monitor.\n",
1094 /* A little dummy to make linking with the library succeed. */