1 /* Memory-access and commands for remote es1800 processes, for GDB.
2 Copyright (C) 1988, 1992 Free Software Foundation, Inc.
4 This file is added to GDB to make it possible to do debugging via an
5 ES-1800 emulator. The code was originally written by Johan Holmberg
6 TT/SJ Ericsson Telecom AB and later modified by Johan Henriksson
7 TT/SJ. It was modified for gdb 4.0 by TX/DK Jan Nordenand by TX/DKG
10 This file is part of GDB.
12 GDB is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 1, or (at your option)
17 GDB is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. */
28 /* Emulator communication protocol.
29 All values are encoded in ascii hex digits.
36 - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - -- 6 - - 7 -
37 D = XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
38 A = XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
39 PC = XXXXXX SSP = XXXXXX USP = XXXXXX SR = XXXXXXXX
41 Each byte of register data is described by two hex digits.
63 Each byte of register data is described by two hex digits.
69 AA..AA is address, XXXXXXX is the contents
74 AA..AA is address, XXXXXXXX is data
80 AA..AA is address to resume. If AA..AA is omitted, resume at same address.
86 AA..AA is address to resume. If AA..AA is omitted, resume at same address.
96 #include <sys/ioctl.h>
103 #include "gdb_string.h"
105 #include "inferior.h"
107 #include "gdb_wait.h"
109 #include "remote-utils.h"
113 /* Prototypes for local functions */
115 static void es1800_child_detach (char *, int);
117 static void es1800_child_open (char *, int);
119 static void es1800_transparent (char *, int);
121 static void es1800_create_inferior (char *, char *, char **);
123 static void es1800_load (char *, int);
125 static void es1800_kill (void);
127 static int verify_break (int);
129 static int es1800_remove_breakpoint (CORE_ADDR
, char *);
131 static int es1800_insert_breakpoint (CORE_ADDR
, char *);
133 static void es1800_files_info (struct target_ops
*);
136 es1800_xfer_inferior_memory (CORE_ADDR
, char *, int, int,
137 struct target_ops
*);
139 static void es1800_prepare_to_store (void);
141 static int es1800_wait (int, struct target_waitstatus
*);
143 static void es1800_resume (int, int, enum target_signal
);
145 static void es1800_detach (char *, int);
147 static void es1800_attach (char *, int);
149 static int damn_b (char *);
151 static void es1800_open (char *, int);
153 static void es1800_timer (void);
155 static void es1800_reset (char *);
157 static void es1800_request_quit (void);
159 static int readchar (void);
161 static void expect (char *, int);
163 static void expect_prompt (void);
165 static void download (FILE *, int, int);
168 static void bfd_copy (bfd
*, bfd
*);
171 static void get_break_addr (int, CORE_ADDR
*);
173 static int fromhex (int);
175 static int tohex (int);
177 static void es1800_close (int);
179 static void es1800_fetch_registers (void);
181 static void es1800_fetch_register (int);
183 static void es1800_store_register (int);
185 static void es1800_read_bytes (CORE_ADDR
, char *, int);
187 static void es1800_write_bytes (CORE_ADDR
, char *, int);
189 static void send_with_reply (char *, char *, int);
191 static void send_command (char *);
193 static void send (char *);
195 static void getmessage (char *, int);
197 static void es1800_mourn_inferior (void);
199 static void es1800_create_break_insn (char *, int);
201 static void es1800_init_break (char *, int);
203 /* Local variables */
205 /* FIXME: Convert this to use "set remotedebug" instead. */
206 #define LOG_FILE "es1800.log"
207 #if defined (LOG_FILE)
208 static FILE *log_file
;
211 extern struct target_ops es1800_ops
; /* Forward decl */
212 extern struct target_ops es1800_child_ops
; /* Forward decl */
215 static int timeout
= 100;
216 static char *savename
; /* Name of i/o device used */
217 static serial_ttystate es1800_saved_ttystate
;
218 static int es1800_fc_save
; /* Save fcntl state */
220 /* indicates that the emulator uses 32-bit data-adress (68020-mode)
221 instead of 24-bit (68000 -mode) */
225 #define MODE (m68020 ? "M68020" : "M68000" )
226 #define ES1800_BREAK_VEC (0xf)
228 /* Descriptor for I/O to remote machine. Initialize it to NULL so that
229 es1800_open knows that we don't have a file open when the program
232 static serial_t es1800_desc
= NULL
;
235 #define HDRLEN sizeof("@.BAAAAAAAA=$VV\r")
237 /* Maximum number of bytes to read/write at once. The value here
238 is chosen to fill up a packet. */
240 #define MAXBUFBYTES ((PBUFSIZ-150)*16/75 )
242 static int es1800_break_vec
= 0;
243 static char es1800_break_insn
[2];
244 static long es1800_break_address
;
245 static void (*old_sigint
) (); /* Old signal-handler for sigint */
246 static jmp_buf interrupt
;
248 /* Local signalhandler to allow breaking tranfers or program run.
249 Rely on global variables: old_sigint(), interrupt */
252 es1800_request_quit ()
254 /* restore original signalhandler */
255 signal (SIGINT
, old_sigint
);
256 longjmp (interrupt
, 1);
261 Sending reset character(octal 32) to emulator.
262 quit - return to '(esgdb)' prompt or continue */
272 printf ("\nResetting emulator... ");
274 strcpy (buf
, "\032");
284 /* Open a connection to a remote debugger and push the new target
285 onto the stack. Check if the emulator is responding and find out
286 what kind of processor the emulator is connected to.
287 Initiate the breakpoint handling in the emulator.
289 name - the filename used for communication (ex. '/dev/tta')
290 from_tty - says whether to be verbose or not */
293 es1800_open (name
, 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 (quitting
)
429 if (es1800_desc
!= NULL
)
431 printf ("\nClosing connection to emulator...\n");
432 if (SERIAL_SET_TTY_STATE (es1800_desc
, es1800_saved_ttystate
) < 0)
433 print_sys_errmsg ("warning: unable to restore tty state", errno
);
434 fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_SETFL
, es1800_fc_save
);
435 SERIAL_CLOSE (es1800_desc
);
438 if (savename
!= NULL
)
444 #if defined (LOG_FILE)
446 if (log_file
!= NULL
)
448 if (ferror (log_file
))
450 printf ("Error writing log file.\n");
452 if (fclose (log_file
) != 0)
454 printf ("Error closing log file.\n");
459 #endif /* LOG_FILE */
463 /* Attaches to a process on the target side
464 proc_id - the id of the process to be attached.
465 from_tty - says whether to be verbose or not */
468 es1800_attach (args
, from_tty
)
472 error ("Cannot attach to pid %s, this feature is not implemented yet.",
477 /* Takes a program previously attached to and detaches it.
478 We better not have left any breakpoints
479 in the program or it'll die when it hits one.
480 Close the open connection to the remote debugger.
481 Use this when you want to detach and do something else
484 args - arguments given to the 'detach' command
485 from_tty - says whether to be verbose or not */
488 es1800_detach (args
, from_tty
)
494 error ("Argument given to \"detach\" when remotely debugging.");
499 printf ("Ending es1800 remote debugging.\n");
504 /* Tell the remote machine to resume.
505 step - single-step or run free
506 siggnal - the signal value to be given to the target (0 = no signal) */
509 es1800_resume (pid
, step
, siggnal
)
512 enum target_signal siggnal
;
518 error ("Can't send signals to a remote system.");
522 strcpy (buf
, "STP\r");
527 send_command ("RBK");
531 /* Wait until the remote machine stops, then return,
532 storing status in STATUS just as `wait' would.
536 es1800_wait (pid
, status
)
538 struct target_waitstatus
*status
;
540 unsigned char buf
[PBUFSIZ
];
541 int old_timeout
= timeout
;
543 status
->kind
= TARGET_WAITKIND_EXITED
;
544 status
->value
.integer
= 0;
546 timeout
= 0; /* Don't time out -- user program is running. */
547 if (!setjmp (interrupt
))
549 old_sigint
= signal (SIGINT
, es1800_request_quit
);
552 getmessage (buf
, sizeof (buf
));
553 if (strncmp (buf
, "\r\n* BREAK *", 11) == 0)
555 status
->kind
= TARGET_WAITKIND_STOPPED
;
556 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
557 send_command ("STP"); /* Restore stack and PC and such */
560 send_command ("STP");
564 if (strncmp (buf
, "STP\r\n ", 6) == 0)
566 status
->kind
= TARGET_WAITKIND_STOPPED
;
567 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
570 if (buf
[strlen (buf
) - 2] == 'R')
572 printf ("Unexpected emulator reply: \n%s\n", buf
);
576 printf ("Unexpected stop: \n%s\n", buf
);
577 status
->kind
= TARGET_WAITKIND_STOPPED
;
578 status
->value
.sig
= TARGET_SIGNAL_QUIT
;
586 printf ("\nStopping emulator...");
587 if (!setjmp (interrupt
))
589 old_sigint
= signal (SIGINT
, es1800_request_quit
);
590 send_command ("STP");
591 printf (" emulator stopped\n");
592 status
->kind
= TARGET_WAITKIND_STOPPED
;
593 status
->value
.sig
= TARGET_SIGNAL_INT
;
598 es1800_reset ((char *) 1);
601 signal (SIGINT
, old_sigint
);
602 timeout
= old_timeout
;
607 /* Fetch register values from remote machine.
608 regno - the register to be fetched (fetch all registers if -1) */
611 es1800_fetch_register (regno
)
618 static char regtab
[18][4] =
620 "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ",
621 "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP",
625 if ((regno
< 15) || (regno
== 16) || (regno
== 17))
628 send_with_reply (regtab
[regno
], buf
, sizeof (buf
));
630 for (k
= 0; k
< 4; k
++)
632 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
634 error ("Emulator reply is too short: %s", buf
);
636 registers
[r
++] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
641 es1800_fetch_registers ();
645 /* Read the remote registers into REGISTERS.
646 Always fetches all registers. */
649 es1800_fetch_registers ()
652 char SR_buf
[PBUFSIZ
];
658 send_with_reply ("DR", buf
, sizeof (buf
));
660 /* Reply is edited to a string that describes registers byte by byte,
661 each byte encoded as two hex characters. */
666 /* parsing row one - D0-D7-registers */
671 for (i
= 4; i
< 70; i
+= (i
== 39 ? 3 : 1))
673 for (k
= 0; k
< 4; k
++)
675 if (p
[i
+ 0] == 0 || p
[i
+ 1] == 0)
677 error ("Emulator reply is too short: %s", buf
);
679 registers
[r
++] = (fromhex (p
[i
+ 0]) * 16) + fromhex (p
[i
+ 1]);
685 /* parsing row two - A0-A6-registers */
690 for (i
= 4; i
< 61; i
+= (i
== 39 ? 3 : 1))
692 for (k
= 0; k
< 4; k
++)
694 if (p
[i
+ 0] == 0 || p
[i
+ 1] == 0)
696 error ("Emulator reply is too short: %s", buf
);
698 registers
[r
++] = (fromhex (p
[i
+ 0])) * 16 + fromhex (p
[i
+ 1]);
708 /* fetch SSP-, SR- and PC-registers */
710 /* first - check STATUS-word and decide which stackpointer to use */
712 send_with_reply ("SR", SR_buf
, sizeof (SR_buf
));
718 if (*p
== '3') /* use masterstackpointer MSP */
720 send_with_reply ("MSP", buf
, sizeof (buf
));
722 else if (*p
== '2') /* use interruptstackpointer ISP */
724 send_with_reply ("ISP", buf
, sizeof (buf
));
727 /* use userstackpointer USP */
729 send_with_reply ("USP", buf
, sizeof (buf
));
732 for (k
= 0; k
< 4; k
++)
734 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
736 error ("Emulator reply is too short: %s", buf
);
738 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
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
);
749 fromhex (SR_buf
[k
* 2 + 1]) * 16 + fromhex (SR_buf
[k
* 2 + 2]);
751 send_with_reply ("PC", buf
, sizeof (buf
));
753 for (k
= 0; k
< 4; k
++)
755 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
757 error ("Emulator reply is too short: %s", buf
);
759 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
765 if (*p
== '2') /* use supervisorstackpointer SSP */
767 send_with_reply ("SSP", buf
, sizeof (buf
));
770 /* use userstackpointer USP */
772 send_with_reply ("USP", buf
, sizeof (buf
));
775 /* fetch STACKPOINTER */
778 for (k
= 0; k
< 4; k
++)
780 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
782 error ("Emulator reply is too short: %s", buf
);
784 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
790 for (k
= 0; k
< 4; k
++)
792 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
794 error ("Emulator reply is too short: %s", buf
);
797 fromhex (SR_buf
[k
* 2 + 1]) * 16 + fromhex (SR_buf
[k
* 2 + 2]);
802 send_with_reply ("PC", buf
, sizeof (buf
));
804 for (k
= 0; k
< 4; k
++)
806 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
808 error ("Emulator reply is too short: %s", buf
);
810 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
815 /* Store register value, located in REGISTER, on the target processor.
816 regno - the register-number of the register to store
817 (-1 means store them all)
818 FIXME: Return errno value. */
821 es1800_store_register (regno
)
825 static char regtab
[18][4] =
827 "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ",
828 "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP",
833 char SR_buf
[PBUFSIZ
];
834 char stack_pointer
[4];
841 r
= (unsigned char *) registers
;
843 if (regno
== -1) /* write all registers */
849 /* write one register */
856 if ((regno
== -1) || (regno
== 15))
858 /* fetch current status */
859 send_with_reply ("SR", SR_buf
, sizeof (SR_buf
));
864 if (*p
== '3') /* use masterstackpointer MSP */
866 strcpy (stack_pointer
, "MSP");
870 if (*p
== '2') /* use interruptstackpointer ISP */
872 strcpy (stack_pointer
, "ISP");
876 strcpy (stack_pointer
, "USP"); /* use userstackpointer USP */
883 if (*p
== '2') /* use supervisorstackpointer SSP */
885 strcpy (stack_pointer
, "SSP");
889 strcpy (stack_pointer
, "USP"); /* use userstackpointer USP */
892 strcpy (regtab
[15], stack_pointer
);
895 for (i
= j
; i
< k
; i
++)
897 buf
[0] = regtab
[i
][0];
898 buf
[1] = regtab
[i
][1];
899 buf
[2] = regtab
[i
][2];
902 buf
[5] = tohex ((*r
>> 4) & 0x0f);
903 buf
[6] = tohex (*r
++ & 0x0f);
904 buf
[7] = tohex ((*r
>> 4) & 0x0f);
905 buf
[8] = tohex (*r
++ & 0x0f);
906 buf
[9] = tohex ((*r
>> 4) & 0x0f);
907 buf
[10] = tohex (*r
++ & 0x0f);
908 buf
[11] = tohex ((*r
>> 4) & 0x0f);
909 buf
[12] = tohex (*r
++ & 0x0f);
912 send_with_reply (buf
, buf
, sizeof (buf
)); /* FIXME, reply not used? */
917 /* Prepare to store registers. */
920 es1800_prepare_to_store ()
922 /* Do nothing, since we can store individual regs */
925 /* Convert hex digit A to a number. */
931 if (a
>= '0' && a
<= '9')
935 else if (a
>= 'a' && a
<= 'f')
939 else if (a
>= 'A' && a
<= 'F')
945 error ("Reply contains invalid hex digit");
951 /* Convert number NIB to a hex digit. */
963 return ('A' + nib
- 10);
967 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
968 to or from debugger address MYADDR. Write to inferior if WRITE is
969 nonzero. Returns length of data written or read; 0 for error.
971 memaddr - the target's address
972 myaddr - gdb's address
973 len - number of bytes
974 write - write if != 0 otherwise read */
977 es1800_xfer_inferior_memory (memaddr
, myaddr
, len
, write
, tops
)
982 struct target_ops
*tops
; /* Unused */
989 xfersize
= len
> MAXBUFBYTES
? MAXBUFBYTES
: len
;
992 es1800_write_bytes (memaddr
, myaddr
, xfersize
);
996 es1800_read_bytes (memaddr
, myaddr
, xfersize
);
1002 return (origlen
); /* no error possible */
1006 /* Write memory data directly to the emulator.
1007 This does not inform the data cache; the data cache uses this.
1008 MEMADDR is the address in the remote memory space.
1009 MYADDR is the address of the buffer in our space.
1010 LEN is the number of bytes.
1012 memaddr - the target's address
1013 myaddr - gdb's address
1014 len - number of bytes */
1017 es1800_write_bytes (memaddr
, myaddr
, len
)
1027 for (i
= 0; i
< len
; i
++)
1029 sprintf (buf
, "@.B$%x=$%x", memaddr
+ i
, (*p
++) & 0xff);
1030 send_with_reply (buf
, buf
, sizeof (buf
)); /* FIXME send_command? */
1035 /* Read memory data directly from the emulator.
1036 This does not use the data cache; the data cache uses this.
1038 memaddr - the target's address
1039 myaddr - gdb's address
1040 len - number of bytes */
1043 es1800_read_bytes (memaddr
, myaddr
, len
)
1048 static int DB_tab
[16] =
1049 {8, 11, 14, 17, 20, 23, 26, 29, 34, 37, 40, 43, 46, 49, 52, 55};
1056 if (len
> PBUFSIZ
/ 2 - 1)
1061 if (len
== 1) /* The emulator does not like expressions like: */
1063 len
= 2; /* DB.B $20018 TO $20018 */
1066 /* Reply describes registers byte by byte, each byte encoded as two hex
1069 sprintf (buf
, "DB.B $%x TO $%x", memaddr
, memaddr
+ len
- 1);
1070 send_with_reply (buf
, buf
, sizeof (buf
));
1072 low_addr
= memaddr
& 0x0f;
1073 for (i
= low_addr
; i
< low_addr
+ len
; i
++)
1075 if ((!(i
% 16)) && i
)
1076 { /* if (i = 16,32,48) */
1077 while (*p
++ != '\n')
1082 p
= b
+ DB_tab
[i
% 16] + (m68020
? 2 : 0);
1083 if (p
[0] == 32 || p
[1] == 32)
1085 error ("Emulator reply is too short: %s", buf
);
1087 myaddr
[i
- low_addr
] = fromhex (p
[0]) * 16 + fromhex (p
[1]);
1091 /* Information about the current target */
1094 es1800_files_info (tops
)
1095 struct target_ops
*tops
; /* Unused */
1097 printf ("ES1800 Attached to %s at %d baud in %s mode\n", savename
, 19200,
1102 /* We read the contents of the target location and stash it,
1103 then overwrite it with a breakpoint instruction.
1105 addr - is the target location in the target machine.
1106 contents_cache - is a pointer to memory allocated for saving the target contents.
1107 It is guaranteed by the caller to be long enough to save sizeof
1110 FIXME: This size is target_arch dependent and should be available in
1111 the target_arch transfer vector, if we ever have one... */
1114 es1800_insert_breakpoint (addr
, contents_cache
)
1116 char *contents_cache
;
1120 val
= target_read_memory (addr
, contents_cache
, sizeof (es1800_break_insn
));
1124 val
= target_write_memory (addr
, es1800_break_insn
,
1125 sizeof (es1800_break_insn
));
1132 /* Write back the stashed instruction
1134 addr - is the target location in the target machine.
1135 contents_cache - is a pointer to memory allocated for saving the target contents.
1136 It is guaranteed by the caller to be long enough to save sizeof
1137 BREAKPOINT bytes. */
1140 es1800_remove_breakpoint (addr
, contents_cache
)
1142 char *contents_cache
;
1145 return (target_write_memory (addr
, contents_cache
,
1146 sizeof (es1800_break_insn
)));
1149 /* create_break_insn ()
1150 Primitive datastructures containing the es1800 breakpoint instruction */
1153 es1800_create_break_insn (ins
, vec
)
1166 Seach for breakpoint routine in emulator memory.
1167 returns non-zero on failure
1168 vec - trap vector used for breakpoints */
1174 CORE_ADDR memaddress
;
1176 char *instr
= "NqNqNqNs"; /* breakpoint routine */
1179 get_break_addr (vec
, &memaddress
);
1183 status
= target_read_memory (memaddress
, buf
, 8);
1186 memory_error (status
, memaddress
);
1188 return (STRCMP (instr
, buf
));
1194 /* get_break_addr ()
1195 find address of breakpint routine
1196 vec - trap vector used for breakpoints
1197 addrp - store the address here */
1200 get_break_addr (vec
, addrp
)
1204 CORE_ADDR memaddress
= 0;
1213 send_with_reply ("VBR ", buf
, sizeof (buf
));
1215 for (k
= 0; k
< 4; k
++)
1217 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
1219 error ("Emulator reply is too short: %s", buf
);
1221 base_addr
[k
] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
1223 /* base addr of exception vector table */
1224 memaddress
= *((CORE_ADDR
*) base_addr
);
1227 memaddress
+= (vec
+ 32) * 4; /* address of trap vector */
1228 status
= target_read_memory (memaddress
, (char *) addrp
, 4);
1231 memory_error (status
, memaddress
);
1236 /* Kill an inferior process */
1241 if (inferior_pid
!= 0)
1244 es1800_mourn_inferior ();
1249 /* Load a file to the ES1800 emulator.
1250 Converts the file from a.out format into Extended Tekhex format
1251 before the file is loaded.
1252 Also loads the trap routine, and sets the ES1800 breakpoint on it
1253 filename - the a.out to be loaded
1254 from_tty - says whether to be verbose or not
1255 FIXME Uses emulator overlay memory for trap routine */
1258 es1800_load (filename
, from_tty
)
1266 struct cleanup
*old_chain
;
1267 int es1800_load_format
= 5;
1269 if (es1800_desc
== NULL
)
1271 printf ("No emulator attached, type emulator-command first\n");
1275 filename
= tilde_expand (filename
);
1276 make_cleanup (free
, filename
);
1278 switch (es1800_load_format
)
1280 case 2: /* Extended Tekhex */
1283 printf ("Converting \"%s\" to Extended Tekhex Format\n", filename
);
1285 sprintf (buf
, "tekhex %s", filename
);
1287 sprintf (loadname
, "out.hex");
1290 case 5: /* Motorola S-rec */
1293 printf ("Converting \"%s\" to Motorola S-record format\n",
1296 /* in the future the source code in copy (part of binutils-1.93) will
1297 be included in this file */
1299 "copy -s \"a.out-sunos-big\" -d \"srec\" %s /tmp/out.hex",
1302 sprintf (loadname
, "/tmp/out.hex");
1306 error ("Downloading format not defined\n");
1309 breakpoint_init_inferior ();
1313 printf ("Downloading \"%s\" to the ES 1800\n", filename
);
1315 if ((instream
= fopen (loadname
, "r")) == NULL
)
1317 perror_with_name ("fopen:");
1320 old_chain
= make_cleanup (fclose
, instream
);
1325 download (instream
, from_tty
, es1800_load_format
);
1327 /* if breakpoint routine is not present anymore we have to check
1328 whether to download a new breakpoint routine or not */
1330 if ((verify_break (es1800_break_vec
) != 0)
1331 && query ("No breakpoint routine in ES 1800 emulator!\nDownload a breakpoint routine to the emulator? "))
1334 printf ("Using break vector 0x%x\n", es1800_break_vec
);
1335 sprintf (buf
, "0x%x ", es1800_break_vec
);
1336 printf ("Give the start address of the breakpoint routine: ");
1337 fgets (buf
+ strlen (buf
), sizeof (buf
) - strlen (buf
), stdin
);
1338 es1800_init_break (buf
, 0);
1341 do_cleanups (old_chain
);
1343 readchar (); /* FIXME I am getting a ^G = 7 after the prompt */
1346 if (fclose (instream
) == EOF
)
1351 if (es1800_load_format
!= 2)
1353 sprintf (buf
, "/usr/bin/rm %s", loadname
);
1357 symbol_file_command (filename
, from_tty
); /* reading symbol table */
1363 #define NUMCPYBYTES 20
1366 bfd_copy (from_bfd
, to_bfd
)
1372 char buf
[NUMCPYBYTES
];
1374 for (p
= from_bfd
->sections
; p
!= NULL
; p
= p
->next
)
1376 printf (" Copying section %s. Size = %x.\n", p
->name
, p
->_cooked_size
);
1377 printf (" vma = %x, offset = %x, output_sec = %x\n",
1378 p
->vma
, p
->output_offset
, p
->output_section
);
1379 new = bfd_make_section (to_bfd
, p
->name
);
1380 if (p
->_cooked_size
&&
1381 !bfd_set_section_size (to_bfd
, new, p
->_cooked_size
))
1383 error ("Wrong BFD size!\n");
1385 if (!bfd_set_section_flags (to_bfd
, new, p
->flags
))
1387 error ("bfd_set_section_flags");
1391 for (i
= 0; (i
+ NUMCPYBYTES
) < p
->_cooked_size
; i
+= NUMCPYBYTES
)
1393 if (!bfd_get_section_contents (from_bfd
, p
, (PTR
) buf
, (file_ptr
) i
,
1394 (bfd_size_type
) NUMCPYBYTES
))
1396 error ("bfd_get_section_contents\n");
1398 if (!bfd_set_section_contents (to_bfd
, new, (PTR
) buf
, (file_ptr
) i
,
1399 (bfd_size_type
) NUMCPYBYTES
))
1401 error ("bfd_set_section_contents\n");
1404 bfd_get_section_contents (from_bfd
, p
, (PTR
) buf
, (file_ptr
) i
,
1405 (bfd_size_type
) (p
->_cooked_size
- i
));
1406 bfd_set_section_contents (to_bfd
, new, (PTR
) buf
, (file_ptr
) i
,
1407 (bfd_size_type
) (p
->_cooked_size
- i
));
1413 /* Start an process on the es1800 and set inferior_pid to the new
1415 execfile - the file to run
1416 args - arguments passed to the program
1417 env - the environment vector to pass */
1420 es1800_create_inferior (execfile
, args
, env
)
1428 struct expression
*expr
;
1429 register struct cleanup
*old_chain
= 0;
1435 error ("Can't pass arguments to remote ES1800 process");
1439 if (query ("Use 'start' as entry point? "))
1441 expr
= parse_c_expression ("start");
1442 old_chain
= make_cleanup (free_current_contents
, &expr
);
1443 val
= evaluate_expression (expr
);
1444 entry_pt
= (val
->location
).address
;
1448 printf ("Enter the program's entry point (in hexadecimal): ");
1449 scanf ("%x", &entry_pt
);
1453 if (execfile
== 0 || exec_bfd
== 0)
1455 error ("No executable file specified");
1458 entry_pt
= (int) bfd_get_start_address (exec_bfd
);
1462 /* Now that we have a child process, make it our target. */
1464 push_target (&es1800_child_ops
);
1466 /* The "process" (board) is already stopped awaiting our commands, and
1467 the program is already downloaded. We just set its PC and go. */
1469 inferior_pid
= pid
; /* Needed for wait_for_inferior below */
1471 clear_proceed_status ();
1473 /* Tell wait_for_inferior that we've started a new process. */
1475 init_wait_for_inferior ();
1477 /* Set up the "saved terminal modes" of the inferior
1478 based on what modes we are starting it with. */
1480 target_terminal_init ();
1482 /* Install inferior's terminal modes. */
1484 target_terminal_inferior ();
1486 /* remote_start (args); */
1487 /* trap_expected = 0; */
1488 /* insert_step_breakpoint (); FIXME, do we need this? */
1490 /* Let 'er rip... */
1491 proceed ((CORE_ADDR
) entry_pt
, TARGET_SIGNAL_DEFAULT
, 0);
1496 /* The process has died, clean up. */
1499 es1800_mourn_inferior ()
1501 remove_breakpoints ();
1502 unpush_target (&es1800_child_ops
);
1503 generic_mourn_inferior (); /* Do all the proper things now */
1506 /* ES1800-protocol specific routines */
1508 /* Keep discarding input from the remote system, until STRING is found.
1509 Let the user break out immediately.
1510 string - the string to expect
1511 nowait - break out if string not the emulator's first respond otherwise
1512 read until string is found (== 0) */
1515 expect (string
, nowait
)
1530 if (c
== toupper (*p
))
1545 printf ("\'%s\' expected\n", string
);
1546 printf ("char %d is %d", p
- string
, c
);
1552 /* Keep discarding input until we see the prompt. */
1561 /* Read one character */
1565 /* read from stdin */
1573 printf ("readchar, give one character\n");
1576 #if defined (LOG_FILE)
1577 putc (buf
[0] & 0x7f, log_file
);
1580 return (buf
[0] & 0x7f);
1583 #else /* !DEBUG_STDIN */
1585 /* Read a character from the remote system, doing all the fancy
1593 ch
= SERIAL_READCHAR (es1800_desc
, timeout
);
1595 /* FIXME: doing an error() here will probably cause trouble, at least if from
1597 if (ch
== SERIAL_TIMEOUT
)
1598 error ("Timeout reading from remote system.");
1599 else if (ch
== SERIAL_ERROR
)
1600 perror_with_name ("remote read");
1602 #if defined (LOG_FILE)
1603 putc (ch
& 0x7f, log_file
);
1610 #endif /* DEBUG_STDIN */
1613 /* Send a command to the emulator and save the reply.
1614 Report an error if we get an error reply.
1615 string - the es1800 command
1616 buf - containing the emulator reply on return
1617 len - size of buf */
1620 send_with_reply (string
, buf
, len
)
1625 SERIAL_WRITE (es1800_desc
, "\r", 1);
1632 getmessage (buf
, len
);
1636 /* Send the command in STR to the emulator adding \r. check
1637 the echo for consistency.
1638 string - the es1800 command */
1641 send_command (string
)
1645 SERIAL_WRITE (es1800_desc
, "\r", 1);
1655 string - the es1800 command */
1663 fprintf (stderr
, "Sending: %s\n", string
);
1665 SERIAL_WRITE (es1800_desc
, string
, strlen (string
));
1669 /* Read a message from the emulator and store it in BUF.
1670 buf - containing the emulator reply on return
1671 len - size of buf */
1674 getmessage (buf
, len
)
1680 int prompt_found
= 0;
1683 #if defined (LOG_FILE)
1684 /* This is a convenient place to do this. The idea is to do it often
1685 enough that we never lose much data if we terminate abnormally. */
1695 if (len
-- < 2) /* char and terminaling NULL */
1697 error ("input buffer overrun\n");
1702 if ((c
== '>') && (*(bp
- 1) == ' '))
1707 while (!prompt_found
);
1712 fprintf (stderr
, "message received :%s\n", buf
);
1717 download (instream
, from_tty
, format
)
1726 send_command ("SET #2,$1A"); /* reset char = ^Z */
1727 send_command ("SET #3,$11,$13"); /* XON XOFF */
1730 send_command ("SET #26,#2");
1734 send_command ("SET #26,#5"); /* Format=Extended Tekhex */
1736 send_command ("DFB = $10");
1737 send_command ("PUR");
1738 send_command ("CES");
1743 printf (" 0 records loaded...\r");
1745 while (fgets (buf
, 160, instream
))
1750 printf ("%5d\b\b\b\b\b", ++i
);
1753 if ((c
= readchar ()) != 006)
1755 error ("expected ACK");
1764 /* Additional commands */
1766 #if defined (TIOCGETP) && defined (FNDELAY) && defined (EWOULDBLOCK)
1767 #define PROVIDE_TRANSPARENT
1770 #ifdef PROVIDE_TRANSPARENT
1771 /* Talk directly to the emulator
1772 FIXME, uses busy wait, and is SUNOS (or at least BSD) specific */
1776 es1800_transparent (args
, from_tty
)
1781 struct sgttyb modebl
;
1784 struct sgttyb console_mode_save
;
1785 int console_fc_save
;
1790 char consolebuf
[80];
1792 char es1800_buf
[80];
1796 if (es1800_desc
== NULL
)
1798 printf ("No emulator attached, type emulator-command first\n");
1803 printf ("You are now communicating directly with the ES 1800 emulator.\n");
1804 printf ("To leave this mode (transparent mode), press ^E.\n");
1809 if ((console
= open ("/dev/tty", O_RDWR
)) == -1)
1811 perror_with_name ("/dev/tty:");
1814 if ((fcflag
= fcntl (console
, F_GETFL
, 0)) == -1)
1816 perror_with_name ("fcntl console");
1819 console_fc_save
= fcflag
;
1820 fcflag
= fcflag
| FNDELAY
;
1822 if (fcntl (console
, F_SETFL
, fcflag
) == -1)
1824 perror_with_name ("fcntl console");
1827 if (ioctl (console
, TIOCGETP
, &modebl
))
1829 perror_with_name ("ioctl console");
1832 console_mode_save
= modebl
;
1833 modebl
.sg_flags
= RAW
;
1835 if (ioctl (console
, TIOCSETP
, &modebl
))
1837 perror_with_name ("ioctl console");
1840 if ((fcflag
= fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_GETFL
, 0)) == -1)
1842 perror_with_name ("fcntl serial");
1845 es1800_fc_save
= fcflag
;
1846 fcflag
= fcflag
| FNDELAY
;
1848 if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_SETFL
, fcflag
) == -1)
1850 perror_with_name ("fcntl serial");
1855 cc
= read (console
, inputbuf
, inputcnt
);
1858 if ((*inputbuf
& 0x7f) == 0x05)
1862 for (i
= 0; i
< cc
;)
1864 es1800_buf
[es1800_cnt
++] = inputbuf
[i
++];
1866 if ((cc
= SERIAL_WRITE (es1800_desc
, es1800_buf
, es1800_cnt
)) == -1)
1868 perror_with_name ("FEL! write:");
1871 if (es1800_cnt
&& cc
)
1873 for (i
= 0; i
< es1800_cnt
; i
++)
1875 es1800_buf
[i
] = es1800_buf
[cc
+ i
];
1879 else if (errno
!= EWOULDBLOCK
)
1881 perror_with_name ("FEL! read:");
1884 cc
= read (DEPRECATED_SERIAL_FD (es1800_desc
), inputbuf
, inputcnt
);
1887 for (i
= 0; i
< cc
;)
1889 consolebuf
[consolecnt
++] = inputbuf
[i
++];
1891 if ((cc
= write (console
, consolebuf
, consolecnt
)) == -1)
1893 perror_with_name ("FEL! write:");
1896 if (consolecnt
&& cc
)
1898 for (i
= 0; i
< consolecnt
; i
++)
1900 consolebuf
[i
] = consolebuf
[cc
+ i
];
1904 else if (errno
!= EWOULDBLOCK
)
1906 perror_with_name ("FEL! read:");
1910 console_fc_save
= console_fc_save
& !FNDELAY
;
1911 if (fcntl (console
, F_SETFL
, console_fc_save
) == -1)
1913 perror_with_name ("FEL! fcntl");
1916 if (ioctl (console
, TIOCSETP
, &console_mode_save
))
1918 perror_with_name ("FEL! ioctl");
1923 if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_SETFL
, es1800_fc_save
) == -1)
1925 perror_with_name ("FEL! fcntl");
1931 #endif /* PROVIDE_TRANSPARENT */
1934 es1800_init_break (args
, from_tty
)
1938 CORE_ADDR memaddress
= 0;
1947 error_no_arg ("a trap vector");
1950 if (!(space_index
= strchr (args
, ' ')))
1952 error ("Two arguments needed (trap vector and address of break routine).\n");
1955 *space_index
= '\0';
1957 es1800_break_vec
= strtol (args
, (char **) NULL
, 0);
1958 es1800_break_address
= parse_and_eval_address (space_index
+ 1);
1960 es1800_create_break_insn (es1800_break_insn
, es1800_break_vec
);
1964 send_with_reply ("VBR ", buf
, sizeof (buf
));
1966 for (k
= 0; k
< 4; k
++)
1968 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
1970 error ("Emulator reply is too short: %s", buf
);
1972 base_addr
[k
] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
1974 /* base addr of exception vector table */
1975 memaddress
= *((CORE_ADDR
*) base_addr
);
1978 memaddress
+= (es1800_break_vec
+ 32) * 4; /* address of trap vector */
1980 sprintf (buf
, "@.L%lx=$%lx", memaddress
, es1800_break_address
);
1981 send_command (buf
); /* set the address of the break routine in the */
1984 sprintf (buf
, "@.L%lx=$4E714E71", es1800_break_address
); /* NOP; NOP */
1986 sprintf (buf
, "@.L%lx=$4E714E73", es1800_break_address
+ 4); /* NOP; RTE */
1989 sprintf (buf
, "AC2=$%lx", es1800_break_address
+ 4);
1990 /* breakpoint at es1800-break_address */
1992 send_command ("WHEN AC2 THEN BRK"); /* ie in exception routine */
1996 printf ("Breakpoint (trap $%x) routine at address: %lx\n",
1997 es1800_break_vec
, es1800_break_address
);
2002 es1800_child_open (arg
, from_tty
)
2006 error ("Use the \"run\" command to start a child process.");
2010 es1800_child_detach (args
, from_tty
)
2016 error ("Argument given to \"detach\" when remotely debugging.");
2022 printf ("Ending debugging the process %d.\n", inferior_pid
);
2027 /* Define the target subroutine names */
2029 struct target_ops es1800_ops
;
2032 init_es1800_ops (void)
2034 es1800_ops
.to_shortname
= "es1800";
2035 es1800_ops
.to_longname
= "Remote serial target in ES1800-emulator protocol";
2036 es1800_ops
.to_doc
= "Remote debugging on the es1800 emulator via a serial line.\n\
2037 Specify the serial device it is connected to (e.g. /dev/ttya).";
2038 es1800_ops
.to_open
= es1800_open
;
2039 es1800_ops
.to_close
= es1800_close
;
2040 es1800_ops
.to_attach
= es1800_attach
;
2041 es1800_ops
.to_post_attach
= NULL
;
2042 es1800_ops
.to_require_attach
= NULL
;
2043 es1800_ops
.to_detach
= es1800_detach
;
2044 es1800_ops
.to_require_detach
= NULL
;
2045 es1800_ops
.to_resume
= es1800_resume
;
2046 es1800_ops
.to_wait
= NULL
;
2047 es1800_ops
.to_post_wait
= NULL
;
2048 es1800_ops
.to_fetch_registers
= NULL
;
2049 es1800_ops
.to_store_registers
= NULL
;
2050 es1800_ops
.to_prepare_to_store
= es1800_prepare_to_store
;
2051 es1800_ops
.to_xfer_memory
= es1800_xfer_inferior_memory
;
2052 es1800_ops
.to_files_info
= es1800_files_info
;
2053 es1800_ops
.to_insert_breakpoint
= es1800_insert_breakpoint
;
2054 es1800_ops
.to_remove_breakpoint
= es1800_remove_breakpoint
;
2055 es1800_ops
.to_terminal_init
= NULL
;
2056 es1800_ops
.to_terminal_inferior
= NULL
;
2057 es1800_ops
.to_terminal_ours_for_output
= NULL
;
2058 es1800_ops
.to_terminal_ours
= NULL
;
2059 es1800_ops
.to_terminal_info
= NULL
;
2060 es1800_ops
.to_kill
= NULL
;
2061 es1800_ops
.to_load
= es1800_load
;
2062 es1800_ops
.to_lookup_symbol
= NULL
;
2063 es1800_ops
.to_create_inferior
= es1800_create_inferior
;
2064 es1800_ops
.to_post_startup_inferior
= NULL
;
2065 es1800_ops
.to_acknowledge_created_inferior
= NULL
;
2066 es1800_ops
.to_clone_and_follow_inferior
= NULL
;
2067 es1800_ops
.to_post_follow_inferior_by_clone
= NULL
;
2068 es1800_ops
.to_insert_fork_catchpoint
= NULL
;
2069 es1800_ops
.to_remove_fork_catchpoint
= NULL
;
2070 es1800_ops
.to_insert_vfork_catchpoint
= NULL
;
2071 es1800_ops
.to_remove_vfork_catchpoint
= NULL
;
2072 es1800_ops
.to_has_forked
= NULL
;
2073 es1800_ops
.to_has_vforked
= NULL
;
2074 es1800_ops
.to_can_follow_vfork_prior_to_exec
= NULL
;
2075 es1800_ops
.to_post_follow_vfork
= NULL
;
2076 es1800_ops
.to_insert_exec_catchpoint
= NULL
;
2077 es1800_ops
.to_remove_exec_catchpoint
= NULL
;
2078 es1800_ops
.to_has_execd
= NULL
;
2079 es1800_ops
.to_reported_exec_events_per_exec_call
= NULL
;
2080 es1800_ops
.to_has_exited
= NULL
;
2081 es1800_ops
.to_mourn_inferior
= NULL
;
2082 es1800_ops
.to_can_run
= 0;
2083 es1800_ops
.to_notice_signals
= 0;
2084 es1800_ops
.to_thread_alive
= 0;
2085 es1800_ops
.to_stop
= 0;
2086 es1800_ops
.to_pid_to_exec_file
= NULL
;
2087 es1800_ops
.to_core_file_to_sym_file
= NULL
;
2088 es1800_ops
.to_stratum
= core_stratum
;
2089 es1800_ops
.DONT_USE
= 0;
2090 es1800_ops
.to_has_all_memory
= 0;
2091 es1800_ops
.to_has_memory
= 1;
2092 es1800_ops
.to_has_stack
= 0;
2093 es1800_ops
.to_has_registers
= 0;
2094 es1800_ops
.to_has_execution
= 0;
2095 es1800_ops
.to_sections
= NULL
;
2096 es1800_ops
.to_sections_end
= NULL
;
2097 es1800_ops
.to_magic
= OPS_MAGIC
;
2100 /* Define the target subroutine names */
2102 struct target_ops es1800_child_ops
;
2105 init_es1800_child_ops (void)
2107 es1800_child_ops
.to_shortname
= "es1800_process";
2108 es1800_child_ops
.to_longname
= "Remote serial target in ES1800-emulator protocol";
2109 es1800_child_ops
.to_doc
= "Remote debugging on the es1800 emulator via a serial line.\n\
2110 Specify the serial device it is connected to (e.g. /dev/ttya).";
2111 es1800_child_ops
.to_open
= es1800_child_open
;
2112 es1800_child_ops
.to_close
= NULL
;
2113 es1800_child_ops
.to_attach
= es1800_attach
;
2114 es1800_child_ops
.to_post_attach
= NULL
;
2115 es1800_child_ops
.to_require_attach
= NULL
;
2116 es1800_child_ops
.to_detach
= es1800_child_detach
;
2117 es1800_child_ops
.to_require_detach
= NULL
;
2118 es1800_child_ops
.to_resume
= es1800_resume
;
2119 es1800_child_ops
.to_wait
= es1800_wait
;
2120 es1800_child_ops
.to_post_wait
= NULL
;
2121 es1800_child_ops
.to_fetch_registers
= es1800_fetch_register
;
2122 es1800_child_ops
.to_store_registers
= es1800_store_register
;
2123 es1800_child_ops
.to_prepare_to_store
= es1800_prepare_to_store
;
2124 es1800_child_ops
.to_xfer_memory
= es1800_xfer_inferior_memory
;
2125 es1800_child_ops
.to_files_info
= es1800_files_info
;
2126 es1800_child_ops
.to_insert_breakpoint
= es1800_insert_breakpoint
;
2127 es1800_child_ops
.to_remove_breakpoint
= es1800_remove_breakpoint
;
2128 es1800_child_ops
.to_terminal_init
= NULL
;
2129 es1800_child_ops
.to_terminal_inferior
= NULL
;
2130 es1800_child_ops
.to_terminal_ours_for_output
= NULL
;
2131 es1800_child_ops
.to_terminal_ours
= NULL
;
2132 es1800_child_ops
.to_terminal_info
= NULL
;
2133 es1800_child_ops
.to_kill
= es1800_kill
;
2134 es1800_child_ops
.to_load
= es1800_load
;
2135 es1800_child_ops
.to_lookup_symbol
= NULL
;
2136 es1800_child_ops
.to_create_inferior
= es1800_create_inferior
;
2137 es1800_child_ops
.to_post_startup_inferior
= NULL
;
2138 es1800_child_ops
.to_acknowledge_created_inferior
= NULL
;
2139 es1800_child_ops
.to_clone_and_follow_inferior
= NULL
;
2140 es1800_child_ops
.to_post_follow_inferior_by_clone
= NULL
;
2141 es1800_child_ops
.to_insert_fork_catchpoint
= NULL
;
2142 es1800_child_ops
.to_remove_fork_catchpoint
= NULL
;
2143 es1800_child_ops
.to_insert_vfork_catchpoint
= NULL
;
2144 es1800_child_ops
.to_remove_vfork_catchpoint
= NULL
;
2145 es1800_child_ops
.to_has_forked
= NULL
;
2146 es1800_child_ops
.to_has_vforked
= NULL
;
2147 es1800_child_ops
.to_can_follow_vfork_prior_to_exec
= NULL
;
2148 es1800_child_ops
.to_post_follow_vfork
= NULL
;
2149 es1800_child_ops
.to_insert_exec_catchpoint
= NULL
;
2150 es1800_child_ops
.to_remove_exec_catchpoint
= NULL
;
2151 es1800_child_ops
.to_has_execd
= NULL
;
2152 es1800_child_ops
.to_reported_exec_events_per_exec_call
= NULL
;
2153 es1800_child_ops
.to_has_exited
= NULL
;
2154 es1800_child_ops
.to_mourn_inferior
= es1800_mourn_inferior
;
2155 es1800_child_ops
.to_can_run
= 0;
2156 es1800_child_ops
.to_notice_signals
= 0;
2157 es1800_child_ops
.to_thread_alive
= 0;
2158 es1800_child_ops
.to_stop
= 0;
2159 es1800_child_ops
.to_pid_to_exec_file
= NULL
;
2160 es1800_child_ops
.to_core_file_to_sym_file
= NULL
;
2161 es1800_child_ops
.to_stratum
= process_stratum
;
2162 es1800_child_ops
.DONT_USE
= 0;
2163 es1800_child_ops
.to_has_all_memory
= 1;
2164 es1800_child_ops
.to_has_memory
= 1;
2165 es1800_child_ops
.to_has_stack
= 1;
2166 es1800_child_ops
.to_has_registers
= 1;
2167 es1800_child_ops
.to_has_execution
= 1;
2168 es1800_child_ops
.to_sections
= NULL
;
2169 es1800_child_ops
.to_sections_end
= NULL
;
2170 es1800_child_ops
.to_magic
= OPS_MAGIC
;
2174 _initialize_es1800 ()
2177 init_es1800_child_ops ();
2178 add_target (&es1800_ops
);
2179 add_target (&es1800_child_ops
);
2180 #ifdef PROVIDE_TRANSPARENT
2181 add_com ("transparent", class_support
, es1800_transparent
,
2182 "Start transparent communication with the ES 1800 emulator.");
2183 #endif /* PROVIDE_TRANSPARENT */
2184 add_com ("init_break", class_support
, es1800_init_break
,
2185 "Download break routine and initialize break facility on ES 1800");