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,
19 Boston, MA 02111-1307, USA. */
21 /* This interface was written by studying the behavior of the SDS
22 monitor on an ADS 821/860 board, and by consulting the
23 documentation of the monitor that is available on Motorola's web
27 #include "gdb_string.h"
37 #include "gdb-stabs.h"
38 #include "gdbthread.h"
42 #include <sys/types.h>
48 extern void _initialize_remote_sds (void);
50 /* Declarations of local functions. */
52 static int sds_write_bytes (CORE_ADDR
, char *, int);
54 static int sds_read_bytes (CORE_ADDR
, char *, int);
56 static void sds_files_info (struct target_ops
*ignore
);
58 static int sds_xfer_memory (CORE_ADDR
, char *, int, int, struct target_ops
*);
60 static void sds_prepare_to_store (void);
62 static void sds_fetch_registers (int);
64 static void sds_resume (int, int, enum target_signal
);
66 static int sds_start_remote (PTR
);
68 static void sds_open (char *, int);
70 static void sds_close (int);
72 static void sds_store_registers (int);
74 static void sds_mourn (void);
76 static void sds_create_inferior (char *, char *, char **);
78 static void sds_load (char *, int);
80 static int getmessage (unsigned char *, int);
82 static int putmessage (unsigned char *, int);
84 static int sds_send (unsigned char *, int);
86 static int readchar (int);
88 static int sds_wait (int, struct target_waitstatus
*);
90 static void sds_kill (void);
92 static int tohex (int);
94 static int fromhex (int);
96 static void sds_detach (char *, int);
98 static void sds_interrupt (int);
100 static void sds_interrupt_twice (int);
102 static void interrupt_query (void);
104 static int read_frame (char *);
106 static int sds_insert_breakpoint (CORE_ADDR
, char *);
108 static int sds_remove_breakpoint (CORE_ADDR
, char *);
110 static void init_sds_ops (void);
112 static void sds_command (char *args
, int from_tty
);
114 /* Define the target operations vector. */
116 static struct target_ops sds_ops
;
118 /* This was 5 seconds, which is a long time to sit and wait.
119 Unless this is going though some terminal server or multiplexer or
120 other form of hairy serial connection, I would think 2 seconds would
123 static int sds_timeout
= 2;
125 /* Descriptor for I/O to remote machine. Initialize it to NULL so
126 that sds_open knows that we don't have a file open when the program
129 static serial_t sds_desc
= NULL
;
131 /* This limit comes from the monitor. */
135 /* Maximum number of bytes to read/write at once. The value here
136 is chosen to fill up a packet (the headers account for the 32). */
137 #define MAXBUFBYTES ((PBUFSIZ-32)/2)
139 static int next_msg_id
;
141 static int just_started
;
143 static int message_pending
;
146 /* Clean up connection to a remote debugger. */
150 sds_close (int quitting
)
153 SERIAL_CLOSE (sds_desc
);
157 /* Stub for catch_errors. */
160 sds_start_remote (PTR dummy
)
163 unsigned char buf
[200];
165 immediate_quit
++; /* Allow user to interrupt it */
167 /* Ack any packet which the remote side has already sent. */
168 SERIAL_WRITE (sds_desc
, "{#*\r\n", 5);
169 SERIAL_WRITE (sds_desc
, "{#}\r\n", 5);
171 while ((c
= readchar (1)) >= 0)
172 printf_unfiltered ("%c", c
);
173 printf_unfiltered ("\n");
185 start_remote (); /* Initialize gdb process mechanisms */
189 /* Open a connection to a remote debugger.
190 NAME is the filename used for communication. */
193 sds_open (char *name
, int from_tty
)
196 error ("To open a remote debug connection, you need to specify what serial\n\
197 device is attached to the remote system (e.g. /dev/ttya).");
199 target_preopen (from_tty
);
201 unpush_target (&sds_ops
);
203 sds_desc
= SERIAL_OPEN (name
);
205 perror_with_name (name
);
209 if (SERIAL_SETBAUDRATE (sds_desc
, baud_rate
))
211 SERIAL_CLOSE (sds_desc
);
212 perror_with_name (name
);
217 SERIAL_RAW (sds_desc
);
219 /* If there is something sitting in the buffer we might take it as a
220 response to a command, which would be bad. */
221 SERIAL_FLUSH_INPUT (sds_desc
);
225 puts_filtered ("Remote debugging using ");
226 puts_filtered (name
);
227 puts_filtered ("\n");
229 push_target (&sds_ops
); /* Switch to using remote target now */
233 /* Start the remote connection; if error (0), discard this target.
234 In particular, if the user quits, be sure to discard it (we'd be
235 in an inconsistent state otherwise). */
236 if (!catch_errors (sds_start_remote
, NULL
,
237 "Couldn't establish connection to remote target\n",
242 /* This takes a program previously attached to and detaches it. After
243 this is done, GDB can be used to debug some other program. We
244 better not have left any breakpoints in the target program or it'll
245 die when it hits one. */
248 sds_detach (char *args
, int from_tty
)
253 error ("Argument given to \"detach\" when remotely debugging.");
256 /* Tell the remote target to detach. */
263 puts_filtered ("Ending remote debugging.\n");
266 /* Convert hex digit A to a number. */
271 if (a
>= '0' && a
<= '9')
273 else if (a
>= 'a' && a
<= 'f')
276 error ("Reply contains invalid hex digit %d", a
);
279 /* Convert number NIB to a hex digit. */
287 return 'a' + nib
- 10;
291 tob64 (unsigned char *inbuf
, char *outbuf
, int len
)
297 error ("bad length");
300 for (i
= 0; i
< len
; i
+= 3)
302 /* Collect the next three bytes into a number. */
303 sum
= ((long) *inbuf
++) << 16;
304 sum
|= ((long) *inbuf
++) << 8;
305 sum
|= ((long) *inbuf
++);
307 /* Spit out 4 6-bit encodings. */
308 *p
++ = ((sum
>> 18) & 0x3f) + '0';
309 *p
++ = ((sum
>> 12) & 0x3f) + '0';
310 *p
++ = ((sum
>> 6) & 0x3f) + '0';
311 *p
++ = (sum
& 0x3f) + '0';
317 fromb64 (char *inbuf
, char *outbuf
, int len
)
322 error ("bad length");
324 for (i
= 0; i
< len
; i
+= 4)
326 /* Collect 4 6-bit digits. */
327 sum
= (*inbuf
++ - '0') << 18;
328 sum
|= (*inbuf
++ - '0') << 12;
329 sum
|= (*inbuf
++ - '0') << 6;
330 sum
|= (*inbuf
++ - '0');
332 /* Now take the resulting 24-bit number and get three bytes out
334 *outbuf
++ = (sum
>> 16) & 0xff;
335 *outbuf
++ = (sum
>> 8) & 0xff;
336 *outbuf
++ = sum
& 0xff;
339 return (len
/ 4) * 3;
343 /* Tell the remote machine to resume. */
345 static enum target_signal last_sent_signal
= TARGET_SIGNAL_0
;
349 sds_resume (int pid
, int step
, enum target_signal siggnal
)
351 unsigned char buf
[PBUFSIZ
];
353 last_sent_signal
= siggnal
;
354 last_sent_step
= step
;
356 buf
[0] = (step
? 21 : 20);
357 buf
[1] = 0; /* (should be signal?) */
362 /* Send a message to target to halt it. Target will respond, and send
363 us a message pending notice. */
366 sds_interrupt (int signo
)
368 unsigned char buf
[PBUFSIZ
];
370 /* If this doesn't work, try more severe steps. */
371 signal (signo
, sds_interrupt_twice
);
374 fprintf_unfiltered (gdb_stdlog
, "sds_interrupt called\n");
380 static void (*ofunc
) ();
382 /* The user typed ^C twice. */
385 sds_interrupt_twice (int signo
)
387 signal (signo
, ofunc
);
391 signal (signo
, sds_interrupt
);
394 /* Ask the user what to do when an interrupt is received. */
397 interrupt_query (void)
399 target_terminal_ours ();
401 if (query ("Interrupted while waiting for the program.\n\
402 Give up (and stop debugging it)? "))
404 target_mourn_inferior ();
405 return_to_top_level (RETURN_QUIT
);
408 target_terminal_inferior ();
411 /* If nonzero, ignore the next kill. */
414 /* Wait until the remote machine stops, then return, storing status in
415 STATUS just as `wait' would. Returns "pid" (though it's not clear
416 what, if anything, that means in the case of this target). */
419 sds_wait (int pid
, struct target_waitstatus
*status
)
421 unsigned char buf
[PBUFSIZ
];
424 status
->kind
= TARGET_WAITKIND_EXITED
;
425 status
->value
.integer
= 0;
427 ofunc
= (void (*)()) signal (SIGINT
, sds_interrupt
);
429 signal (SIGINT
, ofunc
);
434 status
->kind
= TARGET_WAITKIND_STOPPED
;
445 retlen
= sds_send (buf
, 1);
448 fprintf_unfiltered (gdb_stdlog
, "Signals: %02x%02x %02x %02x\n",
453 status
->kind
= TARGET_WAITKIND_STOPPED
;
454 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
462 static unsigned char sprs
[16];
464 /* Read the remote registers into the block REGS. */
465 /* Currently we just read all the registers, so we don't use regno. */
469 sds_fetch_registers (int regno
)
471 unsigned char buf
[PBUFSIZ
];
473 char regs
[REGISTER_BYTES
];
475 /* Unimplemented registers read as all bits zero. */
476 memset (regs
, 0, REGISTER_BYTES
);
481 retlen
= sds_send (buf
, 3);
483 for (i
= 0; i
< 4 * 6; ++i
)
484 regs
[i
+ 4 * 32 + 8 * 32] = buf
[i
];
485 for (i
= 0; i
< 4 * 4; ++i
)
486 sprs
[i
] = buf
[i
+ 4 * 7];
491 retlen
= sds_send (buf
, 3);
493 for (i
= 0; i
< retlen
; i
++)
496 /* (should warn about reply too short) */
498 for (i
= 0; i
< NUM_REGS
; i
++)
499 supply_register (i
, ®s
[REGISTER_BYTE (i
)]);
502 /* Prepare to store registers. Since we may send them all, we have to
503 read out the ones we don't want to change first. */
506 sds_prepare_to_store (void)
508 /* Make sure the entire registers array is valid. */
509 read_register_bytes (0, (char *) NULL
, REGISTER_BYTES
);
512 /* Store register REGNO, or all registers if REGNO == -1, from the contents
513 of REGISTERS. FIXME: ignores errors. */
516 sds_store_registers (int regno
)
518 unsigned char *p
, buf
[PBUFSIZ
];
521 /* Store all the special-purpose registers. */
527 for (i
= 0; i
< 4 * 6; i
++)
528 *p
++ = registers
[i
+ 4 * 32 + 8 * 32];
529 for (i
= 0; i
< 4 * 1; i
++)
531 for (i
= 0; i
< 4 * 4; i
++)
534 sds_send (buf
, p
- buf
);
536 /* Store all the general-purpose registers. */
542 for (i
= 0; i
< 4 * 32; i
++)
545 sds_send (buf
, p
- buf
);
549 /* Write memory data directly to the remote machine. This does not
550 inform the data cache; the data cache uses this. MEMADDR is the
551 address in the remote memory space. MYADDR is the address of the
552 buffer in our space. LEN is the number of bytes.
554 Returns number of bytes transferred, or 0 for error. */
557 sds_write_bytes (CORE_ADDR memaddr
, char *myaddr
, int len
)
559 int max_buf_size
; /* Max size of packet output buffer */
561 unsigned char buf
[PBUFSIZ
];
565 /* Chop the transfer down if necessary */
572 todo
= min (len
, max_buf_size
);
576 buf
[2] = (int) (memaddr
>> 24) & 0xff;
577 buf
[3] = (int) (memaddr
>> 16) & 0xff;
578 buf
[4] = (int) (memaddr
>> 8) & 0xff;
579 buf
[5] = (int) (memaddr
) & 0xff;
583 for (i
= 0; i
< todo
; i
++)
584 buf
[i
+ 8] = myaddr
[i
];
586 sds_send (buf
, 8 + todo
);
588 /* (should look at result) */
597 /* Read memory data directly from the remote machine. This does not
598 use the data cache; the data cache uses this. MEMADDR is the
599 address in the remote memory space. MYADDR is the address of the
600 buffer in our space. LEN is the number of bytes.
602 Returns number of bytes transferred, or 0 for error. */
605 sds_read_bytes (CORE_ADDR memaddr
, char *myaddr
, int len
)
607 int max_buf_size
; /* Max size of packet output buffer */
609 unsigned char buf
[PBUFSIZ
];
613 /* Chop the transfer down if necessary */
620 todo
= min (len
, max_buf_size
);
624 buf
[2] = (int) (memaddr
>> 24) & 0xff;
625 buf
[3] = (int) (memaddr
>> 16) & 0xff;
626 buf
[4] = (int) (memaddr
>> 8) & 0xff;
627 buf
[5] = (int) (memaddr
) & 0xff;
628 buf
[6] = (int) (todo
>> 8) & 0xff;
629 buf
[7] = (int) (todo
) & 0xff;
632 retlen
= sds_send (buf
, 9);
634 if (retlen
- 2 != todo
)
639 /* Reply describes memory byte by byte. */
641 for (i
= 0; i
< todo
; i
++)
642 myaddr
[i
] = buf
[i
+ 2];
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. TARGET is unused. */
659 sds_xfer_memory (CORE_ADDR memaddr
, char *myaddr
, int len
, int should_write
,
660 struct target_ops
*target
)
665 res
= sds_write_bytes (memaddr
, myaddr
, len
);
667 res
= sds_read_bytes (memaddr
, myaddr
, len
);
674 sds_files_info (struct target_ops
*ignore
)
676 puts_filtered ("Debugging over a serial connection, using SDS protocol.\n");
679 /* Stuff for dealing with the packets which are part of this protocol.
680 See comment at top of file for details. */
682 /* Read a single character from the remote end, masking it down to 7 bits. */
685 readchar (int timeout
)
689 ch
= SERIAL_READCHAR (sds_desc
, timeout
);
691 if (remote_debug
> 1 && ch
>= 0)
692 fprintf_unfiltered (gdb_stdlog
, "%c(%x)", ch
, ch
);
697 error ("Remote connection closed");
699 perror_with_name ("Remote communication error");
707 /* An SDS-style checksum is a sum of the bytes modulo 253. (Presumably
708 because 253, 254, and 255 are special flags in the protocol.) */
711 compute_checksum (int csum
, char *buf
, int len
)
715 for (i
= 0; i
< len
; ++i
)
716 csum
+= (unsigned char) buf
[i
];
722 /* Send the command in BUF to the remote machine, and read the reply
726 sds_send (unsigned char *buf
, int len
)
728 putmessage (buf
, len
);
730 return getmessage (buf
, 0);
733 /* Send a message to the remote machine. */
736 putmessage (unsigned char *buf
, int len
)
739 unsigned char csum
= 0;
740 char buf2
[PBUFSIZ
], buf3
[PBUFSIZ
];
741 unsigned char header
[3];
744 /* Copy the packet into buffer BUF2, encapsulating it
745 and giving it a checksum. */
747 if (len
> 170) /* Prosanity check */
752 fprintf_unfiltered (gdb_stdlog
, "Message to send: \"");
753 for (i
= 0; i
< len
; ++i
)
754 fprintf_unfiltered (gdb_stdlog
, "%02x", buf
[i
]);
755 fprintf_unfiltered (gdb_stdlog
, "\"\n");
767 header
[1] = next_msg_id
;
771 csum
= compute_checksum (csum
, buf
, len
);
772 csum
= compute_checksum (csum
, header
+ 1, 2);
776 tob64 (header
, p
, 3);
778 enclen
= tob64 (buf
, buf3
, ((len
+ 2) / 3) * 3);
780 for (i
= 0; i
< enclen
; ++i
)
785 next_msg_id
= (next_msg_id
+ 3) % 245;
787 /* Send it over and over until we get a positive ack. */
794 fprintf_unfiltered (gdb_stdlog
, "Sending encoded: \"%s\"", buf2
);
795 fprintf_unfiltered (gdb_stdlog
,
796 " (Checksum %d, id %d, length %d)\n",
797 header
[0], header
[1], header
[2]);
798 gdb_flush (gdb_stdlog
);
800 if (SERIAL_WRITE (sds_desc
, buf2
, p
- buf2
))
801 perror_with_name ("putmessage: write failed");
807 /* Come here after finding the start of the frame. Collect the rest
808 into BUF. Returns 0 on any error, 1 on success. */
811 read_frame (char *buf
)
820 c
= readchar (sds_timeout
);
826 fputs_filtered ("Timeout in mid-message, retrying\n", gdb_stdlog
);
830 fputs_filtered ("Saw new packet start in middle of old one\n",
832 return 0; /* Start a new packet, count retries */
840 fprintf_unfiltered (gdb_stdlog
, "Received encoded: \"%s\"\n",
846 if (bp
< buf
+ PBUFSIZ
- 1)
853 puts_filtered ("Message too long: ");
855 puts_filtered ("\n");
862 /* Read a packet from the remote machine, with error checking,
863 and store it in BUF. BUF is expected to be of size PBUFSIZ.
864 If FOREVER, wait forever rather than timing out; this is used
865 while the target is executing user code. */
868 getmessage (unsigned char *buf
, int forever
)
873 int val
, i
, len
, csum
;
874 unsigned char header
[3];
875 unsigned char inbuf
[500];
877 strcpy (buf
, "timeout");
881 timeout
= watchdog
> 0 ? watchdog
: -1;
885 timeout
= sds_timeout
;
889 for (tries
= 1; tries
<= MAX_TRIES
; tries
++)
891 /* This can loop forever if the remote side sends us characters
892 continuously, but if it pauses, we'll get a zero from readchar
893 because of timeout. Then we'll count that as a retry. */
895 /* Note that we will only wait forever prior to the start of a packet.
896 After that, we expect characters to arrive at a brisk pace. They
897 should show up within sds_timeout intervals. */
901 c
= readchar (timeout
);
903 if (c
== SERIAL_TIMEOUT
)
905 if (forever
) /* Watchdog went off. Kill the target. */
907 target_mourn_inferior ();
908 error ("Watchdog has expired. Target detached.\n");
911 fputs_filtered ("Timed out.\n", gdb_stdlog
);
915 while (c
!= '$' && c
!= '{');
917 /* We might have seen a "trigraph", a sequence of three characters
918 that indicate various sorts of communication state. */
922 /* Read the other two chars of the trigraph. */
923 c2
= readchar (timeout
);
924 c3
= readchar (timeout
);
926 fprintf_unfiltered (gdb_stdlog
, "Trigraph %c%c%c received\n",
936 val
= read_frame (inbuf
);
940 fromb64 (inbuf
, header
, 4);
941 /* (should check out other bits) */
942 fromb64 (inbuf
+ 4, buf
, strlen (inbuf
) - 4);
947 csum
= compute_checksum (csum
, buf
, len
);
948 csum
= compute_checksum (csum
, header
+ 1, 2);
950 if (csum
!= header
[0])
951 fprintf_unfiltered (gdb_stderr
,
952 "Checksum mismatch: computed %d, received %d\n",
955 if (header
[2] == 0xff)
956 fprintf_unfiltered (gdb_stderr
, "Requesting resend...\n");
960 fprintf_unfiltered (gdb_stdlog
,
961 "... (Got checksum %d, id %d, length %d)\n",
962 header
[0], header
[1], header
[2]);
963 fprintf_unfiltered (gdb_stdlog
, "Message received: \"");
964 for (i
= 0; i
< len
; ++i
)
966 fprintf_unfiltered (gdb_stdlog
, "%02x", (unsigned char) buf
[i
]);
968 fprintf_unfiltered (gdb_stdlog
, "\"\n");
971 /* no ack required? */
975 /* Try the whole thing again. */
977 /* need to do something here */
980 /* We have tried hard enough, and just can't receive the packet. Give up. */
982 printf_unfiltered ("Ignoring packet error, continuing...\n");
989 /* Don't try to do anything to the target. */
995 unpush_target (&sds_ops
);
996 generic_mourn_inferior ();
1000 sds_create_inferior (char *exec_file
, char *args
, char **env
)
1002 inferior_pid
= 42000;
1004 /* Clean up from the last time we were running. */
1005 clear_proceed_status ();
1007 /* Let the remote process run. */
1008 proceed (bfd_get_start_address (exec_bfd
), TARGET_SIGNAL_0
, 0);
1012 sds_load (char *filename
, int from_tty
)
1014 generic_load (filename
, from_tty
);
1019 /* The SDS monitor has commands for breakpoint insertion, although it
1020 it doesn't actually manage the breakpoints, it just returns the
1021 replaced instruction back to the debugger. */
1024 sds_insert_breakpoint (CORE_ADDR addr
, char *contents_cache
)
1027 unsigned char *p
, buf
[PBUFSIZ
];
1032 *p
++ = (int) (addr
>> 24) & 0xff;
1033 *p
++ = (int) (addr
>> 16) & 0xff;
1034 *p
++ = (int) (addr
>> 8) & 0xff;
1035 *p
++ = (int) (addr
) & 0xff;
1037 retlen
= sds_send (buf
, p
- buf
);
1039 for (i
= 0; i
< 4; ++i
)
1040 contents_cache
[i
] = buf
[i
+ 2];
1046 sds_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
1049 unsigned char *p
, buf
[PBUFSIZ
];
1054 *p
++ = (int) (addr
>> 24) & 0xff;
1055 *p
++ = (int) (addr
>> 16) & 0xff;
1056 *p
++ = (int) (addr
>> 8) & 0xff;
1057 *p
++ = (int) (addr
) & 0xff;
1058 for (i
= 0; i
< 4; ++i
)
1059 *p
++ = contents_cache
[i
];
1061 retlen
= sds_send (buf
, p
- buf
);
1069 sds_ops
.to_shortname
= "sds";
1070 sds_ops
.to_longname
= "Remote serial target with SDS protocol";
1071 sds_ops
.to_doc
= "Use a remote computer via a serial line; using the SDS protocol.\n\
1072 Specify the serial device it is connected to (e.g. /dev/ttya).";
1073 sds_ops
.to_open
= sds_open
;
1074 sds_ops
.to_close
= sds_close
;
1075 sds_ops
.to_detach
= sds_detach
;
1076 sds_ops
.to_resume
= sds_resume
;
1077 sds_ops
.to_wait
= sds_wait
;
1078 sds_ops
.to_fetch_registers
= sds_fetch_registers
;
1079 sds_ops
.to_store_registers
= sds_store_registers
;
1080 sds_ops
.to_prepare_to_store
= sds_prepare_to_store
;
1081 sds_ops
.to_xfer_memory
= sds_xfer_memory
;
1082 sds_ops
.to_files_info
= sds_files_info
;
1083 sds_ops
.to_insert_breakpoint
= sds_insert_breakpoint
;
1084 sds_ops
.to_remove_breakpoint
= sds_remove_breakpoint
;
1085 sds_ops
.to_kill
= sds_kill
;
1086 sds_ops
.to_load
= sds_load
;
1087 sds_ops
.to_create_inferior
= sds_create_inferior
;
1088 sds_ops
.to_mourn_inferior
= sds_mourn
;
1089 sds_ops
.to_stratum
= process_stratum
;
1090 sds_ops
.to_has_all_memory
= 1;
1091 sds_ops
.to_has_memory
= 1;
1092 sds_ops
.to_has_stack
= 1;
1093 sds_ops
.to_has_registers
= 1;
1094 sds_ops
.to_has_execution
= 1;
1095 sds_ops
.to_magic
= OPS_MAGIC
;
1098 /* Put a command string, in args, out to the monitor and display the
1102 sds_command (char *args
, int from_tty
)
1106 unsigned char buf
[1000];
1108 /* Convert hexadecimal chars into a byte buffer. */
1113 buf
[len
++] = fromhex (p
[0]) * 16 + fromhex (p
[1]);
1119 retlen
= sds_send (buf
, len
);
1121 printf_filtered ("Reply is ");
1122 for (i
= 0; i
< retlen
; ++i
)
1124 printf_filtered ("%02x", buf
[i
]);
1126 printf_filtered ("\n");
1130 _initialize_remote_sds (void)
1133 add_target (&sds_ops
);
1135 add_show_from_set (add_set_cmd ("sdstimeout", no_class
,
1136 var_integer
, (char *) &sds_timeout
,
1137 "Set timeout value for sds read.\n", &setlist
),
1140 add_com ("sds", class_obscure
, sds_command
,
1141 "Send a command to the SDS monitor.");