1 /* Remote debugging interface for HMS Monitor Version 1.0
3 Copyright 1992 Free Software Foundation, Inc.
5 Contributed by Steve Chamberlain sac@cygnus.com
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
41 /* External data declarations */
42 extern int stop_soon_quietly
; /* for wait_for_inferior */
44 /* External function declarations */
45 extern struct value
*call_function_by_hand();
47 /* Forward data declarations */
48 extern struct target_ops hms_ops
; /* Forward declaration */
50 /* Forward function declarations */
51 static void hms_fetch_registers ();
52 static int hms_store_registers ();
53 static void hms_close ();
54 static int hms_clear_breakpoints();
56 extern struct target_ops hms_ops
;
60 # define DENTER(NAME) (printf_filtered("Entering %s\n",NAME), fflush(stdout))
61 # define DEXIT(NAME) (printf_filtered("Exiting %s\n",NAME), fflush(stdout))
69 static int timeout
= 5;
70 static char *dev_name
= "/dev/ttya";
75 /* Descriptor for I/O to remote machine. Initialize it to -1 so that
76 hms_open knows that we don't have a file open when the program
79 #define OPEN(x) ((x) >= 0)
94 ioctl (desc
, TIOCGETP
, &sg
);
98 sg
.c_lflag
&= ~(ICANON
);
104 sg
.c_lflag
|= ICANON
;
106 sg
.sg_flags
&= ~(RAW
);
109 ioctl (desc
, TIOCSETP
, &sg
);
112 /* Suck up all the input from the hms */
118 /* termio does the timeout for us. */
119 while (read (hms_desc
, buf
, 8) > 0);
122 while (read (hms_desc
, buf
, 8) > 0);
127 /* Read a character from the remote system, doing all the fancy
136 /* termio does the timeout for us. */
137 read (hms_desc
, &buf
, 1);
140 if (read (hms_desc
, &buf
, 1) < 0)
143 error ("Timeout reading from remote system.");
145 perror_with_name ("remote");
151 error ("Timeout reading from remote system.");
159 /* Keep discarding input from the remote system, until STRING is found.
160 Let the user break out immediately. */
171 if (readchar() == *p
)
185 /* Keep discarding input until we see the hms prompt.
187 The convention for dealing with the prompt is that you
189 o *then* wait for the prompt.
191 Thus the last thing that a procedure does with the serial line
192 will be an expect_prompt(). Exception: hms_resume does not
193 wait for the prompt, because the terminal is being handed over
194 to the inferior. However, the next thing which happens after that
195 is a hms_wait which does wait for the prompt.
196 Note that this includes abnormal exit, e.g. error(). This is
197 necessary to prevent getting into states from which we can't
206 /* Get a hex digit from the remote system & return its value.
207 If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */
209 get_hex_digit (ignore_space
)
216 if (ch
>= '0' && ch
<= '9')
218 else if (ch
>= 'A' && ch
<= 'F')
219 return ch
- 'A' + 10;
220 else if (ch
>= 'a' && ch
<= 'f')
221 return ch
- 'a' + 10;
222 else if (ch
== ' ' && ignore_space
)
227 error ("Invalid hex digit from remote system.");
232 /* Get a byte from hms_desc and put it in *BYT. Accept any number
240 val
= get_hex_digit (1) << 4;
241 val
|= get_hex_digit (0);
245 /* Read a 32-bit hex word from the hms, preceded by a space */
253 for (j
= 0; j
< 8; j
++)
254 val
= (val
<< 4) + get_hex_digit (j
== 0);
257 /* Called when SIGALRM signal sent due to alarm() timeout. */
262 # define volatile /**/
265 volatile int n_alarms
;
272 printf ("hms_timer called\n");
278 /* malloc'd name of the program on the remote system. */
279 static char *prog_name
= NULL
;
281 /* Number of SIGTRAPs we need to simulate. That is, the next
282 NEED_ARTIFICIAL_TRAP calls to hms_wait should just return
283 SIGTRAP without actually waiting for anything. */
285 static int need_artificial_trap
= 0;
288 hms_kill(arg
,from_tty
)
293 DENTER("hms_kill()");
294 fprintf (hms_stream
, "K");
296 fprintf (hms_stream
, "\r");
302 * Download a file specified in 'args', to the hms.
305 hms_load(args
,fromtty
)
314 DENTER("hms_load()");
317 printf_filtered("HMS not open. Use 'target' command to open HMS\n");
320 abfd
= bfd_openr(args
,"coff-h8300");
323 printf_filtered("Can't open a bfd on file\n");
327 if (bfd_check_format(abfd
, bfd_object
) ==0)
329 printf_filtered("File is not an object file\n");
334 while (s
!= (asection
*)NULL
)
336 if (s
->flags
& SEC_LOAD
)
338 char *buffer
= xmalloc(s
->_raw_size
);
339 bfd_get_section_contents(abfd
, s
, buffer
, 0, s
->_raw_size
);
341 hms_write_inferior_memory(s
->vma
, buffer
, s
->_raw_size
);
350 /* This is called not only when we first attach, but also when the
351 user types "run" after having attached. */
353 hms_create_inferior (execfile
, args
, env
)
360 DENTER("hms_create_inferior()");
363 error ("Can't pass arguments to remote hms process.");
365 if (execfile
== 0 || exec_bfd
== 0)
366 error ("No exec file specified");
368 entry_pt
= (int) bfd_get_start_address (exec_bfd
);
374 hms_clear_breakpoints();
375 init_wait_for_inferior ();
376 /* Clear the input because what the hms sends back is different
377 * depending on whether it was running or not.
379 /* slurp_input(); /* After this there should be a prompt */
383 printf_filtered("Do you want to download '%s' (y/n)? [y] : ",prog_name
);
387 if (*buffer
!= 'n') {
388 hms_load(prog_name
,0);
393 insert_breakpoints (); /* Needed to get correct instruction in cache */
394 proceed(entry_pt
, -1, 0);
399 printf_filtered("Hms not open yet.\n");
401 DEXIT("hms_create_inferior()");
404 /* Translate baud rates from integers to damn B_codes. Unix should
405 have outgrown this crap years ago, but even POSIX wouldn't buck it. */
414 static struct {int rate
, damn_b
;} baudtab
[] = {
434 static int damn_b (rate
)
439 for (i
= 0; baudtab
[i
].rate
!= -1; i
++)
440 if (rate
== baudtab
[i
].rate
) return baudtab
[i
].damn_b
;
441 return B38400
; /* Random */
445 /* Open a connection to a remote debugger.
446 NAME is the filename used for communication, then a space,
454 while (*s
&& !isspace(*s
))
459 static char *get_word(p
)
474 while (*s
&& !isspace(*s
))
480 copy
= xmalloc(len
+1);
481 memcpy(copy
, word
, len
);
487 static int baudrate
= 9600;
489 hms_open (name
, from_tty
)
497 DENTER("hms_open()");
504 printf("Input string %s\n", name
);
506 prog_name
= get_word(&name
);
510 hms_desc
= open (dev_name
, O_RDWR
);
512 perror_with_name (dev_name
);
513 ioctl (hms_desc
, TIOCGETP
, &sg
);
515 sg
.c_cc
[VMIN
] = 0; /* read with timeout. */
516 sg
.c_cc
[VTIME
] = timeout
* 10;
517 sg
.c_lflag
&= ~(ICANON
| ECHO
);
518 sg
.c_cflag
= (sg
.c_cflag
& ~CBAUD
) | damn_b (baudrate
);
520 sg
.sg_ispeed
= damn_b (baudrate
);
521 sg
.sg_ospeed
= damn_b (baudrate
);
522 sg
.sg_flags
|= RAW
| ANYP
;
523 sg
.sg_flags
&= ~ECHO
;
526 ioctl (hms_desc
, TIOCSETP
, &sg
);
529 push_target (&hms_ops
);
530 /* start_remote (); /* Initialize gdb process mechanisms */
534 #ifndef NO_SIGINTERRUPT
535 /* Cause SIGALRM's to make reads fail with EINTR instead of resuming
537 if (siginterrupt (SIGALRM
, 1) != 0)
538 perror ("hms_open: error in siginterrupt");
541 /* Set up read timeout timer. */
542 if ((void (*)) signal (SIGALRM
, hms_timer
) == (void (*)) -1)
543 perror ("hms_open: error in signal");
547 /* Put this port into NORMAL mode, send the 'normal' character */
548 hms_write("\001", 1); /* Control A */
549 hms_write("\r", 1); /* Cr */
552 /* Hello? Are you there? */
553 write (hms_desc
, "\r", 1);
557 /* Clear any break points */
558 hms_clear_breakpoints();
561 printf_filtered("Remote debugging on an H8/300 HMS via %s %s.\n",dev_name
,prog_name
);
566 /* Close out all files and local state before this target loses control. */
573 DENTER("hms_close()");
575 /* Clear any break points */
576 hms_clear_breakpoints();
578 /* Put this port back into REMOTE mode */
579 if (OPEN(hms_desc
)) {
581 sleep(1); /* Let any output make it all the way back */
582 write(hms_desc
, "R\r", 2);
585 /* Due to a bug in Unix, fclose closes not only the stdio stream,
586 but also the file descriptor. So we don't actually close
591 /* Do not try to close hms_desc again, later in the program. */
595 DEXIT("hms_close()");
598 /* Attach to the target that is already loaded and possibly running */
600 hms_attach (args
, from_tty
)
605 DENTER("hms_attach()");
607 printf_filtered ("Attaching to remote program %s.\n", prog_name
);
609 /* push_target(&hms_ops); /* This done in hms_open() */
611 mark_breakpoints_out ();
613 /* Send the hms a kill. It is ok if it is not already running */
615 fprintf(hms_stream
, "K\r");
616 expect_prompt(); /* Slurp the echo */
618 /* We will get a task spawn event immediately. */
619 init_wait_for_inferior ();
620 clear_proceed_status ();
621 stop_soon_quietly
= 1;
622 wait_for_inferior ();
623 stop_soon_quietly
= 0;
625 DEXIT("hms_attach()");
629 /* Terminate the open connection to the remote debugger.
630 Use this when you want to detach and do something else
633 hms_detach (args
,from_tty
)
637 DENTER("hms_detach()");
638 if (OPEN(hms_desc
)) { /* Send it on its way (tell it to continue) */
639 hms_clear_breakpoints();
641 fprintf(hms_stream
,"G\r");
645 pop_target(); /* calls hms_close to do the real work */
647 printf_filtered ("Ending remote %s debugging\n", target_shortname
);
648 DEXIT("hms_detach()");
651 /* Tell the remote machine to resume. */
654 hms_resume (step
, sig
)
657 DENTER("hms_resume()");
664 /* Force the next hms_wait to return a trap. Not doing anything
665 about I/O from the target means that the user has to type
666 "continue" to see any. FIXME, this should be fixed. */
667 need_artificial_trap
= 1;
674 DEXIT("hms_resume()");
677 /* Wait until the remote machine stops, then return,
678 storing status in STATUS just as `wait' would. */
684 /* Strings to look for. '?' means match any single character.
685 Note that with the algorithm we use, the initial character
686 of the string cannot recur in the string, or we will not
687 find some cases of the string in the input. */
689 static char bpt
[] = "At breakpoint:";
690 /* It would be tempting to look for "\n[__exit + 0x8]\n"
691 but that requires loading symbols with "yc i" and even if
692 we did do that we don't know that the file has symbols. */
693 static char exitmsg
[] = "HMS>";
697 /* Large enough for either sizeof (bpt) or sizeof (exitmsg) chars. */
699 /* Current position in swallowed. */
700 char *swallowed_p
= swallowed
;
704 int old_timeout
= timeout
;
705 int old_immediate_quit
= immediate_quit
;
707 DENTER("hms_wait()");
709 WSETEXIT ((*status
), 0);
711 if (need_artificial_trap
!= 0)
713 WSETSTOP ((*status
), SIGTRAP
);
714 need_artificial_trap
--;
718 timeout
= 0; /* Don't time out -- user program is running. */
719 immediate_quit
= 1; /* Helps ability to QUIT */
721 QUIT
; /* Let user quit and leave process running */
733 if (ch
== *ep
|| *ep
== '?') {
745 /* Print out any characters which have been swallowed. */
746 for (p
= swallowed
; p
< swallowed_p
; ++p
)
748 swallowed_p
= swallowed
;
751 if ((ch
!= '\r' && ch
!= '\n') || swallowed_cr
>10)
762 WSETSTOP ((*status
), SIGTRAP
);
767 WSETEXIT ((*status
), 0);
770 timeout
= old_timeout
;
771 immediate_quit
= old_immediate_quit
;
772 printf ("%s is at %s:%d.\n",
773 local_hex_string(sal
.pc
),
774 sal
.symtab
->filename
, sal
.line
);
779 /* Return the name of register number REGNO
780 in the form input and output by hms.
782 Returns a pointer to a static buffer containing the answer. */
787 static char *rn
[NUM_REGS
]= REGISTER_NAMES
;
794 /* Read the remote registers. */
795 static int gethex(length
, start
, ok
)
804 if (*start
>='a' && *start
<= 'f')
806 result
+= *start
- 'a' + 10;
808 else if (*start
>='A' && *start
<= 'F')
810 result
+= *start
- 'A' + 10;
812 else if (*start
>='0' && *start
<= '9')
814 result
+= *start
- '0' ;
823 timed_read(buf
, n
, timeout
)
834 if (c
== 0) return i
;
848 for (i
= 0; i
< l
; i
++)
854 printf ("Line %d of \"%s\" is at pc %s but contains no code.\n",
855 sal
.line
, sal
.symtab
->filename
, local_hex_string(start_pc
));
857 hms_write( s
, strlen(s
));
858 printf ("Line %d of \"%s\" starts at pc %s",
859 sal
.line
, sal
.symtab
->filename
,
860 local_hex_string(start_pc
));
861 printf (" and ends at %s.\n",
862 local_hex_string(end_pc
));
864 #define REGREPLY_SIZE 79
865 char linebuf
[REGREPLY_SIZE
+1];
870 printf ("Line number %d is out of range for \"%s\".\n",
871 sal
.line
, sal
.symtab
->filename
);
878 s
= timed_read(linebuf
, REGREPLY_SIZE
, 1);
881 linebuf
[REGREPLY_SIZE
] = 0;
883 if (linebuf
[0] == 'r' &&
884 linebuf
[1] == '\r' &&
885 linebuf
[2] == '\n' &&
889 linebuf
[75] == 'H' &&
890 linebuf
[76] == 'M' &&
894 PC=XXXX CCR=XX:XXXXXXXX R0-R7= XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
895 5436789012345678901234567890123456789012345678901234567890123456789012
900 reg
[PC_REGNUM
] = gethex(4,linebuf
+6, &gottok
);
901 reg
[CCR_REGNUM
] = gethex(2,linebuf
+15, &gottok
);
902 for (i
= 0; i
< 8; i
++)
904 reg
[i
] = gethex(4, linebuf
+34+5*i
, &gottok
);
909 for (i
= 0; i
< NUM_REGS
; i
++)
911 supply_register (i
, reg
+i
);
915 /* Fetch register REGNO, or all registers if REGNO is -1.
918 hms_fetch_register (regno
)
922 hms_fetch_registers ();
926 /* Store the remote registers from the contents of the block REGS. */
929 hms_store_registers ()
932 for (i
= 0; i
< NUM_REGS
; i
++)
933 hms_store_register(i
);
938 /* Store register REGNO, or all if REGNO == -1.
939 Return errno value. */
941 hms_store_register (regno
)
945 printf ("Expression not found\n");
947 hms_store_registers ();
950 char *name
= get_reg_name (regno
);
952 sprintf(buffer
,"r %s=%x", name
, read_register(regno
));
953 hms_write_cr(buffer
);
957 DEXIT("hms_store_registers()");
961 /* Get ready to modify the registers array. On machines which store
962 individual registers, this doesn't need to do anything. On machines
963 which store all the registers in one fell swoop, this makes sure
964 that registers contains all the registers from the program being
968 hms_prepare_to_store ()
970 /* Do nothing, since we can store individual regs */
982 /* Read a word from remote address ADDR and return it.
983 * This goes through the data cache.
986 hms_fetch_word (addr
)
989 return dcache_fetch (addr
);
992 /* Write a word WORD into remote address ADDR.
993 This goes through the data cache. */
996 hms_store_word (addr
, word
)
1000 dcache_poke (addr
, word
);
1004 hms_xfer_inferior_memory(memaddr
, myaddr
, len
, write
, target
)
1009 struct target_ops
*target
; /* ignored */
1012 /* Round starting address down to longword boundary. */
1013 register CORE_ADDR addr
;
1014 /* Round ending address up; get number of longwords that makes. */
1016 /* Allocate buffer of that many longwords. */
1017 register int *buffer
;
1020 addr
= memaddr
& - sizeof (int);
1021 count
= (((memaddr
+ len
) - addr
) + sizeof (int) - 1) / sizeof (int);
1023 printf ("Expression not found\n");
1024 buffer
= (int *)alloca (count
* sizeof (int));
1027 /* Fill start and end extra bytes of buffer with existing memory data. */
1029 if (addr
!= memaddr
|| len
< (int)sizeof (int)) {
1030 /* Need part of initial word -- fetch it. */
1031 buffer
[0] = hms_fetch_word (addr
);
1034 if (count
> 1) /* FIXME, avoid if even boundary */
1037 = hms_fetch_word (addr
+ (count
- 1) * sizeof (int));
1040 /* Copy data to be written over corresponding part of buffer */
1042 bcopy (myaddr
, (char *) buffer
+ (memaddr
& (sizeof (int) - 1)), len
);
1044 /* Write the entire buffer. */
1046 for (i
= 0; i
< count
; i
++, addr
+= sizeof (int))
1049 hms_store_word (addr
, buffer
[i
]);
1060 /* Read all the longwords */
1061 for (i
= 0; i
< count
; i
++, addr
+= sizeof (int))
1064 buffer
[i
] = hms_fetch_word (addr
);
1072 /* Copy appropriate bytes out of the buffer. */
1073 bcopy ((char *) buffer
+ (memaddr
& (sizeof (int) - 1)), myaddr
, len
);
1082 hms_xfer_inferior_memory (memaddr
, myaddr
, len
, write
)
1090 return hms_write_inferior_memory (memaddr
, myaddr
, len
);
1092 return hms_read_inferior_memory (memaddr
, myaddr
, len
);
1098 hms_write_inferior_memory (memaddr
, myaddr
, len
)
1104 bfd
*abfd
= bfd_openw(dev_name
, "srec");
1107 bfd_set_format(abfd
, bfd_object
);
1108 a
= bfd_make_section(abfd
, ".text");
1111 a
->flags
= SEC_LOAD
| SEC_HAS_CONTENTS
;
1112 hms_write_cr("tl"); /* tell hms here comes the recs */
1113 bfd_set_section_contents(abfd
, a
, myaddr
, 0, len
);
1122 printf_filtered("\tAttached to %s at %d baud and running program %s\n",
1123 dev_name
, baudrate
, bfd_get_filename(exec_bfd
));
1124 printf_filtered("\ton an H8/300 processor.\n");
1127 /* Copy LEN bytes of data from debugger memory at MYADDR
1128 to inferior's memory at MEMADDR. Returns errno value.
1129 * sb/sh instructions don't work on unaligned addresses, when TU=1.
1133 /* Read LEN bytes from inferior memory at MEMADDR. Put the result
1134 at debugger address MYADDR. Returns errno value. */
1136 hms_read_inferior_memory(memaddr
, myaddr
, len
)
1141 /* Align to nearest low 16 bits */
1145 CORE_ADDR start
= memaddr
& ~0xf;
1146 CORE_ADDR end
= ((memaddr
+ len
+16) & ~0xf) -1;
1148 CORE_ADDR start
= memaddr
;
1149 CORE_ADDR end
= memaddr
+ len
-1;
1154 AAAA: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX '................'
1155 012345678901234567890123456789012345678901234567890123456789012345
1159 if (memaddr
& 0xf) abort();
1160 if (len
!= 16) abort();
1162 sprintf(buffer
, "m %4x %4x", start
, end
);
1163 hms_write_cr(buffer
);
1164 /* drop the echo and newline*/
1165 for (i
= 0; i
< 13; i
++)
1170 /* Grab the lines as they come out and fill the area */
1180 buffer
[0] = readchar();
1181 if (buffer
[0] == 'M')
1183 for (i
= 1; i
< 66; i
++)
1184 buffer
[i
] = readchar();
1186 /* Now parse the line */
1188 addr
= gethex(4, buffer
, &ok
);
1190 for (p
= 0; p
< 16; p
+=2)
1192 byte
[p
] = gethex(2, buffer
+ idx
, &ok
);
1193 byte
[p
+1] = gethex(2, buffer
+ idx
+ 2, &ok
);
1199 for (p
= 0; p
<16;p
++)
1201 if (addr
+ p
>= memaddr
&&
1202 addr
+ p
< memaddr
+ len
)
1204 myaddr
[ (addr
+ p
)-memaddr
] = byte
[p
];
1213 hms_write("\003",1);
1223 /* This routine is run as a hook, just before the main command loop is
1224 entered. If gdb is configured for the H8, but has not had its
1225 target specified yet, this will loop prompting the user to do so.
1228 hms_before_main_loop ()
1232 extern FILE *instream
;
1233 extern jmp_buf to_top_level
;
1235 push_target (&hms_ops
);
1238 while (current_target
!= &hms_ops
) {
1239 /* remote tty not specified yet */
1240 if ( instream
== stdin
){
1241 printf("\nEnter device and filename, or \"quit\" to quit: ");
1244 fgets( ttyname
, sizeof(ttyname
)-1, stdin
);
1246 if ( !strcmp("quit", ttyname
) ){
1250 hms_open( ttyname
, 1 );
1252 /* Now that we have a tty open for talking to the remote machine,
1253 download the executable file if one was specified. */
1254 if ( !setjmp(to_top_level
) && exec_bfd
) {
1255 target_load (bfd_get_filename (exec_bfd
), 1);
1262 #define MAX_BREAKS 16
1263 static int num_brkpts
=0;
1265 hms_insert_breakpoint(addr
, save
)
1267 char *save
; /* Throw away, let hms save instructions */
1270 DENTER("hms_insert_breakpoint()");
1273 if (num_brkpts
< MAX_BREAKS
) {
1276 sprintf(buffer
,"b %x", addr
& 0xffff);
1277 hms_write_cr(buffer
);
1279 DEXIT("hms_insert_breakpoint() success");
1280 return(0); /* Success */
1282 fprintf_filtered(stderr
,
1283 "Too many break points, break point not installed\n");
1284 DEXIT("hms_insert_breakpoint() failure");
1285 return(1); /* Failure */
1291 hms_remove_breakpoint(addr
, save
)
1293 char *save
; /* Throw away, let hms save instructions */
1295 DENTER("hms_remove_breakpoint()");
1296 if (num_brkpts
> 0) {
1300 sprintf(buffer
,"b - %x", addr
& 0xffff);
1301 hms_write_cr(buffer
);
1305 DEXIT("hms_remove_breakpoint()");
1309 /* Clear the hmss notion of what the break points are */
1311 hms_clear_breakpoints()
1314 DENTER("hms_clear_breakpoint()");
1315 if (OPEN(hms_desc
)) {
1316 hms_write_cr("b -");
1321 DEXIT("hms_clear_breakpoint()");
1326 DENTER("hms_mourn()");
1327 hms_clear_breakpoints();
1328 /* pop_target (); /* Pop back to no-child state */
1329 generic_mourn_inferior ();
1330 DEXIT("hms_mourn()");
1333 /* Display everthing we read in from the hms until we match/see the
1342 while (c
=readchar()) {
1345 if (i
== strlen(str
)) return;
1348 for (j
=0 ; j
<i
; j
++) /* Put everthing we matched */
1359 /* Put a command string, in args, out to the hms. The hms is assumed to
1360 be in raw mode, all writing/reading done through hms_desc.
1361 Ouput from the hms is placed on the users terminal until the
1362 prompt from the hms is seen.
1363 FIXME: Can't handle commands that take input. */
1366 hms_com (args
, fromtty
)
1374 /* Clear all input so only command relative output is displayed */
1378 hms_write("\030",1);
1383 /* Define the target subroutine names */
1385 struct target_ops hms_ops
= {
1386 "hms", "Remote HMS monitor",
1387 "Use the H8 evaluation board running the HMS monitor connected\n\
1390 hms_open
, hms_close
,
1391 hms_attach
, hms_detach
, hms_resume
, hms_wait
,
1392 hms_fetch_register
, hms_store_register
,
1393 hms_prepare_to_store
, 0, 0, /* conv_to, conv_from */
1394 hms_xfer_inferior_memory
,
1396 hms_insert_breakpoint
, hms_remove_breakpoint
, /* Breakpoints */
1397 0, 0, 0, 0, 0, /* Terminal handling */
1398 hms_kill
, /* FIXME, kill */
1400 call_function_by_hand
,
1401 0, /* lookup_symbol */
1402 hms_create_inferior
, /* create_inferior */
1403 hms_mourn
, /* mourn_inferior FIXME */
1404 process_stratum
, 0, /* next */
1405 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
1406 0,0, /* Section pointers */
1407 OPS_MAGIC
, /* Always the last thing */
1420 dev_name
= get_word(&s
);
1430 int newrate
= atoi(s
);
1432 while (baudtab
[which
].rate
!= newrate
)
1434 if (baudtab
[which
].rate
== -1)
1436 error("Can't use %d baud\n", newrate
);
1443 printf_filtered("Checking target is in sync\n");
1446 get_baudrate_right();
1448 printf_filtered("Sending commands to set target to %d\n",
1451 sprintf(buffer
, "tm %d. N 8 1", baudrate
);
1456 /***********************************************************************/
1459 _initialize_remote_hms ()
1461 add_target (&hms_ops
);
1462 add_com ("hms <command>", class_obscure
, hms_com
,
1463 "Send a command to the HMS monitor.");
1464 add_com ("snoop", class_obscure
, hms_quiet
,
1465 "Show what commands are going to the monitor");
1466 add_com ("device", class_obscure
, hms_device
,
1467 "Set the terminal line for HMS communications");
1469 add_com ("speed", class_obscure
, hms_speed
,
1470 "Set the terminal line speed for HMS communications");
This page took 0.058462 seconds and 5 git commands to generate.