Obsolete harris 88k target.
[deliverable/binutils-gdb.git] / gdb / remote-adapt.c
1 /* Remote debugging interface for AMD 290*0 Adapt Monitor Version 2.1d18.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
3 2001 Free Software Foundation, Inc.
4 Contributed by David Wood at New York University (wood@lab.ultra.nyu.edu).
5 Adapted from work done at Cygnus Support in remote-eb.c.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
23
24 /* This is like remote.c but is for an esoteric situation--
25 having a 29k board attached to an Adapt inline monitor.
26 The monitor is connected via serial line to a unix machine
27 running gdb.
28
29 3/91 - developed on Sun3 OS 4.1, by David Wood
30 o - I can't get binary coff to load.
31 o - I can't get 19200 baud rate to work.
32 7/91 o - Freeze mode tracing can be done on a 29050. */
33
34
35
36 #include "defs.h"
37 #include "gdb_string.h"
38 #include "inferior.h"
39 #include "value.h"
40 #include <ctype.h>
41 #include <fcntl.h>
42 #include <signal.h>
43 #include <errno.h>
44 #include "terminal.h"
45 #include "target.h"
46 #include "gdbcore.h"
47 #include "regcache.h"
48
49 /* This processor is getting rusty but I am trying to keep it
50 up to date at least with data structure changes.
51 Activate this block to compile just this file.
52 */
53 #define COMPILE_CHECK 0
54 #if COMPILE_CHECK
55 #define Q_REGNUM 0
56 #define VAB_REGNUM 0
57 #define CPS_REGNUM 0
58 #define IPA_REGNUM 0
59 #define IPB_REGNUM 0
60 #define GR1_REGNUM 0
61 #define LR0_REGNUM 0
62 #define IPC_REGNUM 0
63 #define CR_REGNUM 0
64 #define BP_REGNUM 0
65 #define FC_REGNUM 0
66 #define INTE_REGNUM 0
67 #define EXO_REGNUM 0
68 #define GR96_REGNUM 0
69 #define NPC_REGNUM
70 #define FPE_REGNUM 0
71 #define PC2_REGNUM 0
72 #define FPS_REGNUM 0
73 #define ALU_REGNUM 0
74 #define LRU_REGNUM 0
75 #define TERMINAL int
76 #define RAW 1
77 #define ANYP 1
78 extern int a29k_freeze_mode;
79 extern int processor_type;
80 extern char *processor_name;
81 #endif
82
83 /* External data declarations */
84 extern int stop_soon_quietly; /* for wait_for_inferior */
85
86 /* Forward data declarations */
87 extern struct target_ops adapt_ops; /* Forward declaration */
88
89 /* Forward function declarations */
90 static void adapt_fetch_registers ();
91 static void adapt_store_registers ();
92 static void adapt_close ();
93 static int adapt_clear_breakpoints ();
94
95 #define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400)
96 #define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE)
97
98 /* Can't seem to get binary coff working */
99 #define ASCII_COFF /* Adapt will be downloaded with ascii coff */
100
101 /* FIXME: Replace with `set remotedebug'. */
102 #define LOG_FILE "adapt.log"
103 #if defined (LOG_FILE)
104 FILE *log_file = NULL;
105 #endif
106
107 static int timeout = 5;
108 static char *dev_name;
109
110 /* Descriptor for I/O to remote machine. Initialize it to -1 so that
111 adapt_open knows that we don't have a file open when the program
112 starts. */
113 int adapt_desc = -1;
114
115 /* stream which is fdopen'd from adapt_desc. Only valid when
116 adapt_desc != -1. */
117 FILE *adapt_stream;
118
119 #define ON 1
120 #define OFF 0
121 static void
122 rawmode (int desc, int turnon)
123 {
124
125 TERMINAL sg;
126
127 if (desc < 0)
128 return;
129
130 ioctl (desc, TIOCGETP, &sg);
131
132 if (turnon)
133 {
134 #ifdef HAVE_TERMIO
135 sg.c_lflag &= ~(ICANON);
136 #else
137 sg.sg_flags |= RAW;
138 #endif
139 }
140 else
141 {
142 #ifdef HAVE_TERMIO
143 sg.c_lflag |= ICANON;
144 #else
145 sg.sg_flags &= ~(RAW);
146 #endif
147 }
148 ioctl (desc, TIOCSETP, &sg);
149 }
150
151 /* Suck up all the input from the adapt */
152 slurp_input (void)
153 {
154 char buf[8];
155
156 #ifdef HAVE_TERMIO
157 /* termio does the timeout for us. */
158 while (read (adapt_desc, buf, 8) > 0);
159 #else
160 alarm (timeout);
161 while (read (adapt_desc, buf, 8) > 0);
162 alarm (0);
163 #endif
164 }
165
166 /* Read a character from the remote system, doing all the fancy
167 timeout stuff. */
168 static int
169 readchar (void)
170 {
171 char buf;
172
173 buf = '\0';
174 #ifdef HAVE_TERMIO
175 /* termio does the timeout for us. */
176 read (adapt_desc, &buf, 1);
177 #else
178 alarm (timeout);
179 if (read (adapt_desc, &buf, 1) < 0)
180 {
181 if (errno == EINTR)
182 error ("Timeout reading from remote system.");
183 else
184 perror_with_name ("remote");
185 }
186 alarm (0);
187 #endif
188
189 if (buf == '\0')
190 error ("Timeout reading from remote system.");
191 #if defined (LOG_FILE)
192 putc (buf & 0x7f, log_file);
193 #endif
194 return buf & 0x7f;
195 }
196
197 /* Keep discarding input from the remote system, until STRING is found.
198 Let the user break out immediately. */
199 static void
200 expect (char *string)
201 {
202 char *p = string;
203
204 fflush (adapt_stream);
205 immediate_quit++;
206 while (1)
207 {
208 if (readchar () == *p)
209 {
210 p++;
211 if (*p == '\0')
212 {
213 immediate_quit--;
214 return;
215 }
216 }
217 else
218 p = string;
219 }
220 }
221
222 /* Keep discarding input until we see the adapt prompt.
223
224 The convention for dealing with the prompt is that you
225 o give your command
226 o *then* wait for the prompt.
227
228 Thus the last thing that a procedure does with the serial line
229 will be an expect_prompt(). Exception: adapt_resume does not
230 wait for the prompt, because the terminal is being handed over
231 to the inferior. However, the next thing which happens after that
232 is a adapt_wait which does wait for the prompt.
233 Note that this includes abnormal exit, e.g. error(). This is
234 necessary to prevent getting into states from which we can't
235 recover. */
236 static void
237 expect_prompt (void)
238 {
239 #if defined (LOG_FILE)
240 /* This is a convenient place to do this. The idea is to do it often
241 enough that we never lose much data if we terminate abnormally. */
242 fflush (log_file);
243 #endif
244 fflush (adapt_stream);
245 expect ("\n# ");
246 }
247
248 /* Get a hex digit from the remote system & return its value.
249 If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */
250 static int
251 get_hex_digit (int ignore_space)
252 {
253 int ch;
254 while (1)
255 {
256 ch = readchar ();
257 if (ch >= '0' && ch <= '9')
258 return ch - '0';
259 else if (ch >= 'A' && ch <= 'F')
260 return ch - 'A' + 10;
261 else if (ch >= 'a' && ch <= 'f')
262 return ch - 'a' + 10;
263 else if (ch == ' ' && ignore_space)
264 ;
265 else
266 {
267 expect_prompt ();
268 error ("Invalid hex digit from remote system.");
269 }
270 }
271 }
272
273 /* Get a byte from adapt_desc and put it in *BYT. Accept any number
274 leading spaces. */
275 static void
276 get_hex_byte (char *byt)
277 {
278 int val;
279
280 val = get_hex_digit (1) << 4;
281 val |= get_hex_digit (0);
282 *byt = val;
283 }
284
285 /* Read a 32-bit hex word from the adapt, preceded by a space */
286 static long
287 get_hex_word (void)
288 {
289 long val;
290 int j;
291
292 val = 0;
293 for (j = 0; j < 8; j++)
294 val = (val << 4) + get_hex_digit (j == 0);
295 return val;
296 }
297 /* Get N 32-bit hex words from remote, each preceded by a space
298 and put them in registers starting at REGNO. */
299 static void
300 get_hex_regs (int n, int regno)
301 {
302 long val;
303 while (n--)
304 {
305 val = get_hex_word ();
306 supply_register (regno++, (char *) &val);
307 }
308 }
309 /* Called when SIGALRM signal sent due to alarm() timeout. */
310 #ifndef HAVE_TERMIO
311
312 #ifndef __STDC__
313 #ifndef volatile
314 #define volatile
315 /**/
316 # endif
317 #endif
318 volatile int n_alarms;
319
320 void
321 adapt_timer (void)
322 {
323 #if 0
324 if (kiodebug)
325 printf ("adapt_timer called\n");
326 #endif
327 n_alarms++;
328 }
329 #endif
330
331 /* malloc'd name of the program on the remote system. */
332 static char *prog_name = NULL;
333
334 /* Number of SIGTRAPs we need to simulate. That is, the next
335 NEED_ARTIFICIAL_TRAP calls to adapt_wait should just return
336 SIGTRAP without actually waiting for anything. */
337
338 static int need_artificial_trap = 0;
339
340 void
341 adapt_kill (char *arg, int from_tty)
342 {
343 fprintf (adapt_stream, "K");
344 fprintf (adapt_stream, "\r");
345 expect_prompt ();
346 }
347 /*
348 * Download a file specified in 'args', to the adapt.
349 * FIXME: Assumes the file to download is a binary coff file.
350 */
351 static void
352 adapt_load (char *args, int fromtty)
353 {
354 FILE *fp;
355 int n;
356 char buffer[1024];
357
358 if (!adapt_stream)
359 {
360 printf_filtered ("Adapt not open. Use 'target' command to open adapt\n");
361 return;
362 }
363
364 /* OK, now read in the file. Y=read, C=COFF, T=dTe port
365 0=start address. */
366
367 #ifdef ASCII_COFF /* Ascii coff */
368 fprintf (adapt_stream, "YA T,0\r");
369 fflush (adapt_stream); /* Just in case */
370 /* FIXME: should check args for only 1 argument */
371 sprintf (buffer, "cat %s | btoa > /tmp/#adapt-btoa", args);
372 system (buffer);
373 fp = fopen ("/tmp/#adapt-btoa", "r");
374 rawmode (adapt_desc, OFF);
375 while (n = fread (buffer, 1, 1024, fp))
376 {
377 do
378 {
379 n -= write (adapt_desc, buffer, n);
380 }
381 while (n > 0);
382 if (n < 0)
383 {
384 perror ("writing ascii coff");
385 break;
386 }
387 }
388 fclose (fp);
389 rawmode (adapt_desc, ON);
390 system ("rm /tmp/#adapt-btoa");
391 #else /* Binary coff - can't get it to work . */
392 fprintf (adapt_stream, "YC T,0\r");
393 fflush (adapt_stream); /* Just in case */
394 if (!(fp = fopen (args, "r")))
395 {
396 printf_filtered ("Can't open %s\n", args);
397 return;
398 }
399 while (n = fread (buffer, 1, 512, fp))
400 {
401 do
402 {
403 n -= write (adapt_desc, buffer, n);
404 }
405 while (n > 0);
406 if (n < 0)
407 {
408 perror ("writing ascii coff");
409 break;
410 }
411 }
412 fclose (fp);
413 #endif
414 expect_prompt (); /* Skip garbage that comes out */
415 fprintf (adapt_stream, "\r");
416 expect_prompt ();
417 }
418
419 /* This is called not only when we first attach, but also when the
420 user types "run" after having attached. */
421 void
422 adapt_create_inferior (char *execfile, char *args, char **env)
423 {
424 int entry_pt;
425
426 if (args && *args)
427 error ("Can't pass arguments to remote adapt process.");
428
429 if (execfile == 0 || exec_bfd == 0)
430 error ("No executable file specified");
431
432 entry_pt = (int) bfd_get_start_address (exec_bfd);
433
434 if (adapt_stream)
435 {
436 adapt_kill (NULL, NULL);
437 adapt_clear_breakpoints ();
438 init_wait_for_inferior ();
439 /* Clear the input because what the adapt sends back is different
440 * depending on whether it was running or not.
441 */
442 slurp_input (); /* After this there should be a prompt */
443 fprintf (adapt_stream, "\r");
444 expect_prompt ();
445 printf_filtered ("Do you want to download '%s' (y/n)? [y] : ", prog_name);
446 {
447 char buffer[10];
448 gets (buffer);
449 if (*buffer != 'n')
450 {
451 adapt_load (prog_name, 0);
452 }
453 }
454
455 #ifdef NOTDEF
456 /* Set the PC and wait for a go/cont */
457 fprintf (adapt_stream, "G %x,N\r", entry_pt);
458 printf_filtered ("Now use the 'continue' command to start.\n");
459 expect_prompt ();
460 #else
461 insert_breakpoints (); /* Needed to get correct instruction in cache */
462 proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0);
463 #endif
464
465 }
466 else
467 {
468 printf_filtered ("Adapt not open yet.\n");
469 }
470 }
471
472 /* Translate baud rates from integers to damn B_codes. Unix should
473 have outgrown this crap years ago, but even POSIX wouldn't buck it. */
474
475 #ifndef B19200
476 #define B19200 EXTA
477 #endif
478 #ifndef B38400
479 #define B38400 EXTB
480 #endif
481
482 static struct
483 {
484 int rate, damn_b;
485 }
486 baudtab[] =
487 {
488 {
489 0, B0
490 }
491 ,
492 {
493 50, B50
494 }
495 ,
496 {
497 75, B75
498 }
499 ,
500 {
501 110, B110
502 }
503 ,
504 {
505 134, B134
506 }
507 ,
508 {
509 150, B150
510 }
511 ,
512 {
513 200, B200
514 }
515 ,
516 {
517 300, B300
518 }
519 ,
520 {
521 600, B600
522 }
523 ,
524 {
525 1200, B1200
526 }
527 ,
528 {
529 1800, B1800
530 }
531 ,
532 {
533 2400, B2400
534 }
535 ,
536 {
537 4800, B4800
538 }
539 ,
540 {
541 9600, B9600
542 }
543 ,
544 {
545 19200, B19200
546 }
547 ,
548 {
549 38400, B38400
550 }
551 ,
552 {
553 -1, -1
554 }
555 ,
556 };
557
558 static int
559 damn_b (int rate)
560 {
561 int i;
562
563 for (i = 0; baudtab[i].rate != -1; i++)
564 if (rate == baudtab[i].rate)
565 return baudtab[i].damn_b;
566 return B38400; /* Random */
567 }
568
569
570 /* Open a connection to a remote debugger.
571 NAME is the filename used for communication, then a space,
572 then the baud rate.
573 */
574
575 static int baudrate = 9600;
576 static void
577 adapt_open (char *name, int from_tty)
578 {
579 TERMINAL sg;
580 unsigned int prl;
581 char *p;
582
583 /* Find the first whitespace character, it separates dev_name from
584 prog_name. */
585 if (name == 0)
586 goto erroid;
587
588 for (p = name;
589 *p != '\0' && !isspace (*p); p++)
590 ;
591 if (*p == '\0')
592 erroid:
593 error ("\
594 Please include the name of the device for the serial port,\n\
595 the baud rate, and the name of the program to run on the remote system.");
596 dev_name = (char *) xmalloc (p - name + 1);
597 strncpy (dev_name, name, p - name);
598 dev_name[p - name] = '\0';
599
600 /* Skip over the whitespace after dev_name */
601 for (; isspace (*p); p++)
602 /*EMPTY */ ;
603
604 if (1 != sscanf (p, "%d ", &baudrate))
605 goto erroid;
606
607 /* Skip the number and then the spaces */
608 for (; isdigit (*p); p++)
609 /*EMPTY */ ;
610 for (; isspace (*p); p++)
611 /*EMPTY */ ;
612
613 if (prog_name != NULL)
614 xfree (prog_name);
615 prog_name = savestring (p, strlen (p));
616
617 adapt_close (0);
618
619 adapt_desc = open (dev_name, O_RDWR);
620 if (adapt_desc < 0)
621 perror_with_name (dev_name);
622 ioctl (adapt_desc, TIOCGETP, &sg);
623 #if ! defined(COMPILE_CHECK)
624 #ifdef HAVE_TERMIO
625 sg.c_cc[VMIN] = 0; /* read with timeout. */
626 sg.c_cc[VTIME] = timeout * 10;
627 sg.c_lflag &= ~(ICANON | ECHO);
628 sg.c_cflag = (sg.c_cflag & ~CBAUD) | damn_b (baudrate);
629 #else
630 sg.sg_ispeed = damn_b (baudrate);
631 sg.sg_ospeed = damn_b (baudrate);
632 sg.sg_flags |= RAW | ANYP;
633 sg.sg_flags &= ~ECHO;
634 #endif
635
636 ioctl (adapt_desc, TIOCSETP, &sg);
637 adapt_stream = fdopen (adapt_desc, "r+");
638 #endif /* compile_check */
639 push_target (&adapt_ops);
640
641 #ifndef HAVE_TERMIO
642 #ifndef NO_SIGINTERRUPT
643 /* Cause SIGALRM's to make reads fail with EINTR instead of resuming
644 the read. */
645 if (siginterrupt (SIGALRM, 1) != 0)
646 perror ("adapt_open: error in siginterrupt");
647 #endif
648
649 /* Set up read timeout timer. */
650 if ((void (*)) signal (SIGALRM, adapt_timer) == (void (*)) -1)
651 perror ("adapt_open: error in signal");
652 #endif
653
654 #if defined (LOG_FILE)
655 log_file = fopen (LOG_FILE, "w");
656 if (log_file == NULL)
657 perror_with_name (LOG_FILE);
658 #endif
659
660 /* Put this port into NORMAL mode, send the 'normal' character */
661 write (adapt_desc, "\ 1", 1); /* Control A */
662 write (adapt_desc, "\r", 1);
663 expect_prompt ();
664
665 /* Hello? Are you there? */
666 write (adapt_desc, "\r", 1);
667
668 expect_prompt ();
669
670 /* Clear any break points */
671 adapt_clear_breakpoints ();
672
673 /* Print out some stuff, letting the user now what's going on */
674 printf_filtered ("Connected to an Adapt via %s.\n", dev_name);
675 /* FIXME: can this restriction be removed? */
676 printf_filtered ("Remote debugging using virtual addresses works only\n");
677 printf_filtered ("\twhen virtual addresses map 1:1 to physical addresses.\n");
678 if (processor_type != a29k_freeze_mode)
679 {
680 fprintf_filtered (gdb_stderr,
681 "Freeze-mode debugging not available, and can only be done on an A29050.\n");
682 }
683 }
684
685 /* Close out all files and local state before this target loses control. */
686
687 static void
688 adapt_close (int quitting)
689 {
690
691 /* Clear any break points */
692 adapt_clear_breakpoints ();
693
694 /* Put this port back into REMOTE mode */
695 if (adapt_stream)
696 {
697 fflush (adapt_stream);
698 sleep (1); /* Let any output make it all the way back */
699 write (adapt_desc, "R\r", 2);
700 }
701
702 /* Due to a bug in Unix, fclose closes not only the stdio stream,
703 but also the file descriptor. So we don't actually close
704 adapt_desc. */
705 if (adapt_stream)
706 fclose (adapt_stream); /* This also closes adapt_desc */
707 if (adapt_desc >= 0)
708 /* close (adapt_desc); */
709
710 /* Do not try to close adapt_desc again, later in the program. */
711 adapt_stream = NULL;
712 adapt_desc = -1;
713
714 #if defined (LOG_FILE)
715 if (log_file)
716 {
717 if (ferror (log_file))
718 printf_filtered ("Error writing log file.\n");
719 if (fclose (log_file) != 0)
720 printf_filtered ("Error closing log file.\n");
721 log_file = NULL;
722 }
723 #endif
724 }
725
726 /* Attach to the target that is already loaded and possibly running */
727 static void
728 adapt_attach (char *args, int from_tty)
729 {
730
731 if (from_tty)
732 printf_filtered ("Attaching to remote program %s.\n", prog_name);
733
734 /* Send the adapt a kill. It is ok if it is not already running */
735 fprintf (adapt_stream, "K\r");
736 fflush (adapt_stream);
737 expect_prompt (); /* Slurp the echo */
738 }
739
740
741 /* Terminate the open connection to the remote debugger.
742 Use this when you want to detach and do something else
743 with your gdb. */
744 void
745 adapt_detach (char *args, int from_tty)
746 {
747
748 if (adapt_stream)
749 { /* Send it on its way (tell it to continue) */
750 adapt_clear_breakpoints ();
751 fprintf (adapt_stream, "G\r");
752 }
753
754 pop_target (); /* calls adapt_close to do the real work */
755 if (from_tty)
756 printf_filtered ("Ending remote %s debugging\n", target_shortname);
757 }
758
759 /* Tell the remote machine to resume. */
760
761 void
762 adapt_resume (int pid, int step, enum target_signal sig)
763 {
764 if (step)
765 {
766 write (adapt_desc, "t 1,s\r", 6);
767 /* Wait for the echo. */
768 expect ("t 1,s\r\n");
769 /* Then comes a line containing the instruction we stepped to. */
770 expect ("@");
771 /* Then we get the prompt. */
772 expect_prompt ();
773
774 /* Force the next adapt_wait to return a trap. Not doing anything
775 about I/O from the target means that the user has to type
776 "continue" to see any. FIXME, this should be fixed. */
777 need_artificial_trap = 1;
778 }
779 else
780 {
781 write (adapt_desc, "G\r", 2);
782 /* Swallow the echo. */
783 expect_prompt ();
784 }
785 }
786
787 /* Wait until the remote machine stops, then return,
788 storing status in STATUS just as `wait' would. */
789
790 int
791 adapt_wait (struct target_waitstatus *status)
792 {
793 /* Strings to look for. '?' means match any single character.
794 Note that with the algorithm we use, the initial character
795 of the string cannot recur in the string, or we will not
796 find some cases of the string in the input. */
797
798 static char bpt[] = "@";
799 /* It would be tempting to look for "\n[__exit + 0x8]\n"
800 but that requires loading symbols with "yc i" and even if
801 we did do that we don't know that the file has symbols. */
802 static char exitmsg[] = "@????????I JMPTI GR121,LR0";
803 char *bp = bpt;
804 char *ep = exitmsg;
805
806 /* Large enough for either sizeof (bpt) or sizeof (exitmsg) chars. */
807 char swallowed[50];
808 /* Current position in swallowed. */
809 char *swallowed_p = swallowed;
810
811 int ch;
812 int ch_handled;
813 int old_timeout = timeout;
814 int old_immediate_quit = immediate_quit;
815
816 status->kind = TARGET_WAITKIND_EXITED;
817 status->value.integer = 0;
818
819 if (need_artificial_trap != 0)
820 {
821 status->kind = TARGET_WAITKIND_STOPPED;
822 status->value.sig = TARGET_SIGNAL_TRAP;
823 need_artificial_trap--;
824 return 0;
825 }
826
827 timeout = 0; /* Don't time out -- user program is running. */
828 immediate_quit = 1; /* Helps ability to QUIT */
829 while (1)
830 {
831 QUIT; /* Let user quit and leave process running */
832 ch_handled = 0;
833 ch = readchar ();
834 if (ch == *bp)
835 {
836 bp++;
837 if (*bp == '\0')
838 break;
839 ch_handled = 1;
840
841 *swallowed_p++ = ch;
842 }
843 else
844 bp = bpt;
845 if (ch == *ep || *ep == '?')
846 {
847 ep++;
848 if (*ep == '\0')
849 break;
850
851 if (!ch_handled)
852 *swallowed_p++ = ch;
853 ch_handled = 1;
854 }
855 else
856 ep = exitmsg;
857 if (!ch_handled)
858 {
859 char *p;
860 /* Print out any characters which have been swallowed. */
861 for (p = swallowed; p < swallowed_p; ++p)
862 putc (*p, stdout);
863 swallowed_p = swallowed;
864 putc (ch, stdout);
865 }
866 }
867 expect_prompt ();
868 if (*bp == '\0')
869 {
870 status->kind = TARGET_WAITKIND_STOPPED;
871 status->value.sig = TARGET_SIGNAL_TRAP;
872 }
873 else
874 {
875 status->kind = TARGET_WAITKIND_EXITED;
876 status->value.integer = 0;
877 }
878 timeout = old_timeout;
879 immediate_quit = old_immediate_quit;
880 return 0;
881 }
882
883 /* Return the name of register number REGNO
884 in the form input and output by adapt.
885
886 Returns a pointer to a static buffer containing the answer. */
887 static char *
888 get_reg_name (int regno)
889 {
890 static char buf[80];
891 if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32)
892 sprintf (buf, "GR%03d", regno - GR96_REGNUM + 96);
893 #if defined(GR64_REGNUM)
894 else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32)
895 sprintf (buf, "GR%03d", regno - GR64_REGNUM + 64);
896 #endif
897 else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128)
898 sprintf (buf, "LR%03d", regno - LR0_REGNUM);
899 else if (regno == Q_REGNUM)
900 strcpy (buf, "SR131");
901 else if (regno >= BP_REGNUM && regno <= CR_REGNUM)
902 sprintf (buf, "SR%03d", regno - BP_REGNUM + 133);
903 else if (regno == ALU_REGNUM)
904 strcpy (buf, "SR132");
905 else if (regno >= IPC_REGNUM && regno <= IPB_REGNUM)
906 sprintf (buf, "SR%03d", regno - IPC_REGNUM + 128);
907 else if (regno >= VAB_REGNUM && regno <= LRU_REGNUM)
908 {
909 /* When a 29050 is in freeze-mode, read shadow pcs instead */
910 if ((regno >= NPC_REGNUM && regno <= PC2_REGNUM) && USE_SHADOW_PC)
911 sprintf (buf, "SR%03d", regno - NPC_REGNUM + 20);
912 else
913 sprintf (buf, "SR%03d", regno - VAB_REGNUM);
914 }
915 else if (regno == GR1_REGNUM)
916 strcpy (buf, "GR001");
917 return buf;
918 }
919
920 /* Read the remote registers. */
921
922 static void
923 adapt_fetch_registers (void)
924 {
925 int reg_index;
926 int regnum_index;
927 char tempbuf[10];
928 int sreg_buf[16];
929 int i, j;
930
931 /*
932 * Global registers
933 */
934 #if defined(GR64_REGNUM)
935 write (adapt_desc, "dw gr64,gr95\r", 13);
936 for (reg_index = 64, regnum_index = GR64_REGNUM;
937 reg_index < 96;
938 reg_index += 4, regnum_index += 4)
939 {
940 sprintf (tempbuf, "GR%03d ", reg_index);
941 expect (tempbuf);
942 get_hex_regs (4, regnum_index);
943 expect ("\n");
944 }
945 #endif
946 write (adapt_desc, "dw gr96,gr127\r", 14);
947 for (reg_index = 96, regnum_index = GR96_REGNUM;
948 reg_index < 128;
949 reg_index += 4, regnum_index += 4)
950 {
951 sprintf (tempbuf, "GR%03d ", reg_index);
952 expect (tempbuf);
953 get_hex_regs (4, regnum_index);
954 expect ("\n");
955 }
956
957 /*
958 * Local registers
959 */
960 for (i = 0; i < 128; i += 32)
961 {
962 /* The PC has a tendency to hang if we get these
963 all in one fell swoop ("dw lr0,lr127"). */
964 sprintf (tempbuf, "dw lr%d\r", i);
965 write (adapt_desc, tempbuf, strlen (tempbuf));
966 for (reg_index = i, regnum_index = LR0_REGNUM + i;
967 reg_index < i + 32;
968 reg_index += 4, regnum_index += 4)
969 {
970 sprintf (tempbuf, "LR%03d ", reg_index);
971 expect (tempbuf);
972 get_hex_regs (4, regnum_index);
973 expect ("\n");
974 }
975 }
976
977 /*
978 * Special registers
979 */
980 sprintf (tempbuf, "dw sr0\r");
981 write (adapt_desc, tempbuf, strlen (tempbuf));
982 for (i = 0; i < 4; i++)
983 { /* SR0 - SR14 */
984 sprintf (tempbuf, "SR%3d", i * 4);
985 expect (tempbuf);
986 for (j = 0; j < (i == 3 ? 3 : 4); j++)
987 sreg_buf[i * 4 + j] = get_hex_word ();
988 }
989 expect_prompt ();
990 /*
991 * Read the pcs individually if we are in freeze mode.
992 * See get_reg_name(), it translates the register names for the pcs to
993 * the names of the shadow pcs.
994 */
995 if (USE_SHADOW_PC)
996 {
997 sreg_buf[10] = read_register (NPC_REGNUM); /* pc0 */
998 sreg_buf[11] = read_register (PC_REGNUM); /* pc1 */
999 sreg_buf[12] = read_register (PC2_REGNUM); /* pc2 */
1000 }
1001 for (i = 0; i < 14; i++) /* Supply vab -> lru */
1002 supply_register (VAB_REGNUM + i, (char *) &sreg_buf[i]);
1003 sprintf (tempbuf, "dw sr128\r");
1004 write (adapt_desc, tempbuf, strlen (tempbuf));
1005 for (i = 0; i < 2; i++)
1006 { /* SR128 - SR135 */
1007 sprintf (tempbuf, "SR%3d", 128 + i * 4);
1008 expect (tempbuf);
1009 for (j = 0; j < 4; j++)
1010 sreg_buf[i * 4 + j] = get_hex_word ();
1011 }
1012 expect_prompt ();
1013 supply_register (IPC_REGNUM, (char *) &sreg_buf[0]);
1014 supply_register (IPA_REGNUM, (char *) &sreg_buf[1]);
1015 supply_register (IPB_REGNUM, (char *) &sreg_buf[2]);
1016 supply_register (Q_REGNUM, (char *) &sreg_buf[3]);
1017 /* Skip ALU */
1018 supply_register (BP_REGNUM, (char *) &sreg_buf[5]);
1019 supply_register (FC_REGNUM, (char *) &sreg_buf[6]);
1020 supply_register (CR_REGNUM, (char *) &sreg_buf[7]);
1021
1022 /* There doesn't seem to be any way to get these. */
1023 {
1024 int val = -1;
1025 supply_register (FPE_REGNUM, (char *) &val);
1026 supply_register (INTE_REGNUM, (char *) &val);
1027 supply_register (FPS_REGNUM, (char *) &val);
1028 supply_register (EXO_REGNUM, (char *) &val);
1029 }
1030
1031 write (adapt_desc, "dw gr1,gr1\r", 11);
1032 expect ("GR001 ");
1033 get_hex_regs (1, GR1_REGNUM);
1034 expect_prompt ();
1035 }
1036
1037 /* Fetch register REGNO, or all registers if REGNO is -1.
1038 */
1039 static void
1040 adapt_fetch_register (int regno)
1041 {
1042 if (regno == -1)
1043 adapt_fetch_registers ();
1044 else
1045 {
1046 char *name = get_reg_name (regno);
1047 fprintf (adapt_stream, "dw %s,%s\r", name, name);
1048 expect (name);
1049 expect (" ");
1050 get_hex_regs (1, regno);
1051 expect_prompt ();
1052 }
1053 }
1054
1055 /* Store the remote registers from the contents of the block REGS. */
1056
1057 static void
1058 adapt_store_registers (void)
1059 {
1060 int i, j;
1061
1062 fprintf (adapt_stream, "s gr1,%x\r", read_register (GR1_REGNUM));
1063 expect_prompt ();
1064
1065 #if defined(GR64_REGNUM)
1066 for (j = 0; j < 32; j += 16)
1067 {
1068 fprintf (adapt_stream, "s gr%d,", j + 64);
1069 for (i = 0; i < 15; ++i)
1070 fprintf (adapt_stream, "%x,", read_register (GR64_REGNUM + j + i));
1071 fprintf (adapt_stream, "%x\r", read_register (GR64_REGNUM + j + 15));
1072 expect_prompt ();
1073 }
1074 #endif
1075 for (j = 0; j < 32; j += 16)
1076 {
1077 fprintf (adapt_stream, "s gr%d,", j + 96);
1078 for (i = 0; i < 15; ++i)
1079 fprintf (adapt_stream, "%x,", read_register (GR96_REGNUM + j + i));
1080 fprintf (adapt_stream, "%x\r", read_register (GR96_REGNUM + j + 15));
1081 expect_prompt ();
1082 }
1083
1084 for (j = 0; j < 128; j += 16)
1085 {
1086 fprintf (adapt_stream, "s lr%d,", j);
1087 for (i = 0; i < 15; ++i)
1088 fprintf (adapt_stream, "%x,", read_register (LR0_REGNUM + j + i));
1089 fprintf (adapt_stream, "%x\r", read_register (LR0_REGNUM + j + 15));
1090 expect_prompt ();
1091 }
1092
1093 fprintf (adapt_stream, "s sr128,%x,%x,%x\r", read_register (IPC_REGNUM),
1094 read_register (IPA_REGNUM), read_register (IPB_REGNUM));
1095 expect_prompt ();
1096 fprintf (adapt_stream, "s sr133,%x,%x,%x\r", read_register (BP_REGNUM),
1097 read_register (FC_REGNUM), read_register (CR_REGNUM));
1098 expect_prompt ();
1099 fprintf (adapt_stream, "s sr131,%x\r", read_register (Q_REGNUM));
1100 expect_prompt ();
1101 fprintf (adapt_stream, "s sr0,");
1102 for (i = 0; i < 7; ++i)
1103 fprintf (adapt_stream, "%x,", read_register (VAB_REGNUM + i));
1104 expect_prompt ();
1105 fprintf (adapt_stream, "s sr7,");
1106 for (i = 7; i < 14; ++i)
1107 fprintf (adapt_stream, "%x,", read_register (VAB_REGNUM + i));
1108 expect_prompt ();
1109 }
1110
1111 /* Store register REGNO, or all if REGNO == -1.
1112 Return errno value. */
1113 void
1114 adapt_store_register (int regno)
1115 {
1116 /* printf("adapt_store_register() called.\n"); fflush(stdout); /* */
1117 if (regno == -1)
1118 adapt_store_registers ();
1119 else
1120 {
1121 char *name = get_reg_name (regno);
1122 fprintf (adapt_stream, "s %s,%x\r", name, read_register (regno));
1123 /* Setting GR1 changes the numbers of all the locals, so
1124 invalidate the register cache. Do this *after* calling
1125 read_register, because we want read_register to return the
1126 value that write_register has just stuffed into the registers
1127 array, not the value of the register fetched from the
1128 inferior. */
1129 if (regno == GR1_REGNUM)
1130 registers_changed ();
1131 expect_prompt ();
1132 }
1133 }
1134
1135 /* Get ready to modify the registers array. On machines which store
1136 individual registers, this doesn't need to do anything. On machines
1137 which store all the registers in one fell swoop, this makes sure
1138 that registers contains all the registers from the program being
1139 debugged. */
1140
1141 void
1142 adapt_prepare_to_store (void)
1143 {
1144 /* Do nothing, since we can store individual regs */
1145 }
1146
1147 static CORE_ADDR
1148 translate_addr (CORE_ADDR addr)
1149 {
1150 #if defined(KERNEL_DEBUGGING)
1151 /* Check for a virtual address in the kernel */
1152 /* Assume physical address of ublock is in paddr_u register */
1153 if (addr >= UVADDR)
1154 {
1155 /* PADDR_U register holds the physical address of the ublock */
1156 CORE_ADDR i = (CORE_ADDR) read_register (PADDR_U_REGNUM);
1157 return (i + addr - (CORE_ADDR) UVADDR);
1158 }
1159 else
1160 {
1161 return (addr);
1162 }
1163 #else
1164 return (addr);
1165 #endif
1166 }
1167
1168
1169 /* FIXME! Merge these two. */
1170 int
1171 adapt_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
1172 struct mem_attrib *attrib ATTRIBUTE_UNUSED,
1173 struct target_ops *target ATTRIBUTE_UNUSED)
1174 {
1175
1176 memaddr = translate_addr (memaddr);
1177
1178 if (write)
1179 return adapt_write_inferior_memory (memaddr, myaddr, len);
1180 else
1181 return adapt_read_inferior_memory (memaddr, myaddr, len);
1182 }
1183
1184 void
1185 adapt_files_info (void)
1186 {
1187 printf_filtered ("\tAttached to %s at %d baud and running program %s\n",
1188 dev_name, baudrate, prog_name);
1189 printf_filtered ("\ton an %s processor.\n", processor_name[processor_type]);
1190 }
1191
1192 /* Copy LEN bytes of data from debugger memory at MYADDR
1193 to inferior's memory at MEMADDR. Returns errno value.
1194 * sb/sh instructions don't work on unaligned addresses, when TU=1.
1195 */
1196 int
1197 adapt_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
1198 {
1199 int i;
1200 unsigned int cps;
1201
1202 /* Turn TU bit off so we can do 'sb' commands */
1203 cps = read_register (CPS_REGNUM);
1204 if (cps & 0x00000800)
1205 write_register (CPS_REGNUM, cps & ~(0x00000800));
1206
1207 for (i = 0; i < len; i++)
1208 {
1209 if ((i % 16) == 0)
1210 fprintf (adapt_stream, "sb %x,", memaddr + i);
1211 if ((i % 16) == 15 || i == len - 1)
1212 {
1213 fprintf (adapt_stream, "%x\r", ((unsigned char *) myaddr)[i]);
1214 expect_prompt ();
1215 }
1216 else
1217 fprintf (adapt_stream, "%x,", ((unsigned char *) myaddr)[i]);
1218 }
1219 /* Restore the old value of cps if the TU bit was on */
1220 if (cps & 0x00000800)
1221 write_register (CPS_REGNUM, cps);
1222 return len;
1223 }
1224
1225 /* Read LEN bytes from inferior memory at MEMADDR. Put the result
1226 at debugger address MYADDR. Returns errno value. */
1227 int
1228 adapt_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
1229 {
1230 int i;
1231
1232 /* Number of bytes read so far. */
1233 int count;
1234
1235 /* Starting address of this pass. */
1236 unsigned long startaddr;
1237
1238 /* Number of bytes to read in this pass. */
1239 int len_this_pass;
1240
1241 /* Note that this code works correctly if startaddr is just less
1242 than UINT_MAX (well, really CORE_ADDR_MAX if there was such a
1243 thing). That is, something like
1244 adapt_read_bytes (CORE_ADDR_MAX - 4, foo, 4)
1245 works--it never adds len to memaddr and gets 0. */
1246 /* However, something like
1247 adapt_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
1248 doesn't need to work. Detect it and give up if there's an attempt
1249 to do that. */
1250
1251 if (((memaddr - 1) + len) < memaddr)
1252 return EIO;
1253
1254 startaddr = memaddr;
1255 count = 0;
1256 while (count < len)
1257 {
1258 len_this_pass = 16;
1259 if ((startaddr % 16) != 0)
1260 len_this_pass -= startaddr % 16;
1261 if (len_this_pass > (len - count))
1262 len_this_pass = (len - count);
1263
1264 fprintf (adapt_stream, "db %x,%x\r", startaddr,
1265 (startaddr - 1) + len_this_pass);
1266
1267 #ifdef NOTDEF /* Why do this */
1268 expect ("\n");
1269 /* Look for 8 hex digits. */
1270 i = 0;
1271 while (1)
1272 {
1273 if (isxdigit (readchar ()))
1274 ++i;
1275 else
1276 {
1277 expect_prompt ();
1278 error ("Hex digit expected from remote system.");
1279 }
1280 if (i >= 8)
1281 break;
1282 }
1283 #endif /* NOTDEF */
1284
1285 expect (" ");
1286
1287 for (i = 0; i < len_this_pass; i++)
1288 get_hex_byte (&myaddr[count++]);
1289
1290 expect_prompt ();
1291
1292 startaddr += len_this_pass;
1293 }
1294 return count;
1295 }
1296
1297 #define MAX_BREAKS 8
1298 static int num_brkpts = 0;
1299
1300 /* Insert a breakpoint at ADDR. SAVE is normally the address of the
1301 pattern buffer where the instruction that the breakpoint overwrites
1302 is saved. It is unused here since the Adapt Monitor is responsible
1303 for saving/restoring the original instruction. */
1304
1305 static int
1306 adapt_insert_breakpoint (CORE_ADDR addr, char *save)
1307 {
1308 if (num_brkpts < MAX_BREAKS)
1309 {
1310 num_brkpts++;
1311 fprintf (adapt_stream, "B %x", addr);
1312 fprintf (adapt_stream, "\r");
1313 expect_prompt ();
1314 return (0); /* Success */
1315 }
1316 else
1317 {
1318 fprintf_filtered (gdb_stderr,
1319 "Too many break points, break point not installed\n");
1320 return (1); /* Failure */
1321 }
1322
1323 }
1324
1325 /* Remove a breakpoint at ADDR. SAVE is normally the previously
1326 saved pattern, but is unused here as the Adapt Monitor is
1327 responsible for saving/restoring instructions. */
1328
1329 static int
1330 adapt_remove_breakpoint (CORE_ADDR addr, char *save)
1331 {
1332 if (num_brkpts > 0)
1333 {
1334 num_brkpts--;
1335 fprintf (adapt_stream, "BR %x", addr);
1336 fprintf (adapt_stream, "\r");
1337 fflush (adapt_stream);
1338 expect_prompt ();
1339 }
1340 return (0);
1341 }
1342
1343 /* Clear the adapts notion of what the break points are */
1344 static int
1345 adapt_clear_breakpoints (void)
1346 {
1347 if (adapt_stream)
1348 {
1349 fprintf (adapt_stream, "BR"); /* Clear all break points */
1350 fprintf (adapt_stream, "\r");
1351 fflush (adapt_stream);
1352 expect_prompt ();
1353 }
1354 num_brkpts = 0;
1355 }
1356 static void
1357 adapt_mourn (void)
1358 {
1359 adapt_clear_breakpoints ();
1360 pop_target (); /* Pop back to no-child state */
1361 generic_mourn_inferior ();
1362 }
1363
1364 /* Display everthing we read in from the adapt until we match/see the
1365 * specified string
1366 */
1367 static int
1368 display_until (char *str)
1369 {
1370 int i = 0, j, c;
1371
1372 while (c = readchar ())
1373 {
1374 if (c == str[i])
1375 {
1376 i++;
1377 if (i == strlen (str))
1378 return;
1379 }
1380 else
1381 {
1382 if (i)
1383 {
1384 for (j = 0; j < i; j++) /* Put everthing we matched */
1385 putchar (str[j]);
1386 i = 0;
1387 }
1388 putchar (c);
1389 }
1390 }
1391
1392 }
1393
1394
1395 /* Put a command string, in args, out to the adapt. The adapt is assumed to
1396 be in raw mode, all writing/reading done through adapt_desc.
1397 Ouput from the adapt is placed on the users terminal until the
1398 prompt from the adapt is seen.
1399 FIXME: Can't handle commands that take input. */
1400
1401 void
1402 adapt_com (char *args, int fromtty)
1403 {
1404 if (!adapt_stream)
1405 {
1406 printf_filtered ("Adapt not open. Use the 'target' command to open.\n");
1407 return;
1408 }
1409
1410 /* Clear all input so only command relative output is displayed */
1411 slurp_input ();
1412
1413 switch (islower (args[0]) ? toupper (args[0]) : args[0])
1414 {
1415 default:
1416 printf_filtered ("Unknown/Unimplemented adapt command '%s'\n", args);
1417 break;
1418 case 'G': /* Go, begin execution */
1419 write (adapt_desc, args, strlen (args));
1420 write (adapt_desc, "\r", 1);
1421 expect_prompt ();
1422 break;
1423 case 'B': /* Break points, B or BR */
1424 case 'C': /* Check current 29k status (running/halted) */
1425 case 'D': /* Display data/registers */
1426 case 'I': /* Input from i/o space */
1427 case 'J': /* Jam an instruction */
1428 case 'K': /* Kill, stop execution */
1429 case 'L': /* Disassemble */
1430 case 'O': /* Output to i/o space */
1431 case 'T': /* Trace */
1432 case 'P': /* Pulse an input line */
1433 case 'X': /* Examine special purpose registers */
1434 case 'Z': /* Display trace buffer */
1435 write (adapt_desc, args, strlen (args));
1436 write (adapt_desc, "\r", 1);
1437 expect (args); /* Don't display the command */
1438 display_until ("# ");
1439 break;
1440 /* Begin commands that take input in the form 'c x,y[,z...]' */
1441 case 'S': /* Set memory or register */
1442 if (strchr (args, ','))
1443 { /* Assume it is properly formatted */
1444 write (adapt_desc, args, strlen (args));
1445 write (adapt_desc, "\r", 1);
1446 expect_prompt ();
1447 }
1448 break;
1449 }
1450 }
1451
1452 /* Define the target subroutine names */
1453
1454 struct target_ops adapt_ops;
1455
1456 static void
1457 init_adapt_ops (void)
1458 {
1459 adapt_ops.to_shortname = "adapt";
1460 adapt_ops.to_longname = "Remote AMD `Adapt' target";
1461 adapt_ops.to_doc = "Remote debug an AMD 290*0 using an `Adapt' monitor via RS232";
1462 adapt_ops.to_open = adapt_open;
1463 adapt_ops.to_close = adapt_close;
1464 adapt_ops.to_attach = adapt_attach;
1465 adapt_ops.to_post_attach = NULL;
1466 adapt_ops.to_require_attach = NULL;
1467 adapt_ops.to_detach = adapt_detach;
1468 adapt_ops.to_require_detach = NULL;
1469 adapt_ops.to_resume = adapt_resume;
1470 adapt_ops.to_wait = adapt_wait;
1471 adapt_ops.to_post_wait = NULL;
1472 adapt_ops.to_fetch_registers = adapt_fetch_register;
1473 adapt_ops.to_store_registers = adapt_store_register;
1474 adapt_ops.to_prepare_to_store = adapt_prepare_to_store;
1475 adapt_ops.to_xfer_memory = adapt_xfer_inferior_memory;
1476 adapt_ops.to_files_info = adapt_files_info;
1477 adapt_ops.to_insert_breakpoint = adapt_insert_breakpoint;
1478 adapt_ops.to_remove_breakpoint = adapt_remove_breakpoint;
1479 adapt_ops.to_terminal_init = 0;
1480 adapt_ops.to_terminal_inferior = 0;
1481 adapt_ops.to_terminal_ours_for_output = 0;
1482 adapt_ops.to_terminal_ours = 0;
1483 adapt_ops.to_terminal_info = 0;
1484 adapt_ops.to_kill = adapt_kill;
1485 adapt_ops.to_load = adapt_load;
1486 adapt_ops.to_lookup_symbol = 0;
1487 adapt_ops.to_create_inferior = adapt_create_inferior;
1488 adapt_ops.to_post_startup_inferior = NULL;
1489 adapt_ops.to_acknowledge_created_inferior = NULL;
1490 adapt_ops.to_clone_and_follow_inferior = NULL;
1491 adapt_ops.to_post_follow_inferior_by_clone = NULL;
1492 adapt_ops.to_insert_fork_catchpoint = NULL;
1493 adapt_ops.to_remove_fork_catchpoint = NULL;
1494 adapt_ops.to_insert_vfork_catchpoint = NULL;
1495 adapt_ops.to_remove_vfork_catchpoint = NULL;
1496 adapt_ops.to_has_forked = NULL;
1497 adapt_ops.to_has_vforked = NULL;
1498 adapt_ops.to_can_follow_vfork_prior_to_exec = NULL;
1499 adapt_ops.to_post_follow_vfork = NULL;
1500 adapt_ops.to_insert_exec_catchpoint = NULL;
1501 adapt_ops.to_remove_exec_catchpoint = NULL;
1502 adapt_ops.to_has_execd = NULL;
1503 adapt_ops.to_reported_exec_events_per_exec_call = NULL;
1504 adapt_ops.to_has_exited = NULL;
1505 adapt_ops.to_mourn_inferior = adapt_mourn;
1506 adapt_ops.to_can_run = 0;
1507 adapt_ops.to_notice_signals = 0;
1508 adapt_ops.to_thread_alive = 0;
1509 adapt_ops.to_stop = 0; /* process_stratum; */
1510 adapt_ops.to_pid_to_exec_file = NULL;
1511 adapt_ops.to_core_file_to_sym_file = NULL;
1512 adapt_ops.to_stratum = 0;
1513 adapt_ops.DONT_USE = 0;
1514 adapt_ops.to_has_all_memory = 1;
1515 adapt_ops.to_has_memory = 1;
1516 adapt_ops.to_has_stack = 1;
1517 adapt_ops.to_has_registers = 1;
1518 adapt_ops.to_has_execution = 0;
1519 adapt_ops.to_sections = 0;
1520 adapt_ops.to_sections_end = 0;
1521 adapt_ops.to_magic = OPS_MAGIC;
1522 } /* init_adapt_ops */
1523
1524 void
1525 _initialize_remote_adapt (void)
1526 {
1527 init_adapt_ops ();
1528 add_target (&adapt_ops);
1529 add_com ("adapt <command>", class_obscure, adapt_com,
1530 "Send a command to the AMD Adapt remote monitor.");
1531 }
This page took 0.065724 seconds and 4 git commands to generate.