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 */
116 es1800_child_detach
PARAMS ((char *, int));
119 es1800_child_open
PARAMS ((char *, int));
122 es1800_transparent
PARAMS ((char *, int));
125 es1800_create_inferior
PARAMS ((char *, char *, char **));
128 es1800_load
PARAMS ((char *, int));
131 es1800_kill
PARAMS ((void));
134 verify_break
PARAMS ((int));
137 es1800_remove_breakpoint
PARAMS ((CORE_ADDR
, char *));
140 es1800_insert_breakpoint
PARAMS ((CORE_ADDR
, char *));
143 es1800_files_info
PARAMS ((struct target_ops
*));
146 es1800_xfer_inferior_memory
PARAMS ((CORE_ADDR
, char *, int, int,
147 struct target_ops
*));
150 es1800_prepare_to_store
PARAMS ((void));
152 static int es1800_wait
PARAMS ((int, struct target_waitstatus
*));
154 static void es1800_resume
PARAMS ((int, int, enum target_signal
));
157 es1800_detach
PARAMS ((char *, int));
160 es1800_attach
PARAMS ((char *, int));
163 damn_b
PARAMS ((char *));
166 es1800_open
PARAMS ((char *, int));
169 es1800_timer
PARAMS ((void));
172 es1800_reset
PARAMS ((char *));
175 es1800_request_quit
PARAMS ((void));
178 readchar
PARAMS ((void));
181 expect
PARAMS ((char *, int));
184 expect_prompt
PARAMS ((void));
187 download
PARAMS ((FILE *, int, int));
191 bfd_copy
PARAMS ((bfd
*, bfd
*));
195 get_break_addr
PARAMS ((int, CORE_ADDR
*));
198 fromhex
PARAMS ((int));
201 tohex
PARAMS ((int));
204 es1800_close
PARAMS ((int));
207 es1800_fetch_registers
PARAMS ((void));
210 es1800_fetch_register
PARAMS ((int));
213 es1800_store_register
PARAMS ((int));
216 es1800_read_bytes
PARAMS ((CORE_ADDR
, char *, int));
219 es1800_write_bytes
PARAMS ((CORE_ADDR
, char *, int));
222 send_with_reply
PARAMS ((char *, char *, int));
225 send_command
PARAMS ((char *));
228 send
PARAMS ((char *));
231 getmessage
PARAMS ((char *, int));
234 es1800_mourn_inferior
PARAMS ((void));
237 es1800_create_break_insn
PARAMS ((char *, int));
240 es1800_init_break
PARAMS ((char *, int));
242 /* Local variables */
244 /* FIXME: Convert this to use "set remotedebug" instead. */
245 #define LOG_FILE "es1800.log"
246 #if defined (LOG_FILE)
247 static FILE *log_file
;
250 extern struct target_ops es1800_ops
; /* Forward decl */
251 extern struct target_ops es1800_child_ops
; /* Forward decl */
254 static int timeout
= 100;
255 static char *savename
; /* Name of i/o device used */
256 static serial_ttystate es1800_saved_ttystate
;
257 static int es1800_fc_save
; /* Save fcntl state */
259 /* indicates that the emulator uses 32-bit data-adress (68020-mode)
260 instead of 24-bit (68000 -mode) */
264 #define MODE (m68020 ? "M68020" : "M68000" )
265 #define ES1800_BREAK_VEC (0xf)
267 /* Descriptor for I/O to remote machine. Initialize it to NULL so that
268 es1800_open knows that we don't have a file open when the program
271 static serial_t es1800_desc
= NULL
;
274 #define HDRLEN sizeof("@.BAAAAAAAA=$VV\r")
276 /* Maximum number of bytes to read/write at once. The value here
277 is chosen to fill up a packet. */
279 #define MAXBUFBYTES ((PBUFSIZ-150)*16/75 )
281 static int es1800_break_vec
= 0;
282 static char es1800_break_insn
[2];
283 static long es1800_break_address
;
284 static void (*old_sigint
) (); /* Old signal-handler for sigint */
285 static jmp_buf interrupt
;
287 /* Local signalhandler to allow breaking tranfers or program run.
288 Rely on global variables: old_sigint(), interrupt */
291 es1800_request_quit ()
293 /* restore original signalhandler */
294 signal (SIGINT
, old_sigint
);
295 longjmp (interrupt
, 1);
300 Sending reset character(octal 32) to emulator.
301 quit - return to '(esgdb)' prompt or continue */
311 printf ("\nResetting emulator... ");
313 strcpy (buf
, "\032");
323 /* Open a connection to a remote debugger and push the new target
324 onto the stack. Check if the emulator is responding and find out
325 what kind of processor the emulator is connected to.
326 Initiate the breakpoint handling in the emulator.
328 name - the filename used for communication (ex. '/dev/tta')
329 from_tty - says whether to be verbose or not */
332 es1800_open (name
, from_tty
)
342 if (!name
) /* no device name given in target command */
344 error_no_arg ("serial port device name");
347 target_preopen (from_tty
);
350 /* open the device and configure it for communication */
354 es1800_desc
= SERIAL_OPEN (name
);
355 if (es1800_desc
== NULL
)
357 perror_with_name (name
);
359 savename
= savestring (name
, strlen (name
));
361 es1800_saved_ttystate
= SERIAL_GET_TTY_STATE (es1800_desc
);
363 if ((fcflag
= fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_GETFL
, 0)) == -1)
365 perror_with_name ("fcntl serial");
367 es1800_fc_save
= fcflag
;
369 fcflag
= (fcflag
& (FREAD
| FWRITE
)); /* mask out any funny stuff */
370 if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_SETFL
, fcflag
) == -1)
372 perror_with_name ("fcntl serial");
377 if (SERIAL_SETBAUDRATE (es1800_desc
, baud_rate
))
379 SERIAL_CLOSE (es1800_desc
);
380 perror_with_name (name
);
384 SERIAL_RAW (es1800_desc
);
386 /* If there is something sitting in the buffer we might take it as a
387 response to a command, which would be bad. */
388 SERIAL_FLUSH_INPUT (es1800_desc
);
390 #endif /* DEBUG_STDIN */
392 push_target (&es1800_ops
); /* Switch to using remote target now */
395 printf ("Remote ES1800 debugging using %s\n", name
);
398 #if defined (LOG_FILE)
400 log_file
= fopen (LOG_FILE
, "w");
401 if (log_file
== NULL
)
403 perror_with_name (LOG_FILE
);
406 #endif /* LOG_FILE */
408 /* Hello? Are you there?, also check mode */
410 /* send_with_reply( "DB 0 TO 1", buf, sizeof(buf)); */
411 /* for (p = buf, i = 0; *p++ =='0';) *//* count the number of zeros */
415 getmessage (buf
, sizeof (buf
)); /* send reset character */
419 printf ("Checking mode.... ");
421 /* m68020 = (i==8); *//* if eight zeros then we are in m68020 mode */
423 /* What kind of processor am i talking to ? */
434 for (i
= 0; i
< 20; i
++, p
++)
437 m68020
= !strncmp (p
, "68020", 5);
440 printf ("You are in %s(%c%c%c%c%c)-mode\n", MODE
, p
[0], p
[1], p
[2],
444 /* if no init_break statement is present in .gdb file we have to check
445 whether to download a breakpoint routine or not */
448 if ((es1800_break_vec
== 0) || (verify_break (es1800_break_vec
) != 0)
449 && query ("No breakpoint routine in ES 1800 emulator!\nDownload a breakpoint routine to the emulator? "))
451 CORE_ADDR memaddress
;
452 printf ("Give the start address of the breakpoint routine: ");
453 scanf ("%li", &memaddress
);
454 es1800_init_break ((es1800_break_vec
? es1800_break_vec
:
455 ES1800_BREAK_VEC
), memaddress
);
461 /* Close out all files and local state before this target loses control.
462 quitting - are we quitting gdb now? */
465 es1800_close (quitting
)
468 if (es1800_desc
!= NULL
)
470 printf ("\nClosing connection to emulator...\n");
471 if (SERIAL_SET_TTY_STATE (es1800_desc
, es1800_saved_ttystate
) < 0)
472 print_sys_errmsg ("warning: unable to restore tty state", errno
);
473 fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_SETFL
, es1800_fc_save
);
474 SERIAL_CLOSE (es1800_desc
);
477 if (savename
!= NULL
)
483 #if defined (LOG_FILE)
485 if (log_file
!= NULL
)
487 if (ferror (log_file
))
489 printf ("Error writing log file.\n");
491 if (fclose (log_file
) != 0)
493 printf ("Error closing log file.\n");
498 #endif /* LOG_FILE */
502 /* Attaches to a process on the target side
503 proc_id - the id of the process to be attached.
504 from_tty - says whether to be verbose or not */
507 es1800_attach (args
, from_tty
)
511 error ("Cannot attach to pid %s, this feature is not implemented yet.",
516 /* Takes a program previously attached to and detaches it.
517 We better not have left any breakpoints
518 in the program or it'll die when it hits one.
519 Close the open connection to the remote debugger.
520 Use this when you want to detach and do something else
523 args - arguments given to the 'detach' command
524 from_tty - says whether to be verbose or not */
527 es1800_detach (args
, from_tty
)
533 error ("Argument given to \"detach\" when remotely debugging.");
538 printf ("Ending es1800 remote debugging.\n");
543 /* Tell the remote machine to resume.
544 step - single-step or run free
545 siggnal - the signal value to be given to the target (0 = no signal) */
548 es1800_resume (pid
, step
, siggnal
)
551 enum target_signal siggnal
;
557 error ("Can't send signals to a remote system.");
561 strcpy (buf
, "STP\r");
566 send_command ("RBK");
570 /* Wait until the remote machine stops, then return,
571 storing status in STATUS just as `wait' would.
575 es1800_wait (pid
, status
)
577 struct target_waitstatus
*status
;
579 unsigned char buf
[PBUFSIZ
];
580 int old_timeout
= timeout
;
582 status
->kind
= TARGET_WAITKIND_EXITED
;
583 status
->value
.integer
= 0;
585 timeout
= 0; /* Don't time out -- user program is running. */
586 if (!setjmp (interrupt
))
588 old_sigint
= signal (SIGINT
, es1800_request_quit
);
591 getmessage (buf
, sizeof (buf
));
592 if (strncmp (buf
, "\r\n* BREAK *", 11) == 0)
594 status
->kind
= TARGET_WAITKIND_STOPPED
;
595 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
596 send_command ("STP"); /* Restore stack and PC and such */
599 send_command ("STP");
603 if (strncmp (buf
, "STP\r\n ", 6) == 0)
605 status
->kind
= TARGET_WAITKIND_STOPPED
;
606 status
->value
.sig
= TARGET_SIGNAL_TRAP
;
609 if (buf
[strlen (buf
) - 2] == 'R')
611 printf ("Unexpected emulator reply: \n%s\n", buf
);
615 printf ("Unexpected stop: \n%s\n", buf
);
616 status
->kind
= TARGET_WAITKIND_STOPPED
;
617 status
->value
.sig
= TARGET_SIGNAL_QUIT
;
625 printf ("\nStopping emulator...");
626 if (!setjmp (interrupt
))
628 old_sigint
= signal (SIGINT
, es1800_request_quit
);
629 send_command ("STP");
630 printf (" emulator stopped\n");
631 status
->kind
= TARGET_WAITKIND_STOPPED
;
632 status
->value
.sig
= TARGET_SIGNAL_INT
;
637 es1800_reset ((char *) 1);
640 signal (SIGINT
, old_sigint
);
641 timeout
= old_timeout
;
646 /* Fetch register values from remote machine.
647 regno - the register to be fetched (fetch all registers if -1) */
650 es1800_fetch_register (regno
)
657 static char regtab
[18][4] =
659 "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ",
660 "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP",
664 if ((regno
< 15) || (regno
== 16) || (regno
== 17))
667 send_with_reply (regtab
[regno
], buf
, sizeof (buf
));
669 for (k
= 0; k
< 4; k
++)
671 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
673 error ("Emulator reply is too short: %s", buf
);
675 registers
[r
++] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
680 es1800_fetch_registers ();
684 /* Read the remote registers into REGISTERS.
685 Always fetches all registers. */
688 es1800_fetch_registers ()
691 char SR_buf
[PBUFSIZ
];
697 send_with_reply ("DR", buf
, sizeof (buf
));
699 /* Reply is edited to a string that describes registers byte by byte,
700 each byte encoded as two hex characters. */
705 /* parsing row one - D0-D7-registers */
710 for (i
= 4; i
< 70; i
+= (i
== 39 ? 3 : 1))
712 for (k
= 0; k
< 4; k
++)
714 if (p
[i
+ 0] == 0 || p
[i
+ 1] == 0)
716 error ("Emulator reply is too short: %s", buf
);
718 registers
[r
++] = (fromhex (p
[i
+ 0]) * 16) + fromhex (p
[i
+ 1]);
724 /* parsing row two - A0-A6-registers */
729 for (i
= 4; i
< 61; i
+= (i
== 39 ? 3 : 1))
731 for (k
= 0; k
< 4; k
++)
733 if (p
[i
+ 0] == 0 || p
[i
+ 1] == 0)
735 error ("Emulator reply is too short: %s", buf
);
737 registers
[r
++] = (fromhex (p
[i
+ 0])) * 16 + fromhex (p
[i
+ 1]);
747 /* fetch SSP-, SR- and PC-registers */
749 /* first - check STATUS-word and decide which stackpointer to use */
751 send_with_reply ("SR", SR_buf
, sizeof (SR_buf
));
757 if (*p
== '3') /* use masterstackpointer MSP */
759 send_with_reply ("MSP", buf
, sizeof (buf
));
761 else if (*p
== '2') /* use interruptstackpointer ISP */
763 send_with_reply ("ISP", buf
, sizeof (buf
));
766 /* use userstackpointer USP */
768 send_with_reply ("USP", buf
, sizeof (buf
));
771 for (k
= 0; k
< 4; k
++)
773 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
775 error ("Emulator reply is too short: %s", buf
);
777 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
781 for (k
= 0; k
< 4; k
++)
783 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
785 error ("Emulator reply is too short: %s", buf
);
788 fromhex (SR_buf
[k
* 2 + 1]) * 16 + fromhex (SR_buf
[k
* 2 + 2]);
790 send_with_reply ("PC", buf
, sizeof (buf
));
792 for (k
= 0; k
< 4; k
++)
794 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
796 error ("Emulator reply is too short: %s", buf
);
798 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
804 if (*p
== '2') /* use supervisorstackpointer SSP */
806 send_with_reply ("SSP", buf
, sizeof (buf
));
809 /* use userstackpointer USP */
811 send_with_reply ("USP", buf
, sizeof (buf
));
814 /* fetch STACKPOINTER */
817 for (k
= 0; k
< 4; k
++)
819 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
821 error ("Emulator reply is too short: %s", buf
);
823 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
829 for (k
= 0; k
< 4; k
++)
831 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
833 error ("Emulator reply is too short: %s", buf
);
836 fromhex (SR_buf
[k
* 2 + 1]) * 16 + fromhex (SR_buf
[k
* 2 + 2]);
841 send_with_reply ("PC", buf
, sizeof (buf
));
843 for (k
= 0; k
< 4; k
++)
845 if (p
[k
* 2 + 1] == 0 || p
[k
* 2 + 2] == 0)
847 error ("Emulator reply is too short: %s", buf
);
849 registers
[r
++] = fromhex (buf
[k
* 2 + 1]) * 16 + fromhex (buf
[k
* 2 + 2]);
854 /* Store register value, located in REGISTER, on the target processor.
855 regno - the register-number of the register to store
856 (-1 means store them all)
857 FIXME: Return errno value. */
860 es1800_store_register (regno
)
864 static char regtab
[18][4] =
866 "D0 ", "D1 ", "D2 ", "D3 ", "D4 ", "D5 ", "D6 ", "D7 ",
867 "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", "A6 ", "SSP",
872 char SR_buf
[PBUFSIZ
];
873 char stack_pointer
[4];
880 r
= (unsigned char *) registers
;
882 if (regno
== -1) /* write all registers */
888 /* write one register */
895 if ((regno
== -1) || (regno
== 15))
897 /* fetch current status */
898 send_with_reply ("SR", SR_buf
, sizeof (SR_buf
));
903 if (*p
== '3') /* use masterstackpointer MSP */
905 strcpy (stack_pointer
, "MSP");
909 if (*p
== '2') /* use interruptstackpointer ISP */
911 strcpy (stack_pointer
, "ISP");
915 strcpy (stack_pointer
, "USP"); /* use userstackpointer USP */
922 if (*p
== '2') /* use supervisorstackpointer SSP */
924 strcpy (stack_pointer
, "SSP");
928 strcpy (stack_pointer
, "USP"); /* use userstackpointer USP */
931 strcpy (regtab
[15], stack_pointer
);
934 for (i
= j
; i
< k
; i
++)
936 buf
[0] = regtab
[i
][0];
937 buf
[1] = regtab
[i
][1];
938 buf
[2] = regtab
[i
][2];
941 buf
[5] = tohex ((*r
>> 4) & 0x0f);
942 buf
[6] = tohex (*r
++ & 0x0f);
943 buf
[7] = tohex ((*r
>> 4) & 0x0f);
944 buf
[8] = tohex (*r
++ & 0x0f);
945 buf
[9] = tohex ((*r
>> 4) & 0x0f);
946 buf
[10] = tohex (*r
++ & 0x0f);
947 buf
[11] = tohex ((*r
>> 4) & 0x0f);
948 buf
[12] = tohex (*r
++ & 0x0f);
951 send_with_reply (buf
, buf
, sizeof (buf
)); /* FIXME, reply not used? */
956 /* Prepare to store registers. */
959 es1800_prepare_to_store ()
961 /* Do nothing, since we can store individual regs */
964 /* Convert hex digit A to a number. */
970 if (a
>= '0' && a
<= '9')
974 else if (a
>= 'a' && a
<= 'f')
978 else if (a
>= 'A' && a
<= 'F')
984 error ("Reply contains invalid hex digit");
990 /* Convert number NIB to a hex digit. */
1002 return ('A' + nib
- 10);
1006 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
1007 to or from debugger address MYADDR. Write to inferior if WRITE is
1008 nonzero. Returns length of data written or read; 0 for error.
1010 memaddr - the target's address
1011 myaddr - gdb's address
1012 len - number of bytes
1013 write - write if != 0 otherwise read */
1016 es1800_xfer_inferior_memory (memaddr
, myaddr
, len
, write
, tops
)
1021 struct target_ops
*tops
; /* Unused */
1028 xfersize
= len
> MAXBUFBYTES
? MAXBUFBYTES
: len
;
1031 es1800_write_bytes (memaddr
, myaddr
, xfersize
);
1035 es1800_read_bytes (memaddr
, myaddr
, xfersize
);
1037 memaddr
+= xfersize
;
1041 return (origlen
); /* no error possible */
1045 /* Write memory data directly to the emulator.
1046 This does not inform the data cache; the data cache uses this.
1047 MEMADDR is the address in the remote memory space.
1048 MYADDR is the address of the buffer in our space.
1049 LEN is the number of bytes.
1051 memaddr - the target's address
1052 myaddr - gdb's address
1053 len - number of bytes */
1056 es1800_write_bytes (memaddr
, myaddr
, len
)
1066 for (i
= 0; i
< len
; i
++)
1068 sprintf (buf
, "@.B$%x=$%x", memaddr
+ i
, (*p
++) & 0xff);
1069 send_with_reply (buf
, buf
, sizeof (buf
)); /* FIXME send_command? */
1074 /* Read memory data directly from the emulator.
1075 This does not use the data cache; the data cache uses this.
1077 memaddr - the target's address
1078 myaddr - gdb's address
1079 len - number of bytes */
1082 es1800_read_bytes (memaddr
, myaddr
, len
)
1087 static int DB_tab
[16] =
1088 {8, 11, 14, 17, 20, 23, 26, 29, 34, 37, 40, 43, 46, 49, 52, 55};
1095 if (len
> PBUFSIZ
/ 2 - 1)
1100 if (len
== 1) /* The emulator does not like expressions like: */
1102 len
= 2; /* DB.B $20018 TO $20018 */
1105 /* Reply describes registers byte by byte, each byte encoded as two hex
1108 sprintf (buf
, "DB.B $%x TO $%x", memaddr
, memaddr
+ len
- 1);
1109 send_with_reply (buf
, buf
, sizeof (buf
));
1111 low_addr
= memaddr
& 0x0f;
1112 for (i
= low_addr
; i
< low_addr
+ len
; i
++)
1114 if ((!(i
% 16)) && i
)
1115 { /* if (i = 16,32,48) */
1116 while (*p
++ != '\n')
1121 p
= b
+ DB_tab
[i
% 16] + (m68020
? 2 : 0);
1122 if (p
[0] == 32 || p
[1] == 32)
1124 error ("Emulator reply is too short: %s", buf
);
1126 myaddr
[i
- low_addr
] = fromhex (p
[0]) * 16 + fromhex (p
[1]);
1130 /* Information about the current target */
1133 es1800_files_info (tops
)
1134 struct target_ops
*tops
; /* Unused */
1136 printf ("ES1800 Attached to %s at %d baud in %s mode\n", savename
, 19200,
1141 /* We read the contents of the target location and stash it,
1142 then overwrite it with a breakpoint instruction.
1144 addr - is the target location in the target machine.
1145 contents_cache - is a pointer to memory allocated for saving the target contents.
1146 It is guaranteed by the caller to be long enough to save sizeof
1149 FIXME: This size is target_arch dependent and should be available in
1150 the target_arch transfer vector, if we ever have one... */
1153 es1800_insert_breakpoint (addr
, contents_cache
)
1155 char *contents_cache
;
1159 val
= target_read_memory (addr
, contents_cache
, sizeof (es1800_break_insn
));
1163 val
= target_write_memory (addr
, es1800_break_insn
,
1164 sizeof (es1800_break_insn
));
1171 /* Write back the stashed instruction
1173 addr - is the target location in the target machine.
1174 contents_cache - is a pointer to memory allocated for saving the target contents.
1175 It is guaranteed by the caller to be long enough to save sizeof
1176 BREAKPOINT bytes. */
1179 es1800_remove_breakpoint (addr
, contents_cache
)
1181 char *contents_cache
;
1184 return (target_write_memory (addr
, contents_cache
,
1185 sizeof (es1800_break_insn
)));
1188 /* create_break_insn ()
1189 Primitive datastructures containing the es1800 breakpoint instruction */
1192 es1800_create_break_insn (ins
, vec
)
1205 Seach for breakpoint routine in emulator memory.
1206 returns non-zero on failure
1207 vec - trap vector used for breakpoints */
1213 CORE_ADDR memaddress
;
1215 char *instr
= "NqNqNqNs"; /* breakpoint routine */
1218 get_break_addr (vec
, &memaddress
);
1222 status
= target_read_memory (memaddress
, buf
, 8);
1225 memory_error (status
, memaddress
);
1227 return (STRCMP (instr
, buf
));
1233 /* get_break_addr ()
1234 find address of breakpint routine
1235 vec - trap vector used for breakpoints
1236 addrp - store the address here */
1239 get_break_addr (vec
, addrp
)
1243 CORE_ADDR memaddress
= 0;
1252 send_with_reply ("VBR ", buf
, sizeof (buf
));
1254 for (k
= 0; k
< 4; k
++)
1256 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
1258 error ("Emulator reply is too short: %s", buf
);
1260 base_addr
[k
] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
1262 /* base addr of exception vector table */
1263 memaddress
= *((CORE_ADDR
*) base_addr
);
1266 memaddress
+= (vec
+ 32) * 4; /* address of trap vector */
1267 status
= target_read_memory (memaddress
, (char *) addrp
, 4);
1270 memory_error (status
, memaddress
);
1275 /* Kill an inferior process */
1280 if (inferior_pid
!= 0)
1283 es1800_mourn_inferior ();
1288 /* Load a file to the ES1800 emulator.
1289 Converts the file from a.out format into Extended Tekhex format
1290 before the file is loaded.
1291 Also loads the trap routine, and sets the ES1800 breakpoint on it
1292 filename - the a.out to be loaded
1293 from_tty - says whether to be verbose or not
1294 FIXME Uses emulator overlay memory for trap routine */
1297 es1800_load (filename
, from_tty
)
1305 struct cleanup
*old_chain
;
1306 int es1800_load_format
= 5;
1308 if (es1800_desc
== NULL
)
1310 printf ("No emulator attached, type emulator-command first\n");
1314 filename
= tilde_expand (filename
);
1315 make_cleanup (free
, filename
);
1317 switch (es1800_load_format
)
1319 case 2: /* Extended Tekhex */
1322 printf ("Converting \"%s\" to Extended Tekhex Format\n", filename
);
1324 sprintf (buf
, "tekhex %s", filename
);
1326 sprintf (loadname
, "out.hex");
1329 case 5: /* Motorola S-rec */
1332 printf ("Converting \"%s\" to Motorola S-record format\n",
1335 /* in the future the source code in copy (part of binutils-1.93) will
1336 be included in this file */
1338 "copy -s \"a.out-sunos-big\" -d \"srec\" %s /tmp/out.hex",
1341 sprintf (loadname
, "/tmp/out.hex");
1345 error ("Downloading format not defined\n");
1348 breakpoint_init_inferior ();
1352 printf ("Downloading \"%s\" to the ES 1800\n", filename
);
1354 if ((instream
= fopen (loadname
, "r")) == NULL
)
1356 perror_with_name ("fopen:");
1359 old_chain
= make_cleanup (fclose
, instream
);
1364 download (instream
, from_tty
, es1800_load_format
);
1366 /* if breakpoint routine is not present anymore we have to check
1367 whether to download a new breakpoint routine or not */
1369 if ((verify_break (es1800_break_vec
) != 0)
1370 && query ("No breakpoint routine in ES 1800 emulator!\nDownload a breakpoint routine to the emulator? "))
1373 printf ("Using break vector 0x%x\n", es1800_break_vec
);
1374 sprintf (buf
, "0x%x ", es1800_break_vec
);
1375 printf ("Give the start address of the breakpoint routine: ");
1376 fgets (buf
+ strlen (buf
), sizeof (buf
) - strlen (buf
), stdin
);
1377 es1800_init_break (buf
, 0);
1380 do_cleanups (old_chain
);
1382 readchar (); /* FIXME I am getting a ^G = 7 after the prompt */
1385 if (fclose (instream
) == EOF
)
1390 if (es1800_load_format
!= 2)
1392 sprintf (buf
, "/usr/bin/rm %s", loadname
);
1396 symbol_file_command (filename
, from_tty
); /* reading symbol table */
1402 #define NUMCPYBYTES 20
1405 bfd_copy (from_bfd
, to_bfd
)
1411 char buf
[NUMCPYBYTES
];
1413 for (p
= from_bfd
->sections
; p
!= NULL
; p
= p
->next
)
1415 printf (" Copying section %s. Size = %x.\n", p
->name
, p
->_cooked_size
);
1416 printf (" vma = %x, offset = %x, output_sec = %x\n",
1417 p
->vma
, p
->output_offset
, p
->output_section
);
1418 new = bfd_make_section (to_bfd
, p
->name
);
1419 if (p
->_cooked_size
&&
1420 !bfd_set_section_size (to_bfd
, new, p
->_cooked_size
))
1422 error ("Wrong BFD size!\n");
1424 if (!bfd_set_section_flags (to_bfd
, new, p
->flags
))
1426 error ("bfd_set_section_flags");
1430 for (i
= 0; (i
+ NUMCPYBYTES
) < p
->_cooked_size
; i
+= NUMCPYBYTES
)
1432 if (!bfd_get_section_contents (from_bfd
, p
, (PTR
) buf
, (file_ptr
) i
,
1433 (bfd_size_type
) NUMCPYBYTES
))
1435 error ("bfd_get_section_contents\n");
1437 if (!bfd_set_section_contents (to_bfd
, new, (PTR
) buf
, (file_ptr
) i
,
1438 (bfd_size_type
) NUMCPYBYTES
))
1440 error ("bfd_set_section_contents\n");
1443 bfd_get_section_contents (from_bfd
, p
, (PTR
) buf
, (file_ptr
) i
,
1444 (bfd_size_type
) (p
->_cooked_size
- i
));
1445 bfd_set_section_contents (to_bfd
, new, (PTR
) buf
, (file_ptr
) i
,
1446 (bfd_size_type
) (p
->_cooked_size
- i
));
1452 /* Start an process on the es1800 and set inferior_pid to the new
1454 execfile - the file to run
1455 args - arguments passed to the program
1456 env - the environment vector to pass */
1459 es1800_create_inferior (execfile
, args
, env
)
1467 struct expression
*expr
;
1468 register struct cleanup
*old_chain
= 0;
1474 error ("Can't pass arguments to remote ES1800 process");
1478 if (query ("Use 'start' as entry point? "))
1480 expr
= parse_c_expression ("start");
1481 old_chain
= make_cleanup (free_current_contents
, &expr
);
1482 val
= evaluate_expression (expr
);
1483 entry_pt
= (val
->location
).address
;
1487 printf ("Enter the program's entry point (in hexadecimal): ");
1488 scanf ("%x", &entry_pt
);
1492 if (execfile
== 0 || exec_bfd
== 0)
1494 error ("No executable file specified");
1497 entry_pt
= (int) bfd_get_start_address (exec_bfd
);
1501 /* Now that we have a child process, make it our target. */
1503 push_target (&es1800_child_ops
);
1505 /* The "process" (board) is already stopped awaiting our commands, and
1506 the program is already downloaded. We just set its PC and go. */
1508 inferior_pid
= pid
; /* Needed for wait_for_inferior below */
1510 clear_proceed_status ();
1512 /* Tell wait_for_inferior that we've started a new process. */
1514 init_wait_for_inferior ();
1516 /* Set up the "saved terminal modes" of the inferior
1517 based on what modes we are starting it with. */
1519 target_terminal_init ();
1521 /* Install inferior's terminal modes. */
1523 target_terminal_inferior ();
1525 /* remote_start (args); */
1526 /* trap_expected = 0; */
1527 /* insert_step_breakpoint (); FIXME, do we need this? */
1529 /* Let 'er rip... */
1530 proceed ((CORE_ADDR
) entry_pt
, TARGET_SIGNAL_DEFAULT
, 0);
1535 /* The process has died, clean up. */
1538 es1800_mourn_inferior ()
1540 remove_breakpoints ();
1541 unpush_target (&es1800_child_ops
);
1542 generic_mourn_inferior (); /* Do all the proper things now */
1545 /* ES1800-protocol specific routines */
1547 /* Keep discarding input from the remote system, until STRING is found.
1548 Let the user break out immediately.
1549 string - the string to expect
1550 nowait - break out if string not the emulator's first respond otherwise
1551 read until string is found (== 0) */
1554 expect (string
, nowait
)
1569 if (c
== toupper (*p
))
1584 printf ("\'%s\' expected\n", string
);
1585 printf ("char %d is %d", p
- string
, c
);
1591 /* Keep discarding input until we see the prompt. */
1600 /* Read one character */
1604 /* read from stdin */
1612 printf ("readchar, give one character\n");
1615 #if defined (LOG_FILE)
1616 putc (buf
[0] & 0x7f, log_file
);
1619 return (buf
[0] & 0x7f);
1622 #else /* !DEBUG_STDIN */
1624 /* Read a character from the remote system, doing all the fancy
1632 ch
= SERIAL_READCHAR (es1800_desc
, timeout
);
1634 /* FIXME: doing an error() here will probably cause trouble, at least if from
1636 if (ch
== SERIAL_TIMEOUT
)
1637 error ("Timeout reading from remote system.");
1638 else if (ch
== SERIAL_ERROR
)
1639 perror_with_name ("remote read");
1641 #if defined (LOG_FILE)
1642 putc (ch
& 0x7f, log_file
);
1649 #endif /* DEBUG_STDIN */
1652 /* Send a command to the emulator and save the reply.
1653 Report an error if we get an error reply.
1654 string - the es1800 command
1655 buf - containing the emulator reply on return
1656 len - size of buf */
1659 send_with_reply (string
, buf
, len
)
1664 SERIAL_WRITE (es1800_desc
, "\r", 1);
1671 getmessage (buf
, len
);
1675 /* Send the command in STR to the emulator adding \r. check
1676 the echo for consistency.
1677 string - the es1800 command */
1680 send_command (string
)
1684 SERIAL_WRITE (es1800_desc
, "\r", 1);
1694 string - the es1800 command */
1702 fprintf (stderr
, "Sending: %s\n", string
);
1704 SERIAL_WRITE (es1800_desc
, string
, strlen (string
));
1708 /* Read a message from the emulator and store it in BUF.
1709 buf - containing the emulator reply on return
1710 len - size of buf */
1713 getmessage (buf
, len
)
1719 int prompt_found
= 0;
1722 #if defined (LOG_FILE)
1723 /* This is a convenient place to do this. The idea is to do it often
1724 enough that we never lose much data if we terminate abnormally. */
1734 if (len
-- < 2) /* char and terminaling NULL */
1736 error ("input buffer overrun\n");
1741 if ((c
== '>') && (*(bp
- 1) == ' '))
1746 while (!prompt_found
);
1751 fprintf (stderr
, "message received :%s\n", buf
);
1756 download (instream
, from_tty
, format
)
1765 send_command ("SET #2,$1A"); /* reset char = ^Z */
1766 send_command ("SET #3,$11,$13"); /* XON XOFF */
1769 send_command ("SET #26,#2");
1773 send_command ("SET #26,#5"); /* Format=Extended Tekhex */
1775 send_command ("DFB = $10");
1776 send_command ("PUR");
1777 send_command ("CES");
1782 printf (" 0 records loaded...\r");
1784 while (fgets (buf
, 160, instream
))
1789 printf ("%5d\b\b\b\b\b", ++i
);
1792 if ((c
= readchar ()) != 006)
1794 error ("expected ACK");
1803 /* Additional commands */
1805 #if defined (TIOCGETP) && defined (FNDELAY) && defined (EWOULDBLOCK)
1806 #define PROVIDE_TRANSPARENT
1809 #ifdef PROVIDE_TRANSPARENT
1810 /* Talk directly to the emulator
1811 FIXME, uses busy wait, and is SUNOS (or at least BSD) specific */
1815 es1800_transparent (args
, from_tty
)
1820 struct sgttyb modebl
;
1823 struct sgttyb console_mode_save
;
1824 int console_fc_save
;
1829 char consolebuf
[80];
1831 char es1800_buf
[80];
1835 if (es1800_desc
== NULL
)
1837 printf ("No emulator attached, type emulator-command first\n");
1842 printf ("You are now communicating directly with the ES 1800 emulator.\n");
1843 printf ("To leave this mode (transparent mode), press ^E.\n");
1848 if ((console
= open ("/dev/tty", O_RDWR
)) == -1)
1850 perror_with_name ("/dev/tty:");
1853 if ((fcflag
= fcntl (console
, F_GETFL
, 0)) == -1)
1855 perror_with_name ("fcntl console");
1858 console_fc_save
= fcflag
;
1859 fcflag
= fcflag
| FNDELAY
;
1861 if (fcntl (console
, F_SETFL
, fcflag
) == -1)
1863 perror_with_name ("fcntl console");
1866 if (ioctl (console
, TIOCGETP
, &modebl
))
1868 perror_with_name ("ioctl console");
1871 console_mode_save
= modebl
;
1872 modebl
.sg_flags
= RAW
;
1874 if (ioctl (console
, TIOCSETP
, &modebl
))
1876 perror_with_name ("ioctl console");
1879 if ((fcflag
= fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_GETFL
, 0)) == -1)
1881 perror_with_name ("fcntl serial");
1884 es1800_fc_save
= fcflag
;
1885 fcflag
= fcflag
| FNDELAY
;
1887 if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_SETFL
, fcflag
) == -1)
1889 perror_with_name ("fcntl serial");
1894 cc
= read (console
, inputbuf
, inputcnt
);
1897 if ((*inputbuf
& 0x7f) == 0x05)
1901 for (i
= 0; i
< cc
;)
1903 es1800_buf
[es1800_cnt
++] = inputbuf
[i
++];
1905 if ((cc
= SERIAL_WRITE (es1800_desc
, es1800_buf
, es1800_cnt
)) == -1)
1907 perror_with_name ("FEL! write:");
1910 if (es1800_cnt
&& cc
)
1912 for (i
= 0; i
< es1800_cnt
; i
++)
1914 es1800_buf
[i
] = es1800_buf
[cc
+ i
];
1918 else if (errno
!= EWOULDBLOCK
)
1920 perror_with_name ("FEL! read:");
1923 cc
= read (DEPRECATED_SERIAL_FD (es1800_desc
), inputbuf
, inputcnt
);
1926 for (i
= 0; i
< cc
;)
1928 consolebuf
[consolecnt
++] = inputbuf
[i
++];
1930 if ((cc
= write (console
, consolebuf
, consolecnt
)) == -1)
1932 perror_with_name ("FEL! write:");
1935 if (consolecnt
&& cc
)
1937 for (i
= 0; i
< consolecnt
; i
++)
1939 consolebuf
[i
] = consolebuf
[cc
+ i
];
1943 else if (errno
!= EWOULDBLOCK
)
1945 perror_with_name ("FEL! read:");
1949 console_fc_save
= console_fc_save
& !FNDELAY
;
1950 if (fcntl (console
, F_SETFL
, console_fc_save
) == -1)
1952 perror_with_name ("FEL! fcntl");
1955 if (ioctl (console
, TIOCSETP
, &console_mode_save
))
1957 perror_with_name ("FEL! ioctl");
1962 if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc
), F_SETFL
, es1800_fc_save
) == -1)
1964 perror_with_name ("FEL! fcntl");
1970 #endif /* PROVIDE_TRANSPARENT */
1973 es1800_init_break (args
, from_tty
)
1977 CORE_ADDR memaddress
= 0;
1986 error_no_arg ("a trap vector");
1989 if (!(space_index
= strchr (args
, ' ')))
1991 error ("Two arguments needed (trap vector and address of break routine).\n");
1994 *space_index
= '\0';
1996 es1800_break_vec
= strtol (args
, (char **) NULL
, 0);
1997 es1800_break_address
= parse_and_eval_address (space_index
+ 1);
1999 es1800_create_break_insn (es1800_break_insn
, es1800_break_vec
);
2003 send_with_reply ("VBR ", buf
, sizeof (buf
));
2005 for (k
= 0; k
< 4; k
++)
2007 if ((p
[k
* 2 + 1] == 0) || (p
[k
* 2 + 2] == 0))
2009 error ("Emulator reply is too short: %s", buf
);
2011 base_addr
[k
] = (fromhex (p
[k
* 2 + 1]) * 16) + fromhex (p
[k
* 2 + 2]);
2013 /* base addr of exception vector table */
2014 memaddress
= *((CORE_ADDR
*) base_addr
);
2017 memaddress
+= (es1800_break_vec
+ 32) * 4; /* address of trap vector */
2019 sprintf (buf
, "@.L%lx=$%lx", memaddress
, es1800_break_address
);
2020 send_command (buf
); /* set the address of the break routine in the */
2023 sprintf (buf
, "@.L%lx=$4E714E71", es1800_break_address
); /* NOP; NOP */
2025 sprintf (buf
, "@.L%lx=$4E714E73", es1800_break_address
+ 4); /* NOP; RTE */
2028 sprintf (buf
, "AC2=$%lx", es1800_break_address
+ 4);
2029 /* breakpoint at es1800-break_address */
2031 send_command ("WHEN AC2 THEN BRK"); /* ie in exception routine */
2035 printf ("Breakpoint (trap $%x) routine at address: %lx\n",
2036 es1800_break_vec
, es1800_break_address
);
2041 es1800_child_open (arg
, from_tty
)
2045 error ("Use the \"run\" command to start a child process.");
2049 es1800_child_detach (args
, from_tty
)
2055 error ("Argument given to \"detach\" when remotely debugging.");
2061 printf ("Ending debugging the process %d.\n", inferior_pid
);
2066 /* Define the target subroutine names */
2068 struct target_ops es1800_ops
;
2071 init_es1800_ops (void)
2073 es1800_ops
.to_shortname
= "es1800";
2074 es1800_ops
.to_longname
= "Remote serial target in ES1800-emulator protocol";
2075 es1800_ops
.to_doc
= "Remote debugging on the es1800 emulator via a serial line.\n\
2076 Specify the serial device it is connected to (e.g. /dev/ttya).";
2077 es1800_ops
.to_open
= es1800_open
;
2078 es1800_ops
.to_close
= es1800_close
;
2079 es1800_ops
.to_attach
= es1800_attach
;
2080 es1800_ops
.to_post_attach
= NULL
;
2081 es1800_ops
.to_require_attach
= NULL
;
2082 es1800_ops
.to_detach
= es1800_detach
;
2083 es1800_ops
.to_require_detach
= NULL
;
2084 es1800_ops
.to_resume
= es1800_resume
;
2085 es1800_ops
.to_wait
= NULL
;
2086 es1800_ops
.to_post_wait
= NULL
;
2087 es1800_ops
.to_fetch_registers
= NULL
;
2088 es1800_ops
.to_store_registers
= NULL
;
2089 es1800_ops
.to_prepare_to_store
= es1800_prepare_to_store
;
2090 es1800_ops
.to_xfer_memory
= es1800_xfer_inferior_memory
;
2091 es1800_ops
.to_files_info
= es1800_files_info
;
2092 es1800_ops
.to_insert_breakpoint
= es1800_insert_breakpoint
;
2093 es1800_ops
.to_remove_breakpoint
= es1800_remove_breakpoint
;
2094 es1800_ops
.to_terminal_init
= NULL
;
2095 es1800_ops
.to_terminal_inferior
= NULL
;
2096 es1800_ops
.to_terminal_ours_for_output
= NULL
;
2097 es1800_ops
.to_terminal_ours
= NULL
;
2098 es1800_ops
.to_terminal_info
= NULL
;
2099 es1800_ops
.to_kill
= NULL
;
2100 es1800_ops
.to_load
= es1800_load
;
2101 es1800_ops
.to_lookup_symbol
= NULL
;
2102 es1800_ops
.to_create_inferior
= es1800_create_inferior
;
2103 es1800_ops
.to_post_startup_inferior
= NULL
;
2104 es1800_ops
.to_acknowledge_created_inferior
= NULL
;
2105 es1800_ops
.to_clone_and_follow_inferior
= NULL
;
2106 es1800_ops
.to_post_follow_inferior_by_clone
= NULL
;
2107 es1800_ops
.to_insert_fork_catchpoint
= NULL
;
2108 es1800_ops
.to_remove_fork_catchpoint
= NULL
;
2109 es1800_ops
.to_insert_vfork_catchpoint
= NULL
;
2110 es1800_ops
.to_remove_vfork_catchpoint
= NULL
;
2111 es1800_ops
.to_has_forked
= NULL
;
2112 es1800_ops
.to_has_vforked
= NULL
;
2113 es1800_ops
.to_can_follow_vfork_prior_to_exec
= NULL
;
2114 es1800_ops
.to_post_follow_vfork
= NULL
;
2115 es1800_ops
.to_insert_exec_catchpoint
= NULL
;
2116 es1800_ops
.to_remove_exec_catchpoint
= NULL
;
2117 es1800_ops
.to_has_execd
= NULL
;
2118 es1800_ops
.to_reported_exec_events_per_exec_call
= NULL
;
2119 es1800_ops
.to_has_exited
= NULL
;
2120 es1800_ops
.to_mourn_inferior
= NULL
;
2121 es1800_ops
.to_can_run
= 0;
2122 es1800_ops
.to_notice_signals
= 0;
2123 es1800_ops
.to_thread_alive
= 0;
2124 es1800_ops
.to_stop
= 0;
2125 es1800_ops
.to_pid_to_exec_file
= NULL
;
2126 es1800_ops
.to_core_file_to_sym_file
= NULL
;
2127 es1800_ops
.to_stratum
= core_stratum
;
2128 es1800_ops
.DONT_USE
= 0;
2129 es1800_ops
.to_has_all_memory
= 0;
2130 es1800_ops
.to_has_memory
= 1;
2131 es1800_ops
.to_has_stack
= 0;
2132 es1800_ops
.to_has_registers
= 0;
2133 es1800_ops
.to_has_execution
= 0;
2134 es1800_ops
.to_sections
= NULL
;
2135 es1800_ops
.to_sections_end
= NULL
;
2136 es1800_ops
.to_magic
= OPS_MAGIC
;
2139 /* Define the target subroutine names */
2141 struct target_ops es1800_child_ops
;
2144 init_es1800_child_ops (void)
2146 es1800_child_ops
.to_shortname
= "es1800_process";
2147 es1800_child_ops
.to_longname
= "Remote serial target in ES1800-emulator protocol";
2148 es1800_child_ops
.to_doc
= "Remote debugging on the es1800 emulator via a serial line.\n\
2149 Specify the serial device it is connected to (e.g. /dev/ttya).";
2150 es1800_child_ops
.to_open
= es1800_child_open
;
2151 es1800_child_ops
.to_close
= NULL
;
2152 es1800_child_ops
.to_attach
= es1800_attach
;
2153 es1800_child_ops
.to_post_attach
= NULL
;
2154 es1800_child_ops
.to_require_attach
= NULL
;
2155 es1800_child_ops
.to_detach
= es1800_child_detach
;
2156 es1800_child_ops
.to_require_detach
= NULL
;
2157 es1800_child_ops
.to_resume
= es1800_resume
;
2158 es1800_child_ops
.to_wait
= es1800_wait
;
2159 es1800_child_ops
.to_post_wait
= NULL
;
2160 es1800_child_ops
.to_fetch_registers
= es1800_fetch_register
;
2161 es1800_child_ops
.to_store_registers
= es1800_store_register
;
2162 es1800_child_ops
.to_prepare_to_store
= es1800_prepare_to_store
;
2163 es1800_child_ops
.to_xfer_memory
= es1800_xfer_inferior_memory
;
2164 es1800_child_ops
.to_files_info
= es1800_files_info
;
2165 es1800_child_ops
.to_insert_breakpoint
= es1800_insert_breakpoint
;
2166 es1800_child_ops
.to_remove_breakpoint
= es1800_remove_breakpoint
;
2167 es1800_child_ops
.to_terminal_init
= NULL
;
2168 es1800_child_ops
.to_terminal_inferior
= NULL
;
2169 es1800_child_ops
.to_terminal_ours_for_output
= NULL
;
2170 es1800_child_ops
.to_terminal_ours
= NULL
;
2171 es1800_child_ops
.to_terminal_info
= NULL
;
2172 es1800_child_ops
.to_kill
= es1800_kill
;
2173 es1800_child_ops
.to_load
= es1800_load
;
2174 es1800_child_ops
.to_lookup_symbol
= NULL
;
2175 es1800_child_ops
.to_create_inferior
= es1800_create_inferior
;
2176 es1800_child_ops
.to_post_startup_inferior
= NULL
;
2177 es1800_child_ops
.to_acknowledge_created_inferior
= NULL
;
2178 es1800_child_ops
.to_clone_and_follow_inferior
= NULL
;
2179 es1800_child_ops
.to_post_follow_inferior_by_clone
= NULL
;
2180 es1800_child_ops
.to_insert_fork_catchpoint
= NULL
;
2181 es1800_child_ops
.to_remove_fork_catchpoint
= NULL
;
2182 es1800_child_ops
.to_insert_vfork_catchpoint
= NULL
;
2183 es1800_child_ops
.to_remove_vfork_catchpoint
= NULL
;
2184 es1800_child_ops
.to_has_forked
= NULL
;
2185 es1800_child_ops
.to_has_vforked
= NULL
;
2186 es1800_child_ops
.to_can_follow_vfork_prior_to_exec
= NULL
;
2187 es1800_child_ops
.to_post_follow_vfork
= NULL
;
2188 es1800_child_ops
.to_insert_exec_catchpoint
= NULL
;
2189 es1800_child_ops
.to_remove_exec_catchpoint
= NULL
;
2190 es1800_child_ops
.to_has_execd
= NULL
;
2191 es1800_child_ops
.to_reported_exec_events_per_exec_call
= NULL
;
2192 es1800_child_ops
.to_has_exited
= NULL
;
2193 es1800_child_ops
.to_mourn_inferior
= es1800_mourn_inferior
;
2194 es1800_child_ops
.to_can_run
= 0;
2195 es1800_child_ops
.to_notice_signals
= 0;
2196 es1800_child_ops
.to_thread_alive
= 0;
2197 es1800_child_ops
.to_stop
= 0;
2198 es1800_child_ops
.to_pid_to_exec_file
= NULL
;
2199 es1800_child_ops
.to_core_file_to_sym_file
= NULL
;
2200 es1800_child_ops
.to_stratum
= process_stratum
;
2201 es1800_child_ops
.DONT_USE
= 0;
2202 es1800_child_ops
.to_has_all_memory
= 1;
2203 es1800_child_ops
.to_has_memory
= 1;
2204 es1800_child_ops
.to_has_stack
= 1;
2205 es1800_child_ops
.to_has_registers
= 1;
2206 es1800_child_ops
.to_has_execution
= 1;
2207 es1800_child_ops
.to_sections
= NULL
;
2208 es1800_child_ops
.to_sections_end
= NULL
;
2209 es1800_child_ops
.to_magic
= OPS_MAGIC
;
2213 _initialize_es1800 ()
2216 init_es1800_child_ops ();
2217 add_target (&es1800_ops
);
2218 add_target (&es1800_child_ops
);
2219 #ifdef PROVIDE_TRANSPARENT
2220 add_com ("transparent", class_support
, es1800_transparent
,
2221 "Start transparent communication with the ES 1800 emulator.");
2222 #endif /* PROVIDE_TRANSPARENT */
2223 add_com ("init_break", class_support
, es1800_init_break
,
2224 "Download break routine and initialize break facility on ES 1800");