* configure.tgt (i[3456]86-*-openbsd*): Set gdb_target to obds.
[deliverable/binutils-gdb.git] / gdb / remote-os9k.c
1 // OBSOLETE /* Remote debugging interface for boot monitors, for GDB.
2 // OBSOLETE
3 // OBSOLETE Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
4 // OBSOLETE 2000, 2001, 2002 Free Software Foundation, Inc.
5 // OBSOLETE
6 // OBSOLETE This file is part of GDB.
7 // OBSOLETE
8 // OBSOLETE This program is free software; you can redistribute it and/or modify
9 // OBSOLETE it under the terms of the GNU General Public License as published by
10 // OBSOLETE the Free Software Foundation; either version 2 of the License, or
11 // OBSOLETE (at your option) any later version.
12 // OBSOLETE
13 // OBSOLETE This program is distributed in the hope that it will be useful,
14 // OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // OBSOLETE GNU General Public License for more details.
17 // OBSOLETE
18 // OBSOLETE You should have received a copy of the GNU General Public License
19 // OBSOLETE along with this program; if not, write to the Free Software
20 // OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
21 // OBSOLETE Boston, MA 02111-1307, USA. */
22 // OBSOLETE
23 // OBSOLETE /* This file was derived from remote-eb.c, which did a similar job, but for
24 // OBSOLETE an AMD-29K running EBMON. That file was in turn derived from remote.c
25 // OBSOLETE as mentioned in the following comment (left in for comic relief):
26 // OBSOLETE
27 // OBSOLETE "This is like remote.c but is for a different situation--
28 // OBSOLETE having a PC running os9000 hook up with a unix machine with
29 // OBSOLETE a serial line, and running ctty com2 on the PC. os9000 has a debug
30 // OBSOLETE monitor called ROMBUG running. Not to mention that the PC
31 // OBSOLETE has PC/NFS, so it can access the same executables that gdb can,
32 // OBSOLETE over the net in real time."
33 // OBSOLETE
34 // OBSOLETE In reality, this module talks to a debug monitor called 'ROMBUG', which
35 // OBSOLETE We communicate with ROMBUG via a direct serial line, the network version
36 // OBSOLETE of ROMBUG is not available yet.
37 // OBSOLETE */
38 // OBSOLETE
39 // OBSOLETE /* FIXME This file needs to be rewritten if it's to work again, either
40 // OBSOLETE to self-contained or to use the new monitor interface. */
41 // OBSOLETE
42 // OBSOLETE #include "defs.h"
43 // OBSOLETE #include "gdbcore.h"
44 // OBSOLETE #include "target.h"
45 // OBSOLETE #include "gdb_string.h"
46 // OBSOLETE #include <sys/types.h>
47 // OBSOLETE #include "command.h"
48 // OBSOLETE #include "serial.h"
49 // OBSOLETE #include "monitor.h"
50 // OBSOLETE #include "remote-utils.h"
51 // OBSOLETE #include "symtab.h"
52 // OBSOLETE #include "symfile.h"
53 // OBSOLETE #include "objfiles.h"
54 // OBSOLETE #include "gdb-stabs.h"
55 // OBSOLETE #include "regcache.h"
56 // OBSOLETE
57 // OBSOLETE struct cmd_list_element *showlist;
58 // OBSOLETE extern struct target_ops rombug_ops; /* Forward declaration */
59 // OBSOLETE extern struct monitor_ops rombug_cmds; /* Forward declaration */
60 // OBSOLETE extern struct cmd_list_element *setlist;
61 // OBSOLETE extern struct cmd_list_element *unsetlist;
62 // OBSOLETE extern int attach_flag;
63 // OBSOLETE
64 // OBSOLETE static void rombug_close ();
65 // OBSOLETE static void rombug_fetch_register ();
66 // OBSOLETE static void rombug_fetch_registers ();
67 // OBSOLETE static void rombug_store_register ();
68 // OBSOLETE #if 0
69 // OBSOLETE static int sr_get_debug (); /* flag set by "set remotedebug" */
70 // OBSOLETE #endif
71 // OBSOLETE static int hashmark; /* flag set by "set hash" */
72 // OBSOLETE static int rombug_is_open = 0;
73 // OBSOLETE
74 // OBSOLETE /* FIXME: Replace with sr_get_debug (). */
75 // OBSOLETE #define LOG_FILE "monitor.log"
76 // OBSOLETE FILE *log_file;
77 // OBSOLETE static int monitor_log = 0;
78 // OBSOLETE static int tty_xon = 0;
79 // OBSOLETE static int tty_xoff = 0;
80 // OBSOLETE
81 // OBSOLETE static int timeout = 10;
82 // OBSOLETE static int is_trace_mode = 0;
83 // OBSOLETE /* Descriptor for I/O to remote machine. Initialize it to NULL */
84 // OBSOLETE static struct serial *monitor_desc = NULL;
85 // OBSOLETE
86 // OBSOLETE static CORE_ADDR bufaddr = 0;
87 // OBSOLETE static int buflen = 0;
88 // OBSOLETE static char readbuf[16];
89 // OBSOLETE
90 // OBSOLETE /* Send data to monitor. Works just like printf. */
91 // OBSOLETE static void
92 // OBSOLETE printf_monitor (char *pattern,...)
93 // OBSOLETE {
94 // OBSOLETE va_list args;
95 // OBSOLETE char buf[200];
96 // OBSOLETE int i;
97 // OBSOLETE
98 // OBSOLETE va_start (args, pattern);
99 // OBSOLETE
100 // OBSOLETE vsprintf (buf, pattern, args);
101 // OBSOLETE va_end (args);
102 // OBSOLETE
103 // OBSOLETE if (serial_write (monitor_desc, buf, strlen (buf)))
104 // OBSOLETE fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n",
105 // OBSOLETE safe_strerror (errno));
106 // OBSOLETE }
107 // OBSOLETE
108 // OBSOLETE /* Read a character from the remote system, doing all the fancy timeout stuff */
109 // OBSOLETE static int
110 // OBSOLETE readchar (int timeout)
111 // OBSOLETE {
112 // OBSOLETE int c;
113 // OBSOLETE
114 // OBSOLETE c = serial_readchar (monitor_desc, timeout);
115 // OBSOLETE
116 // OBSOLETE if (sr_get_debug ())
117 // OBSOLETE putchar (c & 0x7f);
118 // OBSOLETE
119 // OBSOLETE if (monitor_log && isascii (c))
120 // OBSOLETE putc (c & 0x7f, log_file);
121 // OBSOLETE
122 // OBSOLETE if (c >= 0)
123 // OBSOLETE return c & 0x7f;
124 // OBSOLETE
125 // OBSOLETE if (c == SERIAL_TIMEOUT)
126 // OBSOLETE {
127 // OBSOLETE if (timeout == 0)
128 // OBSOLETE return c; /* Polls shouldn't generate timeout errors */
129 // OBSOLETE
130 // OBSOLETE error ("Timeout reading from remote system.");
131 // OBSOLETE }
132 // OBSOLETE
133 // OBSOLETE perror_with_name ("remote-monitor");
134 // OBSOLETE }
135 // OBSOLETE
136 // OBSOLETE /* Scan input from the remote system, until STRING is found. If DISCARD is
137 // OBSOLETE non-zero, then discard non-matching input, else print it out.
138 // OBSOLETE Let the user break out immediately. */
139 // OBSOLETE static void
140 // OBSOLETE expect (char *string, int discard)
141 // OBSOLETE {
142 // OBSOLETE char *p = string;
143 // OBSOLETE int c;
144 // OBSOLETE
145 // OBSOLETE if (sr_get_debug ())
146 // OBSOLETE printf ("Expecting \"%s\"\n", string);
147 // OBSOLETE
148 // OBSOLETE immediate_quit++;
149 // OBSOLETE while (1)
150 // OBSOLETE {
151 // OBSOLETE c = readchar (timeout);
152 // OBSOLETE if (!isascii (c))
153 // OBSOLETE continue;
154 // OBSOLETE if (c == *p++)
155 // OBSOLETE {
156 // OBSOLETE if (*p == '\0')
157 // OBSOLETE {
158 // OBSOLETE immediate_quit--;
159 // OBSOLETE if (sr_get_debug ())
160 // OBSOLETE printf ("\nMatched\n");
161 // OBSOLETE return;
162 // OBSOLETE }
163 // OBSOLETE }
164 // OBSOLETE else
165 // OBSOLETE {
166 // OBSOLETE if (!discard)
167 // OBSOLETE {
168 // OBSOLETE fwrite (string, 1, (p - 1) - string, stdout);
169 // OBSOLETE putchar ((char) c);
170 // OBSOLETE fflush (stdout);
171 // OBSOLETE }
172 // OBSOLETE p = string;
173 // OBSOLETE }
174 // OBSOLETE }
175 // OBSOLETE }
176 // OBSOLETE
177 // OBSOLETE /* Keep discarding input until we see the ROMBUG prompt.
178 // OBSOLETE
179 // OBSOLETE The convention for dealing with the prompt is that you
180 // OBSOLETE o give your command
181 // OBSOLETE o *then* wait for the prompt.
182 // OBSOLETE
183 // OBSOLETE Thus the last thing that a procedure does with the serial line
184 // OBSOLETE will be an expect_prompt(). Exception: rombug_resume does not
185 // OBSOLETE wait for the prompt, because the terminal is being handed over
186 // OBSOLETE to the inferior. However, the next thing which happens after that
187 // OBSOLETE is a rombug_wait which does wait for the prompt.
188 // OBSOLETE Note that this includes abnormal exit, e.g. error(). This is
189 // OBSOLETE necessary to prevent getting into states from which we can't
190 // OBSOLETE recover. */
191 // OBSOLETE static void
192 // OBSOLETE expect_prompt (int discard)
193 // OBSOLETE {
194 // OBSOLETE if (monitor_log)
195 // OBSOLETE /* This is a convenient place to do this. The idea is to do it often
196 // OBSOLETE enough that we never lose much data if we terminate abnormally. */
197 // OBSOLETE fflush (log_file);
198 // OBSOLETE
199 // OBSOLETE if (is_trace_mode)
200 // OBSOLETE {
201 // OBSOLETE expect ("trace", discard);
202 // OBSOLETE }
203 // OBSOLETE else
204 // OBSOLETE {
205 // OBSOLETE expect (PROMPT, discard);
206 // OBSOLETE }
207 // OBSOLETE }
208 // OBSOLETE
209 // OBSOLETE /* Get a hex digit from the remote system & return its value.
210 // OBSOLETE If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */
211 // OBSOLETE static int
212 // OBSOLETE get_hex_digit (int ignore_space)
213 // OBSOLETE {
214 // OBSOLETE int ch;
215 // OBSOLETE while (1)
216 // OBSOLETE {
217 // OBSOLETE ch = readchar (timeout);
218 // OBSOLETE if (ch >= '0' && ch <= '9')
219 // OBSOLETE return ch - '0';
220 // OBSOLETE else if (ch >= 'A' && ch <= 'F')
221 // OBSOLETE return ch - 'A' + 10;
222 // OBSOLETE else if (ch >= 'a' && ch <= 'f')
223 // OBSOLETE return ch - 'a' + 10;
224 // OBSOLETE else if (ch == ' ' && ignore_space)
225 // OBSOLETE ;
226 // OBSOLETE else
227 // OBSOLETE {
228 // OBSOLETE expect_prompt (1);
229 // OBSOLETE error ("Invalid hex digit from remote system.");
230 // OBSOLETE }
231 // OBSOLETE }
232 // OBSOLETE }
233 // OBSOLETE
234 // OBSOLETE /* Get a byte from monitor and put it in *BYT. Accept any number
235 // OBSOLETE leading spaces. */
236 // OBSOLETE static void
237 // OBSOLETE get_hex_byte (char *byt)
238 // OBSOLETE {
239 // OBSOLETE int val;
240 // OBSOLETE
241 // OBSOLETE val = get_hex_digit (1) << 4;
242 // OBSOLETE val |= get_hex_digit (0);
243 // OBSOLETE *byt = val;
244 // OBSOLETE }
245 // OBSOLETE
246 // OBSOLETE /* Get N 32-bit words from remote, each preceded by a space,
247 // OBSOLETE and put them in registers starting at REGNO. */
248 // OBSOLETE static void
249 // OBSOLETE get_hex_regs (int n, int regno)
250 // OBSOLETE {
251 // OBSOLETE long val;
252 // OBSOLETE int i;
253 // OBSOLETE unsigned char b;
254 // OBSOLETE
255 // OBSOLETE for (i = 0; i < n; i++)
256 // OBSOLETE {
257 // OBSOLETE int j;
258 // OBSOLETE
259 // OBSOLETE val = 0;
260 // OBSOLETE for (j = 0; j < 4; j++)
261 // OBSOLETE {
262 // OBSOLETE get_hex_byte (&b);
263 // OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
264 // OBSOLETE val = (val << 8) + b;
265 // OBSOLETE else
266 // OBSOLETE val = val + (b << (j * 8));
267 // OBSOLETE }
268 // OBSOLETE supply_register (regno++, (char *) &val);
269 // OBSOLETE }
270 // OBSOLETE }
271 // OBSOLETE
272 // OBSOLETE /* This is called not only when we first attach, but also when the
273 // OBSOLETE user types "run" after having attached. */
274 // OBSOLETE static void
275 // OBSOLETE rombug_create_inferior (char *execfile, char *args, char **env)
276 // OBSOLETE {
277 // OBSOLETE int entry_pt;
278 // OBSOLETE
279 // OBSOLETE if (args && *args)
280 // OBSOLETE error ("Can't pass arguments to remote ROMBUG process");
281 // OBSOLETE
282 // OBSOLETE if (execfile == 0 || exec_bfd == 0)
283 // OBSOLETE error ("No executable file specified");
284 // OBSOLETE
285 // OBSOLETE entry_pt = (int) bfd_get_start_address (exec_bfd);
286 // OBSOLETE
287 // OBSOLETE if (monitor_log)
288 // OBSOLETE fputs ("\nIn Create_inferior()", log_file);
289 // OBSOLETE
290 // OBSOLETE
291 // OBSOLETE /* The "process" (board) is already stopped awaiting our commands, and
292 // OBSOLETE the program is already downloaded. We just set its PC and go. */
293 // OBSOLETE
294 // OBSOLETE init_wait_for_inferior ();
295 // OBSOLETE proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0);
296 // OBSOLETE }
297 // OBSOLETE
298 // OBSOLETE /* Open a connection to a remote debugger.
299 // OBSOLETE NAME is the filename used for communication. */
300 // OBSOLETE
301 // OBSOLETE static char dev_name[100];
302 // OBSOLETE
303 // OBSOLETE static void
304 // OBSOLETE rombug_open (char *args, int from_tty)
305 // OBSOLETE {
306 // OBSOLETE if (args == NULL)
307 // OBSOLETE error ("Use `target RomBug DEVICE-NAME' to use a serial port, or \n\
308 // OBSOLETE `target RomBug HOST-NAME:PORT-NUMBER' to use a network connection.");
309 // OBSOLETE
310 // OBSOLETE target_preopen (from_tty);
311 // OBSOLETE
312 // OBSOLETE if (rombug_is_open)
313 // OBSOLETE unpush_target (&rombug_ops);
314 // OBSOLETE
315 // OBSOLETE strcpy (dev_name, args);
316 // OBSOLETE monitor_desc = serial_open (dev_name);
317 // OBSOLETE if (monitor_desc == NULL)
318 // OBSOLETE perror_with_name (dev_name);
319 // OBSOLETE
320 // OBSOLETE /* if baud rate is set by 'set remotebaud' */
321 // OBSOLETE if (serial_setbaudrate (monitor_desc, sr_get_baud_rate ()))
322 // OBSOLETE {
323 // OBSOLETE serial_close (monitor_desc);
324 // OBSOLETE perror_with_name ("RomBug");
325 // OBSOLETE }
326 // OBSOLETE serial_raw (monitor_desc);
327 // OBSOLETE if (tty_xon || tty_xoff)
328 // OBSOLETE {
329 // OBSOLETE struct hardware_ttystate
330 // OBSOLETE {
331 // OBSOLETE struct termios t;
332 // OBSOLETE }
333 // OBSOLETE *tty_s;
334 // OBSOLETE
335 // OBSOLETE tty_s = (struct hardware_ttystate *) serial_get_tty_state (monitor_desc);
336 // OBSOLETE if (tty_xon)
337 // OBSOLETE tty_s->t.c_iflag |= IXON;
338 // OBSOLETE if (tty_xoff)
339 // OBSOLETE tty_s->t.c_iflag |= IXOFF;
340 // OBSOLETE serial_set_tty_state (monitor_desc, (serial_ttystate) tty_s);
341 // OBSOLETE }
342 // OBSOLETE
343 // OBSOLETE rombug_is_open = 1;
344 // OBSOLETE
345 // OBSOLETE log_file = fopen (LOG_FILE, "w");
346 // OBSOLETE if (log_file == NULL)
347 // OBSOLETE perror_with_name (LOG_FILE);
348 // OBSOLETE
349 // OBSOLETE push_monitor (&rombug_cmds);
350 // OBSOLETE printf_monitor ("\r"); /* CR wakes up monitor */
351 // OBSOLETE expect_prompt (1);
352 // OBSOLETE push_target (&rombug_ops);
353 // OBSOLETE attach_flag = 1;
354 // OBSOLETE
355 // OBSOLETE if (from_tty)
356 // OBSOLETE printf ("Remote %s connected to %s\n", target_shortname,
357 // OBSOLETE dev_name);
358 // OBSOLETE
359 // OBSOLETE rombug_fetch_registers ();
360 // OBSOLETE
361 // OBSOLETE printf_monitor ("ov e \r");
362 // OBSOLETE expect_prompt (1);
363 // OBSOLETE bufaddr = 0;
364 // OBSOLETE buflen = 0;
365 // OBSOLETE }
366 // OBSOLETE
367 // OBSOLETE /*
368 // OBSOLETE * Close out all files and local state before this target loses control.
369 // OBSOLETE */
370 // OBSOLETE
371 // OBSOLETE static void
372 // OBSOLETE rombug_close (int quitting)
373 // OBSOLETE {
374 // OBSOLETE if (rombug_is_open)
375 // OBSOLETE {
376 // OBSOLETE serial_close (monitor_desc);
377 // OBSOLETE monitor_desc = NULL;
378 // OBSOLETE rombug_is_open = 0;
379 // OBSOLETE }
380 // OBSOLETE
381 // OBSOLETE if (log_file)
382 // OBSOLETE {
383 // OBSOLETE if (ferror (log_file))
384 // OBSOLETE fprintf_unfiltered (gdb_stderr, "Error writing log file.\n");
385 // OBSOLETE if (fclose (log_file) != 0)
386 // OBSOLETE fprintf_unfiltered (gdb_stderr, "Error closing log file.\n");
387 // OBSOLETE log_file = 0;
388 // OBSOLETE }
389 // OBSOLETE }
390 // OBSOLETE
391 // OBSOLETE int
392 // OBSOLETE rombug_link (char *mod_name, CORE_ADDR *text_reloc)
393 // OBSOLETE {
394 // OBSOLETE int i, j;
395 // OBSOLETE unsigned long val;
396 // OBSOLETE unsigned char b;
397 // OBSOLETE
398 // OBSOLETE printf_monitor ("l %s \r", mod_name);
399 // OBSOLETE expect_prompt (1);
400 // OBSOLETE printf_monitor (".r \r");
401 // OBSOLETE expect (REG_DELIM, 1);
402 // OBSOLETE for (i = 0; i <= 7; i++)
403 // OBSOLETE {
404 // OBSOLETE val = 0;
405 // OBSOLETE for (j = 0; j < 4; j++)
406 // OBSOLETE {
407 // OBSOLETE get_hex_byte (&b);
408 // OBSOLETE val = (val << 8) + b;
409 // OBSOLETE }
410 // OBSOLETE }
411 // OBSOLETE expect_prompt (1);
412 // OBSOLETE *text_reloc = val;
413 // OBSOLETE return 1;
414 // OBSOLETE }
415 // OBSOLETE
416 // OBSOLETE /* Terminate the open connection to the remote debugger.
417 // OBSOLETE Use this when you want to detach and do something else
418 // OBSOLETE with your gdb. */
419 // OBSOLETE static void
420 // OBSOLETE rombug_detach (int from_tty)
421 // OBSOLETE {
422 // OBSOLETE if (attach_flag)
423 // OBSOLETE {
424 // OBSOLETE printf_monitor (GO_CMD);
425 // OBSOLETE attach_flag = 0;
426 // OBSOLETE }
427 // OBSOLETE pop_target (); /* calls rombug_close to do the real work */
428 // OBSOLETE if (from_tty)
429 // OBSOLETE printf ("Ending remote %s debugging\n", target_shortname);
430 // OBSOLETE }
431 // OBSOLETE
432 // OBSOLETE /*
433 // OBSOLETE * Tell the remote machine to resume.
434 // OBSOLETE */
435 // OBSOLETE static void
436 // OBSOLETE rombug_resume (ptid_t ptid, int step, enum target_signal sig)
437 // OBSOLETE {
438 // OBSOLETE if (monitor_log)
439 // OBSOLETE fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig);
440 // OBSOLETE
441 // OBSOLETE if (step)
442 // OBSOLETE {
443 // OBSOLETE is_trace_mode = 1;
444 // OBSOLETE printf_monitor (STEP_CMD);
445 // OBSOLETE /* wait for the echo. **
446 // OBSOLETE expect (STEP_CMD, 1);
447 // OBSOLETE */
448 // OBSOLETE }
449 // OBSOLETE else
450 // OBSOLETE {
451 // OBSOLETE printf_monitor (GO_CMD);
452 // OBSOLETE /* swallow the echo. **
453 // OBSOLETE expect (GO_CMD, 1);
454 // OBSOLETE */
455 // OBSOLETE }
456 // OBSOLETE bufaddr = 0;
457 // OBSOLETE buflen = 0;
458 // OBSOLETE }
459 // OBSOLETE
460 // OBSOLETE /*
461 // OBSOLETE * Wait until the remote machine stops, then return,
462 // OBSOLETE * storing status in status just as `wait' would.
463 // OBSOLETE */
464 // OBSOLETE
465 // OBSOLETE static ptid *
466 // OBSOLETE rombug_wait (ptid_t ptid, struct target_waitstatus *status)
467 // OBSOLETE {
468 // OBSOLETE int old_timeout = timeout;
469 // OBSOLETE struct section_offsets *offs;
470 // OBSOLETE CORE_ADDR addr, pc;
471 // OBSOLETE struct obj_section *obj_sec;
472 // OBSOLETE
473 // OBSOLETE if (monitor_log)
474 // OBSOLETE fputs ("\nIn wait ()", log_file);
475 // OBSOLETE
476 // OBSOLETE status->kind = TARGET_WAITKIND_EXITED;
477 // OBSOLETE status->value.integer = 0;
478 // OBSOLETE
479 // OBSOLETE timeout = -1; /* Don't time out -- user program is running. */
480 // OBSOLETE expect ("eax:", 0); /* output any message before register display */
481 // OBSOLETE expect_prompt (1); /* Wait for prompt, outputting extraneous text */
482 // OBSOLETE
483 // OBSOLETE status->kind = TARGET_WAITKIND_STOPPED;
484 // OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP;
485 // OBSOLETE timeout = old_timeout;
486 // OBSOLETE rombug_fetch_registers ();
487 // OBSOLETE bufaddr = 0;
488 // OBSOLETE buflen = 0;
489 // OBSOLETE pc = read_register (PC_REGNUM);
490 // OBSOLETE addr = read_register (DATABASE_REG);
491 // OBSOLETE obj_sec = find_pc_section (pc);
492 // OBSOLETE if (obj_sec != NULL)
493 // OBSOLETE {
494 // OBSOLETE if (obj_sec->objfile != symfile_objfile)
495 // OBSOLETE new_symfile_objfile (obj_sec->objfile, 1, 0);
496 // OBSOLETE offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
497 // OBSOLETE memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
498 // OBSOLETE offs->offsets[SECT_OFF_DATA (symfile_objfile)] = addr;
499 // OBSOLETE offs->offsets[SECT_OFF_BSS (symfile_objfile)] = addr;
500 // OBSOLETE
501 // OBSOLETE objfile_relocate (symfile_objfile, offs);
502 // OBSOLETE }
503 // OBSOLETE
504 // OBSOLETE return inferior_ptid;
505 // OBSOLETE }
506 // OBSOLETE
507 // OBSOLETE /* Return the name of register number regno in the form input and output by
508 // OBSOLETE monitor. Currently, register_names just happens to contain exactly what
509 // OBSOLETE monitor wants. Lets take advantage of that just as long as possible! */
510 // OBSOLETE
511 // OBSOLETE static char *
512 // OBSOLETE get_reg_name (int regno)
513 // OBSOLETE {
514 // OBSOLETE static char buf[50];
515 // OBSOLETE char *p;
516 // OBSOLETE char *b;
517 // OBSOLETE
518 // OBSOLETE b = buf;
519 // OBSOLETE
520 // OBSOLETE if (regno < 0)
521 // OBSOLETE return ("");
522 // OBSOLETE /*
523 // OBSOLETE for (p = REGISTER_NAME (regno); *p; p++)
524 // OBSOLETE *b++ = toupper(*p);
525 // OBSOLETE *b = '\000';
526 // OBSOLETE */
527 // OBSOLETE p = (char *) REGISTER_NAME (regno);
528 // OBSOLETE return p;
529 // OBSOLETE /*
530 // OBSOLETE return buf;
531 // OBSOLETE */
532 // OBSOLETE }
533 // OBSOLETE
534 // OBSOLETE /* read the remote registers into the block regs. */
535 // OBSOLETE
536 // OBSOLETE static void
537 // OBSOLETE rombug_fetch_registers (void)
538 // OBSOLETE {
539 // OBSOLETE int regno, j, i;
540 // OBSOLETE long val;
541 // OBSOLETE unsigned char b;
542 // OBSOLETE
543 // OBSOLETE printf_monitor (GET_REG);
544 // OBSOLETE expect ("eax:", 1);
545 // OBSOLETE expect ("\n", 1);
546 // OBSOLETE get_hex_regs (1, 0);
547 // OBSOLETE get_hex_regs (1, 3);
548 // OBSOLETE get_hex_regs (1, 1);
549 // OBSOLETE get_hex_regs (1, 2);
550 // OBSOLETE get_hex_regs (1, 6);
551 // OBSOLETE get_hex_regs (1, 7);
552 // OBSOLETE get_hex_regs (1, 5);
553 // OBSOLETE get_hex_regs (1, 4);
554 // OBSOLETE for (regno = 8; regno <= 15; regno++)
555 // OBSOLETE {
556 // OBSOLETE expect (REG_DELIM, 1);
557 // OBSOLETE if (regno >= 8 && regno <= 13)
558 // OBSOLETE {
559 // OBSOLETE val = 0;
560 // OBSOLETE for (j = 0; j < 2; j++)
561 // OBSOLETE {
562 // OBSOLETE get_hex_byte (&b);
563 // OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
564 // OBSOLETE val = (val << 8) + b;
565 // OBSOLETE else
566 // OBSOLETE val = val + (b << (j * 8));
567 // OBSOLETE }
568 // OBSOLETE
569 // OBSOLETE if (regno == 8)
570 // OBSOLETE i = 10;
571 // OBSOLETE if (regno >= 9 && regno <= 12)
572 // OBSOLETE i = regno + 3;
573 // OBSOLETE if (regno == 13)
574 // OBSOLETE i = 11;
575 // OBSOLETE supply_register (i, (char *) &val);
576 // OBSOLETE }
577 // OBSOLETE else if (regno == 14)
578 // OBSOLETE {
579 // OBSOLETE get_hex_regs (1, PC_REGNUM);
580 // OBSOLETE }
581 // OBSOLETE else if (regno == 15)
582 // OBSOLETE {
583 // OBSOLETE get_hex_regs (1, 9);
584 // OBSOLETE }
585 // OBSOLETE else
586 // OBSOLETE {
587 // OBSOLETE val = 0;
588 // OBSOLETE supply_register (regno, (char *) &val);
589 // OBSOLETE }
590 // OBSOLETE }
591 // OBSOLETE is_trace_mode = 0;
592 // OBSOLETE expect_prompt (1);
593 // OBSOLETE }
594 // OBSOLETE
595 // OBSOLETE /* Fetch register REGNO, or all registers if REGNO is -1.
596 // OBSOLETE Returns errno value. */
597 // OBSOLETE static void
598 // OBSOLETE rombug_fetch_register (int regno)
599 // OBSOLETE {
600 // OBSOLETE int val, j;
601 // OBSOLETE unsigned char b;
602 // OBSOLETE
603 // OBSOLETE if (monitor_log)
604 // OBSOLETE {
605 // OBSOLETE fprintf (log_file, "\nIn Fetch Register (reg=%s)\n", get_reg_name (regno));
606 // OBSOLETE fflush (log_file);
607 // OBSOLETE }
608 // OBSOLETE
609 // OBSOLETE if (regno < 0)
610 // OBSOLETE {
611 // OBSOLETE rombug_fetch_registers ();
612 // OBSOLETE }
613 // OBSOLETE else
614 // OBSOLETE {
615 // OBSOLETE char *name = get_reg_name (regno);
616 // OBSOLETE printf_monitor (GET_REG);
617 // OBSOLETE if (regno >= 10 && regno <= 15)
618 // OBSOLETE {
619 // OBSOLETE expect ("\n", 1);
620 // OBSOLETE expect ("\n", 1);
621 // OBSOLETE expect (name, 1);
622 // OBSOLETE expect (REG_DELIM, 1);
623 // OBSOLETE val = 0;
624 // OBSOLETE for (j = 0; j < 2; j++)
625 // OBSOLETE {
626 // OBSOLETE get_hex_byte (&b);
627 // OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
628 // OBSOLETE val = (val << 8) + b;
629 // OBSOLETE else
630 // OBSOLETE val = val + (b << (j * 8));
631 // OBSOLETE }
632 // OBSOLETE supply_register (regno, (char *) &val);
633 // OBSOLETE }
634 // OBSOLETE else if (regno == 8 || regno == 9)
635 // OBSOLETE {
636 // OBSOLETE expect ("\n", 1);
637 // OBSOLETE expect ("\n", 1);
638 // OBSOLETE expect ("\n", 1);
639 // OBSOLETE expect (name, 1);
640 // OBSOLETE expect (REG_DELIM, 1);
641 // OBSOLETE get_hex_regs (1, regno);
642 // OBSOLETE }
643 // OBSOLETE else
644 // OBSOLETE {
645 // OBSOLETE expect (name, 1);
646 // OBSOLETE expect (REG_DELIM, 1);
647 // OBSOLETE expect ("\n", 1);
648 // OBSOLETE get_hex_regs (1, 0);
649 // OBSOLETE get_hex_regs (1, 3);
650 // OBSOLETE get_hex_regs (1, 1);
651 // OBSOLETE get_hex_regs (1, 2);
652 // OBSOLETE get_hex_regs (1, 6);
653 // OBSOLETE get_hex_regs (1, 7);
654 // OBSOLETE get_hex_regs (1, 5);
655 // OBSOLETE get_hex_regs (1, 4);
656 // OBSOLETE }
657 // OBSOLETE expect_prompt (1);
658 // OBSOLETE }
659 // OBSOLETE return;
660 // OBSOLETE }
661 // OBSOLETE
662 // OBSOLETE /* Store the remote registers from the contents of the block REGS. */
663 // OBSOLETE
664 // OBSOLETE static void
665 // OBSOLETE rombug_store_registers (void)
666 // OBSOLETE {
667 // OBSOLETE int regno;
668 // OBSOLETE
669 // OBSOLETE for (regno = 0; regno <= PC_REGNUM; regno++)
670 // OBSOLETE rombug_store_register (regno);
671 // OBSOLETE
672 // OBSOLETE registers_changed ();
673 // OBSOLETE }
674 // OBSOLETE
675 // OBSOLETE /* Store register REGNO, or all if REGNO == 0.
676 // OBSOLETE return errno value. */
677 // OBSOLETE static void
678 // OBSOLETE rombug_store_register (int regno)
679 // OBSOLETE {
680 // OBSOLETE char *name;
681 // OBSOLETE
682 // OBSOLETE if (monitor_log)
683 // OBSOLETE fprintf (log_file, "\nIn Store_register (regno=%d)\n", regno);
684 // OBSOLETE
685 // OBSOLETE if (regno == -1)
686 // OBSOLETE rombug_store_registers ();
687 // OBSOLETE else
688 // OBSOLETE {
689 // OBSOLETE if (sr_get_debug ())
690 // OBSOLETE printf ("Setting register %s to 0x%x\n", get_reg_name (regno), read_register (regno));
691 // OBSOLETE
692 // OBSOLETE name = get_reg_name (regno);
693 // OBSOLETE if (name == 0)
694 // OBSOLETE return;
695 // OBSOLETE printf_monitor (SET_REG, name, read_register (regno));
696 // OBSOLETE
697 // OBSOLETE is_trace_mode = 0;
698 // OBSOLETE expect_prompt (1);
699 // OBSOLETE }
700 // OBSOLETE }
701 // OBSOLETE
702 // OBSOLETE /* Get ready to modify the registers array. On machines which store
703 // OBSOLETE individual registers, this doesn't need to do anything. On machines
704 // OBSOLETE which store all the registers in one fell swoop, this makes sure
705 // OBSOLETE that registers contains all the registers from the program being
706 // OBSOLETE debugged. */
707 // OBSOLETE
708 // OBSOLETE static void
709 // OBSOLETE rombug_prepare_to_store (void)
710 // OBSOLETE {
711 // OBSOLETE /* Do nothing, since we can store individual regs */
712 // OBSOLETE }
713 // OBSOLETE
714 // OBSOLETE static void
715 // OBSOLETE rombug_files_info (void)
716 // OBSOLETE {
717 // OBSOLETE printf ("\tAttached to %s at %d baud.\n",
718 // OBSOLETE dev_name, sr_get_baud_rate ());
719 // OBSOLETE }
720 // OBSOLETE
721 // OBSOLETE /* Copy LEN bytes of data from debugger memory at MYADDR
722 // OBSOLETE to inferior's memory at MEMADDR. Returns length moved. */
723 // OBSOLETE static int
724 // OBSOLETE rombug_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
725 // OBSOLETE {
726 // OBSOLETE int i;
727 // OBSOLETE char buf[10];
728 // OBSOLETE
729 // OBSOLETE if (monitor_log)
730 // OBSOLETE fprintf (log_file, "\nIn Write_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len);
731 // OBSOLETE
732 // OBSOLETE printf_monitor (MEM_SET_CMD, memaddr);
733 // OBSOLETE for (i = 0; i < len; i++)
734 // OBSOLETE {
735 // OBSOLETE expect (CMD_DELIM, 1);
736 // OBSOLETE printf_monitor ("%x \r", myaddr[i]);
737 // OBSOLETE if (sr_get_debug ())
738 // OBSOLETE printf ("\nSet 0x%x to 0x%x\n", memaddr + i, myaddr[i]);
739 // OBSOLETE }
740 // OBSOLETE expect (CMD_DELIM, 1);
741 // OBSOLETE if (CMD_END)
742 // OBSOLETE printf_monitor (CMD_END);
743 // OBSOLETE is_trace_mode = 0;
744 // OBSOLETE expect_prompt (1);
745 // OBSOLETE
746 // OBSOLETE bufaddr = 0;
747 // OBSOLETE buflen = 0;
748 // OBSOLETE return len;
749 // OBSOLETE }
750 // OBSOLETE
751 // OBSOLETE /* Read LEN bytes from inferior memory at MEMADDR. Put the result
752 // OBSOLETE at debugger address MYADDR. Returns length moved. */
753 // OBSOLETE static int
754 // OBSOLETE rombug_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
755 // OBSOLETE {
756 // OBSOLETE int i, j;
757 // OBSOLETE
758 // OBSOLETE /* Number of bytes read so far. */
759 // OBSOLETE int count;
760 // OBSOLETE
761 // OBSOLETE /* Starting address of this pass. */
762 // OBSOLETE unsigned long startaddr;
763 // OBSOLETE
764 // OBSOLETE /* Number of bytes to read in this pass. */
765 // OBSOLETE int len_this_pass;
766 // OBSOLETE
767 // OBSOLETE if (monitor_log)
768 // OBSOLETE fprintf (log_file, "\nIn Read_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len);
769 // OBSOLETE
770 // OBSOLETE /* Note that this code works correctly if startaddr is just less
771 // OBSOLETE than UINT_MAX (well, really CORE_ADDR_MAX if there was such a
772 // OBSOLETE thing). That is, something like
773 // OBSOLETE rombug_read_bytes (CORE_ADDR_MAX - 4, foo, 4)
774 // OBSOLETE works--it never adds len To memaddr and gets 0. */
775 // OBSOLETE /* However, something like
776 // OBSOLETE rombug_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
777 // OBSOLETE doesn't need to work. Detect it and give up if there's an attempt
778 // OBSOLETE to do that. */
779 // OBSOLETE if (((memaddr - 1) + len) < memaddr)
780 // OBSOLETE {
781 // OBSOLETE errno = EIO;
782 // OBSOLETE return 0;
783 // OBSOLETE }
784 // OBSOLETE if (bufaddr <= memaddr && (memaddr + len) <= (bufaddr + buflen))
785 // OBSOLETE {
786 // OBSOLETE memcpy (myaddr, &readbuf[memaddr - bufaddr], len);
787 // OBSOLETE return len;
788 // OBSOLETE }
789 // OBSOLETE
790 // OBSOLETE startaddr = memaddr;
791 // OBSOLETE count = 0;
792 // OBSOLETE while (count < len)
793 // OBSOLETE {
794 // OBSOLETE len_this_pass = 16;
795 // OBSOLETE if ((startaddr % 16) != 0)
796 // OBSOLETE len_this_pass -= startaddr % 16;
797 // OBSOLETE if (len_this_pass > (len - count))
798 // OBSOLETE len_this_pass = (len - count);
799 // OBSOLETE if (sr_get_debug ())
800 // OBSOLETE printf ("\nDisplay %d bytes at %x\n", len_this_pass, startaddr);
801 // OBSOLETE
802 // OBSOLETE printf_monitor (MEM_DIS_CMD, startaddr, 8);
803 // OBSOLETE expect ("- ", 1);
804 // OBSOLETE for (i = 0; i < 16; i++)
805 // OBSOLETE {
806 // OBSOLETE get_hex_byte (&readbuf[i]);
807 // OBSOLETE }
808 // OBSOLETE bufaddr = startaddr;
809 // OBSOLETE buflen = 16;
810 // OBSOLETE memcpy (&myaddr[count], readbuf, len_this_pass);
811 // OBSOLETE count += len_this_pass;
812 // OBSOLETE startaddr += len_this_pass;
813 // OBSOLETE expect (CMD_DELIM, 1);
814 // OBSOLETE }
815 // OBSOLETE if (CMD_END)
816 // OBSOLETE printf_monitor (CMD_END);
817 // OBSOLETE is_trace_mode = 0;
818 // OBSOLETE expect_prompt (1);
819 // OBSOLETE
820 // OBSOLETE return len;
821 // OBSOLETE }
822 // OBSOLETE
823 // OBSOLETE /* Transfer LEN bytes between GDB address MYADDR and target address
824 // OBSOLETE MEMADDR. If WRITE is non-zero, transfer them to the target,
825 // OBSOLETE otherwise transfer them from the target. TARGET is unused.
826 // OBSOLETE
827 // OBSOLETE Returns the number of bytes transferred. */
828 // OBSOLETE
829 // OBSOLETE static int
830 // OBSOLETE rombug_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
831 // OBSOLETE int write, struct mem_attrib *attrib,
832 // OBSOLETE struct target_ops *target)
833 // OBSOLETE {
834 // OBSOLETE if (write)
835 // OBSOLETE return rombug_write_inferior_memory (memaddr, myaddr, len);
836 // OBSOLETE else
837 // OBSOLETE return rombug_read_inferior_memory (memaddr, myaddr, len);
838 // OBSOLETE }
839 // OBSOLETE
840 // OBSOLETE static void
841 // OBSOLETE rombug_kill (char *args, int from_tty)
842 // OBSOLETE {
843 // OBSOLETE return; /* ignore attempts to kill target system */
844 // OBSOLETE }
845 // OBSOLETE
846 // OBSOLETE /* Clean up when a program exits.
847 // OBSOLETE The program actually lives on in the remote processor's RAM, and may be
848 // OBSOLETE run again without a download. Don't leave it full of breakpoint
849 // OBSOLETE instructions. */
850 // OBSOLETE
851 // OBSOLETE static void
852 // OBSOLETE rombug_mourn_inferior (void)
853 // OBSOLETE {
854 // OBSOLETE remove_breakpoints ();
855 // OBSOLETE generic_mourn_inferior (); /* Do all the proper things now */
856 // OBSOLETE }
857 // OBSOLETE
858 // OBSOLETE #define MAX_MONITOR_BREAKPOINTS 16
859 // OBSOLETE
860 // OBSOLETE static CORE_ADDR breakaddr[MAX_MONITOR_BREAKPOINTS] =
861 // OBSOLETE {0};
862 // OBSOLETE
863 // OBSOLETE static int
864 // OBSOLETE rombug_insert_breakpoint (CORE_ADDR addr, char *shadow)
865 // OBSOLETE {
866 // OBSOLETE int i;
867 // OBSOLETE CORE_ADDR bp_addr = addr;
868 // OBSOLETE int bp_size = 0;
869 // OBSOLETE
870 // OBSOLETE if (monitor_log)
871 // OBSOLETE fprintf (log_file, "\nIn Insert_breakpoint (addr=%x)\n", addr);
872 // OBSOLETE BREAKPOINT_FROM_PC (&bp_addr, &bp_size);
873 // OBSOLETE
874 // OBSOLETE for (i = 0; i <= MAX_MONITOR_BREAKPOINTS; i++)
875 // OBSOLETE if (breakaddr[i] == 0)
876 // OBSOLETE {
877 // OBSOLETE breakaddr[i] = addr;
878 // OBSOLETE if (sr_get_debug ())
879 // OBSOLETE printf ("Breakpoint at %x\n", addr);
880 // OBSOLETE rombug_read_inferior_memory (bp_addr, shadow, bp_size);
881 // OBSOLETE printf_monitor (SET_BREAK_CMD, addr);
882 // OBSOLETE is_trace_mode = 0;
883 // OBSOLETE expect_prompt (1);
884 // OBSOLETE return 0;
885 // OBSOLETE }
886 // OBSOLETE
887 // OBSOLETE fprintf_unfiltered (gdb_stderr, "Too many breakpoints (> 16) for monitor\n");
888 // OBSOLETE return 1;
889 // OBSOLETE }
890 // OBSOLETE
891 // OBSOLETE /*
892 // OBSOLETE * _remove_breakpoint -- Tell the monitor to remove a breakpoint
893 // OBSOLETE */
894 // OBSOLETE static int
895 // OBSOLETE rombug_remove_breakpoint (CORE_ADDR addr, char *shadow)
896 // OBSOLETE {
897 // OBSOLETE int i;
898 // OBSOLETE
899 // OBSOLETE if (monitor_log)
900 // OBSOLETE fprintf (log_file, "\nIn Remove_breakpoint (addr=%x)\n", addr);
901 // OBSOLETE
902 // OBSOLETE for (i = 0; i < MAX_MONITOR_BREAKPOINTS; i++)
903 // OBSOLETE if (breakaddr[i] == addr)
904 // OBSOLETE {
905 // OBSOLETE breakaddr[i] = 0;
906 // OBSOLETE printf_monitor (CLR_BREAK_CMD, addr);
907 // OBSOLETE is_trace_mode = 0;
908 // OBSOLETE expect_prompt (1);
909 // OBSOLETE return 0;
910 // OBSOLETE }
911 // OBSOLETE
912 // OBSOLETE fprintf_unfiltered (gdb_stderr,
913 // OBSOLETE "Can't find breakpoint associated with 0x%x\n", addr);
914 // OBSOLETE return 1;
915 // OBSOLETE }
916 // OBSOLETE
917 // OBSOLETE /* Load a file. This is usually an srecord, which is ascii. No
918 // OBSOLETE protocol, just sent line by line. */
919 // OBSOLETE
920 // OBSOLETE #define DOWNLOAD_LINE_SIZE 100
921 // OBSOLETE static void
922 // OBSOLETE rombug_load (char *arg)
923 // OBSOLETE {
924 // OBSOLETE /* this part comment out for os9* */
925 // OBSOLETE #if 0
926 // OBSOLETE FILE *download;
927 // OBSOLETE char buf[DOWNLOAD_LINE_SIZE];
928 // OBSOLETE int i, bytes_read;
929 // OBSOLETE
930 // OBSOLETE if (sr_get_debug ())
931 // OBSOLETE printf ("Loading %s to monitor\n", arg);
932 // OBSOLETE
933 // OBSOLETE download = fopen (arg, "r");
934 // OBSOLETE if (download == NULL)
935 // OBSOLETE {
936 // OBSOLETE error (sprintf (buf, "%s Does not exist", arg));
937 // OBSOLETE return;
938 // OBSOLETE }
939 // OBSOLETE
940 // OBSOLETE printf_monitor (LOAD_CMD);
941 // OBSOLETE /* expect ("Waiting for S-records from host... ", 1); */
942 // OBSOLETE
943 // OBSOLETE while (!feof (download))
944 // OBSOLETE {
945 // OBSOLETE bytes_read = fread (buf, sizeof (char), DOWNLOAD_LINE_SIZE, download);
946 // OBSOLETE if (hashmark)
947 // OBSOLETE {
948 // OBSOLETE putchar ('.');
949 // OBSOLETE fflush (stdout);
950 // OBSOLETE }
951 // OBSOLETE
952 // OBSOLETE if (serial_write (monitor_desc, buf, bytes_read))
953 // OBSOLETE {
954 // OBSOLETE fprintf_unfiltered (gdb_stderr,
955 // OBSOLETE "serial_write failed: (while downloading) %s\n",
956 // OBSOLETE safe_strerror (errno));
957 // OBSOLETE break;
958 // OBSOLETE }
959 // OBSOLETE i = 0;
960 // OBSOLETE while (i++ <= 200000)
961 // OBSOLETE {
962 // OBSOLETE }; /* Ugly HACK, probably needs flow control */
963 // OBSOLETE if (bytes_read < DOWNLOAD_LINE_SIZE)
964 // OBSOLETE {
965 // OBSOLETE if (!feof (download))
966 // OBSOLETE error ("Only read %d bytes\n", bytes_read);
967 // OBSOLETE break;
968 // OBSOLETE }
969 // OBSOLETE }
970 // OBSOLETE
971 // OBSOLETE if (hashmark)
972 // OBSOLETE {
973 // OBSOLETE putchar ('\n');
974 // OBSOLETE }
975 // OBSOLETE if (!feof (download))
976 // OBSOLETE error ("Never got EOF while downloading");
977 // OBSOLETE fclose (download);
978 // OBSOLETE #endif /* 0 */
979 // OBSOLETE }
980 // OBSOLETE
981 // OBSOLETE /* Put a command string, in args, out to MONITOR.
982 // OBSOLETE Output from MONITOR is placed on the users terminal until the prompt
983 // OBSOLETE is seen. */
984 // OBSOLETE
985 // OBSOLETE static void
986 // OBSOLETE rombug_command (char *args, int fromtty)
987 // OBSOLETE {
988 // OBSOLETE if (monitor_desc == NULL)
989 // OBSOLETE error ("monitor target not open.");
990 // OBSOLETE
991 // OBSOLETE if (monitor_log)
992 // OBSOLETE fprintf (log_file, "\nIn command (args=%s)\n", args);
993 // OBSOLETE
994 // OBSOLETE if (!args)
995 // OBSOLETE error ("Missing command.");
996 // OBSOLETE
997 // OBSOLETE printf_monitor ("%s\r", args);
998 // OBSOLETE expect_prompt (0);
999 // OBSOLETE }
1000 // OBSOLETE
1001 // OBSOLETE #if 0
1002 // OBSOLETE /* Connect the user directly to MONITOR. This command acts just like the
1003 // OBSOLETE 'cu' or 'tip' command. Use <CR>~. or <CR>~^D to break out. */
1004 // OBSOLETE
1005 // OBSOLETE static struct ttystate ttystate;
1006 // OBSOLETE
1007 // OBSOLETE static void
1008 // OBSOLETE cleanup_tty (void)
1009 // OBSOLETE {
1010 // OBSOLETE printf ("\r\n[Exiting connect mode]\r\n");
1011 // OBSOLETE /*serial_restore(0, &ttystate); */
1012 // OBSOLETE }
1013 // OBSOLETE
1014 // OBSOLETE static void
1015 // OBSOLETE connect_command (char *args, int fromtty)
1016 // OBSOLETE {
1017 // OBSOLETE fd_set readfds;
1018 // OBSOLETE int numfds;
1019 // OBSOLETE int c;
1020 // OBSOLETE char cur_esc = 0;
1021 // OBSOLETE
1022 // OBSOLETE dont_repeat ();
1023 // OBSOLETE
1024 // OBSOLETE if (monitor_desc == NULL)
1025 // OBSOLETE error ("monitor target not open.");
1026 // OBSOLETE
1027 // OBSOLETE if (args)
1028 // OBSOLETE fprintf ("This command takes no args. They have been ignored.\n");
1029 // OBSOLETE
1030 // OBSOLETE printf ("[Entering connect mode. Use ~. or ~^D to escape]\n");
1031 // OBSOLETE
1032 // OBSOLETE serial_raw (0, &ttystate);
1033 // OBSOLETE
1034 // OBSOLETE make_cleanup (cleanup_tty, 0);
1035 // OBSOLETE
1036 // OBSOLETE FD_ZERO (&readfds);
1037 // OBSOLETE
1038 // OBSOLETE while (1)
1039 // OBSOLETE {
1040 // OBSOLETE do
1041 // OBSOLETE {
1042 // OBSOLETE FD_SET (0, &readfds);
1043 // OBSOLETE FD_SET (deprecated_serial_fd (monitor_desc), &readfds);
1044 // OBSOLETE numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
1045 // OBSOLETE }
1046 // OBSOLETE while (numfds == 0);
1047 // OBSOLETE
1048 // OBSOLETE if (numfds < 0)
1049 // OBSOLETE perror_with_name ("select");
1050 // OBSOLETE
1051 // OBSOLETE if (FD_ISSET (0, &readfds))
1052 // OBSOLETE { /* tty input, send to monitor */
1053 // OBSOLETE c = getchar ();
1054 // OBSOLETE if (c < 0)
1055 // OBSOLETE perror_with_name ("connect");
1056 // OBSOLETE
1057 // OBSOLETE printf_monitor ("%c", c);
1058 // OBSOLETE switch (cur_esc)
1059 // OBSOLETE {
1060 // OBSOLETE case 0:
1061 // OBSOLETE if (c == '\r')
1062 // OBSOLETE cur_esc = c;
1063 // OBSOLETE break;
1064 // OBSOLETE case '\r':
1065 // OBSOLETE if (c == '~')
1066 // OBSOLETE cur_esc = c;
1067 // OBSOLETE else
1068 // OBSOLETE cur_esc = 0;
1069 // OBSOLETE break;
1070 // OBSOLETE case '~':
1071 // OBSOLETE if (c == '.' || c == '\004')
1072 // OBSOLETE return;
1073 // OBSOLETE else
1074 // OBSOLETE cur_esc = 0;
1075 // OBSOLETE }
1076 // OBSOLETE }
1077 // OBSOLETE
1078 // OBSOLETE if (FD_ISSET (deprecated_serial_fd (monitor_desc), &readfds))
1079 // OBSOLETE {
1080 // OBSOLETE while (1)
1081 // OBSOLETE {
1082 // OBSOLETE c = readchar (0);
1083 // OBSOLETE if (c < 0)
1084 // OBSOLETE break;
1085 // OBSOLETE putchar (c);
1086 // OBSOLETE }
1087 // OBSOLETE fflush (stdout);
1088 // OBSOLETE }
1089 // OBSOLETE }
1090 // OBSOLETE }
1091 // OBSOLETE #endif
1092 // OBSOLETE
1093 // OBSOLETE /*
1094 // OBSOLETE * Define the monitor command strings. Since these are passed directly
1095 // OBSOLETE * through to a printf style function, we need can include formatting
1096 // OBSOLETE * strings. We also need a CR or LF on the end.
1097 // OBSOLETE */
1098 // OBSOLETE #warning FIXME: monitor interface pattern strings, stale struct decl
1099 // OBSOLETE struct monitor_ops rombug_cmds =
1100 // OBSOLETE {
1101 // OBSOLETE "g \r", /* execute or usually GO command */
1102 // OBSOLETE "g \r", /* continue command */
1103 // OBSOLETE "t \r", /* single step */
1104 // OBSOLETE "b %x\r", /* set a breakpoint */
1105 // OBSOLETE "k %x\r", /* clear a breakpoint */
1106 // OBSOLETE "c %x\r", /* set memory to a value */
1107 // OBSOLETE "d %x %d\r", /* display memory */
1108 // OBSOLETE "$%08X", /* prompt memory commands use */
1109 // OBSOLETE ".%s %x\r", /* set a register */
1110 // OBSOLETE ":", /* delimiter between registers */
1111 // OBSOLETE ". \r", /* read a register */
1112 // OBSOLETE "mf \r", /* download command */
1113 // OBSOLETE "RomBug: ", /* monitor command prompt */
1114 // OBSOLETE ": ", /* end-of-command delimitor */
1115 // OBSOLETE ".\r" /* optional command terminator */
1116 // OBSOLETE };
1117 // OBSOLETE
1118 // OBSOLETE struct target_ops rombug_ops;
1119 // OBSOLETE
1120 // OBSOLETE static void
1121 // OBSOLETE init_rombug_ops (void)
1122 // OBSOLETE {
1123 // OBSOLETE rombug_ops.to_shortname = "rombug";
1124 // OBSOLETE rombug_ops.to_longname = "Microware's ROMBUG debug monitor";
1125 // OBSOLETE rombug_ops.to_doc = "Use a remote computer running the ROMBUG debug monitor.\n\
1126 // OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).",
1127 // OBSOLETE rombug_ops.to_open = rombug_open;
1128 // OBSOLETE rombug_ops.to_close = rombug_close;
1129 // OBSOLETE rombug_ops.to_attach = 0;
1130 // OBSOLETE rombug_ops.to_post_attach = NULL;
1131 // OBSOLETE rombug_ops.to_require_attach = NULL;
1132 // OBSOLETE rombug_ops.to_detach = rombug_detach;
1133 // OBSOLETE rombug_ops.to_require_detach = NULL;
1134 // OBSOLETE rombug_ops.to_resume = rombug_resume;
1135 // OBSOLETE rombug_ops.to_wait = rombug_wait;
1136 // OBSOLETE rombug_ops.to_post_wait = NULL;
1137 // OBSOLETE rombug_ops.to_fetch_registers = rombug_fetch_register;
1138 // OBSOLETE rombug_ops.to_store_registers = rombug_store_register;
1139 // OBSOLETE rombug_ops.to_prepare_to_store = rombug_prepare_to_store;
1140 // OBSOLETE rombug_ops.to_xfer_memory = rombug_xfer_inferior_memory;
1141 // OBSOLETE rombug_ops.to_files_info = rombug_files_info;
1142 // OBSOLETE rombug_ops.to_insert_breakpoint = rombug_insert_breakpoint;
1143 // OBSOLETE rombug_ops.to_remove_breakpoint = rombug_remove_breakpoint; /* Breakpoints */
1144 // OBSOLETE rombug_ops.to_terminal_init = 0;
1145 // OBSOLETE rombug_ops.to_terminal_inferior = 0;
1146 // OBSOLETE rombug_ops.to_terminal_ours_for_output = 0;
1147 // OBSOLETE rombug_ops.to_terminal_ours = 0;
1148 // OBSOLETE rombug_ops.to_terminal_info = 0; /* Terminal handling */
1149 // OBSOLETE rombug_ops.to_kill = rombug_kill;
1150 // OBSOLETE rombug_ops.to_load = rombug_load; /* load */
1151 // OBSOLETE rombug_ops.to_lookup_symbol = rombug_link; /* lookup_symbol */
1152 // OBSOLETE rombug_ops.to_create_inferior = rombug_create_inferior;
1153 // OBSOLETE rombug_ops.to_post_startup_inferior = NULL;
1154 // OBSOLETE rombug_ops.to_acknowledge_created_inferior = NULL;
1155 // OBSOLETE rombug_ops.to_clone_and_follow_inferior = NULL;
1156 // OBSOLETE rombug_ops.to_post_follow_inferior_by_clone = NULL;
1157 // OBSOLETE rombug_ops.to_insert_fork_catchpoint = NULL;
1158 // OBSOLETE rombug_ops.to_remove_fork_catchpoint = NULL;
1159 // OBSOLETE rombug_ops.to_insert_vfork_catchpoint = NULL;
1160 // OBSOLETE rombug_ops.to_remove_vfork_catchpoint = NULL;
1161 // OBSOLETE rombug_ops.to_has_forked = NULL;
1162 // OBSOLETE rombug_ops.to_has_vforked = NULL;
1163 // OBSOLETE rombug_ops.to_can_follow_vfork_prior_to_exec = NULL;
1164 // OBSOLETE rombug_ops.to_post_follow_vfork = NULL;
1165 // OBSOLETE rombug_ops.to_insert_exec_catchpoint = NULL;
1166 // OBSOLETE rombug_ops.to_remove_exec_catchpoint = NULL;
1167 // OBSOLETE rombug_ops.to_has_execd = NULL;
1168 // OBSOLETE rombug_ops.to_reported_exec_events_per_exec_call = NULL;
1169 // OBSOLETE rombug_ops.to_has_exited = NULL;
1170 // OBSOLETE rombug_ops.to_mourn_inferior = rombug_mourn_inferior;
1171 // OBSOLETE rombug_ops.to_can_run = 0; /* can_run */
1172 // OBSOLETE rombug_ops.to_notice_signals = 0; /* notice_signals */
1173 // OBSOLETE rombug_ops.to_thread_alive = 0;
1174 // OBSOLETE rombug_ops.to_stop = 0; /* to_stop */
1175 // OBSOLETE rombug_ops.to_pid_to_exec_file = NULL;
1176 // OBSOLETE rombug_ops.to_stratum = process_stratum;
1177 // OBSOLETE rombug_ops.DONT_USE = 0; /* next */
1178 // OBSOLETE rombug_ops.to_has_all_memory = 1;
1179 // OBSOLETE rombug_ops.to_has_memory = 1;
1180 // OBSOLETE rombug_ops.to_has_stack = 1;
1181 // OBSOLETE rombug_ops.to_has_registers = 1;
1182 // OBSOLETE rombug_ops.to_has_execution = 1; /* has execution */
1183 // OBSOLETE rombug_ops.to_sections = 0;
1184 // OBSOLETE rombug_ops.to_sections_end = 0; /* Section pointers */
1185 // OBSOLETE rombug_ops.to_magic = OPS_MAGIC; /* Always the last thing */
1186 // OBSOLETE }
1187 // OBSOLETE
1188 // OBSOLETE void
1189 // OBSOLETE _initialize_remote_os9k (void)
1190 // OBSOLETE {
1191 // OBSOLETE init_rombug_ops ();
1192 // OBSOLETE add_target (&rombug_ops);
1193 // OBSOLETE
1194 // OBSOLETE add_show_from_set (
1195 // OBSOLETE add_set_cmd ("hash", no_class, var_boolean, (char *) &hashmark,
1196 // OBSOLETE "Set display of activity while downloading a file.\nWhen enabled, a period \'.\' is displayed.",
1197 // OBSOLETE &setlist),
1198 // OBSOLETE &showlist);
1199 // OBSOLETE
1200 // OBSOLETE add_show_from_set (
1201 // OBSOLETE add_set_cmd ("timeout", no_class, var_zinteger,
1202 // OBSOLETE (char *) &timeout,
1203 // OBSOLETE "Set timeout in seconds for remote MIPS serial I/O.",
1204 // OBSOLETE &setlist),
1205 // OBSOLETE &showlist);
1206 // OBSOLETE
1207 // OBSOLETE add_show_from_set (
1208 // OBSOLETE add_set_cmd ("remotelog", no_class, var_zinteger,
1209 // OBSOLETE (char *) &monitor_log,
1210 // OBSOLETE "Set monitor activity log on(=1) or off(=0).",
1211 // OBSOLETE &setlist),
1212 // OBSOLETE &showlist);
1213 // OBSOLETE
1214 // OBSOLETE add_show_from_set (
1215 // OBSOLETE add_set_cmd ("remotexon", no_class, var_zinteger,
1216 // OBSOLETE (char *) &tty_xon,
1217 // OBSOLETE "Set remote tty line XON control",
1218 // OBSOLETE &setlist),
1219 // OBSOLETE &showlist);
1220 // OBSOLETE
1221 // OBSOLETE add_show_from_set (
1222 // OBSOLETE add_set_cmd ("remotexoff", no_class, var_zinteger,
1223 // OBSOLETE (char *) &tty_xoff,
1224 // OBSOLETE "Set remote tty line XOFF control",
1225 // OBSOLETE &setlist),
1226 // OBSOLETE &showlist);
1227 // OBSOLETE
1228 // OBSOLETE add_com ("rombug <command>", class_obscure, rombug_command,
1229 // OBSOLETE "Send a command to the debug monitor.");
1230 // OBSOLETE #if 0
1231 // OBSOLETE add_com ("connect", class_obscure, connect_command,
1232 // OBSOLETE "Connect the terminal directly up to a serial based command monitor.\nUse <CR>~. or <CR>~^D to break out.");
1233 // OBSOLETE #endif
1234 // OBSOLETE }
This page took 0.056227 seconds and 4 git commands to generate.