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"
35 #include "breakpoint.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 target_ops
*target
);
57 static void arm_rdi_prepare_to_store (void);
59 static void arm_rdi_fetch_registers (int regno
);
61 static void arm_rdi_resume (int pid
, int step
, enum target_signal siggnal
);
63 static int arm_rdi_start_remote (char *dummy
);
65 static void arm_rdi_open (char *name
, int from_tty
);
67 static void arm_rdi_create_inferior (char *exec_file
, char *args
, char **env
);
69 static void arm_rdi_close (int quitting
);
71 static void arm_rdi_store_registers (int regno
);
73 static void arm_rdi_mourn (void);
75 static void arm_rdi_send (char *buf
);
77 static int arm_rdi_wait (int pid
, struct target_waitstatus
*status
);
79 static void arm_rdi_kill (void);
81 static void arm_rdi_detach (char *args
, int from_tty
);
83 static void arm_rdi_interrupt (int signo
);
85 static void arm_rdi_interrupt_twice (int signo
);
87 static void interrupt_query (void);
89 static int arm_rdi_insert_breakpoint (CORE_ADDR
, char *);
91 static int arm_rdi_remove_breakpoint (CORE_ADDR
, char *);
93 static char *rdi_error_message (int err
);
95 static enum target_signal
rdi_error_signal (int err
);
97 /* Global variables. */
99 struct target_ops arm_rdi_ops
;
101 static struct Dbg_ConfigBlock gdb_config
;
103 static struct Dbg_HostosInterface gdb_hostif
;
105 static int max_load_size
;
107 static int execute_status
;
109 /* Send heatbeat packets? */
110 static int rdi_heartbeat
= 0;
112 /* Target has ROM at address 0. */
113 static int rom_at_zero
= 0;
115 /* Enable logging? */
116 static int log_enable
= 0;
118 /* Name of the log file. Default is "rdi.log". */
119 static char *log_filename
;
121 /* A little list of breakpoints that have been set. */
123 static struct local_bp_list_entry
127 struct local_bp_list_entry
*next
;
132 /* Stub for catch_errors. */
135 arm_rdi_start_remote (dummy
)
141 /* Helper callbacks for the "host interface" structure. RDI functions call
142 these to forward output from the target system and so forth. */
147 fprintf_unfiltered (gdb_stdout
, "void dummy\n");
151 myprint (arg
, format
, ap
)
156 vfprintf_unfiltered (gdb_stdout
, format
, ap
);
165 fputc_unfiltered (c
, gdb_stdout
);
169 mywrite (arg
, buffer
, len
)
178 for (i
= 0; i
< len
; i
++)
180 if (isascii ((int) *e
))
182 fputc_unfiltered ((int) *e
, gdb_stdout
);
196 /* These last two are tricky as we have to handle the special case of
197 being interrupted more carefully */
203 return fgetc (stdin
);
207 mygets (arg
, buffer
, len
)
212 return fgets (buffer
, len
, stdin
);
215 /* Prevent multiple calls to angel_RDI_close(). */
216 static int closed_already
= 1;
218 /* Open a connection to a remote debugger. NAME is the filename used
219 for communication. */
222 arm_rdi_open (name
, from_tty
)
227 unsigned long arg1
, arg2
;
228 char *openArgs
= NULL
;
229 char *devName
= NULL
;
233 error ("To open an RDI connection, you need to specify what serial\n\
234 device is attached to the remote system (e.g. /dev/ttya).");
236 /* split name after whitespace, pass tail as arg to open command */
238 devName
= xstrdup (name
);
239 p
= strchr (devName
, ' ');
251 /* Make the basic low-level connection. */
254 rslt
= Adp_OpenDevice (devName
, openArgs
, rdi_heartbeat
);
257 error ("Could not open device \"%s\"", name
);
259 gdb_config
.bytesex
= 2 | (TARGET_BYTE_ORDER
== BIG_ENDIAN
? 1 : 0);
261 gdb_config
.rditype
= 2;
262 gdb_config
.heartbeat_on
= 1;
263 gdb_config
.flags
= 2;
265 gdb_hostif
.dbgprint
= myprint
;
266 gdb_hostif
.dbgpause
= mypause
;
267 gdb_hostif
.dbgarg
= NULL
;
268 gdb_hostif
.writec
= mywritec
;
269 gdb_hostif
.readc
= myreadc
;
270 gdb_hostif
.write
= mywrite
;
271 gdb_hostif
.gets
= mygets
;
272 gdb_hostif
.hostosarg
= NULL
;
273 gdb_hostif
.reset
= voiddummy
;
275 rslt
= angel_RDI_open (10, &gdb_config
, &gdb_hostif
, NULL
);
276 if (rslt
== RDIError_BigEndian
|| rslt
== RDIError_LittleEndian
)
277 ; /* do nothing, this is the expected return */
280 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
282 error ("RID_open failed\n");
285 rslt
= angel_RDI_info (RDIInfo_Target
, &arg1
, &arg2
);
288 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
290 rslt
= angel_RDI_info (RDIInfo_Points
, &arg1
, &arg2
);
293 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
295 rslt
= angel_RDI_info (RDIInfo_Step
, &arg1
, &arg2
);
298 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
300 rslt
= angel_RDI_info (RDIInfo_CoPro
, &arg1
, &arg2
);
303 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
305 rslt
= angel_RDI_info (RDIInfo_SemiHosting
, &arg1
, &arg2
);
308 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
311 rslt
= angel_RDI_info (RDIInfo_GetLoadSize
, &arg1
, &arg2
);
314 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
316 max_load_size
= arg1
;
318 push_target (&arm_rdi_ops
);
320 target_fetch_registers (-1);
322 rslt
= angel_RDI_open (1, &gdb_config
, NULL
, NULL
);
325 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt
));
328 arg1
= rom_at_zero
? 0x0 : 0x13b;
330 rslt
= angel_RDI_info (RDIVector_Catch
, &arg1
, &arg2
);
333 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
336 arg1
= (unsigned long) "";
337 rslt
= angel_RDI_info (RDISet_Cmdline
, &arg1
, &arg2
);
340 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
343 /* Clear out any existing records of breakpoints. */
345 struct local_bp_list_entry
*entry
, *preventry
= NULL
;
347 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
354 printf_filtered ("Connected to ARM RDI target.\n");
359 /* Start an inferior process and set inferior_pid to its pid.
360 EXEC_FILE is the file to run.
361 ARGS is a string containing the arguments to the program.
362 ENV is the environment vector to pass. Errors reported with error().
363 On VxWorks and various standalone systems, we ignore exec_file. */
364 /* This is called not only when we first attach, but also when the
365 user types "run" after having attached. */
368 arm_rdi_create_inferior (exec_file
, args
, env
)
374 unsigned long arg1
, arg2
;
376 CORE_ADDR entry_point
;
378 if (exec_file
== 0 || exec_bfd
== 0)
379 error ("No executable file specified.");
381 entry_point
= (CORE_ADDR
) bfd_get_start_address (exec_bfd
);
384 remove_breakpoints ();
385 init_wait_for_inferior ();
387 len
= strlen (exec_file
) + 1 + strlen (args
) + 1 + /*slop */ 10;
388 arg_buf
= (char *) alloca (len
);
390 strcat (arg_buf
, exec_file
);
391 strcat (arg_buf
, " ");
392 strcat (arg_buf
, args
);
395 insert_breakpoints (); /* Needed to get correct instruction in cache */
401 if (strncmp (*env
, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0)
403 unsigned long top_of_memory
;
406 /* Set up memory limit */
407 top_of_memory
= strtoul (*env
+ sizeof ("MEMSIZE=") - 1,
409 printf_filtered ("Setting top-of-memory to 0x%lx\n",
412 rslt
= angel_RDI_info (RDIInfo_SetTopMem
, &top_of_memory
, &arg2
);
415 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
422 arg1
= (unsigned long) arg_buf
;
423 rslt
= angel_RDI_info (RDISet_Cmdline
, /* &arg1 */ (unsigned long *) arg_buf
, &arg2
);
426 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt
));
429 proceed (entry_point
, TARGET_SIGNAL_DEFAULT
, 0);
432 /* This takes a program previously attached to and detaches it. After
433 this is done, GDB can be used to debug some other program. We
434 better not have left any breakpoints in the target program or it'll
435 die when it hits one. */
438 arm_rdi_detach (args
, from_tty
)
445 /* Clean up connection to a remote debugger. */
448 arm_rdi_close (quitting
)
455 rslt
= angel_RDI_close ();
458 printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt
));
463 generic_mourn_inferior ();
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 /* We remove the inserted breakpoints in case the user wants to
742 issue another target and load commands to rerun his application;
743 This is something that wouldn't work on a native target, for instance,
744 as the process goes away when the inferior exits, but it works with
745 some remote targets like this one. That is why this is done here. */
746 remove_breakpoints();
747 unpush_target (&arm_rdi_ops
);
748 generic_mourn_inferior ();
751 /* While the RDI library keeps track of its own breakpoints, we need
752 to remember "handles" so that we can delete them later. Since
753 breakpoints get used for stepping, be careful not to leak memory
757 arm_rdi_insert_breakpoint (addr
, contents_cache
)
759 char *contents_cache
;
763 struct local_bp_list_entry
*entry
;
764 int type
= RDIPoint_EQ
;
766 if (arm_pc_is_thumb (addr
) || arm_pc_is_thumb_dummy (addr
))
767 type
|= RDIPoint_16Bit
;
768 rslt
= angel_RDI_setbreak (addr
, type
, 0, &point
);
771 printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt
));
774 (struct local_bp_list_entry
*) xmalloc (sizeof (struct local_bp_list_entry
));
776 entry
->point
= point
;
777 entry
->next
= local_bp_list
;
778 local_bp_list
= entry
;
783 arm_rdi_remove_breakpoint (addr
, contents_cache
)
785 char *contents_cache
;
789 struct local_bp_list_entry
*entry
, *preventry
;
791 for (entry
= local_bp_list
; entry
!= NULL
; entry
= entry
->next
)
793 if (entry
->addr
== addr
)
801 rslt
= angel_RDI_clearbreak (entry
->point
);
804 printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt
));
806 /* Delete the breakpoint entry locally. */
807 if (entry
== local_bp_list
)
809 local_bp_list
= entry
->next
;
813 preventry
->next
= entry
->next
;
821 rdi_error_message (err
)
826 case RDIError_NoError
:
829 return "debuggee reset";
830 case RDIError_UndefinedInstruction
:
831 return "undefined instruction";
832 case RDIError_SoftwareInterrupt
:
833 return "SWI trapped";
834 case RDIError_PrefetchAbort
:
835 return "prefetch abort, execution ran into unmapped memory?";
836 case RDIError_DataAbort
:
837 return "data abort, no memory at specified address?";
838 case RDIError_AddressException
:
839 return "address exception, access >26bit in 26bit mode";
841 return "IRQ, interrupt trapped";
843 return "FIQ, fast interrupt trapped";
845 return "a miscellaneous type of error";
846 case RDIError_BranchThrough0
:
847 return "branch through location 0";
848 case RDIError_NotInitialised
:
849 return "internal error, RDI_open not called first";
850 case RDIError_UnableToInitialise
:
851 return "internal error, target world is broken";
852 case RDIError_WrongByteSex
:
853 return "See Operator: WrongByteSex";
854 case RDIError_UnableToTerminate
:
855 return "See Operator: Unable to Terminate";
856 case RDIError_BadInstruction
:
857 return "bad instruction, illegal to execute this instruction";
858 case RDIError_IllegalInstruction
:
859 return "illegal instruction, the effect of executing it is undefined";
860 case RDIError_BadCPUStateSetting
:
861 return "internal error, tried to set SPSR of user mode";
862 case RDIError_UnknownCoPro
:
863 return "unknown co-processor";
864 case RDIError_UnknownCoProState
:
865 return "cannot execute co-processor request";
866 case RDIError_BadCoProState
:
867 return "recognizably broken co-processor request";
868 case RDIError_BadPointType
:
869 return "internal error, bad point yype";
870 case RDIError_UnimplementedType
:
871 return "internal error, unimplemented type";
872 case RDIError_BadPointSize
:
873 return "internal error, bad point size";
874 case RDIError_UnimplementedSize
:
875 return "internal error, unimplemented size";
876 case RDIError_NoMorePoints
:
877 return "last break/watch point was used";
878 case RDIError_BreakpointReached
:
879 return "breakpoint reached";
880 case RDIError_WatchpointAccessed
:
881 return "watchpoint accessed";
882 case RDIError_NoSuchPoint
:
883 return "attempted to clear non-existent break/watch point";
884 case RDIError_ProgramFinishedInStep
:
885 return "end of the program reached while stepping";
886 case RDIError_UserInterrupt
:
887 return "you pressed Escape";
888 case RDIError_CantSetPoint
:
889 return "no more break/watch points available";
890 case RDIError_IncompatibleRDILevels
:
891 return "incompatible RDI levels";
892 case RDIError_LittleEndian
:
893 return "debuggee is little endian";
894 case RDIError_BigEndian
:
895 return "debuggee is big endian";
896 case RDIError_SoftInitialiseError
:
897 return "recoverable error in RDI initialization";
898 case RDIError_InsufficientPrivilege
:
899 return "internal error, supervisor state not accessible to monitor";
900 case RDIError_UnimplementedMessage
:
901 return "internal error, unimplemented message";
902 case RDIError_UndefinedMessage
:
903 return "internal error, undefined message";
905 return "undefined error message, should reset target";
909 /* Convert the ARM error messages to signals that GDB knows about. */
911 static enum target_signal
912 rdi_error_signal (err
)
917 case RDIError_NoError
:
920 return TARGET_SIGNAL_TERM
; /* ??? */
921 case RDIError_UndefinedInstruction
:
922 return TARGET_SIGNAL_ILL
;
923 case RDIError_SoftwareInterrupt
:
924 case RDIError_PrefetchAbort
:
925 case RDIError_DataAbort
:
926 return TARGET_SIGNAL_TRAP
;
927 case RDIError_AddressException
:
928 return TARGET_SIGNAL_SEGV
;
931 return TARGET_SIGNAL_TRAP
;
933 return TARGET_SIGNAL_TERM
;
934 case RDIError_BranchThrough0
:
935 return TARGET_SIGNAL_TRAP
;
936 case RDIError_NotInitialised
:
937 case RDIError_UnableToInitialise
:
938 case RDIError_WrongByteSex
:
939 case RDIError_UnableToTerminate
:
940 return TARGET_SIGNAL_UNKNOWN
;
941 case RDIError_BadInstruction
:
942 case RDIError_IllegalInstruction
:
943 return TARGET_SIGNAL_ILL
;
944 case RDIError_BadCPUStateSetting
:
945 case RDIError_UnknownCoPro
:
946 case RDIError_UnknownCoProState
:
947 case RDIError_BadCoProState
:
948 case RDIError_BadPointType
:
949 case RDIError_UnimplementedType
:
950 case RDIError_BadPointSize
:
951 case RDIError_UnimplementedSize
:
952 case RDIError_NoMorePoints
:
953 return TARGET_SIGNAL_UNKNOWN
;
954 case RDIError_BreakpointReached
:
955 case RDIError_WatchpointAccessed
:
956 return TARGET_SIGNAL_TRAP
;
957 case RDIError_NoSuchPoint
:
958 case RDIError_ProgramFinishedInStep
:
959 return TARGET_SIGNAL_UNKNOWN
;
960 case RDIError_UserInterrupt
:
961 return TARGET_SIGNAL_INT
;
962 case RDIError_IncompatibleRDILevels
:
963 case RDIError_LittleEndian
:
964 case RDIError_BigEndian
:
965 case RDIError_SoftInitialiseError
:
966 case RDIError_InsufficientPrivilege
:
967 case RDIError_UnimplementedMessage
:
968 case RDIError_UndefinedMessage
:
970 return TARGET_SIGNAL_UNKNOWN
;
974 /* Define the target operations structure. */
979 arm_rdi_ops
.to_shortname
= "rdi";
980 arm_rdi_ops
.to_longname
= "ARM RDI";
981 arm_rdi_ops
.to_doc
= "Use a remote ARM-based computer; via the RDI library.\n\
982 Specify the serial device it is connected to (e.g. /dev/ttya).";
983 arm_rdi_ops
.to_open
= arm_rdi_open
;
984 arm_rdi_ops
.to_close
= arm_rdi_close
;
985 arm_rdi_ops
.to_detach
= arm_rdi_detach
;
986 arm_rdi_ops
.to_resume
= arm_rdi_resume
;
987 arm_rdi_ops
.to_wait
= arm_rdi_wait
;
988 arm_rdi_ops
.to_fetch_registers
= arm_rdi_fetch_registers
;
989 arm_rdi_ops
.to_store_registers
= arm_rdi_store_registers
;
990 arm_rdi_ops
.to_prepare_to_store
= arm_rdi_prepare_to_store
;
991 arm_rdi_ops
.to_xfer_memory
= arm_rdi_xfer_memory
;
992 arm_rdi_ops
.to_files_info
= arm_rdi_files_info
;
993 arm_rdi_ops
.to_insert_breakpoint
= arm_rdi_insert_breakpoint
;
994 arm_rdi_ops
.to_remove_breakpoint
= arm_rdi_remove_breakpoint
;
995 arm_rdi_ops
.to_kill
= arm_rdi_kill
;
996 arm_rdi_ops
.to_load
= generic_load
;
997 arm_rdi_ops
.to_create_inferior
= arm_rdi_create_inferior
;
998 arm_rdi_ops
.to_mourn_inferior
= arm_rdi_mourn_inferior
;
999 arm_rdi_ops
.to_stratum
= process_stratum
;
1000 arm_rdi_ops
.to_has_all_memory
= 1;
1001 arm_rdi_ops
.to_has_memory
= 1;
1002 arm_rdi_ops
.to_has_stack
= 1;
1003 arm_rdi_ops
.to_has_registers
= 1;
1004 arm_rdi_ops
.to_has_execution
= 1;
1005 arm_rdi_ops
.to_magic
= OPS_MAGIC
;
1009 rdilogfile_command (char *arg
, int from_tty
)
1011 if (!arg
|| strlen (arg
) == 0)
1013 printf_filtered ("rdi log file is '%s'\n", log_filename
);
1018 free (log_filename
);
1020 log_filename
= xstrdup (arg
);
1022 Adp_SetLogfile (log_filename
);
1026 rdilogenable_command (char *args
, int from_tty
)
1028 if (!args
|| strlen (args
) == 0)
1030 printf_filtered ("rdi log is %s\n", log_enable
? "enabled" : "disabled");
1034 if (!strcasecmp (args
, "1") ||
1035 !strcasecmp (args
, "y") ||
1036 !strcasecmp (args
, "yes") ||
1037 !strcasecmp (args
, "on") ||
1038 !strcasecmp (args
, "t") ||
1039 !strcasecmp (args
, "true"))
1040 Adp_SetLogEnable (log_enable
= 1);
1041 else if (!strcasecmp (args
, "0") ||
1042 !strcasecmp (args
, "n") ||
1043 !strcasecmp (args
, "no") ||
1044 !strcasecmp (args
, "off") ||
1045 !strcasecmp (args
, "f") ||
1046 !strcasecmp (args
, "false"))
1047 Adp_SetLogEnable (log_enable
= 0);
1049 printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
1050 " try y or n\n", args
);
1054 _initialize_remote_rdi ()
1057 add_target (&arm_rdi_ops
);
1059 log_filename
= xstrdup ("rdi.log");
1060 Adp_SetLogfile (log_filename
);
1061 Adp_SetLogEnable (log_enable
);
1063 add_cmd ("rdilogfile", class_maintenance
,
1065 "Set filename for ADP packet log.\n\
1066 This file is used to log Angel Debugger Protocol packets.\n\
1067 With a single argument, sets the logfile name to that value.\n\
1068 Without an argument, shows the current logfile name.\n\
1069 See also: rdilogenable\n",
1072 add_cmd ("rdilogenable", class_maintenance
,
1073 rdilogenable_command
,
1074 "Set enable logging of ADP packets.\n\
1075 This will log ADP packets exchanged between gdb and the\n\
1076 rdi target device.\n\
1077 An argument of 1,t,true,y,yes will enable.\n\
1078 An argument of 0,f,false,n,no will disabled.\n\
1079 Withough an argument, it will display current state.\n",
1083 (add_set_cmd ("rdiromatzero", no_class
,
1084 var_boolean
, (char *) &rom_at_zero
,
1085 "Set target has ROM at addr 0.\n\
1086 A true value disables vector catching, false enables vector catching.\n\
1087 This is evaluated at the time the 'target rdi' command is executed\n",
1092 (add_set_cmd ("rdiheartbeat", no_class
,
1093 var_boolean
, (char *) &rdi_heartbeat
,
1094 "Set enable for ADP heartbeat packets.\n\
1095 I don't know why you would want this. If you enable them,\n\
1096 it will confuse ARM and EPI JTAG interface boxes as well\n\
1097 as the Angel Monitor.\n",
1102 /* A little dummy to make linking with the library succeed. */