1 /* Remote debugging for the ARM RDP interface.
2 Copyright 1994, 1995 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, Boston, MA 02111-1307, USA.
25 Much of this file (in particular the SWI stuff) is based on code by
28 I hacked on and simplified it by removing a lot of sexy features he
29 had added, and some of the (unix specific) workarounds he'd done
30 for other GDB problems - which if they still exist should be fixed
31 in GDB, not in a remote-foo thing . I also made it conform more to
32 the doc I have; which may be wrong.
44 #ifdef ANSI_PROTOTYPES
52 #include "remote-utils.h"
53 #include "gdb_string.h"
60 extern struct target_ops remote_rdp_ops;
62 static host_callback *callback = &default_callback;
71 char command_line[10];
73 int rdi_stopped_status;
79 /* Definitions for the RDP protocol. */
81 #define RDP_MOUTHFULL (1<<6)
82 #define FPU_COPRO_NUMBER 1
85 #define RDP_OPEN_TYPE_COLD 0
86 #define RDP_OPEN_TYPE_WARM 1
87 #define RDP_OPEN_TYPE_BAUDRATE 2
89 #define RDP_OPEN_BAUDRATE_9600 1
90 #define RDP_OPEN_BAUDRATE_19200 2
91 #define RDP_OPEN_BAUDRATE_38400 3
93 #define RDP_OPEN_TYPE_RETURN_SEX (1<<3)
97 #define RDP_MEM_READ 2
99 #define RDP_MEM_WRITE 3
101 #define RDP_CPU_READ 4
102 #define RDP_CPU_WRITE 5
103 #define RDP_CPU_READWRITE_MODE_CURRENT 255
104 #define RDP_CPU_READWRITE_MASK_PC (1<<16)
105 #define RDP_CPU_READWRITE_MASK_CPSR (1<<17)
106 #define RDP_CPU_READWRITE_MASK_SPSR (1<<18)
108 #define RDP_COPRO_READ 6
109 #define RDP_COPRO_WRITE 7
110 #define RDP_FPU_READWRITE_MASK_FPS (1<<8)
112 #define RDP_SET_BREAK 0xa
113 #define RDP_SET_BREAK_TYPE_PC_EQUAL 0
114 #define RDP_SET_BREAK_TYPE_GET_HANDLE (0x10)
116 #define RDP_CLEAR_BREAK 0xb
118 #define RDP_EXEC 0x10
119 #define RDP_EXEC_TYPE_SYNC 0
121 #define RDP_STEP 0x11
123 #define RDP_INFO 0x12
124 #define RDP_INFO_ABOUT_STEP 2
125 #define RDP_INFO_ABOUT_STEP_GT_1 1
126 #define RDP_INFO_ABOUT_STEP_TO_JMP 2
127 #define RDP_INFO_ABOUT_STEP_1 4
128 #define RDP_INFO_ABOUT_TARGET 0
129 #define RDP_INFO_ABOUT_BREAK 1
130 #define RDP_INFO_ABOUT_BREAK_COMP 1
131 #define RDP_INFO_ABOUT_BREAK_RANGE 2
132 #define RDP_INFO_ABOUT_BREAK_BYTE_READ 4
133 #define RDP_INFO_ABOUT_BREAK_HALFWORD_READ 8
134 #define RDP_INFO_ABOUT_BREAK_WORD_READ (1<<4)
135 #define RDP_INFO_ABOUT_BREAK_BYTE_WRITE (1<<5)
136 #define RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE (1<<6)
137 #define RDP_INFO_ABOUT_BREAK_WORD_WRITE (1<<7)
138 #define RDP_INFO_ABOUT_BREAK_MASK (1<<8)
139 #define RDP_INFO_ABOUT_BREAK_THREAD_BREAK (1<<9)
140 #define RDP_INFO_ABOUT_BREAK_THREAD_WATCH (1<<10)
141 #define RDP_INFO_ABOUT_BREAK_COND (1<<11)
142 #define RDP_INFO_VECTOR_CATCH (0x180)
143 #define RDP_INFO_ICEBREAKER (7)
144 #define RDP_INFO_SET_CMDLINE (0x300)
146 #define RDP_SELECT_CONFIG (0x16)
147 #define RDI_ConfigCPU 0
148 #define RDI_ConfigSystem 1
149 #define RDI_MatchAny 0
150 #define RDI_MatchExactly 1
151 #define RDI_MatchNoEarlier 2
153 #define RDP_RESET 0x7f
155 /* Returns from RDP */
156 #define RDP_RES_STOPPED 0x20
157 #define RDP_RES_SWI 0x21
158 #define RDP_RES_FATAL 0x5e
159 #define RDP_RES_VALUE 0x5f
160 #define RDP_RES_VALUE_LITTLE_ENDIAN 240
161 #define RDP_RES_VALUE_BIG_ENDIAN 241
162 #define RDP_RES_RESET 0x7f
163 #define RDP_RES_AT_BREAKPOINT 143
164 #define RDP_RES_IDUNNO 0xe6
165 #define RDP_OSOpReply 0x13
166 #define RDP_OSOpWord 2
167 #define RDP_OSOpNothing 0
169 static int timeout = 2;
171 static char * commandline = NULL;
174 remote_rdp_xfer_inferior_memory PARAMS ((CORE_ADDR memaddr,
178 struct target_ops * target));
181 /* Stuff for talking to the serial layer. */
186 int c = SERIAL_READCHAR (io, timeout);
189 printf ("[%02x]\n", c);
191 if (c == SERIAL_TIMEOUT)
194 return (unsigned char) c;
196 error ("Timeout reading from remote_system");
202 /* Note that the target always speaks little-endian to us,
203 even if it's a big endian machine. */
207 unsigned int val = 0;
210 for (n = 0; n < 4; n++)
223 printf ("(%02x)\n", val);
224 SERIAL_WRITE (io, &val, 1);
231 /* We always send in little endian */
239 printf ("(%04x)", val);
241 SERIAL_WRITE (io, b, 4);
246 /* Stuff for talking to the RDP layer. */
248 /* This is a bit more fancy that need be so that it syncs even in nasty cases.
250 I'be been unable to make it reliably sync up with the change
251 baudrate open command. It likes to sit and say it's been reset,
252 with no more action. So I took all that code out. I'd rather sync
253 reliably at 9600 than wait forever for a possible 19200 connection.
262 int type = cold ? RDP_OPEN_TYPE_COLD : RDP_OPEN_TYPE_WARM;
265 time_t now = time (0);
266 time_t stop_time = now + 10; /* Try and sync for 10 seconds, then give up */
269 while (time (0) < stop_time && !sync)
274 SERIAL_FLUSH_INPUT (io);
275 SERIAL_FLUSH_OUTPUT (io);
278 printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
281 ** It seems necessary to reset an EmbeddedICE to get it going.
282 ** This has the side benefit of displaying the startup banner.
286 put_byte (RDP_RESET);
287 while ((restype = SERIAL_READCHAR (io, 1)) > 0)
294 /* Sent at start of reset process: ignore */
297 printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
304 /* Got end-of-banner mark */
305 printf_filtered ("\n");
311 put_byte (type | RDP_OPEN_TYPE_RETURN_SEX );
314 while (!sync && (restype = SERIAL_READCHAR (io, 1)) > 0)
317 printf_unfiltered ("[%02x]\n", restype);
324 while ((restype = SERIAL_READCHAR (io, 1)) == RDP_RESET)
326 while ((restype = SERIAL_READCHAR (io, 1)) > 0)
328 printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
330 while ((restype = SERIAL_READCHAR (io, 1)) > 0)
334 printf_unfiltered ("\nThe board has sent notification that it was reset.\n");
335 printf_unfiltered ("Waiting for it to settle down...\n");
339 printf_unfiltered ("\nTrying again.\n");
345 int resval = SERIAL_READCHAR (io, 1);
348 printf_unfiltered ("[%02x]\n", resval);
354 case RDP_RES_VALUE_LITTLE_ENDIAN:
355 target_byte_order = LITTLE_ENDIAN;
358 case RDP_RES_VALUE_BIG_ENDIAN:
359 target_byte_order = BIG_ENDIAN;
372 error ("Couldn't reset the board, try pressing the reset button");
377 #ifdef ANSI_PROTOTYPES
379 send_rdp (char *template,...)
382 send_rdp (char *template, va_alist)
389 #ifdef ANSI_PROTOTYPES
390 va_start (alist, template);
405 val = va_arg (alist, int);
409 val = va_arg (alist, int);
417 if (val != RDP_RES_VALUE)
419 printf_unfiltered ("got bad res value of %d, %x\n", val, val);
423 pstat = va_arg (alist, int *);
424 pi = va_arg (alist, int *);
426 *pstat = get_byte ();
427 /* Check the result was zero, if not read the syndrome */
434 /* Check the result code */
441 /* Target can't do it; never mind */
442 printf_unfiltered ("RDP: Insufficient privilege\n");
445 /* Target can't do it; never mind */
446 printf_unfiltered ("RDP: Unimplemented message\n");
449 error ("Command garbled");
452 error ("Corrupt reply from target");
457 /* Read a word from the target */
458 pi = va_arg (alist, int *);
462 /* Read in some bytes from the target. */
463 pc = va_arg (alist, char *);
464 val = va_arg (alist, int);
465 for (i = 0; i < val; i++)
471 /* send what's being pointed at */
472 pc = va_arg (alist, char *);
473 val = va_arg (alist, int);
475 SERIAL_WRITE (io, pc, val);
478 /* Send whats in the queue */
481 SERIAL_WRITE (io, buf, dst - buf);
486 pi = va_arg (alist, int *);
501 rdp_write (memaddr, buf, len)
509 send_rdp ("bww-p-SV", RDP_MEM_WRITE, memaddr, len, buf, len, &res, &val);
520 rdp_read (memaddr, buf, len)
527 send_rdp ("bww-S-P-V",
528 RDP_MEM_READ, memaddr, len,
539 rdp_fetch_one_register (mask, buf)
544 send_rdp ("bbw-SWZ", RDP_CPU_READ, RDP_CPU_READWRITE_MODE_CURRENT, mask, &val);
545 store_signed_integer (buf, 4, val);
549 rdp_fetch_one_fpu_register (mask, buf)
554 /* !!! Since the PIE board doesn't work as documented,
555 and it doesn't have FPU hardware anyway and since it
556 slows everything down, I've disabled this. */
558 if (mask == RDP_FPU_READWRITE_MASK_FPS)
560 /* this guy is only a word */
561 send_rdp ("bbw-SWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, &val);
562 store_signed_integer (buf, 4, val);
566 /* There are 12 bytes long
567 !! fixme about endianness
569 int dummy; /* I've seen these come back as four words !! */
570 send_rdp ("bbw-SWWWWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, buf + 0, buf + 4, buf + 8, &dummy);
573 memset (buf, 0, MAX_REGISTER_RAW_SIZE);
578 rdp_store_one_register (mask, buf)
582 int val = extract_unsigned_integer (buf, 4);
585 RDP_CPU_WRITE, RDP_CPU_READWRITE_MODE_CURRENT, mask, val);
590 rdp_store_one_fpu_register (mask, buf)
595 /* See comment in fetch_one_fpu_register */
596 if (mask == RDP_FPU_READWRITE_MASK_FPS)
598 int val = extract_unsigned_integer (buf, 4);
599 /* this guy is only a word */
600 send_rdp ("bbww-SZ", RDP_COPRO_WRITE,
606 /* There are 12 bytes long
607 !! fixme about endianness
610 /* I've seen these come as four words, not the three advertized !! */
611 printf ("Sending mask %x\n", mask);
612 send_rdp ("bbwwwww-SZ",
621 printf ("done mask %x\n", mask);
627 /* Convert between GDB requests and the RDP layer. */
630 remote_rdp_fetch_register (regno)
635 for (regno = 0; regno < NUM_REGS; regno++)
636 remote_rdp_fetch_register (regno);
640 char buf[MAX_REGISTER_RAW_SIZE];
642 rdp_fetch_one_register (1 << regno, buf);
643 else if (regno == PC_REGNUM)
644 rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_PC, buf);
645 else if (regno == PS_REGNUM)
646 rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_CPSR, buf);
647 else if (regno == FPS_REGNUM)
648 rdp_fetch_one_fpu_register (RDP_FPU_READWRITE_MASK_FPS, buf);
649 else if (regno >= F0_REGNUM && regno <= F7_REGNUM)
650 rdp_fetch_one_fpu_register (1 << (regno - F0_REGNUM), buf);
653 printf ("Help me with fetch reg %d\n", regno);
655 supply_register (regno, buf);
661 remote_rdp_store_register (regno)
666 for (regno = 0; regno < NUM_REGS; regno++)
667 remote_rdp_store_register (regno);
671 char tmp[MAX_REGISTER_RAW_SIZE];
672 read_register_gen (regno, tmp);
674 rdp_store_one_register (1 << regno, tmp);
675 else if (regno == PC_REGNUM)
676 rdp_store_one_register (RDP_CPU_READWRITE_MASK_PC, tmp);
677 else if (regno == PS_REGNUM)
678 rdp_store_one_register (RDP_CPU_READWRITE_MASK_CPSR, tmp);
679 else if (regno >= F0_REGNUM && regno <= F7_REGNUM)
680 rdp_store_one_fpu_register (1 << (regno - F0_REGNUM), tmp);
683 printf ("Help me with reg %d\n", regno);
691 callback->shutdown (callback);
698 send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_STEP,
700 send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_BREAK,
702 send_rdp ("bw-S-WW-Z", RDP_INFO, RDP_INFO_ABOUT_TARGET,
706 ds.can_step = ds.step_info & RDP_INFO_ABOUT_STEP_1;
708 ds.rdi_level = (ds.target_info >> 5) & 3;
715 /* Start it off, but don't wait for it */
716 send_rdp ("bb-", RDP_EXEC, RDP_EXEC_TYPE_SYNC);
721 rdp_set_command_line (command, args)
726 ** We could use RDP_INFO_SET_CMDLINE to send this, but EmbeddedICE systems
727 ** don't implement that, and get all confused at the unexpected text.
728 ** Instead, just keep a copy, and send it when the target does a SWI_GetEnv
731 if (commandline != NULL)
734 commandline = malloc (strlen (command) + strlen (args) + 2);
735 if (commandline != NULL)
737 strcpy (commandline, command);
738 strcat (commandline, " ");
739 strcat (commandline, args);
747 ** We want the target monitor to intercept the abort vectors
748 ** i.e. stop the program if any of these are used.
750 send_rdp ("bww-SZ", RDP_INFO, RDP_INFO_VECTOR_CATCH,
752 ** Specify a bitmask including
754 ** the undefined instruction vector
755 ** the prefetch abort vector
756 ** the data abort vector
757 ** the address exception vector
759 (1<<0)|(1<<1)|(1<<3)|(1<<4)|(1<<5)
782 #define SWI_WriteC 0x0
783 #define SWI_Write0 0x2
784 #define SWI_ReadC 0x4
786 #define SWI_GetEnv 0x10
787 #define SWI_Exit 0x11
788 #define SWI_EnterOS 0x16
790 #define SWI_GetErrno 0x60
791 #define SWI_Clock 0x61
793 #define SWI_Time 0x63
794 #define SWI_Remove 0x64
795 #define SWI_Rename 0x65
796 #define SWI_Open 0x66
798 #define SWI_Close 0x68
799 #define SWI_Write 0x69
800 #define SWI_Read 0x6a
801 #define SWI_Seek 0x6b
802 #define SWI_Flen 0x6c
804 #define SWI_IsTTY 0x6e
805 #define SWI_TmpNam 0x6f
806 #define SWI_InstallHandler 0x70
807 #define SWI_GenerateError 0x71
820 callback->write_stdout (callback, &c, 1);
823 for (i = 0; i < args->n; i++)
824 callback->write_stdout (callback, args->s, strlen (args->s));
827 callback->read_stdin (callback, &c, 1);
831 args->n = callback->system (callback, args->s);
834 args->n = callback->get_errno (callback);
837 args->n = callback->time (callback, NULL);
840 args->n = callback->unlink (callback, args->s);
843 args->n = callback->rename (callback, args[0].s, args[1].s);
863 args->n = callback->open (callback, args->s, i);
867 args->n = callback->close (callback, args->n);
871 args->n = callback->write (callback, args[0].n, args[1].s, args[1].n);
875 char *copy = alloca (args[2].n);
876 int done = callback->read (callback, args[0].n, copy, args[2].n);
878 remote_rdp_xfer_inferior_memory (args[0].n, copy, done, 1, 0);
884 args->n = callback->lseek (callback, args[0].n, args[1].n, 0) >= 0;
888 long old = callback->lseek (callback, args->n, 1, 1);
889 args->n = callback->lseek (callback, args->n, 2, 0);
890 callback->lseek (callback, args->n, old, 0);
895 args->n = callback->isatty (callback, args->n);
899 if (commandline != NULL)
901 int len = strlen (commandline);
905 commandline [255]='\0';
907 remote_rdp_xfer_inferior_memory (args[0].n,
908 commandline, len+1, 1, 0);
911 remote_rdp_xfer_inferior_memory (args[0].n, "", 1, 1, 0);
928 int swino = get_word ();
929 int type = get_byte ();
935 args[count].n = get_byte ();
939 args[count].n = get_word ();
943 /* If the word is under 32 bytes it will be sent otherwise
944 an address to it is passed. Also: Special case of 255 */
954 remote_rdp_xfer_inferior_memory (get_word (),
963 buf = alloca (len + 1);
964 for (i = 0; i < len; i++)
965 buf[i] = get_byte ();
973 error ("Unimplented SWI argument");
980 if (exec_swi (swino, args))
982 /* We have two options here reply with either a byte or a word
983 which is stored in args[0].n. There is no harm in replying with
984 a word all the time, so thats what I do! */
985 send_rdp ("bbw-", RDP_OSOpReply, RDP_OSOpWord, args[0].n);
989 send_rdp ("bb-", RDP_OSOpReply, RDP_OSOpNothing);
994 rdp_execute_finish ()
1001 res = SERIAL_READCHAR (io, 1);
1002 while (res == SERIAL_TIMEOUT)
1005 printf_filtered ("Waiting for target..\n");
1006 res = SERIAL_READCHAR (io, 1);
1015 send_rdp ("B", &ds.rdi_stopped_status);
1019 printf_filtered ("Target reset\n");
1023 printf_filtered ("Ignoring %x\n", res);
1033 rdp_execute_start ();
1034 rdp_execute_finish ();
1038 remote_rdp_insert_breakpoint (addr, save)
1043 if (ds.rdi_level > 0)
1045 send_rdp ("bwb-SWB",
1048 RDP_SET_BREAK_TYPE_PC_EQUAL | RDP_SET_BREAK_TYPE_GET_HANDLE,
1057 RDP_SET_BREAK_TYPE_PC_EQUAL,
1064 remote_rdp_remove_breakpoint (addr, save)
1069 if (ds.rdi_level > 0)
1071 send_rdp ("b-p-S-B",
1089 if (ds.can_step && 0)
1091 /* The pie board can't do steps so I can't test this, and
1092 the other code will always work. */
1094 send_rdp ("bbw-S-B",
1101 CORE_ADDR pc = read_register (PC_REGNUM);
1102 pc = arm_get_next_pc (pc);
1103 remote_rdp_insert_breakpoint (pc, &handle);
1105 remote_rdp_remove_breakpoint (pc, &handle);
1110 remote_rdp_open (args, from_tty)
1117 error_no_arg ("serial port device name");
1121 target_preopen (from_tty);
1123 io = SERIAL_OPEN (args);
1126 perror_with_name (args);
1130 rdp_init (1, from_tty);
1135 printf_unfiltered ("Remote RDP debugging using %s at %d baud\n", args, baud_rate);
1140 /* Need to set up the vector interception state */
1141 rdp_catch_vectors();
1144 ** If it's an EmbeddedICE, we need to set the processor config.
1145 ** Assume we can always have ARM7TDI...
1147 send_rdp ("bw-SB", RDP_INFO, RDP_INFO_ICEBREAKER, & not_icebreaker);
1148 if (!not_icebreaker)
1150 const char * CPU = "ARM7TDI";
1152 int len = strlen (CPU);
1154 send_rdp ("bbbbw-p-SWZ",
1156 RDI_ConfigCPU, /* Aspect: set the CPU */
1157 len, /* The number of bytes in the name */
1158 RDI_MatchAny, /* We'll take whatever we get */
1159 0, /* We'll take whatever version's there */
1164 /* command line initialised on 'run'*/
1166 push_target (& remote_rdp_ops);
1168 callback->init (callback);
1169 flush_cached_frames ();
1170 registers_changed ();
1171 stop_pc = read_pc ();
1172 set_current_frame (create_new_frame (read_fp (), stop_pc));
1173 select_frame (get_current_frame (), 0);
1174 print_stack_frame (selected_frame, -1, 1);
1179 /* Close out all files and local state before this target loses control. */
1182 remote_rdp_close (quitting)
1185 callback->shutdown (callback);
1192 /* Resume execution of the target process. STEP says whether to single-step
1193 or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
1194 to the target, or zero for no signal. */
1197 remote_rdp_resume (pid, step, siggnal)
1199 enum target_signal siggnal;
1207 /* Wait for inferior process to do something. Return pid of child,
1208 or -1 in case of error; store status through argument pointer STATUS,
1209 just as `wait' would. */
1212 remote_rdp_wait (pid, status)
1214 struct target_waitstatus *status;
1216 switch (ds.rdi_stopped_status)
1221 status->kind = TARGET_WAITKIND_EXITED;
1222 status->value.integer = read_register (0);
1224 case RDP_RES_AT_BREAKPOINT:
1225 status->kind = TARGET_WAITKIND_STOPPED;
1226 /* The signal in sigrc is a host signal. That probably
1228 status->value.sig = TARGET_SIGNAL_TRAP;
1232 status->kind = TARGET_WAITKIND_SIGNALLED;
1233 /* The signal in sigrc is a host signal. That probably
1235 status->value.sig = target_signal_from_host (sigrc);
1240 return inferior_pid;
1243 /* Get ready to modify the registers array. On machines which store
1244 individual registers, this doesn't need to do anything. On machines
1245 which store all the registers in one fell swoop, this makes sure
1246 that registers contains all the registers from the program being
1250 remote_rdp_prepare_to_store ()
1252 /* Do nothing, since we can store individual regs */
1256 remote_rdp_xfer_inferior_memory (memaddr, myaddr, len, write, target)
1261 struct target_ops *target; /* ignored */
1263 /* I infer from D Taylor's code that there's a limit on the amount
1264 we can transfer in one chunk.. */
1269 int thisbite = len - done;
1270 if (thisbite > RDP_MOUTHFULL)
1271 thisbite = RDP_MOUTHFULL;
1277 justdone = rdp_write (memaddr + done, myaddr + done, thisbite);
1281 justdone = rdp_read (memaddr + done, myaddr + done, thisbite);
1286 if (justdone != thisbite)
1299 static struct yn stepinfo[] =
1301 {"Step more than one instruction", RDP_INFO_ABOUT_STEP_GT_1},
1302 {"Step to jump", RDP_INFO_ABOUT_STEP_TO_JMP},
1303 {"Step one instruction", RDP_INFO_ABOUT_STEP_1},
1307 static struct yn breakinfo[] =
1309 {"comparison breakpoints supported", RDP_INFO_ABOUT_BREAK_COMP},
1310 {"range breakpoints supported", RDP_INFO_ABOUT_BREAK_RANGE},
1311 {"watchpoints for byte reads supported", RDP_INFO_ABOUT_BREAK_BYTE_READ},
1312 {"watchpoints for half-word reads supported", RDP_INFO_ABOUT_BREAK_HALFWORD_READ},
1313 {"watchpoints for word reads supported", RDP_INFO_ABOUT_BREAK_WORD_READ},
1314 {"watchpoints for byte writes supported", RDP_INFO_ABOUT_BREAK_BYTE_WRITE},
1315 {"watchpoints for half-word writes supported", RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE},
1316 {"watchpoints for word writes supported", RDP_INFO_ABOUT_BREAK_WORD_WRITE},
1317 {"mask break/watch-points supported", RDP_INFO_ABOUT_BREAK_MASK},
1318 {"thread-specific breakpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_BREAK},
1319 {"thread-specific watchpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_WATCH},
1320 {"conditional breakpoints supported", RDP_INFO_ABOUT_BREAK_COND},
1332 printf_unfiltered (" %-45s : %s\n", t->name, (info & t->bit) ? "Yes" : "No");
1338 remote_rdp_files_info (target)
1339 struct target_ops *target;
1341 printf_filtered ("Target capabilities:\n");
1342 dump_bits (stepinfo, ds.step_info);
1343 dump_bits (breakinfo, ds.break_info);
1344 printf_unfiltered ("target level RDI %x\n", (ds.target_info >> 5) & 3);
1349 remote_rdp_create_inferior (exec_file, allargs, env)
1354 CORE_ADDR entry_point;
1356 if (exec_file == 0 || exec_bfd == 0)
1357 error ("No exec file specified.");
1359 entry_point = (CORE_ADDR) bfd_get_start_address (exec_bfd);
1362 remove_breakpoints ();
1363 init_wait_for_inferior ();
1365 /* This gives us a chance to set up the command line */
1366 rdp_set_command_line (exec_file, allargs);
1369 insert_breakpoints (); /* Needed to get correct instruction in cache */
1372 ** RDP targets don't provide any facility to set the top of memory,
1373 ** so we don't bother to look for MEMSIZE in the environment.
1377 proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0);
1380 /* Accept any stray run/attach commands */
1382 remote_rdp_can_run()
1387 /* Attach doesn't need to do anything */
1389 remote_rdp_attach(args, from_tty)
1396 /* Define the target subroutine names */
1398 struct target_ops remote_rdp_ops =
1400 "rdp", /* to_shortname */
1402 "Remote Target using the RDProtocol",
1404 "Use a remote ARM system which uses the ARM Remote Debugging Protocol",
1405 remote_rdp_open, /* to_open */
1406 remote_rdp_close, /* to_close */
1407 remote_rdp_attach, /* to_attach */
1408 NULL, /* to_detach */
1409 remote_rdp_resume, /* to_resume */
1410 remote_rdp_wait, /* to_wait */
1411 remote_rdp_fetch_register, /* to_fetch_registers */
1412 remote_rdp_store_register, /* to_store_registers */
1413 remote_rdp_prepare_to_store, /* to_prepare_to_store */
1414 remote_rdp_xfer_inferior_memory, /* to_xfer_memory */
1415 remote_rdp_files_info, /* to_files_info */
1416 remote_rdp_insert_breakpoint, /* to_insert_breakpoint */
1417 remote_rdp_remove_breakpoint, /* to_remove_breakpoint */
1418 NULL, /* to_terminal_init */
1419 NULL, /* to_terminal_inferior */
1420 NULL, /* to_terminal_ours_for_output */
1421 NULL, /* to_terminal_ours */
1422 NULL, /* to_terminal_info */
1423 remote_rdp_kill, /* to_kill */
1424 generic_load, /* to_load */
1425 NULL, /* to_lookup_symbol */
1426 remote_rdp_create_inferior, /* to_create_inferior */
1427 generic_mourn_inferior, /* to_mourn_inferior */
1428 remote_rdp_can_run, /* to_can_run */
1429 0, /* to_notice_signals */
1430 0, /* to_thread_alive */
1432 process_stratum, /* to_stratum */
1434 1, /* to_has_all_memory */
1435 1, /* to_has_memory */
1436 1, /* to_has_stack */
1437 1, /* to_has_registers */
1438 1, /* to_has_execution */
1439 NULL, /* sections */
1440 NULL, /* sections_end */
1441 OPS_MAGIC, /* to_magic */
1445 _initialize_remote_rdp ()
1447 add_target (&remote_rdp_ops);