8636ae27fed13ac5f1dbf6ca758be87e1767222c
1 /* Remote debugging interface for Hitachi HMS Monitor Version 1.0
2 Copyright 1992 Free Software Foundation, Inc.
3 Contributed by Cygnus Support. Written by Steve Chamberlain
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
36 /* External data declarations */
37 extern int stop_soon_quietly
; /* for wait_for_inferior */
39 /* Forward data declarations */
40 extern struct target_ops hms_ops
; /* Forward declaration */
42 /* Forward function declarations */
43 static void hms_fetch_registers ();
44 static int hms_store_registers ();
45 static void hms_close ();
46 static int hms_clear_breakpoints();
48 extern struct target_ops hms_ops
;
53 # define DENTER(NAME) if (!quiet) (printf_filtered("Entering %s\n",NAME), fflush(stdout))
54 # define DEXIT(NAME) if (!quiet) (printf_filtered("Exiting %s\n",NAME), fflush(stdout))
61 /***********************************************************************/
62 /* Caching stuff stolen from remote-nindy.c */
64 /* The data cache records all the data read from the remote machine
65 since the last time it stopped.
67 Each cache block holds LINE_SIZE bytes of data
68 starting at a multiple-of-LINE_SIZE address. */
71 #define LINE_SIZE_POWER 4
72 #define LINE_SIZE (1<<LINE_SIZE_POWER) /* eg 1<<3 == 8 */
73 #define LINE_SIZE_MASK ((LINE_SIZE-1)) /* eg 7*2+1= 111*/
74 #define DCACHE_SIZE 64 /* Number of cache blocks */
75 #define XFORM(x) ((x&LINE_SIZE_MASK)>>2)
77 struct dcache_block
*next
, *last
;
78 unsigned int addr
; /* Address for which data is recorded. */
79 int data
[LINE_SIZE
/sizeof(int)];
82 struct dcache_block dcache_free
, dcache_valid
;
84 /* Free all the data cache blocks, thus discarding all cached data. */
89 register struct dcache_block
*db
;
91 while ((db
= dcache_valid
.next
) != &dcache_valid
)
94 insque (db
, &dcache_free
);
99 * If addr is present in the dcache, return the address of the block
103 struct dcache_block
*
107 register struct dcache_block
*db
;
112 /* Search all cache blocks for one that is at this address. */
113 db
= dcache_valid
.next
;
114 while (db
!= &dcache_valid
)
116 if ((addr
& ~LINE_SIZE_MASK
)== db
->addr
)
123 /* Return the int data at address ADDR in dcache block DC. */
126 dcache_value (db
, addr
)
127 struct dcache_block
*db
;
132 return (db
->data
[XFORM(addr
)]);
135 /* Get a free cache block, put or keep it on the valid list,
136 and return its address. The caller should store into the block
137 the address and data that it describes, then remque it from the
138 free list and insert it into the valid list. This procedure
139 prevents errors from creeping in if a ninMemGet is interrupted
140 (which used to put garbage blocks in the valid list...). */
142 struct dcache_block
*
145 register struct dcache_block
*db
;
147 if ((db
= dcache_free
.next
) == &dcache_free
)
149 /* If we can't get one from the free list, take last valid and put
150 it on the free list. */
151 db
= dcache_valid
.last
;
153 insque (db
, &dcache_free
);
157 insque (db
, &dcache_valid
);
161 /* Return the contents of the word at address ADDR in the remote machine,
162 using the data cache. */
168 register struct dcache_block
*db
;
170 db
= dcache_hit (addr
);
173 db
= dcache_alloc ();
175 hms_read_inferior_memory(addr
& ~LINE_SIZE_MASK
, (unsigned char *)db
->data
, LINE_SIZE
);
177 db
->addr
= addr
& ~LINE_SIZE_MASK
;
178 remque (db
); /* Off the free list */
179 insque (db
, &dcache_valid
); /* On the valid list */
181 return (dcache_value (db
, addr
));
184 /* Write the word at ADDR both in the data cache and in the remote machine. */
186 dcache_poke (addr
, data
)
190 register struct dcache_block
*db
;
192 /* First make sure the word is IN the cache. DB is its cache block. */
193 db
= dcache_hit (addr
);
196 db
= dcache_alloc ();
198 hms_write_inferior_memory(addr
& ~LINE_SIZE_MASK
, (unsigned char *)db
->data
, LINE_SIZE
);
200 db
->addr
= addr
& ~LINE_SIZE_MASK
;
201 remque (db
); /* Off the free list */
202 insque (db
, &dcache_valid
); /* On the valid list */
205 /* Modify the word in the cache. */
206 db
->data
[XFORM(addr
)] = data
;
208 /* Send the changed word. */
210 hms_write_inferior_memory(addr
, (unsigned char *)&data
, 4);
214 /* The cache itself. */
215 struct dcache_block the_cache
[DCACHE_SIZE
];
217 /* Initialize the data cache. */
222 register struct dcache_block
*db
;
225 dcache_free
.next
= dcache_free
.last
= &dcache_free
;
226 dcache_valid
.next
= dcache_valid
.last
= &dcache_valid
;
227 for (i
=0;i
<DCACHE_SIZE
;i
++,db
++)
228 insque (db
, &dcache_free
);
232 /***********************************************************************
233 * I/O stuff stolen from remote-eb.c
234 ***********************************************************************/
236 static int timeout
= 2;
238 static CONST
char *dev_name
;
241 /* Descriptor for I/O to remote machine. Initialize it to -1 so that
242 hms_open knows that we don't have a file open when the program
251 error("remote device not open");
258 /* Read a character from the remote system, doing all the fancy
265 buf
= serial_timedreadchar(timeout
, &ok
);
268 error ("Timeout reading from remote system.");
281 buf
= serial_timedreadchar(timeout
, &ok
);
290 /* Keep discarding input from the remote system, until STRING is found.
291 Let the user break out immediately. */
302 if (readchar() == *p
)
316 /* Keep discarding input until we see the hms prompt.
318 The convention for dealing with the prompt is that you
320 o *then* wait for the prompt.
322 Thus the last thing that a procedure does with the serial line
323 will be an expect_prompt(). Exception: hms_resume does not
324 wait for the prompt, because the terminal is being handed over
325 to the inferior. However, the next thing which happens after that
326 is a hms_wait which does wait for the prompt.
327 Note that this includes abnormal exit, e.g. error(). This is
328 necessary to prevent getting into states from which we can't
336 /* Get a hex digit from the remote system & return its value.
337 If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */
339 get_hex_digit (ignore_space
)
346 if (ch
>= '0' && ch
<= '9')
348 else if (ch
>= 'A' && ch
<= 'F')
349 return ch
- 'A' + 10;
350 else if (ch
>= 'a' && ch
<= 'f')
351 return ch
- 'a' + 10;
352 else if (ch
== ' ' && ignore_space
)
357 error ("Invalid hex digit from remote system.");
362 /* Get a byte from hms_desc and put it in *BYT. Accept any number
370 val
= get_hex_digit (1) << 4;
371 val
|= get_hex_digit (0);
375 /* Read a 32-bit hex word from the hms, preceded by a space */
383 for (j
= 0; j
< 8; j
++)
384 val
= (val
<< 4) + get_hex_digit (j
== 0);
387 /* Called when SIGALRM signal sent due to alarm() timeout. */
391 /* Number of SIGTRAPs we need to simulate. That is, the next
392 NEED_ARTIFICIAL_TRAP calls to hms_wait should just return
393 SIGTRAP without actually waiting for anything. */
395 static int need_artificial_trap
= 0;
398 hms_kill(arg
,from_tty
)
408 * Download a file specified in 'args', to the hms.
411 hms_load(args
,fromtty
)
421 DENTER("hms_load()");
426 abfd
= bfd_openr(args
,"coff-h8300");
429 printf_filtered("Unable to open file %s\n", args
);
433 if (bfd_check_format(abfd
, bfd_object
) ==0)
435 printf_filtered("File is not an object file\n");
440 while (s
!= (asection
*)NULL
)
442 if (s
->flags
& SEC_LOAD
)
448 char *buffer
= xmalloc(DELTA
);
449 printf_filtered("%s\t: 0x%4x .. 0x%4x ",s
->name
, s
->vma
, s
->vma
+ s
->_raw_size
);
450 for (i
= 0; i
< s
->_raw_size
; i
+= DELTA
)
453 if (delta
> s
->_raw_size
- i
)
454 delta
= s
->_raw_size
- i
;
456 bfd_get_section_contents(abfd
, s
, buffer
, i
, delta
);
457 hms_write_inferior_memory(s
->vma
+ i
, buffer
, delta
);
458 printf_filtered("*");
461 printf_filtered( "\n");
466 sprintf(buffer
, "r PC=%x", abfd
->start_address
);
467 hms_write_cr(buffer
);
473 /* This is called not only when we first attach, but also when the
474 user types "run" after having attached. */
476 hms_create_inferior (execfile
, args
, env
)
483 DENTER("hms_create_inferior()");
486 error ("Can't pass arguments to remote hms process.");
488 if (execfile
== 0 || exec_bfd
== 0)
489 error ("No exec file specified");
491 entry_pt
= (int) bfd_get_start_address (exec_bfd
);
496 hms_clear_breakpoints();
497 init_wait_for_inferior ();
501 insert_breakpoints (); /* Needed to get correct instruction in cache */
502 proceed(entry_pt
, -1, 0);
505 DEXIT("hms_create_inferior()");
509 /* Open a connection to a remote debugger.
510 NAME is the filename used for communication, then a space,
518 while (*s
&& !isspace(*s
))
523 static char *get_word(p
)
538 while (*s
&& !isspace(*s
))
544 copy
= xmalloc(len
+1);
545 memcpy(copy
, word
, len
);
551 static int baudrate
= 9600;
557 /* Put this port into NORMAL mode, send the 'normal' character */
559 hms_write("\001", 1); /* Control A */
560 hms_write("\r", 1); /* Cr */
564 serial_timedreadchar(timeout
, &ok
);
570 if (readchar_nofail() == 'r')
573 /* Not the right baudrate, or the board's not on */
579 if (!serial_setbaudrate(baudrate
))
580 error("Can't set baudrate");
586 while (!is_baudrate_right())
588 baudrate
= serial_nextbaudrate(baudrate
);
590 printf_filtered("Board not yet in sync\n");
593 printf_filtered("Board not responding, trying %d baud\n",baudrate
);
595 serial_setbaudrate(baudrate
);
600 hms_open (name
, from_tty
)
608 DENTER("hms_open()");
616 if (name
&& strlen(name
))
617 dev_name
= strdup(name
);
618 if (!serial_open(dev_name
))
619 perror_with_name ((char *)dev_name
);
627 /* start_remote (); /* Initialize gdb process mechanisms */
629 get_baudrate_right();
631 /* Hello? Are you there? */
632 serial_write("\r",1);
635 /* Clear any break points */
636 hms_clear_breakpoints();
639 printf_filtered("Connected to remote H8/300 HMS system.\n");
644 /* Close out all files and local state before this target loses control. */
651 DENTER("hms_close()");
653 /* Clear any break points */
654 hms_clear_breakpoints();
656 /* Put this port back into REMOTE mode */
657 sleep(1); /* Let any output make it all the way back */
658 serial_write("R\r", 2);
662 DEXIT("hms_close()");
665 /* Attach to the target that is already loaded and possibly running */
667 hms_attach (args
, from_tty
)
672 DENTER("hms_attach()");
674 /* push_target(&hms_ops); /* This done in hms_open() */
676 mark_breakpoints_out ();
678 /* Send the hms a kill. It is ok if it is not already running */
680 fprintf(hms_stream
, "K\r");
681 expect_prompt(); /* Slurp the echo */
683 /* We will get a task spawn event immediately. */
684 init_wait_for_inferior ();
685 clear_proceed_status ();
686 stop_soon_quietly
= 1;
687 wait_for_inferior ();
688 stop_soon_quietly
= 0;
690 DEXIT("hms_attach()");
694 /* Terminate the open connection to the remote debugger.
695 Use this when you want to detach and do something else
698 hms_detach (args
,from_tty
)
702 DENTER("hms_detach()");
705 hms_clear_breakpoints();
708 pop_target(); /* calls hms_close to do the real work */
710 printf_filtered ("Ending remote %s debugging\n", target_shortname
);
711 DEXIT("hms_detach()");
714 /* Tell the remote machine to resume. */
717 hms_resume (step
, sig
)
720 DENTER("hms_resume()");
728 /* Force the next hms_wait to return a trap. Not doing anything
729 about I/O from the target means that the user has to type
730 "continue" to see any. FIXME, this should be fixed. */
731 need_artificial_trap
= 1;
738 DEXIT("hms_resume()");
741 /* Wait until the remote machine stops, then return,
742 storing status in STATUS just as `wait' would. */
748 /* Strings to look for. '?' means match any single character.
749 Note that with the algorithm we use, the initial character
750 of the string cannot recur in the string, or we will not
751 find some cases of the string in the input. */
753 static char bpt
[] = "At breakpoint:";
754 /* It would be tempting to look for "\n[__exit + 0x8]\n"
755 but that requires loading symbols with "yc i" and even if
756 we did do that we don't know that the file has symbols. */
757 static char exitmsg
[] = "HMS>";
761 /* Large enough for either sizeof (bpt) or sizeof (exitmsg) chars. */
763 /* Current position in swallowed. */
764 char *swallowed_p
= swallowed
;
768 int old_timeout
= timeout
;
769 int old_immediate_quit
= immediate_quit
;
770 int swallowed_cr
= 0;
772 DENTER("hms_wait()");
774 WSETEXIT ((*status
), 0);
776 if (need_artificial_trap
!= 0)
778 WSETSTOP ((*status
), SIGTRAP
);
779 need_artificial_trap
--;
783 timeout
= 99999; /* Don't time out -- user program is running. */
784 immediate_quit
= 1; /* Helps ability to QUIT */
787 QUIT
; /* Let user quit and leave process running */
803 if (ch
== *ep
|| *ep
== '?')
820 /* Print out any characters which have been swallowed. */
821 for (p
= swallowed
; p
< swallowed_p
; ++p
)
823 swallowed_p
= swallowed
;
826 if ((ch
!= '\r' && ch
!= '\n') || swallowed_cr
>10)
837 WSETSTOP ((*status
), SIGTRAP
);
842 WSETEXIT ((*status
), 0);
845 timeout
= old_timeout
;
846 immediate_quit
= old_immediate_quit
;
851 /* Return the name of register number REGNO
852 in the form input and output by hms.
854 Returns a pointer to a static buffer containing the answer. */
859 static char *rn
[NUM_REGS
]= REGISTER_NAMES
;
863 /* Read the remote registers. */
864 static int gethex(length
, start
, ok
)
873 if (*start
>='a' && *start
<= 'f')
875 result
+= *start
- 'a' + 10;
877 else if (*start
>='A' && *start
<= 'F')
879 result
+= *start
- 'A' + 10;
881 else if (*start
>='0' && *start
<= '9')
883 result
+= *start
- '0' ;
892 timed_read(buf
, n
, timeout
)
903 if (c
== 0) return i
;
918 for (i
= 0; i
< l
; i
++)
927 hms_write( s
, strlen(s
));
932 hms_fetch_register (dummy
)
935 #define REGREPLY_SIZE 79
936 char linebuf
[REGREPLY_SIZE
+1];
941 REGISTER_TYPE reg
[NUM_REGS
];
949 s
= timed_read(linebuf
, REGREPLY_SIZE
, 1);
952 linebuf
[REGREPLY_SIZE
] = 0;
954 if (linebuf
[0] == 'r' &&
958 linebuf
[75] == 'H' &&
959 linebuf
[76] == 'M' &&
963 PC=XXXX CCR=XX:XXXXXXXX R0-R7= XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
964 5436789012345678901234567890123456789012345678901234567890123456789012
969 reg
[PC_REGNUM
] = gethex(4,linebuf
+6, &gottok
);
970 reg
[CCR_REGNUM
] = gethex(2,linebuf
+15, &gottok
);
971 for (i
= 0; i
< 8; i
++)
973 reg
[i
] = gethex(4, linebuf
+34+5*i
, &gottok
);
978 for (i
= 0; i
< NUM_REGS
; i
++)
982 swapped
[0] = (reg
[i
])>> 8;
984 supply_register (i
, swapped
);
989 /* Store register REGNO, or all if REGNO == -1.
990 Return errno value. */
992 hms_store_register (regno
)
996 /* printf("hms_store_register() called.\n"); fflush(stdout); /* */
999 for (regno
= 0; regno
< NUM_REGS
; regno
++)
1001 hms_store_register(regno
);
1006 char *name
= get_reg_name (regno
);
1008 sprintf(buffer
,"r %s=%x", name
, read_register(regno
));
1009 hms_write_cr(buffer
);
1013 DEXIT("hms_store_registers()");
1019 /* Get ready to modify the registers array. On machines which store
1020 individual registers, this doesn't need to do anything. On machines
1021 which store all the registers in one fell swoop, this makes sure
1022 that registers contains all the registers from the program being
1026 hms_prepare_to_store ()
1028 /* Do nothing, since we can store individual regs */
1032 translate_addr(addr
)
1040 /* Read a word from remote address ADDR and return it.
1041 * This goes through the data cache.
1044 hms_fetch_word (addr
)
1047 return dcache_fetch (addr
);
1050 /* Write a word WORD into remote address ADDR.
1051 This goes through the data cache. */
1054 hms_store_word (addr
, word
)
1058 dcache_poke (addr
, word
);
1062 hms_xfer_inferior_memory(memaddr
, myaddr
, len
, write
, target
)
1067 struct target_ops
*target
; /* ignored */
1070 /* Round starting address down to longword boundary. */
1071 register CORE_ADDR addr
;
1072 /* Round ending address up; get number of longwords that makes. */
1074 /* Allocate buffer of that many longwords. */
1075 register int *buffer
;
1078 addr
= memaddr
& - sizeof (int);
1079 count
= (((memaddr
+ len
) - addr
) + sizeof (int) - 1) / sizeof (int);
1082 buffer
= (int *)alloca (count
* sizeof (int));
1085 /* Fill start and end extra bytes of buffer with existing memory data. */
1087 if (addr
!= memaddr
|| len
< (int)sizeof (int)) {
1088 /* Need part of initial word -- fetch it. */
1089 buffer
[0] = hms_fetch_word (addr
);
1092 if (count
> 1) /* FIXME, avoid if even boundary */
1095 = hms_fetch_word (addr
+ (count
- 1) * sizeof (int));
1098 /* Copy data to be written over corresponding part of buffer */
1100 bcopy (myaddr
, (char *) buffer
+ (memaddr
& (sizeof (int) - 1)), len
);
1102 /* Write the entire buffer. */
1104 for (i
= 0; i
< count
; i
++, addr
+= sizeof (int))
1107 hms_store_word (addr
, buffer
[i
]);
1118 /* Read all the longwords */
1119 for (i
= 0; i
< count
; i
++, addr
+= sizeof (int))
1122 buffer
[i
] = hms_fetch_word (addr
);
1130 /* Copy appropriate bytes out of the buffer. */
1131 bcopy ((char *) buffer
+ (memaddr
& (sizeof (int) - 1)), myaddr
, len
);
1139 hms_write_inferior_memory (memaddr
, myaddr
, len
)
1141 unsigned char *myaddr
;
1153 thisgo
= len
- done
;
1154 if (thisgo
> 20) thisgo
= 20;
1156 sprintf(buffer
,"M.B %4x =", memaddr
+done
);
1157 hms_write(buffer
,10);
1158 for (idx
= 0; idx
< thisgo
; idx
++)
1161 sprintf(buf
, "%2x ", myaddr
[idx
+done
]);
1175 char *file
= "nothing";
1177 file
= bfd_get_filename(exec_bfd
);
1181 printf_filtered("\tAttached to DOS asynctsr and running program %s\n",file
);
1183 printf_filtered("\tAttached to %s at %d baud and running program %s\n",file
);
1185 printf_filtered("\ton an H8/300 processor.\n");
1188 /* Copy LEN bytes of data from debugger memory at MYADDR
1189 to inferior's memory at MEMADDR. Returns errno value.
1190 * sb/sh instructions don't work on unaligned addresses, when TU=1.
1194 /* Read LEN bytes from inferior memory at MEMADDR. Put the result
1195 at debugger address MYADDR. Returns errno value. */
1197 hms_read_inferior_memory(memaddr
, myaddr
, len
)
1202 /* Align to nearest low 16 bits */
1206 CORE_ADDR start
= memaddr
& ~0xf;
1207 CORE_ADDR end
= ((memaddr
+ len
+16) & ~0xf) -1;
1209 CORE_ADDR start
= memaddr
;
1210 CORE_ADDR end
= memaddr
+ len
-1;
1215 AAAA: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX '................'
1216 012345678901234567890123456789012345678901234567890123456789012345
1220 if (memaddr
& 0xf) abort();
1221 if (len
!= 16) abort();
1223 sprintf(buffer
, "m %4x %4x", start
& 0xffff, end
& 0xffff);
1224 hms_write_cr(buffer
);
1225 /* drop the echo and newline*/
1226 for (i
= 0; i
< 13; i
++)
1231 /* Grab the lines as they come out and fill the area */
1241 buffer
[0] = readchar();
1242 if (buffer
[0] == 'M')
1244 for (i
= 1; i
< 66; i
++)
1245 buffer
[i
] = readchar();
1247 /* Now parse the line */
1249 addr
= gethex(4, buffer
, &ok
);
1251 for (p
= 0; p
< 16; p
+=2)
1253 byte
[p
] = gethex(2, buffer
+ idx
, &ok
);
1254 byte
[p
+1] = gethex(2, buffer
+ idx
+ 2, &ok
);
1260 for (p
= 0; p
<16;p
++)
1262 if (addr
+ p
>= memaddr
&&
1263 addr
+ p
< memaddr
+ len
)
1265 myaddr
[ (addr
+ p
)-memaddr
] = byte
[p
];
1276 /* This routine is run as a hook, just before the main command loop is
1277 entered. If gdb is configured for the H8, but has not had its
1278 target specified yet, this will loop prompting the user to do so.
1281 hms_before_main_loop ()
1285 extern FILE *instream
;
1286 extern jmp_buf to_top_level
;
1288 push_target (&hms_ops
);
1292 #define MAX_BREAKS 16
1293 static int num_brkpts
=0;
1295 hms_insert_breakpoint(addr
, save
)
1297 char *save
; /* Throw away, let hms save instructions */
1299 DENTER("hms_insert_breakpoint()");
1302 if (num_brkpts
< MAX_BREAKS
)
1306 sprintf(buffer
,"b %x", addr
& 0xffff);
1307 hms_write_cr(buffer
);
1309 DEXIT("hms_insert_breakpoint() success");
1314 fprintf_filtered(stderr
,
1315 "Too many break points, break point not installed\n");
1316 DEXIT("hms_insert_breakpoint() failure");
1323 hms_remove_breakpoint(addr
, save
)
1325 char *save
; /* Throw away, let hms save instructions */
1327 DENTER("hms_remove_breakpoint()");
1333 sprintf(buffer
,"b - %x", addr
& 0xffff);
1334 hms_write_cr(buffer
);
1338 DEXIT("hms_remove_breakpoint()");
1342 /* Clear the hmss notion of what the break points are */
1344 hms_clear_breakpoints()
1347 DENTER("hms_clear_breakpoint()");
1349 hms_write_cr("b -");
1353 DEXIT("hms_clear_breakpoint()");
1358 DENTER("hms_mourn()");
1359 hms_clear_breakpoints();
1360 generic_mourn_inferior ();
1361 DEXIT("hms_mourn()");
1366 /* Put a command string, in args, out to the hms. The hms is assumed to
1367 be in raw mode, all writing/reading done through desc.
1368 Ouput from the hms is placed on the users terminal until the
1369 prompt from the hms is seen.
1370 FIXME: Can't handle commands that take input. */
1373 hms_com (args
, fromtty
)
1381 /* Clear all input so only command relative output is displayed */
1384 hms_write("\030",1);
1388 /* Define the target subroutine names */
1390 struct target_ops hms_ops
= {
1391 "hms", "Remote HMS monitor",
1392 "Use the H8 evaluation board running the HMS monitor connected\n\
1395 hms_open
, hms_close
,
1396 hms_attach
, hms_detach
, hms_resume
, hms_wait
,
1397 hms_fetch_register
, hms_store_register
,
1398 hms_prepare_to_store
, 0, 0, /* conv_to, conv_from */
1399 hms_xfer_inferior_memory
,
1401 hms_insert_breakpoint
, hms_remove_breakpoint
, /* Breakpoints */
1402 0, 0, 0, 0, 0, /* Terminal handling */
1403 hms_kill
, /* FIXME, kill */
1405 0, /* lookup_symbol */
1406 hms_create_inferior
, /* create_inferior */
1407 hms_mourn
, /* mourn_inferior FIXME */
1408 process_stratum
, 0, /* next */
1409 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
1410 0,0, /* Section pointers */
1411 OPS_MAGIC
, /* Always the last thing */
1419 printf_filtered("Snoop disabled\n");
1421 printf_filtered("Snoop enabled\n");
1430 dev_name
= get_word(&s
);
1444 int newrate
= atoi(s
);
1446 if (!serial_setbaudrate(newrate
))
1447 error("Can't use %d baud\n", newrate
);
1449 printf_filtered("Checking target is in sync\n");
1451 get_baudrate_right();
1453 printf_filtered("Sending commands to set target to %d\n",
1456 sprintf(buffer
, "tm %d. N 8 1", baudrate
);
1457 hms_write_cr(buffer
);
1461 /***********************************************************************/
1464 _initialize_remote_hms ()
1466 add_target (&hms_ops
);
1467 add_com ("hms <command>", class_obscure
, hms_com
,
1468 "Send a command to the HMS monitor.");
1469 add_com ("snoop", class_obscure
, hms_quiet
,
1470 "Show what commands are going to the monitor");
1472 add_com ("device", class_obscure
, hms_device
,
1473 "Set the terminal line for HMS communications");
1475 add_com ("speed", class_obscure
, hms_speed
,
1476 "Set the terminal line speed for HMS communications");
1478 dev_name
= serial_default_name();
This page took 0.059008 seconds and 4 git commands to generate.