1 /* Memory-access and commands for remote es1800 processes, for GDB.
2 Copyright 1988, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
5 This file is added to GDB to make it possible to do debugging via an
6 ES-1800 emulator. The code was originally written by Johan Holmberg
7 TT/SJ Ericsson Telecom AB and later modified by Johan Henriksson
8 TT/SJ. It was modified for gdb 4.0 by TX/DK Jan Nordenand by TX/DKG
11 This file is part of GDB.
13 GDB is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 1, or (at your option)
18 GDB is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. */
29 /* Emulator communication protocol.
30 All values are encoded in ascii hex digits.
37 - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - -- 6 - - 7 -
38 D = XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
39 A = XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
40 PC = XXXXXX SSP = XXXXXX USP = XXXXXX SR = XXXXXXXX
42 Each byte of register data is described by two hex digits.
64 Each byte of register data is described by two hex digits.
70 AA..AA is address, XXXXXXX is the contents
75 AA..AA is address, XXXXXXXX is data
81 AA..AA is address to resume. If AA..AA is omitted, resume at same address.
87 AA..AA is address to resume. If AA..AA is omitted, resume at same address.
97 #include <sys/ioctl.h>
104 #include "gdb_string.h"
106 #include "inferior.h"
110 #include "remote-utils.h"
113 #include "regcache.h"
116 /* Prototypes for local functions */
118 static void es1800_child_detach (char *, int);
120 static void es1800_child_open (char *, int);
122 static void es1800_transparent (char *, int);
124 static void es1800_create_inferior (char *, char *, char **);
126 static void es1800_load (char *, int);
128 static void es1800_kill (void);
130 static int verify_break (int);
132 static int es1800_remove_breakpoint (CORE_ADDR
, char *);
134 static int es1800_insert_breakpoint (CORE_ADDR
, char *);
136 static void es1800_files_info (struct target_ops
*);
139 es1800_xfer_inferior_memory (CORE_ADDR
, char *, int, int,
140 struct mem_attrib
*, struct target_ops
*);
142 static void es1800_prepare_to_store (void);
144 static ptid_t
es1800_wait (ptid_t
, struct target_waitstatus
*);
146 static void es1800_resume (ptid_t
, int, enum target_signal
);
148 static void es1800_detach (char *, int);
150 static void es1800_attach (char *, int);
152 static int damn_b (char *);
154 static void es1800_open (char *, int);
156 static void es1800_timer (void);
158 static void es1800_reset (char *);
160 static void es1800_request_quit (void);
162 static int readchar (void);
164 static void expect (char *, int);
166 static void expect_prompt (void);
168 static void download (FILE *, int, int);
171 static void bfd_copy (bfd
*, bfd
*);
174 static void get_break_addr (int, CORE_ADDR
*);
176 static int fromhex (int);
178 static int tohex (int);
180 static void es1800_close (int);
182 static void es1800_fetch_registers (void);
184 static void es1800_fetch_register (int);
186 static void es1800_store_register (int);
188 static void es1800_read_bytes (CORE_ADDR
, char *, int);
190 static void es1800_write_bytes (CORE_ADDR
, char *, int);
192 static void send_with_reply (char *, char *, int);
194 static void send_command (char *);
196 static void send (char *);
198 static void getmessage (char *, int);
200 static void es1800_mourn_inferior (void);
202 static void es1800_create_break_insn (char *, int);
204 static void es1800_init_break (char *, int);
206 /* Local variables */
208 /* FIXME: Convert this to use "set remotedebug" instead. */
209 #define LOG_FILE "es1800.log"
210 #if defined (LOG_FILE)
211 static FILE *log_file
;
214 extern struct target_ops es1800_ops
; /* Forward decl */
215 extern struct target_ops es1800_child_ops
; /* Forward decl */
218 static int timeout
= 100;
219 static char *savename
; /* Name of i/o device used */
220 static serial_ttystate es1800_saved_ttystate
;
221 static int es1800_fc_save
; /* Save fcntl state */
223 /* indicates that the emulator uses 32-bit data-adress (68020-mode)
224 instead of 24-bit (68000 -mode) */
228 #define MODE (m68020 ? "M68020" : "M68000" )
229 #define ES1800_BREAK_VEC (0xf)
231 /* Descriptor for I/O to remote machine. Initialize it to NULL so that
232 es1800_open knows that we don't have a file open when the program
235 static struct serial
*es1800_desc
= NULL
;
238 #define HDRLEN sizeof("@.BAAAAAAAA=$VV\r")
240 /* Maximum number of bytes to read/write at once. The value here
241 is chosen to fill up a packet. */
243 #define MAXBUFBYTES ((PBUFSIZ-150)*16/75 )
245 static int es1800_break_vec
= 0;
246 static char es1800_break_insn
[2];
247 static long es1800_break_address
;
248 static void (*old_sigint
) (); /* Old signal-handler for sigint */
249 static jmp_buf interrupt
;
251 /* Local signalhandler to allow breaking tranfers or program run.
252 Rely on global variables: old_sigint(), interrupt */
255 es1800_request_quit (void)
257 /* restore original signalhandler */
258 signal (SIGINT
, old_sigint
);
259 longjmp (interrupt
, 1);
264 Sending reset character(octal 32) to emulator.
265 quit - return to '(esgdb)' prompt or continue */
268 es1800_reset (char *quit
)
274 printf ("\nResetting emulator... ");
276 strcpy (buf
, "\032");
286 /* Open a connection to a remote debugger and push the new target
287 onto the stack. Check if the emulator is responding and find out
288 what kind of processor the emulator is connected to.
289 Initiate the breakpoint handling in the emulator.
291 name - the filename used for communication (ex. '/dev/tta')
292 from_tty - says whether to be verbose or not */
295 es1800_open (char *name
, int from_tty
)
303 if (!name
) /* no device name given in target command */
305 error_no_arg ("serial port device name");
308 target_preopen (from_tty
);
311 /* open the device and configure it for communication */
315 es1800_desc
= serial_open (name
);
316 if (es1800_desc
== NULL
)
318 perror_with_name (name
);
320 savename
= savestring (name
, strlen (name
));
322 es1800_saved_ttystate
= serial_get_tty_state (es1800_desc
);
324 if ((fcflag
= fcntl (deprecated_serial_fd (es1800_desc
), F_GETFL
, 0)) == -1)
326 perror_with_name ("fcntl serial");
328 es1800_fc_save
= fcflag
;
330 fcflag
= (fcflag
& (FREAD
| FWRITE
)); /* mask out any funny stuff */
331 if (fcntl (deprecated_serial_fd (es1800_desc
), F_SETFL
, fcflag
) == -1)
333 perror_with_name ("fcntl serial");
338 if (serial_setbaudrate (es1800_desc
, baud_rate
))
340 serial_close (es1800_desc
);
341 perror_with_name (name
);
345 serial_raw (es1800_desc
);
347 /* If there is something sitting in the buffer we might take it as a
348 response to a command, which would be bad. */
349 serial_flush_input (es1800_desc
);
351 #endif /* DEBUG_STDIN */
353 push_target (&es1800_ops
); /* Switch to using remote target now */
356 printf ("Remote ES1800 debugging using %s\n", name
);
359 #if defined (LOG_FILE)
361 log_file
= fopen (LOG_FILE
, "w");
362 if (log_file
== NULL
)
364 perror_with_name (LOG_FILE
);
367 #endif /* LOG_FILE */
369 /* Hello? Are you there?, also check mode */
371 /* send_with_reply( "DB 0 TO 1", buf, sizeof(buf)); */
372 /* for (p = buf, i = 0; *p++ =='0';) *//* count the number of zeros */
376 getmessage (buf
, sizeof (buf
)); /* send reset character */
380 printf ("Checking mode.... ");
382 /* m68020 = (i==8); *//* if eight zeros then we are in m68020 mode */
384 /* What kind of processor am i talking to ? */
395 for (i
= 0; i
< 20; i
++, p
++)
398 m68020
= !strncmp (p
, "68020", 5);
401 printf ("You are in %s(%c%c%c%c%c)-mode\n", MODE
, p
[0], p
[1], p
[2],
405 /* if no init_break statement is present in .gdb file we have to check
406 whether to download a breakpoint routine or not */
409 if ((es1800_break_vec
== 0) || (verify_break (es1800_break_vec
) != 0)
410 && query ("No breakpoint routine in ES 1800 emulator!\nDownload a breakpoint routine to the emulator? "))
412 CORE_ADDR memaddress
;
413 printf ("Give the start address of the breakpoint routine: ");
414 scanf ("%li", &memaddress
);
415 es1800_init_break ((es1800_break_vec
? es1800_break_vec
:
416 ES1800_BREAK_VEC
), memaddress
);
422 /* Close out all files and local state before this target loses control.
423 quitting - are we quitting gdb now? */
426 es1800_close (int quitting
)
428 if (es1800_desc
!= NULL
)
430 printf ("\nClosing connection to emulator...\n");
431 if (serial_set_tty_state (es1800_desc
, es1800_saved_ttystate
) < 0)
432 print_sys_errmsg ("warning: unable to restore tty state", errno
);
433 fcntl (deprecated_serial_fd (es1800_desc
), F_SETFL
, es1800_fc_save
);
434 serial_close (es1800_desc
);
437 if (savename
!= NULL
)
443 #if defined (LOG_FILE)
445 if (log_file
!= NULL
)
447 if (ferror (log_file
))
449 printf ("Error writing log file.\n");
451 if (fclose (log_file
) != 0)
453 printf ("Error closing log file.\n");
458 #endif /* LOG_FILE */
462 /* Attaches to a process on the target side
463 proc_id - the id of the process to be attached.
464 from_tty - says whether to be verbose or not */
467 es1800_attach (char *args
, int from_tty
)
469 error ("Cannot attach to pid %s, this feature is not implemented yet.",
474 /* Takes a program previously attached to and detaches it.
475 We better not have left any breakpoints
476 in the program or it'll die when it hits one.
477 Close the open connection to the remote debugger.
478 Use this when you want to detach and do something else
481 args - arguments given to the 'detach' command
482 from_tty - says whether to be verbose or not */
485 es1800_detach (char *args
, int from_tty
)
489 error ("Argument given to \"detach\" when remotely debugging.");
494 printf ("Ending es1800 remote debugging.\n");
499 /* Tell the remote machine to resume.
500 step - single-step or run free
501 siggnal - the signal value to be given to the target (0 = no signal) */
504 es1800_resume (ptid_t ptid
, int step
, enum target_signal siggnal
)
510 error ("Can't send signals to a remote system.");
514 strcpy (buf
, "STP\r");
519 send_command ("RBK");
523 /* Wait until the remote machine stops, then return,
524 storing status in STATUS just as `wait' would.
528 es1800_wait (ptid_t ptid
, struct target_waitstatus
*status
)
530 unsigned char buf
[PBUFSIZ
];
531 int old_timeout
= timeout
;
533 status
->kind
= TARGET_WAITKIND_EXITED
;
534 status
->value
.integer
= 0;
536 timeout
= 0; /* Don't time out -- user program is running. */
537 if (!setjmp (interrupt
))
539 old_sigint
= signal (SIGINT
, es1800_request_quit
);
542 getmessage (buf
, sizeof (buf
));
543 if (strncmp (buf
, "\r\n* BREAK *", 11) == 0)
545 status
->kind
= TARGET_WAITKIND_STOPPED
;
546 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
547 send_command ("STP"); /* Restore stack and PC and such */
550 send_command ("STP");
554 if (strncmp (buf
, "STP\r\n ", 6) == 0)
556 status
->kind
= TARGET_WAITKIND_STOPPED
;
557 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
560 if (buf
[strlen (buf
) - 2] == 'R')
562 printf ("Unexpected emulator reply: \n%s\n", buf
);
566 printf ("Unexpected stop: \n%s\n", buf
);
567 status
->kind
= TARGET_WAITKIND_STOPPED
;
568 status
->value
.sig
= TARGET_SIGNAL_QUIT
;
576 printf ("\nStopping emulator...");
577 if (!setjmp (interrupt
))
579 old_sigint
= signal (SIGINT
, es1800_request_quit
);
580 send_command ("STP");
581 printf (" emulator stopped\n");
582 status
->kind
= TARGET_WAITKIND_STOPPED
;
583 status
->value
.sig
= TARGET_SIGNAL_INT
;
588 es1800_reset ((char *) 1);
591 signal (SIGINT
, old_sigint
);
592 timeout
= old_timeout
;
593 return inferior_ptid
;
597 /* Fetch register values from remote machine.
598 regno - the register to be fetched (fetch all registers if -1) */
601 es1800_fetch_register (int regno
)
607 static char regtab
[18][4] =
609 "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ",
610 "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP",
614 if ((regno
< 15) || (regno
== 16) || (regno
== 17))
617 send_with_reply (regtab
[regno
], buf
, sizeof (buf
));
619 for (k
= 0; k
< 4; k
++)
621 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
623 error ("Emulator reply is too short: %s", buf
);
625 registers
[r
++] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
630 es1800_fetch_registers ();
634 /* Read the remote registers into REGISTERS.
635 Always fetches all registers. */
638 es1800_fetch_registers (void)
641 char SR_buf
[PBUFSIZ
];
647 send_with_reply ("DR", buf
, sizeof (buf
));
649 /* Reply is edited to a string that describes registers byte by byte,
650 each byte encoded as two hex characters. */
655 /* parsing row one - D0-D7-registers */
660 for (i
= 4; i
< 70; i
+= (i
== 39 ? 3 : 1))
662 for (k
= 0; k
< 4; k
++)
664 if (p
[i
+ 0] == 0 || p
[i
+ 1] == 0)
666 error ("Emulator reply is too short: %s", buf
);
668 registers
[r
++] = (fromhex (p
[i
+ 0]) * 16) + fromhex (p
[i
+ 1]);
674 /* parsing row two - A0-A6-registers */
679 for (i
= 4; i
< 61; i
+= (i
== 39 ? 3 : 1))
681 for (k
= 0; k
< 4; k
++)
683 if (p
[i
+ 0] == 0 || p
[i
+ 1] == 0)
685 error ("Emulator reply is too short: %s", buf
);
687 registers
[r
++] = (fromhex (p
[i
+ 0])) * 16 + fromhex (p
[i
+ 1]);
697 /* fetch SSP-, SR- and PC-registers */
699 /* first - check STATUS-word and decide which stackpointer to use */
701 send_with_reply ("SR", SR_buf
, sizeof (SR_buf
));
707 if (*p
== '3') /* use masterstackpointer MSP */
709 send_with_reply ("MSP", buf
, sizeof (buf
));
711 else if (*p
== '2') /* use interruptstackpointer ISP */
713 send_with_reply ("ISP", buf
, sizeof (buf
));
716 /* use userstackpointer USP */
718 send_with_reply ("USP", buf
, sizeof (buf
));
721 for (k
= 0; k
< 4; k
++)
723 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
725 error ("Emulator reply is too short: %s", buf
);
727 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
731 for (k
= 0; k
< 4; k
++)
733 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
735 error ("Emulator reply is too short: %s", buf
);
738 fromhex (SR_buf
[k
* 2 + 1]) * 16 + fromhex (SR_buf
[k
* 2 + 2]);
740 send_with_reply ("PC", buf
, sizeof (buf
));
742 for (k
= 0; k
< 4; k
++)
744 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
746 error ("Emulator reply is too short: %s", buf
);
748 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
754 if (*p
== '2') /* use supervisorstackpointer SSP */
756 send_with_reply ("SSP", buf
, sizeof (buf
));
759 /* use userstackpointer USP */
761 send_with_reply ("USP", buf
, sizeof (buf
));
764 /* fetch STACKPOINTER */
767 for (k
= 0; k
< 4; k
++)
769 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
771 error ("Emulator reply is too short: %s", buf
);
773 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
779 for (k
= 0; k
< 4; k
++)
781 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
783 error ("Emulator reply is too short: %s", buf
);
786 fromhex (SR_buf
[k
* 2 + 1]) * 16 + fromhex (SR_buf
[k
* 2 + 2]);
791 send_with_reply ("PC", buf
, sizeof (buf
));
793 for (k
= 0; k
< 4; k
++)
795 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
797 error ("Emulator reply is too short: %s", buf
);
799 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
804 /* Store register value, located in REGISTER, on the target processor.
805 regno - the register-number of the register to store
806 (-1 means store them all)
807 FIXME: Return errno value. */
810 es1800_store_register (int regno
)
813 static char regtab
[18][4] =
815 "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ",
816 "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP",
821 char SR_buf
[PBUFSIZ
];
822 char stack_pointer
[4];
829 r
= (unsigned char *) registers
;
831 if (regno
== -1) /* write all registers */
837 /* write one register */
844 if ((regno
== -1) || (regno
== 15))
846 /* fetch current status */
847 send_with_reply ("SR", SR_buf
, sizeof (SR_buf
));
852 if (*p
== '3') /* use masterstackpointer MSP */
854 strcpy (stack_pointer
, "MSP");
858 if (*p
== '2') /* use interruptstackpointer ISP */
860 strcpy (stack_pointer
, "ISP");
864 strcpy (stack_pointer
, "USP"); /* use userstackpointer USP */
871 if (*p
== '2') /* use supervisorstackpointer SSP */
873 strcpy (stack_pointer
, "SSP");
877 strcpy (stack_pointer
, "USP"); /* use userstackpointer USP */
880 strcpy (regtab
[15], stack_pointer
);
883 for (i
= j
; i
< k
; i
++)
885 buf
[0] = regtab
[i
][0];
886 buf
[1] = regtab
[i
][1];
887 buf
[2] = regtab
[i
][2];
890 buf
[5] = tohex ((*r
>> 4) & 0x0f);
891 buf
[6] = tohex (*r
++ & 0x0f);
892 buf
[7] = tohex ((*r
>> 4) & 0x0f);
893 buf
[8] = tohex (*r
++ & 0x0f);
894 buf
[9] = tohex ((*r
>> 4) & 0x0f);
895 buf
[10] = tohex (*r
++ & 0x0f);
896 buf
[11] = tohex ((*r
>> 4) & 0x0f);
897 buf
[12] = tohex (*r
++ & 0x0f);
900 send_with_reply (buf
, buf
, sizeof (buf
)); /* FIXME, reply not used? */
905 /* Prepare to store registers. */
908 es1800_prepare_to_store (void)
910 /* Do nothing, since we can store individual regs */
913 /* Convert hex digit A to a number. */
918 if (a
>= '0' && a
<= '9')
922 else if (a
>= 'a' && a
<= 'f')
926 else if (a
>= 'A' && a
<= 'F')
932 error ("Reply contains invalid hex digit");
938 /* Convert number NIB to a hex digit. */
949 return ('A' + nib
- 10);
953 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
954 to or from debugger address MYADDR. Write to inferior if WRITE is
955 nonzero. Returns length of data written or read; 0 for error.
957 memaddr - the target's address
958 myaddr - gdb's address
959 len - number of bytes
960 write - write if != 0 otherwise read
964 es1800_xfer_inferior_memory (CORE_ADDR memaddr
, char *myaddr
, int len
,
966 struct mem_attrib
*attrib ATTRIBUTE_UNUSED
,
967 struct target_ops
*target ATTRIBUTE_UNUSED
)
974 xfersize
= len
> MAXBUFBYTES
? MAXBUFBYTES
: len
;
977 es1800_write_bytes (memaddr
, myaddr
, xfersize
);
981 es1800_read_bytes (memaddr
, myaddr
, xfersize
);
987 return (origlen
); /* no error possible */
991 /* Write memory data directly to the emulator.
992 This does not inform the data cache; the data cache uses this.
993 MEMADDR is the address in the remote memory space.
994 MYADDR is the address of the buffer in our space.
995 LEN is the number of bytes.
997 memaddr - the target's address
998 myaddr - gdb's address
999 len - number of bytes */
1002 es1800_write_bytes (CORE_ADDR memaddr
, char *myaddr
, int len
)
1009 for (i
= 0; i
< len
; i
++)
1011 sprintf (buf
, "@.B$%x=$%x", memaddr
+ i
, (*p
++) & 0xff);
1012 send_with_reply (buf
, buf
, sizeof (buf
)); /* FIXME send_command? */
1017 /* Read memory data directly from the emulator.
1018 This does not use the data cache; the data cache uses this.
1020 memaddr - the target's address
1021 myaddr - gdb's address
1022 len - number of bytes */
1025 es1800_read_bytes (CORE_ADDR memaddr
, char *myaddr
, int len
)
1027 static int DB_tab
[16] =
1028 {8, 11, 14, 17, 20, 23, 26, 29, 34, 37, 40, 43, 46, 49, 52, 55};
1035 if (len
> PBUFSIZ
/ 2 - 1)
1037 internal_error (__FILE__
, __LINE__
, "failed internal consistency check");
1040 if (len
== 1) /* The emulator does not like expressions like: */
1042 len
= 2; /* DB.B $20018 TO $20018 */
1045 /* Reply describes registers byte by byte, each byte encoded as two hex
1048 sprintf (buf
, "DB.B $%x TO $%x", memaddr
, memaddr
+ len
- 1);
1049 send_with_reply (buf
, buf
, sizeof (buf
));
1051 low_addr
= memaddr
& 0x0f;
1052 for (i
= low_addr
; i
< low_addr
+ len
; i
++)
1054 if ((!(i
% 16)) && i
)
1055 { /* if (i = 16,32,48) */
1056 while (*p
++ != '\n')
1061 p
= b
+ DB_tab
[i
% 16] + (m68020
? 2 : 0);
1062 if (p
[0] == 32 || p
[1] == 32)
1064 error ("Emulator reply is too short: %s", buf
);
1066 myaddr
[i
- low_addr
] = fromhex (p
[0]) * 16 + fromhex (p
[1]);
1070 /* Display information about the current target. TOPS is unused. */
1073 es1800_files_info (struct target_ops
*tops
)
1075 printf ("ES1800 Attached to %s at %d baud in %s mode\n", savename
, 19200,
1080 /* We read the contents of the target location and stash it,
1081 then overwrite it with a breakpoint instruction.
1083 addr - is the target location in the target machine.
1084 contents_cache - is a pointer to memory allocated for saving the target contents.
1085 It is guaranteed by the caller to be long enough to save sizeof
1088 FIXME: This size is target_arch dependent and should be available in
1089 the target_arch transfer vector, if we ever have one... */
1092 es1800_insert_breakpoint (CORE_ADDR addr
, char *contents_cache
)
1096 val
= target_read_memory (addr
, contents_cache
, sizeof (es1800_break_insn
));
1100 val
= target_write_memory (addr
, es1800_break_insn
,
1101 sizeof (es1800_break_insn
));
1108 /* Write back the stashed instruction
1110 addr - is the target location in the target machine.
1111 contents_cache - is a pointer to memory allocated for saving the target contents.
1112 It is guaranteed by the caller to be long enough to save sizeof
1113 BREAKPOINT bytes. */
1116 es1800_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
1119 return (target_write_memory (addr
, contents_cache
,
1120 sizeof (es1800_break_insn
)));
1123 /* create_break_insn ()
1124 Primitive datastructures containing the es1800 breakpoint instruction */
1127 es1800_create_break_insn (char *ins
, int vec
)
1138 Seach for breakpoint routine in emulator memory.
1139 returns non-zero on failure
1140 vec - trap vector used for breakpoints */
1143 verify_break (int vec
)
1145 CORE_ADDR memaddress
;
1147 char *instr
= "NqNqNqNs"; /* breakpoint routine */
1150 get_break_addr (vec
, &memaddress
);
1154 status
= target_read_memory (memaddress
, buf
, 8);
1157 memory_error (status
, memaddress
);
1159 return (strcmp (instr
, buf
));
1165 /* get_break_addr ()
1166 find address of breakpoint routine
1167 vec - trap vector used for breakpoints
1168 addrp - store the address here */
1171 get_break_addr (int vec
, CORE_ADDR
*addrp
)
1173 CORE_ADDR memaddress
= 0;
1182 send_with_reply ("VBR ", buf
, sizeof (buf
));
1184 for (k
= 0; k
< 4; k
++)
1186 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
1188 error ("Emulator reply is too short: %s", buf
);
1190 base_addr
[k
] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
1192 /* base addr of exception vector table */
1193 memaddress
= *((CORE_ADDR
*) base_addr
);
1196 memaddress
+= (vec
+ 32) * 4; /* address of trap vector */
1197 status
= target_read_memory (memaddress
, (char *) addrp
, 4);
1200 memory_error (status
, memaddress
);
1205 /* Kill an inferior process */
1210 if (!ptid_equal (inferior_ptid
, null_ptid
))
1212 inferior_ptid
= null_ptid
;
1213 es1800_mourn_inferior ();
1218 /* Load a file to the ES1800 emulator.
1219 Converts the file from a.out format into Extended Tekhex format
1220 before the file is loaded.
1221 Also loads the trap routine, and sets the ES1800 breakpoint on it
1222 filename - the a.out to be loaded
1223 from_tty - says whether to be verbose or not
1224 FIXME Uses emulator overlay memory for trap routine */
1227 es1800_load (char *filename
, int from_tty
)
1233 struct cleanup
*old_chain
;
1234 int es1800_load_format
= 5;
1236 if (es1800_desc
== NULL
)
1238 printf ("No emulator attached, type emulator-command first\n");
1242 filename
= tilde_expand (filename
);
1243 make_cleanup (xfree
, filename
);
1245 switch (es1800_load_format
)
1247 case 2: /* Extended Tekhex */
1250 printf ("Converting \"%s\" to Extended Tekhex Format\n", filename
);
1252 sprintf (buf
, "tekhex %s", filename
);
1254 sprintf (loadname
, "out.hex");
1257 case 5: /* Motorola S-rec */
1260 printf ("Converting \"%s\" to Motorola S-record format\n",
1263 /* in the future the source code in copy (part of binutils-1.93) will
1264 be included in this file */
1266 "copy -s \"a.out-sunos-big\" -d \"srec\" %s /tmp/out.hex",
1269 sprintf (loadname
, "/tmp/out.hex");
1273 error ("Downloading format not defined\n");
1276 breakpoint_init_inferior ();
1277 inferior_ptid
= null_ptid
;
1280 printf ("Downloading \"%s\" to the ES 1800\n", filename
);
1282 if ((instream
= fopen (loadname
, "r")) == NULL
)
1284 perror_with_name ("fopen:");
1287 old_chain
= make_cleanup (fclose
, instream
);
1292 download (instream
, from_tty
, es1800_load_format
);
1294 /* if breakpoint routine is not present anymore we have to check
1295 whether to download a new breakpoint routine or not */
1297 if ((verify_break (es1800_break_vec
) != 0)
1298 && query ("No breakpoint routine in ES 1800 emulator!\nDownload a breakpoint routine to the emulator? "))
1301 printf ("Using break vector 0x%x\n", es1800_break_vec
);
1302 sprintf (buf
, "0x%x ", es1800_break_vec
);
1303 printf ("Give the start address of the breakpoint routine: ");
1304 fgets (buf
+ strlen (buf
), sizeof (buf
) - strlen (buf
), stdin
);
1305 es1800_init_break (buf
, 0);
1308 do_cleanups (old_chain
);
1310 readchar (); /* FIXME I am getting a ^G = 7 after the prompt */
1313 if (fclose (instream
) == EOF
)
1318 if (es1800_load_format
!= 2)
1320 sprintf (buf
, "/usr/bin/rm %s", loadname
);
1324 symbol_file_add_main (filename
, from_tty
); /* reading symbol table */
1330 #define NUMCPYBYTES 20
1333 bfd_copy (bfd
*from_bfd
, bfd
*to_bfd
)
1337 char buf
[NUMCPYBYTES
];
1339 for (p
= from_bfd
->sections
; p
!= NULL
; p
= p
->next
)
1341 printf (" Copying section %s. Size = %x.\n", p
->name
, p
->_cooked_size
);
1342 printf (" vma = %x, offset = %x, output_sec = %x\n",
1343 p
->vma
, p
->output_offset
, p
->output_section
);
1344 new = bfd_make_section (to_bfd
, p
->name
);
1345 if (p
->_cooked_size
&&
1346 !bfd_set_section_size (to_bfd
, new, p
->_cooked_size
))
1348 error ("Wrong BFD size!\n");
1350 if (!bfd_set_section_flags (to_bfd
, new, p
->flags
))
1352 error ("bfd_set_section_flags");
1356 for (i
= 0; (i
+ NUMCPYBYTES
) < p
->_cooked_size
; i
+= NUMCPYBYTES
)
1358 if (!bfd_get_section_contents (from_bfd
, p
, (PTR
) buf
, (file_ptr
) i
,
1359 (bfd_size_type
) NUMCPYBYTES
))
1361 error ("bfd_get_section_contents\n");
1363 if (!bfd_set_section_contents (to_bfd
, new, (PTR
) buf
, (file_ptr
) i
,
1364 (bfd_size_type
) NUMCPYBYTES
))
1366 error ("bfd_set_section_contents\n");
1369 bfd_get_section_contents (from_bfd
, p
, (PTR
) buf
, (file_ptr
) i
,
1370 (bfd_size_type
) (p
->_cooked_size
- i
));
1371 bfd_set_section_contents (to_bfd
, new, (PTR
) buf
, (file_ptr
) i
,
1372 (bfd_size_type
) (p
->_cooked_size
- i
));
1378 /* Start an process on the es1800 and set inferior_ptid to the new
1380 execfile - the file to run
1381 args - arguments passed to the program
1382 env - the environment vector to pass */
1385 es1800_create_inferior (char *execfile
, char *args
, char **env
)
1390 struct expression
*expr
;
1391 register struct cleanup
*old_chain
= 0;
1397 error ("Can't pass arguments to remote ES1800 process");
1401 if (query ("Use 'start' as entry point? "))
1403 expr
= parse_c_expression ("start");
1404 old_chain
= make_cleanup (free_current_contents
, &expr
);
1405 val
= evaluate_expression (expr
);
1406 entry_pt
= (val
->location
).address
;
1410 printf ("Enter the program's entry point (in hexadecimal): ");
1411 scanf ("%x", &entry_pt
);
1415 if (execfile
== 0 || exec_bfd
== 0)
1417 error ("No executable file specified");
1420 entry_pt
= (int) bfd_get_start_address (exec_bfd
);
1424 /* Now that we have a child process, make it our target. */
1426 push_target (&es1800_child_ops
);
1428 /* The "process" (board) is already stopped awaiting our commands, and
1429 the program is already downloaded. We just set its PC and go. */
1431 inferior_ptid
= pid_to_ptid (pid
); /* Needed for wait_for_inferior below */
1433 clear_proceed_status ();
1435 /* Tell wait_for_inferior that we've started a new process. */
1437 init_wait_for_inferior ();
1439 /* Set up the "saved terminal modes" of the inferior
1440 based on what modes we are starting it with. */
1442 target_terminal_init ();
1444 /* Install inferior's terminal modes. */
1446 target_terminal_inferior ();
1448 /* remote_start (args); */
1449 /* trap_expected = 0; */
1450 /* insert_step_breakpoint (); FIXME, do we need this? */
1452 /* Let 'er rip... */
1453 proceed ((CORE_ADDR
) entry_pt
, TARGET_SIGNAL_DEFAULT
, 0);
1458 /* The process has died, clean up. */
1461 es1800_mourn_inferior (void)
1463 remove_breakpoints ();
1464 unpush_target (&es1800_child_ops
);
1465 generic_mourn_inferior (); /* Do all the proper things now */
1468 /* ES1800-protocol specific routines */
1470 /* Keep discarding input from the remote system, until STRING is found.
1471 Let the user break out immediately.
1472 string - the string to expect
1473 nowait - break out if string not the emulator's first respond otherwise
1474 read until string is found (== 0) */
1477 expect (char *string
, int nowait
)
1490 if (c
== toupper (*p
))
1505 printf ("\'%s\' expected\n", string
);
1506 printf ("char %d is %d", p
- string
, c
);
1512 /* Keep discarding input until we see the prompt. */
1515 expect_prompt (void)
1521 /* Read one character */
1525 /* read from stdin */
1533 printf ("readchar, give one character\n");
1536 #if defined (LOG_FILE)
1537 putc (buf
[0] & 0x7f, log_file
);
1540 return (buf
[0] & 0x7f);
1543 #else /* !DEBUG_STDIN */
1545 /* Read a character from the remote system, doing all the fancy
1553 ch
= serial_readchar (es1800_desc
, timeout
);
1555 /* FIXME: doing an error() here will probably cause trouble, at least if from
1557 if (ch
== SERIAL_TIMEOUT
)
1558 error ("Timeout reading from remote system.");
1559 else if (ch
== SERIAL_ERROR
)
1560 perror_with_name ("remote read");
1562 #if defined (LOG_FILE)
1563 putc (ch
& 0x7f, log_file
);
1570 #endif /* DEBUG_STDIN */
1573 /* Send a command to the emulator and save the reply.
1574 Report an error if we get an error reply.
1575 string - the es1800 command
1576 buf - containing the emulator reply on return
1577 len - size of buf */
1580 send_with_reply (char *string
, char *buf
, int len
)
1583 serial_write (es1800_desc
, "\r", 1);
1590 getmessage (buf
, len
);
1594 /* Send the command in STR to the emulator adding \r. check
1595 the echo for consistency.
1596 string - the es1800 command */
1599 send_command (char *string
)
1602 serial_write (es1800_desc
, "\r", 1);
1612 string - the es1800 command */
1619 fprintf (stderr
, "Sending: %s\n", string
);
1621 serial_write (es1800_desc
, string
, strlen (string
));
1625 /* Read a message from the emulator and store it in BUF.
1626 buf - containing the emulator reply on return
1627 len - size of buf */
1630 getmessage (char *buf
, int len
)
1634 int prompt_found
= 0;
1637 #if defined (LOG_FILE)
1638 /* This is a convenient place to do this. The idea is to do it often
1639 enough that we never lose much data if we terminate abnormally. */
1649 if (len
-- < 2) /* char and terminaling NULL */
1651 error ("input buffer overrun\n");
1656 if ((c
== '>') && (*(bp
- 1) == ' '))
1661 while (!prompt_found
);
1666 fprintf (stderr
, "message received :%s\n", buf
);
1671 download (FILE *instream
, int from_tty
, int format
)
1677 send_command ("SET #2,$1A"); /* reset char = ^Z */
1678 send_command ("SET #3,$11,$13"); /* XON XOFF */
1681 send_command ("SET #26,#2");
1685 send_command ("SET #26,#5"); /* Format=Extended Tekhex */
1687 send_command ("DFB = $10");
1688 send_command ("PUR");
1689 send_command ("CES");
1694 printf (" 0 records loaded...\r");
1696 while (fgets (buf
, 160, instream
))
1701 printf ("%5d\b\b\b\b\b", ++i
);
1704 if ((c
= readchar ()) != 006)
1706 error ("expected ACK");
1715 /* Additional commands */
1717 #if defined (TIOCGETP) && defined (FNDELAY) && defined (EWOULDBLOCK)
1718 #define PROVIDE_TRANSPARENT
1721 #ifdef PROVIDE_TRANSPARENT
1722 /* Talk directly to the emulator
1723 FIXME, uses busy wait, and is SUNOS (or at least BSD) specific */
1727 es1800_transparent (char *args
, int from_tty
)
1730 struct sgttyb modebl
;
1733 struct sgttyb console_mode_save
;
1734 int console_fc_save
;
1739 char consolebuf
[80];
1741 char es1800_buf
[80];
1745 if (es1800_desc
== NULL
)
1747 printf ("No emulator attached, type emulator-command first\n");
1752 printf ("You are now communicating directly with the ES 1800 emulator.\n");
1753 printf ("To leave this mode (transparent mode), press ^E.\n");
1758 if ((console
= open ("/dev/tty", O_RDWR
)) == -1)
1760 perror_with_name ("/dev/tty:");
1763 if ((fcflag
= fcntl (console
, F_GETFL
, 0)) == -1)
1765 perror_with_name ("fcntl console");
1768 console_fc_save
= fcflag
;
1769 fcflag
= fcflag
| FNDELAY
;
1771 if (fcntl (console
, F_SETFL
, fcflag
) == -1)
1773 perror_with_name ("fcntl console");
1776 if (ioctl (console
, TIOCGETP
, &modebl
))
1778 perror_with_name ("ioctl console");
1781 console_mode_save
= modebl
;
1782 modebl
.sg_flags
= RAW
;
1784 if (ioctl (console
, TIOCSETP
, &modebl
))
1786 perror_with_name ("ioctl console");
1789 if ((fcflag
= fcntl (deprecated_serial_fd (es1800_desc
), F_GETFL
, 0)) == -1)
1791 perror_with_name ("fcntl serial");
1794 es1800_fc_save
= fcflag
;
1795 fcflag
= fcflag
| FNDELAY
;
1797 if (fcntl (deprecated_serial_fd (es1800_desc
), F_SETFL
, fcflag
) == -1)
1799 perror_with_name ("fcntl serial");
1804 cc
= read (console
, inputbuf
, inputcnt
);
1807 if ((*inputbuf
& 0x7f) == 0x05)
1811 for (i
= 0; i
< cc
;)
1813 es1800_buf
[es1800_cnt
++] = inputbuf
[i
++];
1815 if ((cc
= serial_write (es1800_desc
, es1800_buf
, es1800_cnt
)) == -1)
1817 perror_with_name ("FEL! write:");
1820 if (es1800_cnt
&& cc
)
1822 for (i
= 0; i
< es1800_cnt
; i
++)
1824 es1800_buf
[i
] = es1800_buf
[cc
+ i
];
1828 else if (errno
!= EWOULDBLOCK
)
1830 perror_with_name ("FEL! read:");
1833 cc
= read (deprecated_serial_fd (es1800_desc
), inputbuf
, inputcnt
);
1836 for (i
= 0; i
< cc
;)
1838 consolebuf
[consolecnt
++] = inputbuf
[i
++];
1840 if ((cc
= write (console
, consolebuf
, consolecnt
)) == -1)
1842 perror_with_name ("FEL! write:");
1845 if (consolecnt
&& cc
)
1847 for (i
= 0; i
< consolecnt
; i
++)
1849 consolebuf
[i
] = consolebuf
[cc
+ i
];
1853 else if (errno
!= EWOULDBLOCK
)
1855 perror_with_name ("FEL! read:");
1859 console_fc_save
= console_fc_save
& !FNDELAY
;
1860 if (fcntl (console
, F_SETFL
, console_fc_save
) == -1)
1862 perror_with_name ("FEL! fcntl");
1865 if (ioctl (console
, TIOCSETP
, &console_mode_save
))
1867 perror_with_name ("FEL! ioctl");
1872 if (fcntl (deprecated_serial_fd (es1800_desc
), F_SETFL
, es1800_fc_save
) == -1)
1874 perror_with_name ("FEL! fcntl");
1880 #endif /* PROVIDE_TRANSPARENT */
1883 es1800_init_break (char *args
, int from_tty
)
1885 CORE_ADDR memaddress
= 0;
1894 error_no_arg ("a trap vector");
1897 if (!(space_index
= strchr (args
, ' ')))
1899 error ("Two arguments needed (trap vector and address of break routine).\n");
1902 *space_index
= '\0';
1904 es1800_break_vec
= strtol (args
, (char **) NULL
, 0);
1905 es1800_break_address
= parse_and_eval_address (space_index
+ 1);
1907 es1800_create_break_insn (es1800_break_insn
, es1800_break_vec
);
1911 send_with_reply ("VBR ", buf
, sizeof (buf
));
1913 for (k
= 0; k
< 4; k
++)
1915 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
1917 error ("Emulator reply is too short: %s", buf
);
1919 base_addr
[k
] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
1921 /* base addr of exception vector table */
1922 memaddress
= *((CORE_ADDR
*) base_addr
);
1925 memaddress
+= (es1800_break_vec
+ 32) * 4; /* address of trap vector */
1927 sprintf (buf
, "@.L%lx=$%lx", memaddress
, es1800_break_address
);
1928 send_command (buf
); /* set the address of the break routine in the */
1931 sprintf (buf
, "@.L%lx=$4E714E71", es1800_break_address
); /* NOP; NOP */
1933 sprintf (buf
, "@.L%lx=$4E714E73", es1800_break_address
+ 4); /* NOP; RTE */
1936 sprintf (buf
, "AC2=$%lx", es1800_break_address
+ 4);
1937 /* breakpoint at es1800-break_address */
1939 send_command ("WHEN AC2 THEN BRK"); /* ie in exception routine */
1943 printf ("Breakpoint (trap $%x) routine at address: %lx\n",
1944 es1800_break_vec
, es1800_break_address
);
1949 es1800_child_open (char *arg
, int from_tty
)
1951 error ("Use the \"run\" command to start a child process.");
1955 es1800_child_detach (char *args
, int from_tty
)
1959 error ("Argument given to \"detach\" when remotely debugging.");
1965 printf ("Ending debugging the process %d.\n", PIDGET (inferior_ptid
));
1970 /* Define the target subroutine names */
1972 struct target_ops es1800_ops
;
1975 init_es1800_ops (void)
1977 es1800_ops
.to_shortname
= "es1800";
1978 es1800_ops
.to_longname
= "Remote serial target in ES1800-emulator protocol";
1979 es1800_ops
.to_doc
= "Remote debugging on the es1800 emulator via a serial line.\n\
1980 Specify the serial device it is connected to (e.g. /dev/ttya).";
1981 es1800_ops
.to_open
= es1800_open
;
1982 es1800_ops
.to_close
= es1800_close
;
1983 es1800_ops
.to_attach
= es1800_attach
;
1984 es1800_ops
.to_post_attach
= NULL
;
1985 es1800_ops
.to_require_attach
= NULL
;
1986 es1800_ops
.to_detach
= es1800_detach
;
1987 es1800_ops
.to_require_detach
= NULL
;
1988 es1800_ops
.to_resume
= es1800_resume
;
1989 es1800_ops
.to_wait
= NULL
;
1990 es1800_ops
.to_post_wait
= NULL
;
1991 es1800_ops
.to_fetch_registers
= NULL
;
1992 es1800_ops
.to_store_registers
= NULL
;
1993 es1800_ops
.to_prepare_to_store
= es1800_prepare_to_store
;
1994 es1800_ops
.to_xfer_memory
= es1800_xfer_inferior_memory
;
1995 es1800_ops
.to_files_info
= es1800_files_info
;
1996 es1800_ops
.to_insert_breakpoint
= es1800_insert_breakpoint
;
1997 es1800_ops
.to_remove_breakpoint
= es1800_remove_breakpoint
;
1998 es1800_ops
.to_terminal_init
= NULL
;
1999 es1800_ops
.to_terminal_inferior
= NULL
;
2000 es1800_ops
.to_terminal_ours_for_output
= NULL
;
2001 es1800_ops
.to_terminal_ours
= NULL
;
2002 es1800_ops
.to_terminal_info
= NULL
;
2003 es1800_ops
.to_kill
= NULL
;
2004 es1800_ops
.to_load
= es1800_load
;
2005 es1800_ops
.to_lookup_symbol
= NULL
;
2006 es1800_ops
.to_create_inferior
= es1800_create_inferior
;
2007 es1800_ops
.to_post_startup_inferior
= NULL
;
2008 es1800_ops
.to_acknowledge_created_inferior
= NULL
;
2009 es1800_ops
.to_clone_and_follow_inferior
= NULL
;
2010 es1800_ops
.to_post_follow_inferior_by_clone
= NULL
;
2011 es1800_ops
.to_insert_fork_catchpoint
= NULL
;
2012 es1800_ops
.to_remove_fork_catchpoint
= NULL
;
2013 es1800_ops
.to_insert_vfork_catchpoint
= NULL
;
2014 es1800_ops
.to_remove_vfork_catchpoint
= NULL
;
2015 es1800_ops
.to_has_forked
= NULL
;
2016 es1800_ops
.to_has_vforked
= NULL
;
2017 es1800_ops
.to_can_follow_vfork_prior_to_exec
= NULL
;
2018 es1800_ops
.to_post_follow_vfork
= NULL
;
2019 es1800_ops
.to_insert_exec_catchpoint
= NULL
;
2020 es1800_ops
.to_remove_exec_catchpoint
= NULL
;
2021 es1800_ops
.to_has_execd
= NULL
;
2022 es1800_ops
.to_reported_exec_events_per_exec_call
= NULL
;
2023 es1800_ops
.to_has_exited
= NULL
;
2024 es1800_ops
.to_mourn_inferior
= NULL
;
2025 es1800_ops
.to_can_run
= 0;
2026 es1800_ops
.to_notice_signals
= 0;
2027 es1800_ops
.to_thread_alive
= 0;
2028 es1800_ops
.to_stop
= 0;
2029 es1800_ops
.to_pid_to_exec_file
= NULL
;
2030 es1800_ops
.to_stratum
= core_stratum
;
2031 es1800_ops
.DONT_USE
= 0;
2032 es1800_ops
.to_has_all_memory
= 0;
2033 es1800_ops
.to_has_memory
= 1;
2034 es1800_ops
.to_has_stack
= 0;
2035 es1800_ops
.to_has_registers
= 0;
2036 es1800_ops
.to_has_execution
= 0;
2037 es1800_ops
.to_sections
= NULL
;
2038 es1800_ops
.to_sections_end
= NULL
;
2039 es1800_ops
.to_magic
= OPS_MAGIC
;
2042 /* Define the target subroutine names */
2044 struct target_ops es1800_child_ops
;
2047 init_es1800_child_ops (void)
2049 es1800_child_ops
.to_shortname
= "es1800_process";
2050 es1800_child_ops
.to_longname
= "Remote serial target in ES1800-emulator protocol";
2051 es1800_child_ops
.to_doc
= "Remote debugging on the es1800 emulator via a serial line.\n\
2052 Specify the serial device it is connected to (e.g. /dev/ttya).";
2053 es1800_child_ops
.to_open
= es1800_child_open
;
2054 es1800_child_ops
.to_close
= NULL
;
2055 es1800_child_ops
.to_attach
= es1800_attach
;
2056 es1800_child_ops
.to_post_attach
= NULL
;
2057 es1800_child_ops
.to_require_attach
= NULL
;
2058 es1800_child_ops
.to_detach
= es1800_child_detach
;
2059 es1800_child_ops
.to_require_detach
= NULL
;
2060 es1800_child_ops
.to_resume
= es1800_resume
;
2061 es1800_child_ops
.to_wait
= es1800_wait
;
2062 es1800_child_ops
.to_post_wait
= NULL
;
2063 es1800_child_ops
.to_fetch_registers
= es1800_fetch_register
;
2064 es1800_child_ops
.to_store_registers
= es1800_store_register
;
2065 es1800_child_ops
.to_prepare_to_store
= es1800_prepare_to_store
;
2066 es1800_child_ops
.to_xfer_memory
= es1800_xfer_inferior_memory
;
2067 es1800_child_ops
.to_files_info
= es1800_files_info
;
2068 es1800_child_ops
.to_insert_breakpoint
= es1800_insert_breakpoint
;
2069 es1800_child_ops
.to_remove_breakpoint
= es1800_remove_breakpoint
;
2070 es1800_child_ops
.to_terminal_init
= NULL
;
2071 es1800_child_ops
.to_terminal_inferior
= NULL
;
2072 es1800_child_ops
.to_terminal_ours_for_output
= NULL
;
2073 es1800_child_ops
.to_terminal_ours
= NULL
;
2074 es1800_child_ops
.to_terminal_info
= NULL
;
2075 es1800_child_ops
.to_kill
= es1800_kill
;
2076 es1800_child_ops
.to_load
= es1800_load
;
2077 es1800_child_ops
.to_lookup_symbol
= NULL
;
2078 es1800_child_ops
.to_create_inferior
= es1800_create_inferior
;
2079 es1800_child_ops
.to_post_startup_inferior
= NULL
;
2080 es1800_child_ops
.to_acknowledge_created_inferior
= NULL
;
2081 es1800_child_ops
.to_clone_and_follow_inferior
= NULL
;
2082 es1800_child_ops
.to_post_follow_inferior_by_clone
= NULL
;
2083 es1800_child_ops
.to_insert_fork_catchpoint
= NULL
;
2084 es1800_child_ops
.to_remove_fork_catchpoint
= NULL
;
2085 es1800_child_ops
.to_insert_vfork_catchpoint
= NULL
;
2086 es1800_child_ops
.to_remove_vfork_catchpoint
= NULL
;
2087 es1800_child_ops
.to_has_forked
= NULL
;
2088 es1800_child_ops
.to_has_vforked
= NULL
;
2089 es1800_child_ops
.to_can_follow_vfork_prior_to_exec
= NULL
;
2090 es1800_child_ops
.to_post_follow_vfork
= NULL
;
2091 es1800_child_ops
.to_insert_exec_catchpoint
= NULL
;
2092 es1800_child_ops
.to_remove_exec_catchpoint
= NULL
;
2093 es1800_child_ops
.to_has_execd
= NULL
;
2094 es1800_child_ops
.to_reported_exec_events_per_exec_call
= NULL
;
2095 es1800_child_ops
.to_has_exited
= NULL
;
2096 es1800_child_ops
.to_mourn_inferior
= es1800_mourn_inferior
;
2097 es1800_child_ops
.to_can_run
= 0;
2098 es1800_child_ops
.to_notice_signals
= 0;
2099 es1800_child_ops
.to_thread_alive
= 0;
2100 es1800_child_ops
.to_stop
= 0;
2101 es1800_child_ops
.to_pid_to_exec_file
= NULL
;
2102 es1800_child_ops
.to_stratum
= process_stratum
;
2103 es1800_child_ops
.DONT_USE
= 0;
2104 es1800_child_ops
.to_has_all_memory
= 1;
2105 es1800_child_ops
.to_has_memory
= 1;
2106 es1800_child_ops
.to_has_stack
= 1;
2107 es1800_child_ops
.to_has_registers
= 1;
2108 es1800_child_ops
.to_has_execution
= 1;
2109 es1800_child_ops
.to_sections
= NULL
;
2110 es1800_child_ops
.to_sections_end
= NULL
;
2111 es1800_child_ops
.to_magic
= OPS_MAGIC
;
2115 _initialize_es1800 (void)
2118 init_es1800_child_ops ();
2119 add_target (&es1800_ops
);
2120 add_target (&es1800_child_ops
);
2121 #ifdef PROVIDE_TRANSPARENT
2122 add_com ("transparent", class_support
, es1800_transparent
,
2123 "Start transparent communication with the ES 1800 emulator.");
2124 #endif /* PROVIDE_TRANSPARENT */
2125 add_com ("init_break", class_support
, es1800_init_break
,
2126 "Download break routine and initialize break facility on ES 1800");