1 /* Remote target communications for serial-line targets using SDS' protocol.
2 Copyright 1997 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. */
20 /* This interface was written by studying the behavior of the SDS
21 monitor on an ADS 821/860 board, and by consulting the
22 documentation of the monitor that is available on Motorola's web
26 #include "gdb_string.h"
36 #include "gdb-stabs.h"
37 #include "gdbthread.h"
42 #include <sys/types.h>
48 /* Declarations of local functions. */
50 static int sds_write_bytes
PARAMS ((CORE_ADDR
, char *, int));
52 static int sds_read_bytes
PARAMS ((CORE_ADDR
, char *, int));
54 static void sds_files_info
PARAMS ((struct target_ops
*ignore
));
56 static int sds_xfer_memory
PARAMS ((CORE_ADDR
, char *,
57 int, int, struct target_ops
*));
59 static void sds_prepare_to_store
PARAMS ((void));
61 static void sds_fetch_registers
PARAMS ((int));
63 static void sds_resume
PARAMS ((int, int, enum target_signal
));
65 static int sds_start_remote
PARAMS ((char *));
67 static void sds_open
PARAMS ((char *, int));
69 static void sds_close
PARAMS ((int));
71 static void sds_store_registers
PARAMS ((int));
73 static void sds_mourn
PARAMS ((void));
75 static void sds_create_inferior
PARAMS ((char *, char *, char **));
77 static void sds_load
PARAMS ((char *, int));
79 static int getmessage
PARAMS ((unsigned char *, int));
81 static int putmessage
PARAMS ((unsigned char *, int));
83 static int sds_send
PARAMS ((unsigned char *, int));
85 static int readchar
PARAMS ((int));
87 static int sds_wait
PARAMS ((int, struct target_waitstatus
*));
89 static void sds_kill
PARAMS ((void));
91 static int tohex
PARAMS ((int));
93 static int fromhex
PARAMS ((int));
95 static void sds_detach
PARAMS ((char *, int));
97 static void sds_interrupt
PARAMS ((int));
99 static void sds_interrupt_twice
PARAMS ((int));
101 static void interrupt_query
PARAMS ((void));
103 static int read_frame
PARAMS ((char *));
105 static int sds_insert_breakpoint
PARAMS ((CORE_ADDR
, char *));
107 static int sds_remove_breakpoint
PARAMS ((CORE_ADDR
, char *));
110 static struct target_ops sds_ops
; /* Forward decl */
112 /* This was 5 seconds, which is a long time to sit and wait.
113 Unless this is going though some terminal server or multiplexer or
114 other form of hairy serial connection, I would think 2 seconds would
117 /* Changed to allow option to set timeout value.
118 was static int sds_timeout = 2; */
119 static int sds_timeout
= 2;
121 /* Descriptor for I/O to remote machine. Initialize it to NULL so
122 that sds_open knows that we don't have a file open when the program
125 static serial_t sds_desc
= NULL
;
127 /* This limit comes from the monitor. */
131 /* Maximum number of bytes to read/write at once. The value here
132 is chosen to fill up a packet (the headers account for the 32). */
133 #define MAXBUFBYTES ((PBUFSIZ-32)/2)
135 static int next_msg_id
;
137 static int just_started
;
139 static int message_pending
;
142 /* Clean up connection to a remote debugger. */
150 SERIAL_CLOSE (sds_desc
);
154 /* Stub for catch_errors. */
157 sds_start_remote (dummy
)
161 unsigned char buf
[200];
163 immediate_quit
= 1; /* Allow user to interrupt it */
165 /* Ack any packet which the remote side has already sent. */
166 SERIAL_WRITE (sds_desc
, "{#*\r\n", 5);
167 SERIAL_WRITE (sds_desc
, "{#}\r\n", 5);
169 while ((c
= readchar (1)) >= 0)
170 printf_unfiltered ("%c", c
);
171 printf_unfiltered ("\n");
183 start_remote (); /* Initialize gdb process mechanisms */
187 /* Open a connection to a remote debugger.
188 NAME is the filename used for communication. */
190 static DCACHE
*sds_dcache
;
193 sds_open (name
, from_tty
)
198 error ("To open a remote debug connection, you need to specify what serial\n\
199 device is attached to the remote system (e.g. /dev/ttya).");
201 target_preopen (from_tty
);
203 unpush_target (&sds_ops
);
205 sds_dcache
= dcache_init (sds_read_bytes
, sds_write_bytes
);
207 sds_desc
= SERIAL_OPEN (name
);
209 perror_with_name (name
);
213 if (SERIAL_SETBAUDRATE (sds_desc
, baud_rate
))
215 SERIAL_CLOSE (sds_desc
);
216 perror_with_name (name
);
221 SERIAL_RAW (sds_desc
);
223 /* If there is something sitting in the buffer we might take it as a
224 response to a command, which would be bad. */
225 SERIAL_FLUSH_INPUT (sds_desc
);
229 puts_filtered ("Remote debugging using ");
230 puts_filtered (name
);
231 puts_filtered ("\n");
233 push_target (&sds_ops
); /* Switch to using remote target now */
237 /* Start the remote connection; if error (0), discard this target.
238 In particular, if the user quits, be sure to discard it (we'd be
239 in an inconsistent state otherwise). */
240 if (!catch_errors (sds_start_remote
, (char *)0,
241 "Couldn't establish connection to remote target\n",
246 /* This takes a program previously attached to and detaches it. After
247 this is done, GDB can be used to debug some other program. We
248 better not have left any breakpoints in the target program or it'll
249 die when it hits one. */
252 sds_detach (args
, from_tty
)
259 error ("Argument given to \"detach\" when remotely debugging.");
262 /* Tell the remote target to detach. */
269 puts_filtered ("Ending remote debugging.\n");
272 /* Convert hex digit A to a number. */
278 if (a
>= '0' && a
<= '9')
280 else if (a
>= 'a' && a
<= 'f')
283 error ("Reply contains invalid hex digit %d", a
);
286 /* Convert number NIB to a hex digit. */
299 tob64 (inbuf
, outbuf
, len
)
300 unsigned char *inbuf
;
308 error ("bad length");
311 for (i
= 0; i
< len
; i
+= 3)
313 /* Collect the next three bytes into a number. */
314 sum
= ((long) *inbuf
++) << 16;
315 sum
|= ((long) *inbuf
++) << 8;
316 sum
|= ((long) *inbuf
++);
318 /* Spit out 4 6-bit encodings. */
319 *p
++ = ((sum
>> 18) & 0x3f) + '0';
320 *p
++ = ((sum
>> 12) & 0x3f) + '0';
321 *p
++ = ((sum
>> 6) & 0x3f) + '0';
322 *p
++ = (sum
& 0x3f) + '0';
328 fromb64 (inbuf
, outbuf
, len
)
329 char *inbuf
, *outbuf
;
335 error ("bad length");
337 for (i
= 0; i
< len
; i
+= 4)
339 /* Collect 4 6-bit digits. */
340 sum
= (*inbuf
++ - '0') << 18;
341 sum
|= (*inbuf
++ - '0') << 12;
342 sum
|= (*inbuf
++ - '0') << 6;
343 sum
|= (*inbuf
++ - '0');
345 /* Now take the resulting 24-bit number and get three bytes out
347 *outbuf
++ = (sum
>> 16) & 0xff;
348 *outbuf
++ = (sum
>> 8) & 0xff;
349 *outbuf
++ = sum
& 0xff;
352 return (len
/ 4) * 3;
356 /* Tell the remote machine to resume. */
358 static enum target_signal last_sent_signal
= TARGET_SIGNAL_0
;
362 sds_resume (pid
, step
, siggnal
)
364 enum target_signal siggnal
;
366 unsigned char buf
[PBUFSIZ
];
368 dcache_flush (sds_dcache
);
370 last_sent_signal
= siggnal
;
371 last_sent_step
= step
;
373 buf
[0] = (step
? 21 : 20);
374 buf
[1] = 0; /* (should be signal?) */
379 /* Send a message to target to halt it. Target will respond, and send
380 us a message pending notice. */
383 sds_interrupt (signo
)
386 unsigned char buf
[PBUFSIZ
];
388 /* If this doesn't work, try more severe steps. */
389 signal (signo
, sds_interrupt_twice
);
392 printf_unfiltered ("sds_interrupt called\n");
398 static void (*ofunc
)();
400 /* The user typed ^C twice. */
403 sds_interrupt_twice (signo
)
406 signal (signo
, ofunc
);
410 signal (signo
, sds_interrupt
);
413 /* Ask the user what to do when an interrupt is received. */
418 target_terminal_ours ();
420 if (query ("Interrupted while waiting for the program.\n\
421 Give up (and stop debugging it)? "))
423 target_mourn_inferior ();
424 return_to_top_level (RETURN_QUIT
);
427 target_terminal_inferior ();
430 /* If nonzero, ignore the next kill. */
433 /* Wait until the remote machine stops, then return, storing status in
434 STATUS just as `wait' would. Returns "pid" (though it's not clear
435 what, if anything, that means in the case of this target). */
438 sds_wait (pid
, status
)
440 struct target_waitstatus
*status
;
442 unsigned char buf
[PBUFSIZ
];
445 status
->kind
= TARGET_WAITKIND_EXITED
;
446 status
->value
.integer
= 0;
448 ofunc
= (void (*)()) signal (SIGINT
, sds_interrupt
);
450 signal (SIGINT
, ofunc
);
455 status
->kind
= TARGET_WAITKIND_STOPPED
;
466 retlen
= sds_send (buf
, 1);
469 fprintf_unfiltered (gdb_stderr
, "Signals: %04x %02x %02x\n",
470 ((int) buf
[0]) << 8 + buf
[1],
474 status
->kind
= TARGET_WAITKIND_STOPPED
;
475 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
483 static unsigned char sprs
[16];
485 /* Read the remote registers into the block REGS. */
486 /* Currently we just read all the registers, so we don't use regno. */
490 sds_fetch_registers (regno
)
493 unsigned char buf
[PBUFSIZ
];
496 char regs
[REGISTER_BYTES
];
498 /* Unimplemented registers read as all bits zero. */
499 memset (regs
, 0, REGISTER_BYTES
);
504 retlen
= sds_send (buf
, 3);
506 for (i
= 0; i
< 4 * 6; ++i
)
507 regs
[i
+ 4 * 32 + 8 * 32] = buf
[i
];
508 for (i
= 0; i
< 4 * 4; ++i
)
509 sprs
[i
] = buf
[i
+ 4 * 7];
514 retlen
= sds_send (buf
, 3);
516 for (i
= 0; i
< retlen
; i
++)
519 /* (should warn about reply too short) */
521 for (i
= 0; i
< NUM_REGS
; i
++)
522 supply_register (i
, ®s
[REGISTER_BYTE(i
)]);
525 /* Prepare to store registers. Since we may send them all, we have to
526 read out the ones we don't want to change first. */
529 sds_prepare_to_store ()
531 /* Make sure the entire registers array is valid. */
532 read_register_bytes (0, (char *)NULL
, REGISTER_BYTES
);
535 /* Store register REGNO, or all registers if REGNO == -1, from the contents
536 of REGISTERS. FIXME: ignores errors. */
539 sds_store_registers (regno
)
542 unsigned char *p
, buf
[PBUFSIZ
];
545 /* Store all the special-purpose registers. */
551 for (i
= 0; i
< 4 * 6; i
++)
552 *p
++ = registers
[i
+ 4 * 32 + 8 * 32];
553 for (i
= 0; i
< 4 * 1; i
++)
555 for (i
= 0; i
< 4 * 4; i
++)
558 sds_send (buf
, p
- buf
);
560 /* Store all the general-purpose registers. */
566 for (i
= 0; i
< 4 * 32; i
++)
569 sds_send (buf
, p
- buf
);
573 /* Write memory data directly to the remote machine. This does not
574 inform the data cache; the data cache uses this. MEMADDR is the
575 address in the remote memory space. MYADDR is the address of the
576 buffer in our space. LEN is the number of bytes.
578 Returns number of bytes transferred, or 0 for error. */
581 sds_write_bytes (memaddr
, myaddr
, len
)
586 int max_buf_size
; /* Max size of packet output buffer */
588 unsigned char buf
[PBUFSIZ
];
592 /* Chop the transfer down if necessary */
599 todo
= min (len
, max_buf_size
);
603 buf
[2] = (int) (memaddr
>> 24) & 0xff;
604 buf
[3] = (int) (memaddr
>> 16) & 0xff;
605 buf
[4] = (int) (memaddr
>> 8) & 0xff;
606 buf
[5] = (int) (memaddr
) & 0xff;
610 for (i
= 0; i
< todo
; i
++)
611 buf
[i
+ 8] = myaddr
[i
];
613 sds_send (buf
, 8 + todo
);
615 /* (should look at result) */
624 /* Read memory data directly from the remote machine. This does not
625 use the data cache; the data cache uses this. MEMADDR is the
626 address in the remote memory space. MYADDR is the address of the
627 buffer in our space. LEN is the number of bytes.
629 Returns number of bytes transferred, or 0 for error. */
632 sds_read_bytes (memaddr
, myaddr
, len
)
637 int max_buf_size
; /* Max size of packet output buffer */
639 unsigned char buf
[PBUFSIZ
];
643 /* Chop the transfer down if necessary */
650 todo
= min (len
, max_buf_size
);
654 buf
[2] = (int) (memaddr
>> 24) & 0xff;
655 buf
[3] = (int) (memaddr
>> 16) & 0xff;
656 buf
[4] = (int) (memaddr
>> 8) & 0xff;
657 buf
[5] = (int) (memaddr
) & 0xff;
658 buf
[6] = (int) (todo
>> 8) & 0xff;
659 buf
[7] = (int) (todo
) & 0xff;
662 retlen
= sds_send (buf
, 9);
664 if (retlen
- 2 != todo
)
669 /* Reply describes memory byte by byte. */
671 for (i
= 0; i
< todo
; i
++)
672 myaddr
[i
] = buf
[i
+ 2];
682 /* Read or write LEN bytes from inferior memory at MEMADDR,
683 transferring to or from debugger address MYADDR. Write to inferior
684 if SHOULD_WRITE is nonzero. Returns length of data written or
685 read; 0 for error. */
689 sds_xfer_memory(memaddr
, myaddr
, len
, should_write
, target
)
694 struct target_ops
*target
; /* ignored */
696 return dcache_xfer_memory (sds_dcache
, memaddr
, myaddr
, len
, should_write
);
701 sds_files_info (ignore
)
702 struct target_ops
*ignore
;
704 puts_filtered ("Debugging over a serial connection, using SDS protocol.\n");
707 /* Stuff for dealing with the packets which are part of this protocol.
708 See comment at top of file for details. */
710 /* Read a single character from the remote end, masking it down to 7 bits. */
718 ch
= SERIAL_READCHAR (sds_desc
, timeout
);
720 if (remote_debug
> 1 && ch
>= 0)
721 printf_unfiltered("%c(%x)", ch
, ch
);
726 error ("Remote connection closed");
728 perror_with_name ("Remote communication error");
736 /* An SDS-style checksum is a sum of the bytes modulo 253. (Presumably
737 because 253, 254, and 255 are special flags in the protocol.) */
740 compute_checksum (csum
, buf
, len
)
746 for (i
= 0; i
< len
; ++i
)
747 csum
+= (unsigned char) buf
[i
];
753 /* Send the command in BUF to the remote machine, and read the reply
761 putmessage (buf
, len
);
763 return getmessage (buf
, 0);
766 /* Send a message to the remote machine. */
769 putmessage (buf
, len
)
774 unsigned char csum
= 0;
775 char buf2
[PBUFSIZ
], buf3
[PBUFSIZ
];
776 unsigned char header
[3];
781 /* Copy the packet into buffer BUF2, encapsulating it
782 and giving it a checksum. */
784 if (len
> 170) /* Prosanity check */
789 fprintf_unfiltered (gdb_stderr
, "Message to send: \"");
790 for (i
= 0; i
< len
; ++i
)
791 fprintf_unfiltered (gdb_stderr
, "%02x", buf
[i
]);
792 fprintf_unfiltered (gdb_stderr
, "\"\n");
804 header
[1] = next_msg_id
;
808 csum
= compute_checksum (csum
, buf
, len
);
809 csum
= compute_checksum (csum
, header
+ 1, 2);
813 tob64 (header
, p
, 3);
815 enclen
= tob64 (buf
, buf3
, ((len
+ 2) / 3) * 3);
817 for (i
= 0; i
< enclen
; ++i
)
822 next_msg_id
= (next_msg_id
+ 3) % 245;
824 /* Send it over and over until we get a positive ack. */
828 int started_error_output
= 0;
833 printf_unfiltered ("Sending encoded: \"%s\"", buf2
);
834 printf_unfiltered (" (Checksum %d, id %d, length %d)\n",
835 header
[0], header
[1], header
[2]);
836 gdb_flush (gdb_stdout
);
838 if (SERIAL_WRITE (sds_desc
, buf2
, p
- buf2
))
839 perror_with_name ("putmessage: write failed");
847 /* Come here after finding the start of the frame. Collect the rest
848 into BUF. Returns 0 on any error, 1 on success. */
861 c
= readchar (sds_timeout
);
867 puts_filtered ("Timeout in mid-message, retrying\n");
871 puts_filtered ("Saw new packet start in middle of old one\n");
872 return 0; /* Start a new packet, count retries */
880 fprintf_unfiltered (gdb_stderr
, "Received encoded: \"%s\"\n",
886 if (bp
< buf
+ PBUFSIZ
- 1)
893 puts_filtered ("Message too long: ");
895 puts_filtered ("\n");
902 /* Read a packet from the remote machine, with error checking,
903 and store it in BUF. BUF is expected to be of size PBUFSIZ.
904 If FOREVER, wait forever rather than timing out; this is used
905 while the target is executing user code. */
908 getmessage (buf
, forever
)
915 int val
, i
, len
, csum
;
916 unsigned char header
[3];
917 unsigned char inbuf
[500];
919 strcpy (buf
, "timeout");
923 #ifdef MAINTENANCE_CMDS
924 timeout
= watchdog
> 0 ? watchdog
: -1;
931 timeout
= sds_timeout
;
935 for (tries
= 1; tries
<= MAX_TRIES
; tries
++)
937 /* This can loop forever if the remote side sends us characters
938 continuously, but if it pauses, we'll get a zero from readchar
939 because of timeout. Then we'll count that as a retry. */
941 /* Note that we will only wait forever prior to the start of a packet.
942 After that, we expect characters to arrive at a brisk pace. They
943 should show up within sds_timeout intervals. */
947 c
= readchar (timeout
);
949 if (c
== SERIAL_TIMEOUT
)
951 #ifdef MAINTENANCE_CMDS
952 if (forever
) /* Watchdog went off. Kill the target. */
954 target_mourn_inferior ();
955 error ("Watchdog has expired. Target detached.\n");
959 puts_filtered ("Timed out.\n");
963 while (c
!= '$' && c
!= '{');
965 /* We might have seen a "trigraph", a sequence of three characters
966 that indicate various sorts of communication state. */
970 /* Read the other two chars of the trigraph. */
971 c2
= readchar (timeout
);
972 c3
= readchar (timeout
);
974 fprintf_unfiltered (gdb_stderr
, "Trigraph %c%c%c received\n",
984 val
= read_frame (inbuf
);
988 fromb64 (inbuf
, header
, 4);
989 /* (should check out other bits) */
990 fromb64 (inbuf
+ 4, buf
, strlen (inbuf
) - 4);
995 csum
= compute_checksum (csum
, buf
, len
);
996 csum
= compute_checksum (csum
, header
+ 1, 2);
998 if (csum
!= header
[0])
999 fprintf_unfiltered (gdb_stderr
,
1000 "Checksum mismatch: computed %d, received %d\n",
1003 if (header
[2] == 0xff)
1004 fprintf_unfiltered (gdb_stderr
, "Requesting resend...\n");
1008 fprintf_unfiltered (gdb_stderr
,
1009 "... (Got checksum %d, id %d, length %d)\n",
1010 header
[0], header
[1], header
[2]);
1011 fprintf_unfiltered (gdb_stderr
, "Message received: \"");
1012 for (i
= 0; i
< len
; ++i
)
1014 fprintf_unfiltered (gdb_stderr
, "%02x", (unsigned char) buf
[i
]);
1016 fprintf_unfiltered (gdb_stderr
, "\"\n");
1019 /* no ack required? */
1023 /* Try the whole thing again. */
1025 /* need to do something here */
1028 /* We have tried hard enough, and just can't receive the packet. Give up. */
1030 printf_unfiltered ("Ignoring packet error, continuing...\n");
1037 /* Don't try to do anything to the target. */
1043 unpush_target (&sds_ops
);
1044 generic_mourn_inferior ();
1048 sds_create_inferior (exec_file
, args
, env
)
1053 inferior_pid
= 42000;
1055 /* Clean up from the last time we were running. */
1056 clear_proceed_status ();
1058 /* Let the remote process run. */
1059 proceed (bfd_get_start_address (exec_bfd
), TARGET_SIGNAL_0
, 0);
1063 sds_load (filename
, from_tty
)
1067 generic_load (filename
, from_tty
);
1072 /* The SDS monitor has commands for breakpoint insertion, although it
1073 it doesn't actually manage the breakpoints, it just returns the
1074 replaced instruction back to the debugger. */
1077 sds_insert_breakpoint (addr
, contents_cache
)
1079 char *contents_cache
;
1082 unsigned char *p
, buf
[PBUFSIZ
];
1087 *p
++ = (int) (addr
>> 24) & 0xff;
1088 *p
++ = (int) (addr
>> 16) & 0xff;
1089 *p
++ = (int) (addr
>> 8) & 0xff;
1090 *p
++ = (int) (addr
) & 0xff;
1092 retlen
= sds_send (buf
, p
- buf
);
1094 for (i
= 0; i
< 4; ++i
)
1095 contents_cache
[i
] = buf
[i
+ 2];
1101 sds_remove_breakpoint (addr
, contents_cache
)
1103 char *contents_cache
;
1106 unsigned char *p
, buf
[PBUFSIZ
];
1111 *p
++ = (int) (addr
>> 24) & 0xff;
1112 *p
++ = (int) (addr
>> 16) & 0xff;
1113 *p
++ = (int) (addr
>> 8) & 0xff;
1114 *p
++ = (int) (addr
) & 0xff;
1115 for (i
= 0; i
< 4; ++i
)
1116 *p
++ = contents_cache
[i
];
1118 retlen
= sds_send (buf
, p
- buf
);
1123 /* Define the target operations vector. */
1125 static struct target_ops sds_ops
;
1127 static void init_sds_ops(void)
1129 sds_ops
.to_shortname
= "sds";
1130 sds_ops
.to_longname
= "Remote serial target with SDS protocol";
1131 sds_ops
.to_doc
= "Use a remote computer via a serial line; using the SDS protocol.\n\
1132 Specify the serial device it is connected to (e.g. /dev/ttya).",
1133 sds_ops
.to_open
= sds_open
;
1134 sds_ops
.to_close
= sds_close
;
1135 sds_ops
.to_attach
= NULL
;
1136 sds_ops
.to_detach
= sds_detach
;
1137 sds_ops
.to_resume
= sds_resume
;
1138 sds_ops
.to_wait
= sds_wait
;
1139 sds_ops
.to_fetch_registers
= sds_fetch_registers
;
1140 sds_ops
.to_store_registers
= sds_store_registers
;
1141 sds_ops
.to_prepare_to_store
= sds_prepare_to_store
;
1142 sds_ops
.to_xfer_memory
= sds_xfer_memory
;
1143 sds_ops
.to_files_info
= sds_files_info
;
1144 sds_ops
.to_insert_breakpoint
= sds_insert_breakpoint
;
1145 sds_ops
.to_remove_breakpoint
= sds_remove_breakpoint
;
1146 sds_ops
.to_terminal_init
= NULL
;
1147 sds_ops
.to_terminal_inferior
= NULL
;
1148 sds_ops
.to_terminal_ours_for_output
= NULL
;
1149 sds_ops
.to_terminal_ours
= NULL
;
1150 sds_ops
.to_terminal_info
= NULL
;
1151 sds_ops
.to_kill
= sds_kill
;
1152 sds_ops
.to_load
= sds_load
;
1153 sds_ops
.to_lookup_symbol
= NULL
;
1154 sds_ops
.to_create_inferior
= sds_create_inferior
;
1155 sds_ops
.to_mourn_inferior
= sds_mourn
;
1156 sds_ops
.to_can_run
= 0;
1157 sds_ops
.to_notice_signals
= 0;
1158 sds_ops
.to_thread_alive
= 0;
1159 sds_ops
.to_stop
= 0;
1160 sds_ops
.to_stratum
= process_stratum
;
1161 sds_ops
.DONT_USE
= NULL
;
1162 sds_ops
.to_has_all_memory
= 1;
1163 sds_ops
.to_has_memory
= 1;
1164 sds_ops
.to_has_stack
= 1; /* to_has_stack */
1165 sds_ops
.to_has_registers
= 1; sds_ops
.to_has_execution
= 1;
1166 sds_ops
.to_sections
= NULL
;
1167 sds_ops
.to_sections_end
= NULL
;
1168 sds_ops
.to_magic
= OPS_MAGIC
;
1171 /* Put a command string, in args, out to the monitor and display the
1175 sds_command (args
, from_tty
)
1181 unsigned char buf
[1000];
1183 /* Convert hexadecimal chars into a byte buffer. */
1188 buf
[len
++] = fromhex (p
[0]) * 16 + fromhex (p
[1]);
1194 retlen
= sds_send (buf
, len
);
1196 printf_filtered ("Reply is ");
1197 for (i
= 0; i
< retlen
; ++i
)
1199 printf_filtered ("%02x", buf
[i
]);
1201 printf_filtered ("\n");
1205 _initialize_remote_sds ()
1208 add_target (&sds_ops
);
1210 add_show_from_set (add_set_cmd ("sdstimeout", no_class
,
1211 var_integer
, (char *)&sds_timeout
,
1212 "Set timeout value for sds read.\n", &setlist
),
1215 add_com ("sds", class_obscure
, sds_command
,
1216 "Send a command to the SDS monitor.");