]>
Commit | Line | Data |
---|---|---|
edd01519 | 1 | /* Remote debugging interface for Hitachi E7000 ICE, for GDB |
2b576293 | 2 | Copyright 1993, 1994 Free Software Foundation, Inc. |
edd01519 SC |
3 | Contributed by Cygnus Support. |
4 | ||
5 | Written by Steve Chamberlain for Cygnus Support. | |
863099f4 SC |
6 | |
7 | This file is part of GDB. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 2 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with this program; if not, write to the Free Software | |
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
22 | ||
2b576293 C |
23 | /* The E7000 is an in-circuit emulator for the Hitachi H8/300-H and |
24 | Hitachi-SH processor. It has serial port and a lan port. | |
25 | ||
26 | The monitor command set makes it difficult to load large ammounts of | |
27 | data over the lan without using ftp - so try not to issue load | |
28 | commands when communicating over ethernet; use the ftpload command. | |
29 | ||
30 | The monitor pauses for a second when dumping srecords to the serial | |
31 | line too, so we use a slower per byte mechanism but without the | |
32 | startup overhead. Even so, it's pretty slow... */ | |
863099f4 SC |
33 | |
34 | #include "defs.h" | |
35 | #include "gdbcore.h" | |
2b576293 | 36 | #include "inferior.h" |
863099f4 SC |
37 | #include "target.h" |
38 | #include "wait.h" | |
2b576293 C |
39 | #include "value.h" |
40 | #include "command.h" | |
863099f4 | 41 | #include <signal.h> |
2b576293 | 42 | #include "gdb_string.h" |
863099f4 SC |
43 | #include <sys/types.h> |
44 | #include "serial.h" | |
2b576293 | 45 | #include "remote-utils.h" |
863099f4 | 46 | |
2b576293 C |
47 | #if 0 |
48 | #define HARD_BREAKPOINTS | |
49 | #define BC_BREAKPOINTS 0 | |
50 | #endif | |
863099f4 | 51 | |
863099f4 SC |
52 | #define CTRLC 0x03 |
53 | #define ENQ 0x05 | |
54 | #define ACK 0x06 | |
55 | #define CTRLZ 0x1a | |
56 | ||
2b576293 | 57 | extern void notice_quit PARAMS ((void)); |
863099f4 | 58 | |
2b576293 | 59 | /* Local function declarations. */ |
863099f4 | 60 | |
2b576293 C |
61 | static void e7000_close PARAMS ((int)); |
62 | ||
63 | static void e7000_fetch_register PARAMS ((int)); | |
64 | ||
65 | static void e7000_store_register PARAMS ((int)); | |
66 | ||
67 | static void e7000_command PARAMS ((char *, int)); | |
68 | ||
69 | static void e7000_login_command PARAMS ((char *, int)); | |
70 | ||
71 | static void e7000_ftp_command PARAMS ((char *, int)); | |
72 | ||
73 | static void e7000_drain_command PARAMS ((char *, int)); | |
863099f4 SC |
74 | |
75 | static void expect PARAMS ((char *)); | |
2b576293 C |
76 | |
77 | static void expect_full_prompt PARAMS ((void)); | |
78 | ||
79 | static void expect_prompt PARAMS ((void)); | |
80 | ||
81 | /* Variables. */ | |
82 | ||
863099f4 SC |
83 | static serial_t e7000_desc; |
84 | ||
2b576293 | 85 | /* Nonzero if using the tcp serial driver. */ |
863099f4 | 86 | |
2b576293 | 87 | static int using_tcp; |
863099f4 | 88 | |
2b576293 | 89 | /* Nonzero if using the pc isa card. */ |
863099f4 | 90 | |
2b576293 | 91 | static int using_pc; |
863099f4 | 92 | |
2b576293 C |
93 | extern struct target_ops e7000_ops; /* Forward declaration */ |
94 | ||
95 | char *ENQSTRING = "\005"; | |
96 | ||
97 | /* Nonzero if some routine (as opposed to the user) wants echoing. | |
98 | FIXME: Do this reentrantly with an extra parameter. */ | |
99 | ||
100 | static int echo; | |
101 | ||
102 | static int ctrl_c; | |
103 | ||
104 | static int timeout = 5; | |
105 | ||
106 | /* Send data to e7000debug. */ | |
edd01519 SC |
107 | |
108 | static void | |
2b576293 C |
109 | puts_e7000debug (buf) |
110 | char *buf; | |
111 | { | |
112 | if (!e7000_desc) | |
113 | error ("Use \"target e7000 ...\" first."); | |
114 | ||
115 | if (remote_debug) | |
116 | printf("Sending %s\n", buf); | |
117 | ||
863099f4 SC |
118 | if (SERIAL_WRITE (e7000_desc, buf, strlen (buf))) |
119 | fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno)); | |
120 | ||
2b576293 C |
121 | /* And expect to see it echoed, unless using the pc interface */ |
122 | #if 0 | |
123 | if (!using_pc) | |
124 | #endif | |
125 | expect (buf); | |
863099f4 SC |
126 | } |
127 | ||
128 | static void | |
129 | putchar_e7000 (x) | |
2b576293 | 130 | int x; |
863099f4 SC |
131 | { |
132 | char b[1]; | |
2b576293 | 133 | |
863099f4 SC |
134 | b[0] = x; |
135 | SERIAL_WRITE (e7000_desc, b, 1); | |
136 | } | |
137 | ||
138 | static void | |
139 | write_e7000 (s) | |
140 | char *s; | |
141 | { | |
142 | SERIAL_WRITE (e7000_desc, s, strlen (s)); | |
143 | } | |
144 | ||
2b576293 C |
145 | static int |
146 | normal (x) | |
147 | int x; | |
148 | { | |
149 | if (x == '\n') | |
150 | return '\r'; | |
151 | return x; | |
152 | } | |
153 | ||
863099f4 SC |
154 | /* Read a character from the remote system, doing all the fancy timeout |
155 | stuff. */ | |
156 | ||
157 | static int | |
158 | readchar (timeout) | |
159 | int timeout; | |
160 | { | |
161 | int c; | |
2b576293 | 162 | |
863099f4 SC |
163 | do |
164 | { | |
165 | c = SERIAL_READCHAR (e7000_desc, timeout); | |
166 | } | |
167 | while (c > 127); | |
2b576293 | 168 | |
863099f4 SC |
169 | if (c == SERIAL_TIMEOUT) |
170 | { | |
171 | if (timeout == 0) | |
2b576293 C |
172 | return -1; |
173 | echo = 0; | |
863099f4 SC |
174 | error ("Timeout reading from remote system."); |
175 | } | |
2b576293 C |
176 | if (remote_debug) |
177 | { | |
178 | putchar (c); | |
179 | fflush (stdout); | |
180 | } | |
181 | ||
182 | return normal (c); | |
863099f4 SC |
183 | } |
184 | ||
2b576293 C |
185 | #if 0 |
186 | char * | |
187 | tl (x) | |
188 | { | |
189 | static char b[8][10]; | |
190 | static int p; | |
191 | ||
192 | p++; | |
193 | p &= 7; | |
194 | if (x >= ' ') | |
195 | { | |
196 | b[p][0] = x; | |
197 | b[p][1] = 0; | |
198 | } | |
199 | else | |
200 | { | |
201 | sprintf(b[p], "<%d>", x); | |
202 | } | |
203 | ||
204 | return b[p]; | |
205 | } | |
206 | #endif | |
207 | ||
208 | /* Scan input from the remote system, until STRING is found. If | |
209 | DISCARD is non-zero, then discard non-matching input, else print it | |
210 | out. Let the user break out immediately. */ | |
edd01519 | 211 | |
863099f4 SC |
212 | static void |
213 | expect (string) | |
214 | char *string; | |
215 | { | |
216 | char *p = string; | |
217 | int c; | |
2b576293 | 218 | int nl = 0; |
863099f4 | 219 | |
863099f4 | 220 | while (1) |
863099f4 SC |
221 | { |
222 | c = readchar (timeout); | |
edd01519 SC |
223 | notice_quit (); |
224 | if (quit_flag == 1) | |
225 | { | |
2b576293 C |
226 | if (ctrl_c) |
227 | { | |
228 | putchar_e7000(CTRLC); | |
229 | --ctrl_c; | |
230 | } | |
edd01519 SC |
231 | else |
232 | { | |
2b576293 | 233 | quit (); |
edd01519 SC |
234 | } |
235 | } | |
236 | ||
863099f4 SC |
237 | if (c == SERIAL_ERROR) |
238 | { | |
239 | error ("Serial communication error"); | |
240 | } | |
2b576293 | 241 | if (echo || remote_debug) |
863099f4 | 242 | { |
2b576293 C |
243 | if (c == '\r' || c == '\n') |
244 | { | |
245 | if (!nl) | |
246 | putchar ('\n'); | |
247 | nl = 1; | |
248 | } | |
249 | else | |
250 | { | |
251 | nl = 0; | |
252 | putchar (c); | |
253 | } | |
863099f4 SC |
254 | fflush (stdout); |
255 | } | |
2b576293 | 256 | if (normal (c) == normal (*p++)) |
863099f4 SC |
257 | { |
258 | if (*p == '\0') | |
2b576293 | 259 | return; |
863099f4 SC |
260 | } |
261 | else | |
262 | { | |
263 | p = string; | |
2b576293 C |
264 | |
265 | if (normal (c) == normal (string[0])) | |
266 | p++; | |
863099f4 SC |
267 | } |
268 | } | |
269 | } | |
270 | ||
271 | /* Keep discarding input until we see the e7000 prompt. | |
272 | ||
273 | The convention for dealing with the prompt is that you | |
274 | o give your command | |
275 | o *then* wait for the prompt. | |
276 | ||
2b576293 C |
277 | Thus the last thing that a procedure does with the serial line will |
278 | be an expect_prompt(). Exception: e7000_resume does not wait for | |
279 | the prompt, because the terminal is being handed over to the | |
280 | inferior. However, the next thing which happens after that is a | |
281 | e7000_wait which does wait for the prompt. Note that this includes | |
282 | abnormal exit, e.g. error(). This is necessary to prevent getting | |
283 | into states from which we can't recover. */ | |
284 | ||
863099f4 SC |
285 | static void |
286 | expect_prompt () | |
287 | { | |
863099f4 SC |
288 | expect (":"); |
289 | } | |
2b576293 | 290 | |
863099f4 SC |
291 | static void |
292 | expect_full_prompt () | |
293 | { | |
2b576293 | 294 | expect ("\r:"); |
863099f4 SC |
295 | } |
296 | ||
297 | static int | |
2b576293 C |
298 | convert_hex_digit (ch) |
299 | int ch; | |
863099f4 SC |
300 | { |
301 | if (ch >= '0' && ch <= '9') | |
302 | return ch - '0'; | |
303 | else if (ch >= 'A' && ch <= 'F') | |
304 | return ch - 'A' + 10; | |
305 | else if (ch >= 'a' && ch <= 'f') | |
306 | return ch - 'a' + 10; | |
307 | return -1; | |
863099f4 SC |
308 | } |
309 | ||
863099f4 SC |
310 | static int |
311 | get_hex (start) | |
312 | int *start; | |
313 | { | |
2b576293 | 314 | int value = convert_hex_digit (*start); |
863099f4 SC |
315 | int try; |
316 | ||
317 | *start = readchar (timeout); | |
2b576293 | 318 | while ((try = convert_hex_digit (*start)) >= 0) |
863099f4 SC |
319 | { |
320 | value <<= 4; | |
321 | value += try; | |
322 | *start = readchar (timeout); | |
323 | } | |
324 | return value; | |
325 | } | |
326 | ||
2b576293 C |
327 | #if 0 |
328 | /* Get N 32-bit words from remote, each preceded by a space, and put | |
329 | them in registers starting at REGNO. */ | |
863099f4 SC |
330 | |
331 | static void | |
332 | get_hex_regs (n, regno) | |
333 | int n; | |
334 | int regno; | |
335 | { | |
336 | long val; | |
337 | int i; | |
338 | ||
339 | for (i = 0; i < n; i++) | |
340 | { | |
341 | int j; | |
342 | ||
343 | val = 0; | |
344 | for (j = 0; j < 8; j++) | |
345 | val = (val << 4) + get_hex_digit (j == 0); | |
346 | supply_register (regno++, (char *) &val); | |
347 | } | |
348 | } | |
2b576293 | 349 | #endif |
863099f4 SC |
350 | |
351 | /* This is called not only when we first attach, but also when the | |
352 | user types "run" after having attached. */ | |
2b576293 | 353 | |
863099f4 SC |
354 | static void |
355 | e7000_create_inferior (execfile, args, env) | |
356 | char *execfile; | |
357 | char *args; | |
358 | char **env; | |
359 | { | |
360 | int entry_pt; | |
361 | ||
362 | if (args && *args) | |
363 | error ("Can't pass arguments to remote E7000DEBUG process"); | |
364 | ||
365 | if (execfile == 0 || exec_bfd == 0) | |
366 | error ("No exec file specified"); | |
367 | ||
368 | entry_pt = (int) bfd_get_start_address (exec_bfd); | |
369 | ||
370 | #ifdef CREATE_INFERIOR_HOOK | |
371 | CREATE_INFERIOR_HOOK (0); /* No process-ID */ | |
372 | #endif | |
373 | ||
374 | /* The "process" (board) is already stopped awaiting our commands, and | |
375 | the program is already downloaded. We just set its PC and go. */ | |
376 | ||
377 | clear_proceed_status (); | |
378 | ||
379 | /* Tell wait_for_inferior that we've started a new process. */ | |
380 | init_wait_for_inferior (); | |
381 | ||
382 | /* Set up the "saved terminal modes" of the inferior | |
383 | based on what modes we are starting it with. */ | |
384 | target_terminal_init (); | |
385 | ||
386 | /* Install inferior's terminal modes. */ | |
387 | target_terminal_inferior (); | |
388 | ||
389 | /* insert_step_breakpoint (); FIXME, do we need this? */ | |
390 | proceed ((CORE_ADDR) entry_pt, -1, 0); /* Let 'er rip... */ | |
391 | } | |
392 | ||
2b576293 C |
393 | /* Open a connection to a remote debugger. NAME is the filename used |
394 | for communication. */ | |
863099f4 SC |
395 | |
396 | static int baudrate = 9600; | |
397 | static char dev_name[100]; | |
398 | ||
399 | static char *machine = ""; | |
400 | static char *user = ""; | |
401 | static char *passwd = ""; | |
402 | static char *dir = ""; | |
403 | ||
404 | /* Grab the next token and buy some space for it */ | |
2b576293 | 405 | |
863099f4 SC |
406 | static char * |
407 | next (ptr) | |
408 | char **ptr; | |
409 | { | |
410 | char *p = *ptr; | |
411 | char *s; | |
412 | char *r; | |
413 | int l = 0; | |
2b576293 | 414 | |
863099f4 | 415 | while (*p && *p == ' ') |
2b576293 | 416 | p++; |
863099f4 SC |
417 | s = p; |
418 | while (*p && (*p != ' ' && *p != '\t')) | |
419 | { | |
420 | l++; | |
421 | p++; | |
422 | } | |
423 | r = xmalloc (l + 1); | |
424 | memcpy (r, s, l); | |
425 | r[l] = 0; | |
426 | *ptr = p; | |
427 | return r; | |
428 | } | |
429 | ||
2b576293 C |
430 | static void |
431 | e7000_login_command (args, from_tty) | |
863099f4 SC |
432 | char *args; |
433 | int from_tty; | |
434 | { | |
435 | if (args) | |
436 | { | |
437 | machine = next (&args); | |
438 | user = next (&args); | |
439 | passwd = next (&args); | |
440 | dir = next (&args); | |
441 | if (from_tty) | |
442 | { | |
443 | printf ("Set info to %s %s %s %s\n", machine, user, passwd, dir); | |
444 | } | |
445 | } | |
446 | else | |
447 | { | |
448 | error ("Syntax is ftplogin <machine> <user> <passwd> <directory>"); | |
449 | } | |
450 | } | |
451 | ||
452 | /* Start an ftp transfer from the E7000 to a host */ | |
453 | ||
2b576293 C |
454 | static void |
455 | e7000_ftp_command (args, from_tty) | |
863099f4 SC |
456 | char *args; |
457 | int from_tty; | |
458 | { | |
2b576293 C |
459 | /* FIXME: arbitrary limit on machine names and such. */ |
460 | char buf[200]; | |
461 | ||
863099f4 SC |
462 | int oldtimeout = timeout; |
463 | timeout = 10; | |
2b576293 C |
464 | |
465 | sprintf (buf, "ftp %s\r", machine); | |
466 | puts_e7000debug (buf); | |
863099f4 | 467 | expect (" Username : "); |
2b576293 C |
468 | sprintf (buf, "%s\r", user); |
469 | puts_e7000debug (buf); | |
863099f4 SC |
470 | expect (" Password : "); |
471 | write_e7000 (passwd); | |
472 | write_e7000 ("\r"); | |
473 | expect ("success\r"); | |
474 | expect ("FTP>"); | |
2b576293 C |
475 | sprintf (buf, "cd %s\r", dir); |
476 | puts_e7000debug (buf); | |
863099f4 | 477 | expect ("FTP>"); |
2b576293 C |
478 | sprintf (buf, "ll 0;s:%s\r", args); |
479 | puts_e7000debug (buf); | |
863099f4 | 480 | expect ("FTP>"); |
2b576293 | 481 | puts_e7000debug ("bye\r"); |
863099f4 | 482 | expect (":"); |
863099f4 SC |
483 | timeout = oldtimeout; |
484 | } | |
485 | ||
486 | static void | |
487 | e7000_open (args, from_tty) | |
488 | char *args; | |
489 | int from_tty; | |
490 | { | |
491 | int n; | |
2b576293 | 492 | int loop; |
863099f4 SC |
493 | char junk[100]; |
494 | int sync; | |
495 | target_preopen (from_tty); | |
496 | ||
2b576293 C |
497 | n = 0; |
498 | if (args && strcasecmp (args, "pc") == 0) | |
499 | { | |
500 | strcpy (dev_name, args); | |
501 | } | |
502 | else | |
863099f4 | 503 | { |
2b576293 C |
504 | if (args) |
505 | { | |
506 | n = sscanf (args, " %s %d %s", dev_name, &baudrate, junk); | |
507 | } | |
508 | ||
509 | if (n != 1 && n != 2) | |
510 | { | |
511 | error ("Bad arguments. Usage:\ttarget e7000 <device> <speed>\n\ | |
512 | or \t\ttarget e7000 <host>[:<port>]\n\ | |
513 | or \t\ttarget e7000 pc\n"); | |
514 | } | |
515 | ||
516 | #ifndef __GO32__ | |
517 | if (n == 1 && strchr (dev_name, ':') == 0) | |
518 | { | |
519 | /* Default to normal telnet port */ | |
520 | strcat (dev_name, ":23"); | |
521 | } | |
522 | #endif | |
863099f4 SC |
523 | } |
524 | ||
525 | push_target (&e7000_ops); | |
863099f4 | 526 | |
2b576293 | 527 | e7000_desc = SERIAL_OPEN (dev_name); |
863099f4 SC |
528 | |
529 | if (!e7000_desc) | |
530 | perror_with_name (dev_name); | |
531 | ||
532 | using_tcp = strcmp (e7000_desc->ops->name, "tcp") == 0; | |
2b576293 | 533 | using_pc = strcmp (e7000_desc->ops->name, "pc") == 0; |
863099f4 SC |
534 | |
535 | SERIAL_SETBAUDRATE (e7000_desc, baudrate); | |
536 | SERIAL_RAW (e7000_desc); | |
537 | ||
538 | /* Hello? Are you there? */ | |
539 | sync = 0; | |
2b576293 | 540 | loop = 0; |
edd01519 | 541 | putchar_e7000 (CTRLC); |
863099f4 SC |
542 | while (!sync) |
543 | { | |
544 | int c; | |
2b576293 | 545 | |
863099f4 SC |
546 | if (from_tty) |
547 | printf_unfiltered ("[waiting for e7000...]\n"); | |
2b576293 C |
548 | |
549 | write_e7000 ("\r"); | |
550 | c = SERIAL_READCHAR (e7000_desc, 1); | |
863099f4 SC |
551 | while (c != SERIAL_TIMEOUT) |
552 | { | |
553 | /* Dont echo cr's */ | |
554 | if (from_tty && c != '\r') | |
555 | { | |
556 | putchar (c); | |
557 | fflush (stdout); | |
558 | } | |
559 | if (c == ':') | |
2b576293 C |
560 | sync = 1; |
561 | ||
562 | if (loop++ == 20) | |
863099f4 | 563 | { |
2b576293 C |
564 | putchar_e7000 (CTRLC); |
565 | loop = 0; | |
863099f4 | 566 | } |
2b576293 C |
567 | |
568 | QUIT ; | |
569 | ||
570 | ||
863099f4 SC |
571 | if (quit_flag) |
572 | { | |
573 | putchar_e7000 (CTRLC); | |
574 | quit_flag = 0; | |
575 | } | |
2b576293 | 576 | c = SERIAL_READCHAR (e7000_desc, 1); |
863099f4 SC |
577 | } |
578 | } | |
2b576293 C |
579 | puts_e7000debug ("\r"); |
580 | ||
863099f4 SC |
581 | expect_prompt (); |
582 | ||
583 | if (from_tty) | |
584 | printf_filtered ("Remote %s connected to %s\n", target_shortname, | |
585 | dev_name); | |
586 | ||
edd01519 SC |
587 | #ifdef GDB_TARGET_IS_H8300 |
588 | h8300hmode = 1; | |
589 | #endif | |
863099f4 SC |
590 | } |
591 | ||
592 | /* Close out all files and local state before this target loses control. */ | |
593 | ||
594 | static void | |
595 | e7000_close (quitting) | |
596 | int quitting; | |
597 | { | |
598 | if (e7000_desc) | |
599 | { | |
600 | SERIAL_CLOSE (e7000_desc); | |
601 | e7000_desc = 0; | |
602 | } | |
603 | } | |
604 | ||
2b576293 C |
605 | /* Terminate the open connection to the remote debugger. Use this |
606 | when you want to detach and do something else with your gdb. */ | |
607 | ||
863099f4 SC |
608 | static void |
609 | e7000_detach (from_tty) | |
610 | int from_tty; | |
611 | { | |
612 | pop_target (); /* calls e7000_close to do the real work */ | |
613 | if (from_tty) | |
614 | printf ("Ending remote %s debugging\n", target_shortname); | |
615 | } | |
616 | ||
617 | /* Tell the remote machine to resume. */ | |
618 | ||
619 | static void | |
620 | e7000_resume (pid, step, sig) | |
621 | int pid, step, sig; | |
622 | { | |
623 | if (step) | |
2b576293 | 624 | puts_e7000debug ("S\r"); |
863099f4 | 625 | else |
2b576293 | 626 | puts_e7000debug ("G\r"); |
863099f4 SC |
627 | } |
628 | ||
629 | /* Read the remote registers into the block REGS. | |
630 | ||
edd01519 | 631 | For the H8/300 a register dump looks like: |
863099f4 | 632 | |
2b576293 C |
633 | PC=00021A CCR=80:I******* |
634 | ER0 - ER3 0000000A 0000002E 0000002E 00000000 | |
635 | ER4 - ER7 00000000 00000000 00000000 00FFEFF6 | |
636 | 000218 MOV.B R1L,R2L | |
637 | STEP NORMAL END or | |
638 | BREAK POINT | |
639 | */ | |
863099f4 SC |
640 | |
641 | #ifdef GDB_TARGET_IS_H8300 | |
2b576293 C |
642 | |
643 | char *want = "PC=%p CCR=%c\n\ | |
863099f4 | 644 | ER0 - ER3 %0 %1 %2 %3\n\ |
edd01519 SC |
645 | ER4 - ER7 %4 %5 %6 %7\n"; |
646 | ||
647 | char *want_nopc = "%p CCR=%c\n\ | |
648 | ER0 - ER3 %0 %1 %2 %3\n\ | |
649 | ER4 - ER7 %4 %5 %6 %7"; | |
650 | ||
863099f4 | 651 | #endif |
2b576293 | 652 | |
863099f4 | 653 | #ifdef GDB_TARGET_IS_SH |
2b576293 C |
654 | |
655 | char *want = "PC=%16 SR=%22\n\ | |
656 | PR=%17 GBR=%18 VBR=%19\n\ | |
657 | MACH=%20 MACL=%21\n\ | |
658 | R0-7 %0 %1 %2 %3 %4 %5 %6 %7\n\ | |
659 | R8-15 %8 %9 %10 %11 %12 %13 %14 %15\n"; | |
863099f4 SC |
660 | |
661 | char *want_nopc = "%16 SR=%22\n\ | |
662 | PR=%17 GBR=%18 VBR=%19\n\ | |
663 | MACH=%20 MACL=%21\n\ | |
664 | R0-7 %0 %1 %2 %3 %4 %5 %6 %7\n\ | |
665 | R8-15 %8 %9 %10 %11 %12 %13 %14 %15"; | |
666 | ||
863099f4 SC |
667 | #endif |
668 | ||
2b576293 | 669 | static int |
863099f4 SC |
670 | gch () |
671 | { | |
672 | int c = readchar (timeout); | |
2b576293 C |
673 | |
674 | if (remote_debug) | |
863099f4 SC |
675 | { |
676 | if (c >= ' ') | |
677 | printf ("%c", c); | |
678 | else if (c == '\n') | |
2b576293 | 679 | printf ("\n"); |
863099f4 SC |
680 | } |
681 | return c; | |
682 | } | |
683 | ||
2b576293 | 684 | static unsigned int |
863099f4 SC |
685 | gbyte () |
686 | { | |
2b576293 C |
687 | int high = convert_hex_digit (gch ()); |
688 | int low = convert_hex_digit (gch ()); | |
689 | ||
863099f4 SC |
690 | return (high << 4) + low; |
691 | } | |
692 | ||
693 | void | |
694 | fetch_regs_from_dump (nextchar, want) | |
695 | int (*nextchar)(); | |
696 | char *want; | |
697 | { | |
698 | int regno; | |
699 | char buf[MAX_REGISTER_RAW_SIZE]; | |
700 | ||
2b576293 C |
701 | int thischar = nextchar (); |
702 | ||
863099f4 SC |
703 | while (*want) |
704 | { | |
705 | switch (*want) | |
706 | { | |
707 | case '\n': | |
2b576293 C |
708 | /* Skip to end of line and then eat all new line type stuff */ |
709 | while (thischar != '\n' && thischar != '\r') | |
710 | thischar = nextchar (); | |
711 | while (thischar == '\n' || thischar == '\r') | |
712 | thischar = nextchar (); | |
863099f4 SC |
713 | want++; |
714 | break; | |
715 | ||
716 | case ' ': | |
2b576293 C |
717 | while (thischar == ' ' |
718 | || thischar == '\t' | |
719 | || thischar == '\r' | |
720 | || thischar == '\n') | |
721 | thischar = nextchar (); | |
863099f4 SC |
722 | want++; |
723 | break; | |
724 | ||
725 | default: | |
726 | if (*want == thischar) | |
727 | { | |
728 | want++; | |
729 | if (*want) | |
2b576293 | 730 | thischar = nextchar (); |
863099f4 SC |
731 | |
732 | } | |
2b576293 | 733 | else if (thischar == ' ' || thischar == '\n' || thischar == '\r') |
863099f4 | 734 | { |
2b576293 | 735 | thischar = nextchar (); |
863099f4 SC |
736 | } |
737 | else { | |
2b576293 C |
738 | error ("out of sync in fetch registers wanted <%s>, got <%c 0x%x>", |
739 | want, thischar, thischar); | |
863099f4 SC |
740 | } |
741 | ||
742 | break; | |
743 | case '%': | |
744 | /* Got a register command */ | |
745 | want++; | |
746 | switch (*want) | |
747 | { | |
748 | #ifdef PC_REGNUM | |
749 | case 'p': | |
750 | regno = PC_REGNUM; | |
751 | want++; | |
752 | break; | |
753 | #endif | |
754 | #ifdef CCR_REGNUM | |
755 | case 'c': | |
756 | regno = CCR_REGNUM; | |
757 | want++; | |
758 | break; | |
759 | #endif | |
760 | #ifdef SP_REGNUM | |
761 | case 's': | |
762 | regno = SP_REGNUM; | |
763 | want++; | |
764 | break; | |
765 | #endif | |
766 | #ifdef FP_REGNUM | |
767 | case 'f': | |
768 | regno = FP_REGNUM; | |
769 | want++; | |
770 | break; | |
771 | #endif | |
772 | ||
863099f4 | 773 | default: |
2b576293 | 774 | if (isdigit (want[0])) |
863099f4 | 775 | { |
2b576293 | 776 | if (isdigit (want[1])) |
863099f4 SC |
777 | { |
778 | regno = (want[0] - '0') * 10 + want[1] - '0'; | |
2b576293 | 779 | want += 2; |
863099f4 SC |
780 | } |
781 | else | |
782 | { | |
783 | regno = want[0] - '0'; | |
784 | want++; | |
785 | } | |
786 | } | |
787 | ||
788 | else | |
2b576293 | 789 | abort (); |
863099f4 SC |
790 | } |
791 | store_signed_integer (buf, | |
792 | REGISTER_RAW_SIZE(regno), | |
2b576293 | 793 | (LONGEST) get_hex (&thischar, nextchar)); |
863099f4 SC |
794 | supply_register (regno, buf); |
795 | break; | |
796 | } | |
797 | } | |
798 | } | |
799 | ||
800 | static void | |
801 | e7000_fetch_registers () | |
802 | { | |
803 | int regno; | |
804 | ||
2b576293 | 805 | puts_e7000debug ("R\r"); |
863099f4 SC |
806 | fetch_regs_from_dump (gch, want); |
807 | ||
808 | /* And supply the extra ones the simulator uses */ | |
809 | for (regno = NUM_REALREGS; regno < NUM_REGS; regno++) | |
810 | { | |
811 | int buf = 0; | |
2b576293 | 812 | |
863099f4 SC |
813 | supply_register (regno, (char *) (&buf)); |
814 | } | |
815 | } | |
816 | ||
2b576293 C |
817 | /* Fetch register REGNO, or all registers if REGNO is -1. Returns |
818 | errno value. */ | |
863099f4 | 819 | |
2b576293 | 820 | static void |
863099f4 SC |
821 | e7000_fetch_register (regno) |
822 | int regno; | |
823 | { | |
824 | e7000_fetch_registers (); | |
825 | } | |
826 | ||
827 | /* Store the remote registers from the contents of the block REGS. */ | |
828 | ||
829 | static void | |
830 | e7000_store_registers () | |
831 | { | |
832 | int regno; | |
833 | ||
834 | for (regno = 0; regno < NUM_REALREGS; regno++) | |
835 | e7000_store_register (regno); | |
836 | ||
837 | registers_changed (); | |
838 | } | |
839 | ||
2b576293 C |
840 | /* Store register REGNO, or all if REGNO == 0. Return errno value. */ |
841 | ||
863099f4 SC |
842 | static void |
843 | e7000_store_register (regno) | |
844 | int regno; | |
845 | { | |
2b576293 C |
846 | char buf[200]; |
847 | ||
863099f4 SC |
848 | if (regno == -1) |
849 | { | |
850 | e7000_store_registers (); | |
851 | return; | |
852 | } | |
2b576293 | 853 | |
863099f4 SC |
854 | #ifdef GDB_TARGET_IS_H8300 |
855 | if (regno <= 7) | |
856 | { | |
2b576293 C |
857 | sprintf (buf, ".ER%d %x\r", regno, read_register (regno)); |
858 | puts_e7000debug (buf); | |
863099f4 SC |
859 | } |
860 | else if (regno == PC_REGNUM) | |
861 | { | |
2b576293 C |
862 | sprintf (buf, ".PC %x\r", read_register (regno)); |
863 | puts_e7000debug (buf); | |
863099f4 SC |
864 | } |
865 | else if (regno == CCR_REGNUM) | |
866 | { | |
2b576293 C |
867 | sprintf (buf, ".CCR %x\r", read_register (regno)); |
868 | puts_e7000debug (buf); | |
863099f4 | 869 | } |
2b576293 | 870 | #endif /* GDB_TARGET_IS_H8300 */ |
863099f4 SC |
871 | |
872 | #ifdef GDB_TARGET_IS_SH | |
873 | switch (regno) | |
874 | { | |
875 | default: | |
2b576293 C |
876 | sprintf (buf, ".R%d %x\r", regno, read_register (regno)); |
877 | puts_e7000debug (buf); | |
863099f4 | 878 | break; |
2b576293 | 879 | |
863099f4 | 880 | case PC_REGNUM: |
2b576293 C |
881 | sprintf (buf, ".PC %x\r", read_register (regno)); |
882 | puts_e7000debug (buf); | |
863099f4 | 883 | break; |
2b576293 | 884 | |
863099f4 | 885 | case SR_REGNUM: |
2b576293 C |
886 | sprintf (buf, ".SR %x\r", read_register (regno)); |
887 | puts_e7000debug (buf); | |
863099f4 SC |
888 | break; |
889 | ||
890 | case PR_REGNUM: | |
2b576293 C |
891 | sprintf (buf, ".PR %x\r", read_register (regno)); |
892 | puts_e7000debug (buf); | |
863099f4 SC |
893 | break; |
894 | ||
895 | case GBR_REGNUM: | |
2b576293 C |
896 | sprintf (buf, ".GBR %x\r", read_register (regno)); |
897 | puts_e7000debug (buf); | |
863099f4 SC |
898 | break; |
899 | ||
900 | case VBR_REGNUM: | |
2b576293 C |
901 | sprintf (buf, ".VBR %x\r", read_register (regno)); |
902 | puts_e7000debug (buf); | |
863099f4 SC |
903 | break; |
904 | ||
905 | case MACH_REGNUM: | |
2b576293 C |
906 | sprintf (buf, ".MACH %x\r", read_register (regno)); |
907 | puts_e7000debug (buf); | |
863099f4 SC |
908 | break; |
909 | ||
910 | case MACL_REGNUM: | |
2b576293 C |
911 | sprintf (buf, ".MACL %x\r", read_register (regno)); |
912 | puts_e7000debug (buf); | |
863099f4 SC |
913 | break; |
914 | } | |
915 | ||
2b576293 C |
916 | #endif /* GDB_TARGET_IS_SH */ |
917 | ||
863099f4 SC |
918 | expect_prompt (); |
919 | } | |
920 | ||
921 | /* Get ready to modify the registers array. On machines which store | |
922 | individual registers, this doesn't need to do anything. On machines | |
923 | which store all the registers in one fell swoop, this makes sure | |
924 | that registers contains all the registers from the program being | |
925 | debugged. */ | |
926 | ||
927 | static void | |
928 | e7000_prepare_to_store () | |
929 | { | |
930 | /* Do nothing, since we can store individual regs */ | |
931 | } | |
932 | ||
933 | static void | |
934 | e7000_files_info () | |
935 | { | |
2b576293 | 936 | printf ("\tAttached to %s at %d baud.\n", dev_name, baudrate); |
863099f4 SC |
937 | } |
938 | ||
2b576293 | 939 | static int |
863099f4 SC |
940 | stickbyte (where, what) |
941 | char *where; | |
942 | unsigned int what; | |
943 | { | |
944 | static CONST char digs[] = "0123456789ABCDEF"; | |
2b576293 | 945 | |
863099f4 SC |
946 | where[0] = digs[(what >> 4) & 0xf]; |
947 | where[1] = digs[(what & 0xf) & 0xf]; | |
2b576293 | 948 | |
863099f4 SC |
949 | return what; |
950 | } | |
951 | ||
2b576293 C |
952 | /* Write a small ammount of memory. */ |
953 | ||
863099f4 SC |
954 | static int |
955 | write_small (memaddr, myaddr, len) | |
956 | CORE_ADDR memaddr; | |
957 | unsigned char *myaddr; | |
958 | int len; | |
959 | { | |
960 | int i; | |
2b576293 C |
961 | char buf[200]; |
962 | ||
863099f4 SC |
963 | for (i = 0; i < len; i++) |
964 | { | |
2b576293 | 965 | if (((memaddr + i) & 3) == 0 && (i + 3 < len)) |
863099f4 SC |
966 | { |
967 | /* Can be done with a long word */ | |
2b576293 C |
968 | sprintf (buf, "m %x %x%02x%02x%02x;l\r", |
969 | memaddr + i, | |
970 | myaddr[i], myaddr[i + 1], myaddr[i + 2], myaddr[i + 3]); | |
971 | puts_e7000debug (buf); | |
863099f4 SC |
972 | i += 3; |
973 | } | |
974 | else | |
975 | { | |
2b576293 C |
976 | sprintf (buf, "m %x %x\r", memaddr + i, myaddr[i]); |
977 | puts_e7000debug (buf); | |
863099f4 SC |
978 | } |
979 | } | |
2b576293 | 980 | |
863099f4 | 981 | expect_prompt (); |
2b576293 | 982 | |
863099f4 SC |
983 | return len; |
984 | } | |
2b576293 C |
985 | |
986 | /* Write a large ammount of memory, this only works with the serial | |
987 | mode enabled. Command is sent as | |
988 | ||
863099f4 SC |
989 | il ;s:s\r -> |
990 | <- il ;s:s\r | |
991 | <- ENQ | |
992 | ACK -> | |
993 | <- LO s\r | |
994 | Srecords... | |
995 | ^Z -> | |
996 | <- ENQ | |
997 | ACK -> | |
998 | <- : | |
2b576293 | 999 | */ |
863099f4 SC |
1000 | |
1001 | static int | |
1002 | write_large (memaddr, myaddr, len) | |
1003 | CORE_ADDR memaddr; | |
1004 | unsigned char *myaddr; | |
1005 | int len; | |
1006 | { | |
1007 | int i; | |
1008 | #define maxstride 128 | |
1009 | int stride; | |
1010 | ||
2b576293 | 1011 | puts_e7000debug ("IL ;S:FK\r"); |
863099f4 SC |
1012 | expect (ENQSTRING); |
1013 | putchar_e7000 (ACK); | |
edd01519 | 1014 | expect ("LO FK\r"); |
2b576293 | 1015 | |
863099f4 SC |
1016 | for (i = 0; i < len; i += stride) |
1017 | { | |
1018 | char compose[maxstride * 2 + 50]; | |
1019 | int address = i + memaddr; | |
1020 | int j; | |
1021 | int check_sum; | |
1022 | int where = 0; | |
1023 | int alen; | |
2b576293 | 1024 | |
863099f4 SC |
1025 | stride = len - i; |
1026 | if (stride > maxstride) | |
1027 | stride = maxstride; | |
1028 | ||
1029 | compose[where++] = 'S'; | |
1030 | check_sum = 0; | |
1031 | if (address >= 0xffffff) | |
2b576293 | 1032 | alen = 4; |
863099f4 | 1033 | else if (address >= 0xffff) |
2b576293 | 1034 | alen = 3; |
863099f4 SC |
1035 | else |
1036 | alen = 2; | |
2b576293 C |
1037 | /* Insert type. */ |
1038 | compose[where++] = alen - 1 + '0'; | |
1039 | /* Insert length. */ | |
1040 | check_sum += stickbyte (compose + where, alen + stride + 1); | |
863099f4 SC |
1041 | where += 2; |
1042 | while (alen > 0) | |
1043 | { | |
1044 | alen--; | |
1045 | check_sum += stickbyte (compose + where, address >> (8 * (alen))); | |
1046 | where += 2; | |
1047 | } | |
1048 | ||
1049 | for (j = 0; j < stride; j++) | |
1050 | { | |
1051 | check_sum += stickbyte (compose + where, myaddr[i + j]); | |
1052 | where += 2; | |
1053 | } | |
863099f4 | 1054 | stickbyte (compose + where, ~check_sum); |
863099f4 SC |
1055 | where += 2; |
1056 | compose[where++] = '\r'; | |
edd01519 SC |
1057 | compose[where++] = '\n'; |
1058 | compose[where++] = 0; | |
2b576293 C |
1059 | |
1060 | SERIAL_WRITE (e7000_desc, compose, where); | |
1061 | j = SERIAL_READCHAR (e7000_desc, 0); | |
1062 | if (j == SERIAL_TIMEOUT) | |
863099f4 | 1063 | { |
2b576293 C |
1064 | /* This is ok - nothing there */ |
1065 | } | |
1066 | else if (j == ENQ) | |
1067 | { | |
1068 | /* Hmm, it's trying to tell us something */ | |
1069 | expect (":"); | |
1070 | error ("Error writing memory"); | |
1071 | } | |
1072 | else | |
1073 | { | |
1074 | printf ("@%d}@", j); | |
1075 | while ((j = SERIAL_READCHAR(e7000_desc,0)) > 0) | |
edd01519 | 1076 | { |
2b576293 | 1077 | printf ("@{%d}@",j); |
edd01519 | 1078 | } |
863099f4 | 1079 | } |
863099f4 | 1080 | } |
2b576293 | 1081 | |
863099f4 SC |
1082 | /* Send the trailer record */ |
1083 | write_e7000 ("S70500000000FA\r"); | |
1084 | putchar_e7000 (CTRLZ); | |
1085 | expect (ENQSTRING); | |
1086 | putchar_e7000 (ACK); | |
1087 | expect (":"); | |
2b576293 | 1088 | |
863099f4 SC |
1089 | return len; |
1090 | } | |
1091 | ||
2b576293 C |
1092 | /* Copy LEN bytes of data from debugger memory at MYADDR to inferior's |
1093 | memory at MEMADDR. Returns length moved. | |
1094 | ||
1095 | Can't use the Srecord load over ethernet, so don't use fast method | |
1096 | then. */ | |
863099f4 | 1097 | |
863099f4 SC |
1098 | static int |
1099 | e7000_write_inferior_memory (memaddr, myaddr, len) | |
1100 | CORE_ADDR memaddr; | |
1101 | unsigned char *myaddr; | |
1102 | int len; | |
1103 | { | |
2b576293 C |
1104 | if (len < 16 || using_tcp || using_pc) |
1105 | return write_small (memaddr, myaddr, len); | |
863099f4 | 1106 | else |
2b576293 | 1107 | return write_large (memaddr, myaddr, len); |
863099f4 SC |
1108 | } |
1109 | ||
863099f4 SC |
1110 | /* Read LEN bytes from inferior memory at MEMADDR. Put the result |
1111 | at debugger address MYADDR. Returns length moved. | |
1112 | ||
863099f4 SC |
1113 | Small transactions we send |
1114 | m <addr>;l | |
1115 | and receive | |
1116 | 00000000 12345678 ? | |
863099f4 SC |
1117 | */ |
1118 | ||
1119 | static int | |
1120 | e7000_read_inferior_memory (memaddr, myaddr, len) | |
1121 | CORE_ADDR memaddr; | |
1122 | unsigned char *myaddr; | |
1123 | int len; | |
1124 | { | |
1125 | int count; | |
1126 | int c; | |
1127 | int i; | |
2b576293 | 1128 | char buf[200]; |
863099f4 SC |
1129 | /* Starting address of this pass. */ |
1130 | ||
2b576293 | 1131 | /* printf("READ INF %x %x %d\n", memaddr, myaddr, len);*/ |
863099f4 SC |
1132 | if (((memaddr - 1) + len) < memaddr) |
1133 | { | |
1134 | errno = EIO; | |
1135 | return 0; | |
1136 | } | |
1137 | ||
2b576293 C |
1138 | sprintf (buf, "m %x;l\r", memaddr); |
1139 | puts_e7000debug (buf); | |
863099f4 SC |
1140 | |
1141 | for (count = 0; count < len; count += 4) | |
1142 | { | |
1143 | /* Suck away the address */ | |
2b576293 | 1144 | c = gch (); |
863099f4 | 1145 | while (c != ' ') |
2b576293 C |
1146 | c = gch (); |
1147 | c = gch (); | |
863099f4 SC |
1148 | if (c == '*') |
1149 | { /* Some kind of error */ | |
1150 | expect_prompt(); | |
1151 | return -1; | |
1152 | } | |
1153 | while (c != ' ') | |
2b576293 | 1154 | c = gch (); |
863099f4 SC |
1155 | |
1156 | /* Now read in the data */ | |
1157 | for (i = 0; i < 4; i++) | |
1158 | { | |
1159 | int b = gbyte(); | |
1160 | if (count + i < len) { | |
1161 | myaddr[count + i] = b; | |
1162 | } | |
1163 | } | |
1164 | ||
1165 | /* Skip the trailing ? and send a . to end and a cr for more */ | |
2b576293 C |
1166 | gch (); |
1167 | gch (); | |
863099f4 | 1168 | if (count + 4 >= len) |
2b576293 | 1169 | puts_e7000debug(".\r"); |
863099f4 | 1170 | else |
2b576293 C |
1171 | puts_e7000debug("\r"); |
1172 | ||
863099f4 SC |
1173 | } |
1174 | expect_prompt(); | |
2b576293 | 1175 | return len; |
863099f4 SC |
1176 | } |
1177 | ||
1178 | ||
1179 | #if 0 | |
1180 | /* | |
1181 | For large transfers we used to send | |
1182 | ||
1183 | ||
1184 | d <addr> <endaddr>\r | |
1185 | ||
1186 | and receive | |
1187 | <ADDR> < D A T A > < ASCII CODE > | |
1188 | 000000 5F FD FD FF DF 7F DF FF 01 00 01 00 02 00 08 04 "_..............." | |
1189 | 000010 FF D7 FF 7F D7 F1 7F FF 00 05 00 00 08 00 40 00 "..............@." | |
1190 | 000020 7F FD FF F7 7F FF FF F7 00 00 00 00 00 00 00 00 "................" | |
1191 | ||
1192 | A cost in chars for each transaction of 80 + 5*n-bytes. | |
1193 | ||
863099f4 SC |
1194 | Large transactions could be done with the srecord load code, but |
1195 | there is a pause for a second before dumping starts, which slows the | |
1196 | average rate down! | |
1197 | */ | |
1198 | ||
1199 | static int | |
1200 | e7000_read_inferior_memory (memaddr, myaddr, len) | |
1201 | CORE_ADDR memaddr; | |
1202 | unsigned char *myaddr; | |
1203 | int len; | |
1204 | { | |
1205 | int count; | |
1206 | int c; | |
2b576293 | 1207 | char buf[200]; |
863099f4 SC |
1208 | |
1209 | /* Starting address of this pass. */ | |
1210 | ||
1211 | if (((memaddr - 1) + len) < memaddr) | |
1212 | { | |
1213 | errno = EIO; | |
1214 | return 0; | |
1215 | } | |
1216 | ||
2b576293 C |
1217 | sprintf (buf, "d %x %x\r", memaddr, memaddr + len - 1); |
1218 | puts_e7000debug (buf); | |
863099f4 SC |
1219 | |
1220 | count = 0; | |
1221 | c = gch (); | |
1222 | ||
1223 | /* First skip the command */ | |
1224 | while (c == '\n') | |
1225 | c = gch (); | |
1226 | ||
1227 | while (c == ' ') | |
1228 | c = gch (); | |
1229 | if (c == '*') | |
1230 | { | |
1231 | expect ("\r"); | |
1232 | return -1; | |
1233 | } | |
1234 | ||
1235 | /* Skip the title line */ | |
1236 | while (c != '\n') | |
1237 | c = gch (); | |
1238 | c = gch (); | |
1239 | while (count < len) | |
1240 | { | |
1241 | /* Skip the address */ | |
1242 | while (c <= ' ') | |
1243 | c = gch (); | |
1244 | ||
1245 | get_hex (&c); | |
1246 | ||
1247 | /* read in the bytes on the line */ | |
1248 | while (c != '"' && count < len) | |
1249 | { | |
1250 | if (c == ' ') | |
1251 | c = gch (); | |
1252 | else | |
1253 | { | |
1254 | myaddr[count++] = get_hex (&c); | |
1255 | } | |
1256 | } | |
1257 | ||
1258 | while (c != '\n') | |
1259 | c = gch (); | |
1260 | } | |
1261 | ||
1262 | while (c != ':') | |
1263 | c = gch (); | |
1264 | ||
1265 | return len; | |
1266 | } | |
1267 | ||
1268 | static int | |
1269 | fast_but_for_the_pause_e7000_read_inferior_memory (memaddr, myaddr, len) | |
1270 | CORE_ADDR memaddr; | |
1271 | char *myaddr; | |
1272 | int len; | |
1273 | { | |
1274 | int loop; | |
1275 | int c; | |
2b576293 | 1276 | char buf[200]; |
863099f4 SC |
1277 | |
1278 | if (((memaddr - 1) + len) < memaddr) | |
1279 | { | |
1280 | errno = EIO; | |
1281 | return 0; | |
1282 | } | |
1283 | ||
2b576293 C |
1284 | sprintf (buf, "is %x@%x:s\r", memaddr, len); |
1285 | puts_e7000debug (buf); | |
863099f4 SC |
1286 | gch (); |
1287 | c = gch (); | |
1288 | if (c != ENQ) | |
1289 | { | |
1290 | /* Got an error */ | |
1291 | error ("Memory read error"); | |
1292 | } | |
1293 | putchar_e7000 (ACK); | |
1294 | expect ("SV s"); | |
1295 | loop = 1; | |
1296 | while (loop) | |
1297 | { | |
1298 | int type; | |
1299 | int length; | |
1300 | int addr; | |
1301 | int i; | |
2b576293 | 1302 | |
863099f4 SC |
1303 | c = gch (); |
1304 | switch (c) | |
1305 | { | |
1306 | case ENQ: /* ENQ, at the end */ | |
1307 | loop = 0; | |
1308 | break; | |
1309 | case 'S': | |
1310 | /* Start of an Srecord */ | |
1311 | type = gch (); | |
1312 | length = gbyte (); | |
1313 | switch (type) | |
1314 | { | |
1315 | case '7': /* Termination record, ignore */ | |
1316 | case '0': | |
1317 | case '8': | |
1318 | case '9': | |
1319 | /* Header record - ignore it */ | |
1320 | while (length--) | |
1321 | { | |
1322 | gbyte (); | |
1323 | } | |
1324 | break; | |
1325 | case '1': | |
1326 | case '2': | |
1327 | case '3': | |
1328 | { | |
1329 | int alen; | |
2b576293 | 1330 | |
863099f4 SC |
1331 | alen = type - '0' + 1; |
1332 | addr = 0; | |
1333 | while (alen--) | |
1334 | { | |
1335 | addr = (addr << 8) + gbyte (); | |
1336 | length--; | |
1337 | } | |
1338 | ||
1339 | for (i = 0; i < length - 1; i++) | |
2b576293 C |
1340 | myaddr[i + addr - memaddr] = gbyte (); |
1341 | ||
863099f4 SC |
1342 | gbyte (); /* Ignore checksum */ |
1343 | } | |
1344 | } | |
1345 | } | |
1346 | } | |
2b576293 | 1347 | |
863099f4 SC |
1348 | putchar_e7000 (ACK); |
1349 | expect ("TOP ADDRESS ="); | |
1350 | expect ("END ADDRESS ="); | |
1351 | expect (":"); | |
1352 | ||
1353 | return len; | |
1354 | } | |
1355 | ||
1356 | #endif | |
1357 | ||
1358 | static int | |
1359 | e7000_xfer_inferior_memory (memaddr, myaddr, len, write, target) | |
1360 | CORE_ADDR memaddr; | |
1361 | unsigned char *myaddr; | |
1362 | int len; | |
1363 | int write; | |
1364 | struct target_ops *target; /* ignored */ | |
1365 | { | |
1366 | if (write) | |
2b576293 | 1367 | return e7000_write_inferior_memory( memaddr, myaddr, len); |
863099f4 | 1368 | else |
2b576293 | 1369 | return e7000_read_inferior_memory( memaddr, myaddr, len); |
863099f4 SC |
1370 | } |
1371 | ||
1372 | static void | |
1373 | e7000_kill (args, from_tty) | |
1374 | char *args; | |
1375 | int from_tty; | |
1376 | { | |
863099f4 SC |
1377 | } |
1378 | ||
1379 | /* Clean up when a program exits. | |
1380 | ||
1381 | The program actually lives on in the remote processor's RAM, and may be | |
1382 | run again without a download. Don't leave it full of breakpoint | |
1383 | instructions. */ | |
1384 | ||
1385 | static void | |
1386 | e7000_mourn_inferior () | |
1387 | { | |
1388 | remove_breakpoints (); | |
1389 | unpush_target (&e7000_ops); | |
1390 | generic_mourn_inferior (); /* Do all the proper things now */ | |
1391 | } | |
1392 | ||
2b576293 C |
1393 | #ifdef HARD_BREAKPOINTS |
1394 | #define MAX_E7000DEBUG_BREAKPOINTS (BC_BREAKPOINTS ? 5 : 200) | |
1395 | #else | |
863099f4 | 1396 | #define MAX_E7000DEBUG_BREAKPOINTS 200 |
2b576293 | 1397 | #endif |
863099f4 SC |
1398 | |
1399 | extern int memory_breakpoint_size; | |
2b576293 C |
1400 | |
1401 | static CORE_ADDR breakaddr[MAX_E7000DEBUG_BREAKPOINTS] = {0}; | |
863099f4 SC |
1402 | |
1403 | static int | |
1404 | e7000_insert_breakpoint (addr, shadow) | |
1405 | CORE_ADDR addr; | |
1406 | unsigned char *shadow; | |
1407 | { | |
1408 | int i; | |
2b576293 | 1409 | char buf[200]; |
edd01519 | 1410 | static char nop[2] = NOP; |
863099f4 SC |
1411 | |
1412 | for (i = 0; i <= MAX_E7000DEBUG_BREAKPOINTS; i++) | |
1413 | if (breakaddr[i] == 0) | |
1414 | { | |
1415 | breakaddr[i] = addr; | |
1416 | /* Save old contents, and insert a nop in the space */ | |
2b576293 C |
1417 | #ifdef HARD_BREAKPOINTS |
1418 | if (BC_BREAKPOINTS) | |
1419 | { | |
1420 | sprintf (buf, "BC%d A=%x\r", i+1, addr); | |
1421 | puts_e7000debug (buf); | |
1422 | } | |
1423 | else | |
1424 | { | |
1425 | sprintf (buf, "B %x\r", addr); | |
1426 | puts_e7000debug (buf); | |
1427 | } | |
1428 | #else | |
863099f4 SC |
1429 | e7000_read_inferior_memory (addr, shadow, 2); |
1430 | e7000_write_inferior_memory (addr, nop, 2); | |
2b576293 C |
1431 | |
1432 | sprintf (buf, "B %x\r", addr); | |
1433 | puts_e7000debug (buf); | |
1434 | #endif | |
863099f4 SC |
1435 | expect_prompt (); |
1436 | return 0; | |
1437 | } | |
1438 | ||
2b576293 C |
1439 | error ("Too many breakpoints ( > %d) for the E7000\n", |
1440 | MAX_E7000DEBUG_BREAKPOINTS); | |
863099f4 SC |
1441 | return 1; |
1442 | } | |
1443 | ||
1444 | static int | |
1445 | e7000_remove_breakpoint (addr, shadow) | |
1446 | CORE_ADDR addr; | |
1447 | unsigned char *shadow; | |
1448 | { | |
1449 | int i; | |
2b576293 | 1450 | char buf[200]; |
863099f4 SC |
1451 | |
1452 | for (i = 0; i < MAX_E7000DEBUG_BREAKPOINTS; i++) | |
1453 | if (breakaddr[i] == addr) | |
1454 | { | |
1455 | breakaddr[i] = 0; | |
2b576293 C |
1456 | #ifdef HARD_BREAKPOINTS |
1457 | if (BC_BREAKPOINTS) | |
1458 | { | |
1459 | sprintf (buf, "BC%d - \r", i+1); | |
1460 | puts_e7000debug (buf); | |
1461 | } | |
1462 | else | |
1463 | { | |
1464 | sprintf (buf, "B - %x\r", addr); | |
1465 | puts_e7000debug (buf); | |
1466 | } | |
863099f4 | 1467 | expect_prompt (); |
2b576293 C |
1468 | #else |
1469 | sprintf (buf, "B - %x\r", addr); | |
1470 | puts_e7000debug (buf); | |
1471 | expect_prompt (); | |
1472 | ||
863099f4 SC |
1473 | /* Replace the insn under the break */ |
1474 | e7000_write_inferior_memory (addr, shadow, 2); | |
2b576293 C |
1475 | #endif |
1476 | ||
863099f4 SC |
1477 | return 0; |
1478 | } | |
1479 | ||
2b576293 | 1480 | warning ("Can't find breakpoint associated with 0x%x\n", addr); |
863099f4 SC |
1481 | return 1; |
1482 | } | |
1483 | ||
2b576293 C |
1484 | /* Put a command string, in args, out to STDBUG. Output from STDBUG |
1485 | is placed on the users terminal until the prompt is seen. */ | |
863099f4 SC |
1486 | |
1487 | static void | |
1488 | e7000_command (args, fromtty) | |
1489 | char *args; | |
1490 | int fromtty; | |
1491 | { | |
2b576293 C |
1492 | /* FIXME: arbitrary limit on length of args. */ |
1493 | char buf[200]; | |
1494 | ||
1495 | echo = 0; | |
863099f4 SC |
1496 | |
1497 | if (!e7000_desc) | |
1498 | error ("e7000 target not open."); | |
1499 | if (!args) | |
1500 | { | |
2b576293 | 1501 | puts_e7000debug ("\r"); |
863099f4 SC |
1502 | } |
1503 | else | |
1504 | { | |
2b576293 C |
1505 | sprintf (buf, "%s\r", args); |
1506 | puts_e7000debug (buf); | |
863099f4 | 1507 | } |
2b576293 | 1508 | |
edd01519 SC |
1509 | echo++; |
1510 | ctrl_c = 2; | |
863099f4 | 1511 | expect_full_prompt (); |
edd01519 SC |
1512 | echo--; |
1513 | ctrl_c = 0; | |
863099f4 | 1514 | printf_unfiltered ("\n"); |
2b576293 C |
1515 | |
1516 | /* Who knows what the command did... */ | |
1517 | registers_changed (); | |
863099f4 SC |
1518 | } |
1519 | ||
1520 | static void | |
1521 | e7000_load (args, fromtty) | |
1522 | char *args; | |
1523 | int fromtty; | |
1524 | { | |
edd01519 | 1525 | gr_load_image (args, fromtty); |
863099f4 SC |
1526 | } |
1527 | ||
1528 | static void | |
2b576293 | 1529 | e7000_drain_command (args, fromtty) |
863099f4 SC |
1530 | char *args; |
1531 | int fromtty; | |
1532 | ||
1533 | { | |
1534 | int c; | |
2b576293 C |
1535 | |
1536 | puts_e7000debug("end\r"); | |
edd01519 | 1537 | putchar_e7000 (CTRLC); |
2b576293 | 1538 | |
edd01519 | 1539 | while ((c = SERIAL_READCHAR (e7000_desc, 1) != SERIAL_TIMEOUT)) |
863099f4 | 1540 | { |
2b576293 | 1541 | if (quit_flag) |
edd01519 SC |
1542 | { |
1543 | putchar_e7000(CTRLC); | |
1544 | quit_flag = 0; | |
1545 | } | |
863099f4 SC |
1546 | if (c > ' ' && c < 127) |
1547 | printf ("%c", c & 0xff); | |
1548 | else | |
1549 | printf ("<%x>", c & 0xff); | |
1550 | } | |
1551 | } | |
1552 | ||
2b576293 | 1553 | #define NITEMS 7 |
edd01519 | 1554 | |
edd01519 SC |
1555 | static int |
1556 | why_stop () | |
1557 | { | |
2b576293 C |
1558 | static char *strings[NITEMS] = { |
1559 | "STEP NORMAL", | |
1560 | "BREAK POINT", | |
1561 | "BREAK KEY", | |
1562 | "BREAK CONDI", | |
1563 | "CYCLE ACCESS", | |
1564 | "ILLEGAL INSTRUCTION", | |
1565 | "WRITE PROTECT", | |
1566 | }; | |
edd01519 SC |
1567 | char *p[NITEMS]; |
1568 | int c; | |
2b576293 C |
1569 | int i; |
1570 | ||
1571 | for (i = 0; i < NITEMS; ++i) | |
1572 | p[i] = strings[i]; | |
edd01519 | 1573 | |
2b576293 | 1574 | c = gch (); |
edd01519 SC |
1575 | while (1) |
1576 | { | |
edd01519 SC |
1577 | for (i = 0; i < NITEMS; i++) |
1578 | { | |
1579 | if (c == *(p[i])) | |
1580 | { | |
1581 | p[i]++; | |
1582 | if (*(p[i]) == 0) | |
1583 | { | |
1584 | /* found one of the choices */ | |
1585 | return i; | |
1586 | } | |
1587 | } | |
2b576293 | 1588 | else |
edd01519 | 1589 | p[i] = strings[i]; |
edd01519 SC |
1590 | } |
1591 | ||
2b576293 | 1592 | c = gch (); |
edd01519 SC |
1593 | } |
1594 | } | |
2b576293 | 1595 | |
edd01519 | 1596 | /* Suck characters, if a string match, then return the strings index |
2b576293 C |
1597 | otherwise echo them. */ |
1598 | ||
edd01519 | 1599 | int |
2b576293 | 1600 | expect_n (strings) |
edd01519 SC |
1601 | char **strings; |
1602 | { | |
1603 | char *(ptr[10]); | |
1604 | int n; | |
1605 | int c; | |
1606 | char saveaway[100]; | |
1607 | char *buffer = saveaway; | |
1608 | /* Count number of expect strings */ | |
1609 | ||
2b576293 | 1610 | for (n = 0; strings[n]; n++) |
edd01519 SC |
1611 | { |
1612 | ptr[n] = strings[n]; | |
1613 | } | |
1614 | ||
2b576293 C |
1615 | while (1) |
1616 | { | |
1617 | int i; | |
1618 | int gotone = 0; | |
edd01519 | 1619 | |
2b576293 C |
1620 | c = SERIAL_READCHAR (e7000_desc, 1); |
1621 | if (c == SERIAL_TIMEOUT) | |
1622 | { | |
1623 | printf_unfiltered ("[waiting for e7000...]\n"); | |
1624 | } | |
edd01519 | 1625 | #ifdef __GO32__ |
2b576293 C |
1626 | if (kbhit ()) |
1627 | { | |
1628 | int k = getkey(); | |
edd01519 | 1629 | |
2b576293 C |
1630 | if (k == 1) |
1631 | quit_flag = 1; | |
1632 | } | |
1633 | #endif | |
1634 | if (quit_flag) | |
1635 | { | |
1636 | putchar_e7000 (CTRLC); /* interrupt the running program */ | |
1637 | quit_flag = 0; | |
1638 | } | |
edd01519 | 1639 | |
2b576293 C |
1640 | for (i = 0; i < n; i++) |
1641 | { | |
1642 | if (c == ptr[i][0]) | |
1643 | { | |
1644 | ptr[i]++; | |
1645 | if (ptr[i][0] == 0) | |
1646 | { | |
1647 | /* Gone all the way */ | |
1648 | return i; | |
1649 | } | |
1650 | gotone = 1; | |
1651 | } | |
1652 | else | |
1653 | { | |
1654 | ptr[i] = strings[i]; | |
1655 | } | |
1656 | } | |
edd01519 | 1657 | |
2b576293 C |
1658 | if (gotone) |
1659 | { | |
1660 | /* Save it up incase we find that there was no match */ | |
1661 | *buffer ++ = c; | |
edd01519 | 1662 | } |
2b576293 C |
1663 | else |
1664 | { | |
1665 | if (buffer != saveaway) | |
1666 | { | |
1667 | *buffer++ = 0; | |
1668 | printf ("%s", buffer); | |
1669 | buffer = saveaway; | |
1670 | } | |
1671 | if (c != SERIAL_TIMEOUT) | |
1672 | { | |
1673 | putchar (c); | |
1674 | fflush (stdout); | |
1675 | } | |
1676 | } | |
1677 | } | |
863099f4 SC |
1678 | } |
1679 | ||
2b576293 C |
1680 | /* We subtract two from the pc here rather than use |
1681 | DECR_PC_AFTER_BREAK since the e7000 doesn't always add two to the | |
1682 | pc, and the simulators never do. */ | |
edd01519 SC |
1683 | |
1684 | static void | |
2b576293 | 1685 | sub2_from_pc () |
edd01519 SC |
1686 | { |
1687 | char buf[4]; | |
2b576293 C |
1688 | char buf2[200]; |
1689 | ||
edd01519 SC |
1690 | store_signed_integer (buf, |
1691 | REGISTER_RAW_SIZE(PC_REGNUM), | |
1692 | read_register (PC_REGNUM) -2); | |
1693 | supply_register (PC_REGNUM, buf); | |
2b576293 C |
1694 | sprintf (buf2, ".PC %x\r", read_register (PC_REGNUM)); |
1695 | puts_e7000debug (buf2); | |
edd01519 | 1696 | } |
2b576293 | 1697 | |
edd01519 SC |
1698 | #define WAS_SLEEP 0 |
1699 | #define WAS_INT 1 | |
1700 | #define WAS_RUNNING 2 | |
1701 | #define WAS_OTHER 3 | |
edd01519 | 1702 | |
2b576293 C |
1703 | static char *estrings[] = { |
1704 | "** SLEEP", | |
1705 | "BREAK !", | |
1706 | "** PC", | |
1707 | "PC", | |
1708 | NULL | |
1709 | }; | |
1710 | ||
1711 | /* Wait until the remote machine stops, then return, storing status in | |
1712 | STATUS just as `wait' would. */ | |
863099f4 SC |
1713 | |
1714 | static int | |
1715 | e7000_wait (pid, status) | |
1716 | int pid; | |
2b576293 | 1717 | struct target_waitstatus *status; |
863099f4 | 1718 | { |
2b576293 | 1719 | int stop_reason; |
863099f4 | 1720 | int regno; |
edd01519 SC |
1721 | int running_count = 0; |
1722 | int had_sleep = 0; | |
863099f4 | 1723 | int loop = 1; |
2b576293 | 1724 | |
863099f4 SC |
1725 | /* Then echo chars until PC= string seen */ |
1726 | gch (); /* Drop cr */ | |
1727 | gch (); /* and space */ | |
2b576293 | 1728 | |
863099f4 SC |
1729 | while (loop) |
1730 | { | |
2b576293 | 1731 | switch (expect_n (estrings)) |
edd01519 SC |
1732 | { |
1733 | case WAS_OTHER: | |
1734 | /* how did this happen ? */ | |
2b576293 | 1735 | loop = 0; |
edd01519 SC |
1736 | break; |
1737 | case WAS_SLEEP: | |
1738 | had_sleep = 1; | |
1739 | putchar_e7000 (CTRLC); | |
1740 | loop = 0; | |
1741 | break; | |
1742 | case WAS_INT: | |
1743 | loop = 0; | |
1744 | break; | |
1745 | case WAS_RUNNING: | |
1746 | running_count++; | |
1747 | if (running_count == 20) | |
863099f4 | 1748 | { |
edd01519 SC |
1749 | printf_unfiltered ("[running...]\n"); |
1750 | running_count = 0; | |
863099f4 | 1751 | } |
edd01519 | 1752 | break; |
2b576293 C |
1753 | default: |
1754 | /* error? */ | |
1755 | break; | |
863099f4 SC |
1756 | } |
1757 | } | |
2b576293 C |
1758 | |
1759 | /* Skip till the PC= */ | |
1760 | expect ("="); | |
863099f4 SC |
1761 | fetch_regs_from_dump (gch, want_nopc); |
1762 | ||
1763 | /* And supply the extra ones the simulator uses */ | |
1764 | for (regno = NUM_REALREGS; regno < NUM_REGS; regno++) | |
1765 | { | |
1766 | int buf = 0; | |
1767 | supply_register (regno, (char *) &buf); | |
1768 | } | |
1769 | ||
2b576293 | 1770 | stop_reason = why_stop (); |
863099f4 | 1771 | expect_full_prompt (); |
863099f4 | 1772 | |
2b576293 C |
1773 | status->kind = TARGET_WAITKIND_STOPPED; |
1774 | status->value.sig = TARGET_SIGNAL_TRAP; | |
1775 | ||
1776 | switch (stop_reason) | |
edd01519 SC |
1777 | { |
1778 | case 1: /* Breakpoint */ | |
2b576293 | 1779 | status->value.sig = TARGET_SIGNAL_TRAP; |
edd01519 | 1780 | break; |
2b576293 C |
1781 | case 0: /* Single step */ |
1782 | status->value.sig = TARGET_SIGNAL_TRAP; | |
edd01519 | 1783 | break; |
2b576293 | 1784 | case 2: /* Interrupt */ |
edd01519 SC |
1785 | if (had_sleep) |
1786 | { | |
2b576293 C |
1787 | status->value.sig = TARGET_SIGNAL_TRAP; |
1788 | sub2_from_pc (); | |
edd01519 SC |
1789 | } |
1790 | else | |
1791 | { | |
2b576293 | 1792 | status->value.sig = TARGET_SIGNAL_INT; |
edd01519 SC |
1793 | } |
1794 | break; | |
2b576293 C |
1795 | case 3: |
1796 | break; | |
1797 | case 4: | |
1798 | printf_unfiltered ("a cycle address error?\n"); | |
1799 | status->value.sig = TARGET_SIGNAL_UNKNOWN; | |
1800 | break; | |
1801 | case 5: | |
1802 | status->value.sig = TARGET_SIGNAL_ILL; | |
1803 | break; | |
1804 | case 6: | |
1805 | status->value.sig = TARGET_SIGNAL_SEGV; | |
1806 | break; | |
1807 | case 7: /* Anything else (NITEMS + 1) */ | |
1808 | printf_unfiltered ("a write protect error?\n"); | |
1809 | status->value.sig = TARGET_SIGNAL_UNKNOWN; | |
1810 | break; | |
1811 | default: | |
1812 | /* Get the user's attention - this should never happen. */ | |
1813 | abort (); | |
edd01519 | 1814 | } |
2b576293 | 1815 | |
863099f4 SC |
1816 | return 0; |
1817 | } | |
1818 | ||
2b576293 | 1819 | /* Define the target subroutine names. */ |
863099f4 SC |
1820 | |
1821 | struct target_ops e7000_ops = | |
1822 | { | |
1823 | "e7000", | |
1824 | "Remote Hitachi e7000 target", | |
1825 | "Use a remote Hitachi e7000 ICE connected by a serial line,\n\ | |
1826 | or a network connection.\n\ | |
1827 | Arguments are the name of the device for the serial line,\n\ | |
1828 | the speed to connect at in bits per second.\n\ | |
1829 | eg\n\ | |
1830 | target e7000 /dev/ttya 9600\n\ | |
1831 | target e7000 foobar", | |
2b576293 C |
1832 | e7000_open, /* to_open */ |
1833 | e7000_close, /* to_close */ | |
1834 | 0, /* to_attach */ | |
1835 | e7000_detach, /* to_detach */ | |
1836 | e7000_resume, /* to_resume */ | |
1837 | e7000_wait, /* to_wait */ | |
1838 | e7000_fetch_register, /* to_fetch_registers */ | |
1839 | e7000_store_register, /* to_store_registers */ | |
1840 | e7000_prepare_to_store, /* to_prepare_to_store */ | |
1841 | e7000_xfer_inferior_memory, /* to_xfer_memory */ | |
1842 | e7000_files_info, /* to_files_info */ | |
1843 | #ifdef HARD_BREAKPOINTS | |
1844 | e7000_insert_breakpoint, /* to_insert_breakpoint */ | |
1845 | e7000_remove_breakpoint, /* to_remove_breakpoint */ | |
1846 | #else | |
1847 | memory_insert_breakpoint, /* to_insert_breakpoint */ | |
1848 | memory_remove_breakpoint, /* to_remove_breakpoint */ | |
1849 | #endif | |
1850 | 0, /* to_terminal_init */ | |
1851 | 0, /* to_terminal_inferior */ | |
1852 | 0, /* to_terminal_ours_for_output */ | |
1853 | 0, /* to_terminal_ours */ | |
1854 | 0, /* to_terminal_info */ | |
1855 | e7000_kill, /* to_kill */ | |
1856 | e7000_load, /* to_load */ | |
1857 | 0, /* to_lookup_symbol */ | |
1858 | e7000_create_inferior, /* to_create_inferior */ | |
1859 | e7000_mourn_inferior, /* to_mourn_inferior */ | |
1860 | 0, /* to_can_run */ | |
1861 | 0, /* to_notice_signals */ | |
1862 | 0, /* to_thread_alive */ | |
1863 | 0, /* to_stop */ | |
1864 | process_stratum, /* to_stratum */ | |
1865 | 0, /* next (unused) */ | |
1866 | 1, /* to_has_all_memory */ | |
1867 | 1, /* to_has_memory */ | |
1868 | 1, /* to_has_stack */ | |
1869 | 1, /* to_has_registers */ | |
1870 | 1, /* to_has_execution */ | |
1871 | 0, /* to_sections */ | |
1872 | 0, /* to_sections_end */ | |
863099f4 SC |
1873 | OPS_MAGIC, /* Always the last thing */ |
1874 | }; | |
1875 | ||
1876 | void | |
1877 | _initialize_remote_e7000 () | |
1878 | { | |
1879 | add_target (&e7000_ops); | |
2b576293 | 1880 | |
863099f4 SC |
1881 | add_com ("e7000 <command>", class_obscure, e7000_command, |
1882 | "Send a command to the e7000 monitor."); | |
1883 | ||
2b576293 | 1884 | add_com ("ftplogin <machine> <name> <passwd> <dir>", class_obscure, e7000_login_command, |
863099f4 SC |
1885 | "Login to machine and change to directory."); |
1886 | ||
2b576293 | 1887 | add_com ("ftpload <file>", class_obscure, e7000_ftp_command, |
863099f4 SC |
1888 | "Fetch and load a file from previously described place."); |
1889 | ||
2b576293 | 1890 | add_com ("drain", class_obscure, e7000_drain_command, |
863099f4 | 1891 | "Drain pending e7000 text buffers."); |
863099f4 | 1892 | } |