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 PARAMS ((int));
49 /* Prototypes for local functions */
51 static void arm_rdi_files_info PARAMS ((struct target_ops * ignore));
53 static int arm_rdi_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr,
54 int len, int should_write,
55 struct target_ops * target));
57 static void arm_rdi_prepare_to_store PARAMS ((void));
59 static void arm_rdi_fetch_registers PARAMS ((int regno));
61 static void arm_rdi_resume PARAMS ((int pid, int step,
62 enum target_signal siggnal));
64 static int arm_rdi_start_remote PARAMS ((char *dummy));
66 static void arm_rdi_open PARAMS ((char *name, int from_tty));
68 static void arm_rdi_create_inferior PARAMS ((char *exec_file, char *args,
71 static void arm_rdi_close PARAMS ((int quitting));
73 static void arm_rdi_store_registers PARAMS ((int regno));
75 static void arm_rdi_mourn PARAMS ((void));
77 static void arm_rdi_send PARAMS ((char *buf));
79 static int arm_rdi_wait PARAMS ((int pid, struct target_waitstatus * status));
81 static void arm_rdi_kill PARAMS ((void));
83 static void arm_rdi_detach PARAMS ((char *args, int from_tty));
85 static void arm_rdi_interrupt PARAMS ((int signo));
87 static void arm_rdi_interrupt_twice PARAMS ((int signo));
89 static void interrupt_query PARAMS ((void));
91 static int arm_rdi_insert_breakpoint PARAMS ((CORE_ADDR, char *));
93 static int arm_rdi_remove_breakpoint PARAMS ((CORE_ADDR, char *));
95 static char *rdi_error_message PARAMS ((int err));
97 static enum target_signal rdi_error_signal PARAMS ((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 (dummy)
143 /* Helper callbacks for the "host interface" structure. RDI functions call
144 these to forward output from the target system and so forth. */
149 fprintf_unfiltered (gdb_stdout, "void dummy\n");
153 myprint (arg, format, ap)
158 vfprintf_unfiltered (gdb_stdout, format, ap);
167 fputc_unfiltered (c, gdb_stdout);
171 mywrite (arg, buffer, len)
180 for (i = 0; i < len; i++)
182 if (isascii ((int) *e))
184 fputc_unfiltered ((int) *e, gdb_stdout);
198 /* These last two are tricky as we have to handle the special case of
199 being interrupted more carefully */
205 return fgetc (stdin);
209 mygets (arg, buffer, len)
214 return fgets (buffer, len, stdin);
217 /* Prevent multiple calls to angel_RDI_close(). */
218 static int closed_already = 1;
220 /* Open a connection to a remote debugger. NAME is the filename used
221 for communication. */
224 arm_rdi_open (name, from_tty)
229 unsigned long arg1, arg2;
230 char *openArgs = NULL;
231 char *devName = NULL;
235 error ("To open an RDI connection, you need to specify what serial\n\
236 device is attached to the remote system (e.g. /dev/ttya).");
238 /* split name after whitespace, pass tail as arg to open command */
240 devName = xstrdup (name);
241 p = strchr (devName, ' ');
253 /* Make the basic low-level connection. */
256 rslt = Adp_OpenDevice (devName, openArgs, rdi_heartbeat);
259 error ("Could not open device \"%s\"", name);
261 gdb_config.bytesex = 2 | (TARGET_BYTE_ORDER == BIG_ENDIAN ? 1 : 0);
263 gdb_config.rditype = 2;
264 gdb_config.heartbeat_on = 1;
265 gdb_config.flags = 2;
267 gdb_hostif.dbgprint = myprint;
268 gdb_hostif.dbgpause = mypause;
269 gdb_hostif.dbgarg = NULL;
270 gdb_hostif.writec = mywritec;
271 gdb_hostif.readc = myreadc;
272 gdb_hostif.write = mywrite;
273 gdb_hostif.gets = mygets;
274 gdb_hostif.hostosarg = NULL;
275 gdb_hostif.reset = voiddummy;
277 rslt = angel_RDI_open (10, &gdb_config, &gdb_hostif, NULL);
278 if (rslt == RDIError_BigEndian || rslt == RDIError_LittleEndian)
279 ; /* do nothing, this is the expected return */
282 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
284 error ("RID_open failed\n");
287 rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2);
290 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
292 rslt = angel_RDI_info (RDIInfo_Points, &arg1, &arg2);
295 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
297 rslt = angel_RDI_info (RDIInfo_Step, &arg1, &arg2);
300 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
302 rslt = angel_RDI_info (RDIInfo_CoPro, &arg1, &arg2);
305 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
307 rslt = angel_RDI_info (RDIInfo_SemiHosting, &arg1, &arg2);
310 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
313 rslt = angel_RDI_info (RDIInfo_GetLoadSize, &arg1, &arg2);
316 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
318 max_load_size = arg1;
320 push_target (&arm_rdi_ops);
322 target_fetch_registers (-1);
324 rslt = angel_RDI_open (1, &gdb_config, NULL, NULL);
327 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
330 arg1 = rom_at_zero ? 0x0 : 0x13b;
332 rslt = angel_RDI_info (RDIVector_Catch, &arg1, &arg2);
335 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
338 arg1 = (unsigned long) "";
339 rslt = angel_RDI_info (RDISet_Cmdline, &arg1, &arg2);
342 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
345 /* Clear out any existing records of breakpoints. */
347 struct local_bp_list_entry *entry, *preventry = NULL;
349 for (entry = local_bp_list; entry != NULL; entry = entry->next)
356 printf_filtered ("Connected to ARM RDI target.\n");
361 /* Start an inferior process and set inferior_pid to its pid.
362 EXEC_FILE is the file to run.
363 ARGS is a string containing the arguments to the program.
364 ENV is the environment vector to pass. Errors reported with error().
365 On VxWorks and various standalone systems, we ignore exec_file. */
366 /* This is called not only when we first attach, but also when the
367 user types "run" after having attached. */
370 arm_rdi_create_inferior (exec_file, args, env)
376 unsigned long arg1, arg2;
378 CORE_ADDR entry_point;
380 if (exec_file == 0 || exec_bfd == 0)
381 error ("No executable file specified.");
383 entry_point = (CORE_ADDR) bfd_get_start_address (exec_bfd);
386 remove_breakpoints ();
387 init_wait_for_inferior ();
389 len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
390 arg_buf = (char *) alloca (len);
392 strcat (arg_buf, exec_file);
393 strcat (arg_buf, " ");
394 strcat (arg_buf, args);
397 insert_breakpoints (); /* Needed to get correct instruction in cache */
403 if (strncmp (*env, "MEMSIZE=", sizeof ("MEMSIZE=") - 1) == 0)
405 unsigned long top_of_memory;
408 /* Set up memory limit */
409 top_of_memory = strtoul (*env + sizeof ("MEMSIZE=") - 1,
411 printf_filtered ("Setting top-of-memory to 0x%lx\n",
414 rslt = angel_RDI_info (RDIInfo_SetTopMem, &top_of_memory, &arg2);
417 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
424 arg1 = (unsigned long) arg_buf;
425 rslt = angel_RDI_info (RDISet_Cmdline, /* &arg1 */ (unsigned long *) arg_buf, &arg2);
428 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
431 proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0);
434 /* This takes a program previously attached to and detaches it. After
435 this is done, GDB can be used to debug some other program. We
436 better not have left any breakpoints in the target program or it'll
437 die when it hits one. */
440 arm_rdi_detach (args, from_tty)
447 /* Clean up connection to a remote debugger. */
450 arm_rdi_close (quitting)
457 rslt = angel_RDI_close ();
460 printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt));
468 /* Tell the remote machine to resume. */
471 arm_rdi_resume (pid, step, siggnal)
473 enum target_signal siggnal;
478 if (0 /* turn on when hardware supports single-stepping */ )
480 rslt = angel_RDI_step (1, &point);
483 printf_filtered ("RDI_step: %s\n", rdi_error_message (rslt));
493 pc = read_register (PC_REGNUM);
494 pc = arm_get_next_pc (pc);
495 arm_rdi_insert_breakpoint (pc, handle);
497 execute_status = rslt = angel_RDI_execute (&point);
498 if (rslt == RDIError_BreakpointReached)
502 printf_filtered ("RDI_execute: %s\n", rdi_error_message (rslt));
506 arm_rdi_remove_breakpoint (pc, handle);
511 /* Send ^C to target to halt it. Target will respond, and send us a
515 arm_rdi_interrupt (signo)
520 static void (*ofunc) ();
522 /* The user typed ^C twice. */
524 arm_rdi_interrupt_twice (signo)
529 /* Ask the user what to do when an interrupt is received. */
536 /* Wait until the remote machine stops, then return, storing status in
537 STATUS just as `wait' would. Returns "pid" (though it's not clear
538 what, if anything, that means in the case of this target). */
541 arm_rdi_wait (pid, status)
543 struct target_waitstatus *status;
545 status->kind = (execute_status == RDIError_NoError ?
546 TARGET_WAITKIND_EXITED : TARGET_WAITKIND_STOPPED);
548 /* convert stopped code from target into right signal */
549 status->value.sig = rdi_error_signal (execute_status);
554 /* Read the remote registers into the block REGS. */
558 arm_rdi_fetch_registers (regno)
561 int rslt, rdi_regmask;
562 unsigned long rawreg, rawregs[32];
567 rslt = angel_RDI_CPUread (255, 0x27fff, rawregs);
570 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt));
573 for (regno = 0; regno < 15; regno++)
575 store_unsigned_integer (cookedreg, 4, rawregs[regno]);
576 supply_register (regno, (char *) cookedreg);
578 store_unsigned_integer (cookedreg, 4, rawregs[15]);
579 supply_register (PS_REGNUM, (char *) cookedreg);
580 arm_rdi_fetch_registers (PC_REGNUM);
584 if (regno == PC_REGNUM)
585 rdi_regmask = RDIReg_PC;
586 else if (regno == PS_REGNUM)
587 rdi_regmask = RDIReg_CPSR;
588 else if (regno < 0 || regno > 15)
591 supply_register (regno, (char *) &rawreg);
595 rdi_regmask = 1 << regno;
597 rslt = angel_RDI_CPUread (255, rdi_regmask, &rawreg);
600 printf_filtered ("RDI_CPUread: %s\n", rdi_error_message (rslt));
602 store_unsigned_integer (cookedreg, 4, rawreg);
603 supply_register (regno, (char *) cookedreg);
608 arm_rdi_prepare_to_store ()
613 /* Store register REGNO, or all registers if REGNO == -1, from the contents
614 of REGISTERS. FIXME: ignores errors. */
617 arm_rdi_store_registers (regno)
620 int rslt, rdi_regmask;
622 /* These need to be able to take 'floating point register' contents */
623 unsigned long rawreg[3], rawerreg[3];
627 for (regno = 0; regno < NUM_REGS; regno++)
628 arm_rdi_store_registers (regno);
632 read_register_gen (regno, (char *) rawreg);
633 /* RDI manipulates data in host byte order, so convert now. */
634 store_unsigned_integer (rawerreg, 4, rawreg[0]);
636 if (regno == PC_REGNUM)
637 rdi_regmask = RDIReg_PC;
638 else if (regno == PS_REGNUM)
639 rdi_regmask = RDIReg_CPSR;
640 else if (regno < 0 || regno > 15)
643 rdi_regmask = 1 << regno;
645 rslt = angel_RDI_CPUwrite (255, rdi_regmask, rawerreg);
648 printf_filtered ("RDI_CPUwrite: %s\n", rdi_error_message (rslt));
653 /* Read or write LEN bytes from inferior memory at MEMADDR,
654 transferring to or from debugger address MYADDR. Write to inferior
655 if SHOULD_WRITE is nonzero. Returns length of data written or
656 read; 0 for error. */
660 arm_rdi_xfer_memory (memaddr, myaddr, len, should_write, target)
665 struct target_ops *target; /* ignored */
671 rslt = angel_RDI_write (myaddr, memaddr, &len);
674 printf_filtered ("RDI_write: %s\n", rdi_error_message (rslt));
679 rslt = angel_RDI_read (memaddr, myaddr, &len);
682 printf_filtered ("RDI_read: %s\n", rdi_error_message (rslt));
689 /* Display random info collected from the target. */
692 arm_rdi_files_info (ignore)
693 struct target_ops *ignore;
695 char *file = "nothing";
697 unsigned long arg1, arg2;
699 rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2);
702 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
704 if (arg1 & (1 << 15))
705 printf_filtered ("Target supports Thumb code.\n");
706 if (arg1 & (1 << 14))
707 printf_filtered ("Target can do profiling.\n");
709 printf_filtered ("Target is real hardware.\n");
711 rslt = angel_RDI_info (RDIInfo_Step, &arg1, &arg2);
714 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
716 printf_filtered ("Target can%s single-step.\n", (arg1 & 0x4 ? "" : "not"));
718 rslt = angel_RDI_info (RDIInfo_Icebreaker, &arg1, &arg2);
721 printf_filtered ("RDI_info: %s\n", rdi_error_message (rslt));
724 printf_filtered ("Target includes an EmbeddedICE.\n");
732 rslt = angel_RDI_open (1, &gdb_config, NULL, NULL);
735 printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
740 arm_rdi_mourn_inferior ()
742 /* We remove the inserted breakpoints in case the user wants to
743 issue another target and load commands to rerun his application;
744 This is something that wouldn't work on a native target, for instance,
745 as the process goes away when the inferior exits, but it works with
746 some remote targets like this one. That is why this is done here. */
747 remove_breakpoints();
748 unpush_target (&arm_rdi_ops);
749 generic_mourn_inferior ();
752 /* While the RDI library keeps track of its own breakpoints, we need
753 to remember "handles" so that we can delete them later. Since
754 breakpoints get used for stepping, be careful not to leak memory
758 arm_rdi_insert_breakpoint (addr, contents_cache)
760 char *contents_cache;
764 struct local_bp_list_entry *entry;
765 int type = RDIPoint_EQ;
767 if (arm_pc_is_thumb (addr) || arm_pc_is_thumb_dummy (addr))
768 type |= RDIPoint_16Bit;
769 rslt = angel_RDI_setbreak (addr, type, 0, &point);
772 printf_filtered ("RDI_setbreak: %s\n", rdi_error_message (rslt));
775 (struct local_bp_list_entry *) xmalloc (sizeof (struct local_bp_list_entry));
777 entry->point = point;
778 entry->next = local_bp_list;
779 local_bp_list = entry;
784 arm_rdi_remove_breakpoint (addr, contents_cache)
786 char *contents_cache;
790 struct local_bp_list_entry *entry, *preventry;
792 for (entry = local_bp_list; entry != NULL; entry = entry->next)
794 if (entry->addr == addr)
802 rslt = angel_RDI_clearbreak (entry->point);
805 printf_filtered ("RDI_clearbreak: %s\n", rdi_error_message (rslt));
807 /* Delete the breakpoint entry locally. */
808 if (entry == local_bp_list)
810 local_bp_list = entry->next;
814 preventry->next = entry->next;
822 rdi_error_message (err)
827 case RDIError_NoError:
830 return "debuggee reset";
831 case RDIError_UndefinedInstruction:
832 return "undefined instruction";
833 case RDIError_SoftwareInterrupt:
834 return "SWI trapped";
835 case RDIError_PrefetchAbort:
836 return "prefetch abort, execution ran into unmapped memory?";
837 case RDIError_DataAbort:
838 return "data abort, no memory at specified address?";
839 case RDIError_AddressException:
840 return "address exception, access >26bit in 26bit mode";
842 return "IRQ, interrupt trapped";
844 return "FIQ, fast interrupt trapped";
846 return "a miscellaneous type of error";
847 case RDIError_BranchThrough0:
848 return "branch through location 0";
849 case RDIError_NotInitialised:
850 return "internal error, RDI_open not called first";
851 case RDIError_UnableToInitialise:
852 return "internal error, target world is broken";
853 case RDIError_WrongByteSex:
854 return "See Operator: WrongByteSex";
855 case RDIError_UnableToTerminate:
856 return "See Operator: Unable to Terminate";
857 case RDIError_BadInstruction:
858 return "bad instruction, illegal to execute this instruction";
859 case RDIError_IllegalInstruction:
860 return "illegal instruction, the effect of executing it is undefined";
861 case RDIError_BadCPUStateSetting:
862 return "internal error, tried to set SPSR of user mode";
863 case RDIError_UnknownCoPro:
864 return "unknown co-processor";
865 case RDIError_UnknownCoProState:
866 return "cannot execute co-processor request";
867 case RDIError_BadCoProState:
868 return "recognizably broken co-processor request";
869 case RDIError_BadPointType:
870 return "internal error, bad point yype";
871 case RDIError_UnimplementedType:
872 return "internal error, unimplemented type";
873 case RDIError_BadPointSize:
874 return "internal error, bad point size";
875 case RDIError_UnimplementedSize:
876 return "internal error, unimplemented size";
877 case RDIError_NoMorePoints:
878 return "last break/watch point was used";
879 case RDIError_BreakpointReached:
880 return "breakpoint reached";
881 case RDIError_WatchpointAccessed:
882 return "watchpoint accessed";
883 case RDIError_NoSuchPoint:
884 return "attempted to clear non-existent break/watch point";
885 case RDIError_ProgramFinishedInStep:
886 return "end of the program reached while stepping";
887 case RDIError_UserInterrupt:
888 return "you pressed Escape";
889 case RDIError_CantSetPoint:
890 return "no more break/watch points available";
891 case RDIError_IncompatibleRDILevels:
892 return "incompatible RDI levels";
893 case RDIError_LittleEndian:
894 return "debuggee is little endian";
895 case RDIError_BigEndian:
896 return "debuggee is big endian";
897 case RDIError_SoftInitialiseError:
898 return "recoverable error in RDI initialization";
899 case RDIError_InsufficientPrivilege:
900 return "internal error, supervisor state not accessible to monitor";
901 case RDIError_UnimplementedMessage:
902 return "internal error, unimplemented message";
903 case RDIError_UndefinedMessage:
904 return "internal error, undefined message";
906 return "undefined error message, should reset target";
910 /* Convert the ARM error messages to signals that GDB knows about. */
912 static enum target_signal
913 rdi_error_signal (err)
918 case RDIError_NoError:
921 return TARGET_SIGNAL_TERM; /* ??? */
922 case RDIError_UndefinedInstruction:
923 return TARGET_SIGNAL_ILL;
924 case RDIError_SoftwareInterrupt:
925 case RDIError_PrefetchAbort:
926 case RDIError_DataAbort:
927 return TARGET_SIGNAL_TRAP;
928 case RDIError_AddressException:
929 return TARGET_SIGNAL_SEGV;
932 return TARGET_SIGNAL_TRAP;
934 return TARGET_SIGNAL_TERM;
935 case RDIError_BranchThrough0:
936 return TARGET_SIGNAL_TRAP;
937 case RDIError_NotInitialised:
938 case RDIError_UnableToInitialise:
939 case RDIError_WrongByteSex:
940 case RDIError_UnableToTerminate:
941 return TARGET_SIGNAL_UNKNOWN;
942 case RDIError_BadInstruction:
943 case RDIError_IllegalInstruction:
944 return TARGET_SIGNAL_ILL;
945 case RDIError_BadCPUStateSetting:
946 case RDIError_UnknownCoPro:
947 case RDIError_UnknownCoProState:
948 case RDIError_BadCoProState:
949 case RDIError_BadPointType:
950 case RDIError_UnimplementedType:
951 case RDIError_BadPointSize:
952 case RDIError_UnimplementedSize:
953 case RDIError_NoMorePoints:
954 return TARGET_SIGNAL_UNKNOWN;
955 case RDIError_BreakpointReached:
956 case RDIError_WatchpointAccessed:
957 return TARGET_SIGNAL_TRAP;
958 case RDIError_NoSuchPoint:
959 case RDIError_ProgramFinishedInStep:
960 return TARGET_SIGNAL_UNKNOWN;
961 case RDIError_UserInterrupt:
962 return TARGET_SIGNAL_INT;
963 case RDIError_IncompatibleRDILevels:
964 case RDIError_LittleEndian:
965 case RDIError_BigEndian:
966 case RDIError_SoftInitialiseError:
967 case RDIError_InsufficientPrivilege:
968 case RDIError_UnimplementedMessage:
969 case RDIError_UndefinedMessage:
971 return TARGET_SIGNAL_UNKNOWN;
975 /* Define the target operations structure. */
980 arm_rdi_ops.to_shortname = "rdi";
981 arm_rdi_ops.to_longname = "ARM RDI";
982 arm_rdi_ops.to_doc = "Use a remote ARM-based computer; via the RDI library.\n\
983 Specify the serial device it is connected to (e.g. /dev/ttya).";
984 arm_rdi_ops.to_open = arm_rdi_open;
985 arm_rdi_ops.to_close = arm_rdi_close;
986 arm_rdi_ops.to_detach = arm_rdi_detach;
987 arm_rdi_ops.to_resume = arm_rdi_resume;
988 arm_rdi_ops.to_wait = arm_rdi_wait;
989 arm_rdi_ops.to_fetch_registers = arm_rdi_fetch_registers;
990 arm_rdi_ops.to_store_registers = arm_rdi_store_registers;
991 arm_rdi_ops.to_prepare_to_store = arm_rdi_prepare_to_store;
992 arm_rdi_ops.to_xfer_memory = arm_rdi_xfer_memory;
993 arm_rdi_ops.to_files_info = arm_rdi_files_info;
994 arm_rdi_ops.to_insert_breakpoint = arm_rdi_insert_breakpoint;
995 arm_rdi_ops.to_remove_breakpoint = arm_rdi_remove_breakpoint;
996 arm_rdi_ops.to_kill = arm_rdi_kill;
997 arm_rdi_ops.to_load = generic_load;
998 arm_rdi_ops.to_create_inferior = arm_rdi_create_inferior;
999 arm_rdi_ops.to_mourn_inferior = arm_rdi_mourn_inferior;
1000 arm_rdi_ops.to_stratum = process_stratum;
1001 arm_rdi_ops.to_has_all_memory = 1;
1002 arm_rdi_ops.to_has_memory = 1;
1003 arm_rdi_ops.to_has_stack = 1;
1004 arm_rdi_ops.to_has_registers = 1;
1005 arm_rdi_ops.to_has_execution = 1;
1006 arm_rdi_ops.to_magic = OPS_MAGIC;
1010 rdilogfile_command (char *arg, int from_tty)
1012 if (!arg || strlen (arg) == 0)
1014 printf_filtered ("rdi log file is '%s'\n", log_filename);
1019 free (log_filename);
1021 log_filename = xstrdup (arg);
1023 Adp_SetLogfile (log_filename);
1027 rdilogenable_command (char *args, int from_tty)
1029 if (!args || strlen (args) == 0)
1031 printf_filtered ("rdi log is %s\n", log_enable ? "enabled" : "disabled");
1035 if (!strcasecmp (args, "1") ||
1036 !strcasecmp (args, "y") ||
1037 !strcasecmp (args, "yes") ||
1038 !strcasecmp (args, "on") ||
1039 !strcasecmp (args, "t") ||
1040 !strcasecmp (args, "true"))
1041 Adp_SetLogEnable (log_enable = 1);
1042 else if (!strcasecmp (args, "0") ||
1043 !strcasecmp (args, "n") ||
1044 !strcasecmp (args, "no") ||
1045 !strcasecmp (args, "off") ||
1046 !strcasecmp (args, "f") ||
1047 !strcasecmp (args, "false"))
1048 Adp_SetLogEnable (log_enable = 0);
1050 printf_filtered ("rdilogenable: unrecognized argument '%s'\n"
1051 " try y or n\n", args);
1055 _initialize_remote_rdi ()
1058 add_target (&arm_rdi_ops);
1060 log_filename = xstrdup ("rdi.log");
1061 Adp_SetLogfile (log_filename);
1062 Adp_SetLogEnable (log_enable);
1064 add_cmd ("rdilogfile", class_maintenance,
1066 "Set filename for ADP packet log.\n\
1067 This file is used to log Angel Debugger Protocol packets.\n\
1068 With a single argument, sets the logfile name to that value.\n\
1069 Without an argument, shows the current logfile name.\n\
1070 See also: rdilogenable\n",
1073 add_cmd ("rdilogenable", class_maintenance,
1074 rdilogenable_command,
1075 "Set enable logging of ADP packets.\n\
1076 This will log ADP packets exchanged between gdb and the\n\
1077 rdi target device.\n\
1078 An argument of 1,t,true,y,yes will enable.\n\
1079 An argument of 0,f,false,n,no will disabled.\n\
1080 Withough an argument, it will display current state.\n",
1084 (add_set_cmd ("rdiromatzero", no_class,
1085 var_boolean, (char *) &rom_at_zero,
1086 "Set target has ROM at addr 0.\n\
1087 A true value disables vector catching, false enables vector catching.\n\
1088 This is evaluated at the time the 'target rdi' command is executed\n",
1093 (add_set_cmd ("rdiheartbeat", no_class,
1094 var_boolean, (char *) &rdi_heartbeat,
1095 "Set enable for ADP heartbeat packets.\n\
1096 I don't know why you would want this. If you enable them,\n\
1097 it will confuse ARM and EPI JTAG interface boxes as well\n\
1098 as the Angel Monitor.\n",
1103 /* A little dummy to make linking with the library succeed. */