1 |
1181 |
sfurman |
// OBSOLETE /* Remote debugging interface for Motorola's MVME187BUG monitor, an embedded
|
2 |
|
|
// OBSOLETE monitor for the m88k.
|
3 |
|
|
// OBSOLETE
|
4 |
|
|
// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
5 |
|
|
// OBSOLETE 2002 Free Software Foundation, Inc.
|
6 |
|
|
// OBSOLETE
|
7 |
|
|
// OBSOLETE Contributed by Cygnus Support. Written by K. Richard Pixley.
|
8 |
|
|
// OBSOLETE
|
9 |
|
|
// OBSOLETE This file is part of GDB.
|
10 |
|
|
// OBSOLETE
|
11 |
|
|
// OBSOLETE This program is free software; you can redistribute it and/or modify
|
12 |
|
|
// OBSOLETE it under the terms of the GNU General Public License as published by
|
13 |
|
|
// OBSOLETE the Free Software Foundation; either version 2 of the License, or
|
14 |
|
|
// OBSOLETE (at your option) any later version.
|
15 |
|
|
// OBSOLETE
|
16 |
|
|
// OBSOLETE This program is distributed in the hope that it will be useful,
|
17 |
|
|
// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
|
|
// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
|
|
// OBSOLETE GNU General Public License for more details.
|
20 |
|
|
// OBSOLETE
|
21 |
|
|
// OBSOLETE You should have received a copy of the GNU General Public License
|
22 |
|
|
// OBSOLETE along with this program; if not, write to the Free Software
|
23 |
|
|
// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
|
24 |
|
|
// OBSOLETE Boston, MA 02111-1307, USA. */
|
25 |
|
|
// OBSOLETE
|
26 |
|
|
// OBSOLETE #include "defs.h"
|
27 |
|
|
// OBSOLETE #include "inferior.h"
|
28 |
|
|
// OBSOLETE #include "gdb_string.h"
|
29 |
|
|
// OBSOLETE #include "regcache.h"
|
30 |
|
|
// OBSOLETE #include <ctype.h>
|
31 |
|
|
// OBSOLETE #include <fcntl.h>
|
32 |
|
|
// OBSOLETE #include <setjmp.h>
|
33 |
|
|
// OBSOLETE #include <errno.h>
|
34 |
|
|
// OBSOLETE
|
35 |
|
|
// OBSOLETE #include "terminal.h"
|
36 |
|
|
// OBSOLETE #include "gdbcore.h"
|
37 |
|
|
// OBSOLETE #include "gdbcmd.h"
|
38 |
|
|
// OBSOLETE
|
39 |
|
|
// OBSOLETE #include "serial.h"
|
40 |
|
|
// OBSOLETE #include "remote-utils.h"
|
41 |
|
|
// OBSOLETE
|
42 |
|
|
// OBSOLETE /* External data declarations */
|
43 |
|
|
// OBSOLETE extern int stop_soon_quietly; /* for wait_for_inferior */
|
44 |
|
|
// OBSOLETE
|
45 |
|
|
// OBSOLETE /* Forward data declarations */
|
46 |
|
|
// OBSOLETE extern struct target_ops bug_ops; /* Forward declaration */
|
47 |
|
|
// OBSOLETE
|
48 |
|
|
// OBSOLETE /* Forward function declarations */
|
49 |
|
|
// OBSOLETE static int bug_clear_breakpoints (void);
|
50 |
|
|
// OBSOLETE
|
51 |
|
|
// OBSOLETE static int bug_read_memory (CORE_ADDR memaddr,
|
52 |
|
|
// OBSOLETE unsigned char *myaddr, int len);
|
53 |
|
|
// OBSOLETE
|
54 |
|
|
// OBSOLETE static int bug_write_memory (CORE_ADDR memaddr,
|
55 |
|
|
// OBSOLETE unsigned char *myaddr, int len);
|
56 |
|
|
// OBSOLETE
|
57 |
|
|
// OBSOLETE /* This variable is somewhat arbitrary. It's here so that it can be
|
58 |
|
|
// OBSOLETE set from within a running gdb. */
|
59 |
|
|
// OBSOLETE
|
60 |
|
|
// OBSOLETE static int srec_max_retries = 3;
|
61 |
|
|
// OBSOLETE
|
62 |
|
|
// OBSOLETE /* Each S-record download to the target consists of an S0 header
|
63 |
|
|
// OBSOLETE record, some number of S3 data records, and one S7 termination
|
64 |
|
|
// OBSOLETE record. I call this download a "frame". Srec_frame says how many
|
65 |
|
|
// OBSOLETE bytes will be represented in each frame. */
|
66 |
|
|
// OBSOLETE
|
67 |
|
|
// OBSOLETE #define SREC_SIZE 160
|
68 |
|
|
// OBSOLETE static int srec_frame = SREC_SIZE;
|
69 |
|
|
// OBSOLETE
|
70 |
|
|
// OBSOLETE /* This variable determines how many bytes will be represented in each
|
71 |
|
|
// OBSOLETE S3 s-record. */
|
72 |
|
|
// OBSOLETE
|
73 |
|
|
// OBSOLETE static int srec_bytes = 40;
|
74 |
|
|
// OBSOLETE
|
75 |
|
|
// OBSOLETE /* At one point it appeared to me as though the bug monitor could not
|
76 |
|
|
// OBSOLETE really be expected to receive two sequential characters at 9600
|
77 |
|
|
// OBSOLETE baud reliably. Echo-pacing is an attempt to force data across the
|
78 |
|
|
// OBSOLETE line even in this condition. Specifically, in echo-pace mode, each
|
79 |
|
|
// OBSOLETE character is sent one at a time and we look for the echo before
|
80 |
|
|
// OBSOLETE sending the next. This is excruciatingly slow. */
|
81 |
|
|
// OBSOLETE
|
82 |
|
|
// OBSOLETE static int srec_echo_pace = 0;
|
83 |
|
|
// OBSOLETE
|
84 |
|
|
// OBSOLETE /* How long to wait after an srec for a possible error message.
|
85 |
|
|
// OBSOLETE Similar to the above, I tried sleeping after sending each S3 record
|
86 |
|
|
// OBSOLETE in hopes that I might actually see error messages from the bug
|
87 |
|
|
// OBSOLETE monitor. This might actually work if we were to use sleep
|
88 |
|
|
// OBSOLETE intervals smaller than 1 second. */
|
89 |
|
|
// OBSOLETE
|
90 |
|
|
// OBSOLETE static int srec_sleep = 0;
|
91 |
|
|
// OBSOLETE
|
92 |
|
|
// OBSOLETE /* Every srec_noise records, flub the checksum. This is a debugging
|
93 |
|
|
// OBSOLETE feature. Set the variable to something other than 1 in order to
|
94 |
|
|
// OBSOLETE inject *deliberate* checksum errors. One might do this if one
|
95 |
|
|
// OBSOLETE wanted to test error handling and recovery. */
|
96 |
|
|
// OBSOLETE
|
97 |
|
|
// OBSOLETE static int srec_noise = 0;
|
98 |
|
|
// OBSOLETE
|
99 |
|
|
// OBSOLETE /* Called when SIGALRM signal sent due to alarm() timeout. */
|
100 |
|
|
// OBSOLETE
|
101 |
|
|
// OBSOLETE /* Number of SIGTRAPs we need to simulate. That is, the next
|
102 |
|
|
// OBSOLETE NEED_ARTIFICIAL_TRAP calls to bug_wait should just return
|
103 |
|
|
// OBSOLETE SIGTRAP without actually waiting for anything. */
|
104 |
|
|
// OBSOLETE
|
105 |
|
|
// OBSOLETE static int need_artificial_trap = 0;
|
106 |
|
|
// OBSOLETE
|
107 |
|
|
// OBSOLETE /*
|
108 |
|
|
// OBSOLETE * Download a file specified in 'args', to the bug.
|
109 |
|
|
// OBSOLETE */
|
110 |
|
|
// OBSOLETE
|
111 |
|
|
// OBSOLETE static void
|
112 |
|
|
// OBSOLETE bug_load (char *args, int fromtty)
|
113 |
|
|
// OBSOLETE {
|
114 |
|
|
// OBSOLETE bfd *abfd;
|
115 |
|
|
// OBSOLETE asection *s;
|
116 |
|
|
// OBSOLETE char buffer[1024];
|
117 |
|
|
// OBSOLETE
|
118 |
|
|
// OBSOLETE sr_check_open ();
|
119 |
|
|
// OBSOLETE
|
120 |
|
|
// OBSOLETE inferior_ptid = null_ptid;
|
121 |
|
|
// OBSOLETE abfd = bfd_openr (args, 0);
|
122 |
|
|
// OBSOLETE if (!abfd)
|
123 |
|
|
// OBSOLETE {
|
124 |
|
|
// OBSOLETE printf_filtered ("Unable to open file %s\n", args);
|
125 |
|
|
// OBSOLETE return;
|
126 |
|
|
// OBSOLETE }
|
127 |
|
|
// OBSOLETE
|
128 |
|
|
// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0)
|
129 |
|
|
// OBSOLETE {
|
130 |
|
|
// OBSOLETE printf_filtered ("File is not an object file\n");
|
131 |
|
|
// OBSOLETE return;
|
132 |
|
|
// OBSOLETE }
|
133 |
|
|
// OBSOLETE
|
134 |
|
|
// OBSOLETE s = abfd->sections;
|
135 |
|
|
// OBSOLETE while (s != (asection *) NULL)
|
136 |
|
|
// OBSOLETE {
|
137 |
|
|
// OBSOLETE srec_frame = SREC_SIZE;
|
138 |
|
|
// OBSOLETE if (s->flags & SEC_LOAD)
|
139 |
|
|
// OBSOLETE {
|
140 |
|
|
// OBSOLETE int i;
|
141 |
|
|
// OBSOLETE
|
142 |
|
|
// OBSOLETE char *buffer = xmalloc (srec_frame);
|
143 |
|
|
// OBSOLETE
|
144 |
|
|
// OBSOLETE printf_filtered ("%s\t: 0x%4lx .. 0x%4lx ", s->name, s->vma, s->vma + s->_raw_size);
|
145 |
|
|
// OBSOLETE gdb_flush (gdb_stdout);
|
146 |
|
|
// OBSOLETE for (i = 0; i < s->_raw_size; i += srec_frame)
|
147 |
|
|
// OBSOLETE {
|
148 |
|
|
// OBSOLETE if (srec_frame > s->_raw_size - i)
|
149 |
|
|
// OBSOLETE srec_frame = s->_raw_size - i;
|
150 |
|
|
// OBSOLETE
|
151 |
|
|
// OBSOLETE bfd_get_section_contents (abfd, s, buffer, i, srec_frame);
|
152 |
|
|
// OBSOLETE bug_write_memory (s->vma + i, buffer, srec_frame);
|
153 |
|
|
// OBSOLETE printf_filtered ("*");
|
154 |
|
|
// OBSOLETE gdb_flush (gdb_stdout);
|
155 |
|
|
// OBSOLETE }
|
156 |
|
|
// OBSOLETE printf_filtered ("\n");
|
157 |
|
|
// OBSOLETE xfree (buffer);
|
158 |
|
|
// OBSOLETE }
|
159 |
|
|
// OBSOLETE s = s->next;
|
160 |
|
|
// OBSOLETE }
|
161 |
|
|
// OBSOLETE sprintf (buffer, "rs ip %lx", (unsigned long) abfd->start_address);
|
162 |
|
|
// OBSOLETE sr_write_cr (buffer);
|
163 |
|
|
// OBSOLETE gr_expect_prompt ();
|
164 |
|
|
// OBSOLETE }
|
165 |
|
|
// OBSOLETE
|
166 |
|
|
// OBSOLETE #if 0
|
167 |
|
|
// OBSOLETE static char *
|
168 |
|
|
// OBSOLETE get_word (char **p)
|
169 |
|
|
// OBSOLETE {
|
170 |
|
|
// OBSOLETE char *s = *p;
|
171 |
|
|
// OBSOLETE char *word;
|
172 |
|
|
// OBSOLETE char *copy;
|
173 |
|
|
// OBSOLETE size_t len;
|
174 |
|
|
// OBSOLETE
|
175 |
|
|
// OBSOLETE while (isspace (*s))
|
176 |
|
|
// OBSOLETE s++;
|
177 |
|
|
// OBSOLETE
|
178 |
|
|
// OBSOLETE word = s;
|
179 |
|
|
// OBSOLETE
|
180 |
|
|
// OBSOLETE len = 0;
|
181 |
|
|
// OBSOLETE
|
182 |
|
|
// OBSOLETE while (*s && !isspace (*s))
|
183 |
|
|
// OBSOLETE {
|
184 |
|
|
// OBSOLETE s++;
|
185 |
|
|
// OBSOLETE len++;
|
186 |
|
|
// OBSOLETE
|
187 |
|
|
// OBSOLETE }
|
188 |
|
|
// OBSOLETE copy = xmalloc (len + 1);
|
189 |
|
|
// OBSOLETE memcpy (copy, word, len);
|
190 |
|
|
// OBSOLETE copy[len] = 0;
|
191 |
|
|
// OBSOLETE *p = s;
|
192 |
|
|
// OBSOLETE return copy;
|
193 |
|
|
// OBSOLETE }
|
194 |
|
|
// OBSOLETE #endif
|
195 |
|
|
// OBSOLETE
|
196 |
|
|
// OBSOLETE static struct gr_settings bug_settings =
|
197 |
|
|
// OBSOLETE {
|
198 |
|
|
// OBSOLETE "Bug>", /* prompt */
|
199 |
|
|
// OBSOLETE &bug_ops, /* ops */
|
200 |
|
|
// OBSOLETE bug_clear_breakpoints, /* clear_all_breakpoints */
|
201 |
|
|
// OBSOLETE gr_generic_checkin, /* checkin */
|
202 |
|
|
// OBSOLETE };
|
203 |
|
|
// OBSOLETE
|
204 |
|
|
// OBSOLETE static char *cpu_check_strings[] =
|
205 |
|
|
// OBSOLETE {
|
206 |
|
|
// OBSOLETE "=",
|
207 |
|
|
// OBSOLETE "Invalid Register",
|
208 |
|
|
// OBSOLETE };
|
209 |
|
|
// OBSOLETE
|
210 |
|
|
// OBSOLETE static void
|
211 |
|
|
// OBSOLETE bug_open (char *args, int from_tty)
|
212 |
|
|
// OBSOLETE {
|
213 |
|
|
// OBSOLETE if (args == NULL)
|
214 |
|
|
// OBSOLETE args = "";
|
215 |
|
|
// OBSOLETE
|
216 |
|
|
// OBSOLETE gr_open (args, from_tty, &bug_settings);
|
217 |
|
|
// OBSOLETE /* decide *now* whether we are on an 88100 or an 88110 */
|
218 |
|
|
// OBSOLETE sr_write_cr ("rs cr06");
|
219 |
|
|
// OBSOLETE sr_expect ("rs cr06");
|
220 |
|
|
// OBSOLETE
|
221 |
|
|
// OBSOLETE switch (gr_multi_scan (cpu_check_strings, 0))
|
222 |
|
|
// OBSOLETE {
|
223 |
|
|
// OBSOLETE case 0: /* this is an m88100 */
|
224 |
|
|
// OBSOLETE target_is_m88110 = 0;
|
225 |
|
|
// OBSOLETE break;
|
226 |
|
|
// OBSOLETE case 1: /* this is an m88110 */
|
227 |
|
|
// OBSOLETE target_is_m88110 = 1;
|
228 |
|
|
// OBSOLETE break;
|
229 |
|
|
// OBSOLETE default:
|
230 |
|
|
// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check");
|
231 |
|
|
// OBSOLETE }
|
232 |
|
|
// OBSOLETE }
|
233 |
|
|
// OBSOLETE
|
234 |
|
|
// OBSOLETE /* Tell the remote machine to resume. */
|
235 |
|
|
// OBSOLETE
|
236 |
|
|
// OBSOLETE void
|
237 |
|
|
// OBSOLETE bug_resume (ptid_t ptid, int step, enum target_signal sig)
|
238 |
|
|
// OBSOLETE {
|
239 |
|
|
// OBSOLETE if (step)
|
240 |
|
|
// OBSOLETE {
|
241 |
|
|
// OBSOLETE sr_write_cr ("t");
|
242 |
|
|
// OBSOLETE
|
243 |
|
|
// OBSOLETE /* Force the next bug_wait to return a trap. Not doing anything
|
244 |
|
|
// OBSOLETE about I/O from the target means that the user has to type
|
245 |
|
|
// OBSOLETE "continue" to see any. FIXME, this should be fixed. */
|
246 |
|
|
// OBSOLETE need_artificial_trap = 1;
|
247 |
|
|
// OBSOLETE }
|
248 |
|
|
// OBSOLETE else
|
249 |
|
|
// OBSOLETE sr_write_cr ("g");
|
250 |
|
|
// OBSOLETE
|
251 |
|
|
// OBSOLETE return;
|
252 |
|
|
// OBSOLETE }
|
253 |
|
|
// OBSOLETE
|
254 |
|
|
// OBSOLETE /* Wait until the remote machine stops, then return,
|
255 |
|
|
// OBSOLETE storing status in STATUS just as `wait' would. */
|
256 |
|
|
// OBSOLETE
|
257 |
|
|
// OBSOLETE static char *wait_strings[] =
|
258 |
|
|
// OBSOLETE {
|
259 |
|
|
// OBSOLETE "At Breakpoint",
|
260 |
|
|
// OBSOLETE "Exception: Data Access Fault (Local Bus Timeout)",
|
261 |
|
|
// OBSOLETE "\r8??\?-Bug>", /* The '\?' avoids creating a trigraph */
|
262 |
|
|
// OBSOLETE "\r197-Bug>",
|
263 |
|
|
// OBSOLETE NULL,
|
264 |
|
|
// OBSOLETE };
|
265 |
|
|
// OBSOLETE
|
266 |
|
|
// OBSOLETE ptid_t
|
267 |
|
|
// OBSOLETE bug_wait (ptid_t ptid, struct target_waitstatus *status)
|
268 |
|
|
// OBSOLETE {
|
269 |
|
|
// OBSOLETE int old_timeout = sr_get_timeout ();
|
270 |
|
|
// OBSOLETE int old_immediate_quit = immediate_quit;
|
271 |
|
|
// OBSOLETE
|
272 |
|
|
// OBSOLETE status->kind = TARGET_WAITKIND_EXITED;
|
273 |
|
|
// OBSOLETE status->value.integer = 0;
|
274 |
|
|
// OBSOLETE
|
275 |
|
|
// OBSOLETE /* read off leftovers from resume so that the rest can be passed
|
276 |
|
|
// OBSOLETE back out as stdout. */
|
277 |
|
|
// OBSOLETE if (need_artificial_trap == 0)
|
278 |
|
|
// OBSOLETE {
|
279 |
|
|
// OBSOLETE sr_expect ("Effective address: ");
|
280 |
|
|
// OBSOLETE (void) sr_get_hex_word ();
|
281 |
|
|
// OBSOLETE sr_expect ("\r\n");
|
282 |
|
|
// OBSOLETE }
|
283 |
|
|
// OBSOLETE
|
284 |
|
|
// OBSOLETE sr_set_timeout (-1); /* Don't time out -- user program is running. */
|
285 |
|
|
// OBSOLETE immediate_quit = 1; /* Helps ability to QUIT */
|
286 |
|
|
// OBSOLETE
|
287 |
|
|
// OBSOLETE switch (gr_multi_scan (wait_strings, need_artificial_trap == 0))
|
288 |
|
|
// OBSOLETE {
|
289 |
|
|
// OBSOLETE case 0: /* breakpoint case */
|
290 |
|
|
// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED;
|
291 |
|
|
// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP;
|
292 |
|
|
// OBSOLETE /* user output from the target can be discarded here. (?) */
|
293 |
|
|
// OBSOLETE gr_expect_prompt ();
|
294 |
|
|
// OBSOLETE break;
|
295 |
|
|
// OBSOLETE
|
296 |
|
|
// OBSOLETE case 1: /* bus error */
|
297 |
|
|
// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED;
|
298 |
|
|
// OBSOLETE status->value.sig = TARGET_SIGNAL_BUS;
|
299 |
|
|
// OBSOLETE /* user output from the target can be discarded here. (?) */
|
300 |
|
|
// OBSOLETE gr_expect_prompt ();
|
301 |
|
|
// OBSOLETE break;
|
302 |
|
|
// OBSOLETE
|
303 |
|
|
// OBSOLETE case 2: /* normal case */
|
304 |
|
|
// OBSOLETE case 3:
|
305 |
|
|
// OBSOLETE if (need_artificial_trap != 0)
|
306 |
|
|
// OBSOLETE {
|
307 |
|
|
// OBSOLETE /* stepping */
|
308 |
|
|
// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED;
|
309 |
|
|
// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP;
|
310 |
|
|
// OBSOLETE need_artificial_trap--;
|
311 |
|
|
// OBSOLETE break;
|
312 |
|
|
// OBSOLETE }
|
313 |
|
|
// OBSOLETE else
|
314 |
|
|
// OBSOLETE {
|
315 |
|
|
// OBSOLETE /* exit case */
|
316 |
|
|
// OBSOLETE status->kind = TARGET_WAITKIND_EXITED;
|
317 |
|
|
// OBSOLETE status->value.integer = 0;
|
318 |
|
|
// OBSOLETE break;
|
319 |
|
|
// OBSOLETE }
|
320 |
|
|
// OBSOLETE
|
321 |
|
|
// OBSOLETE case -1: /* trouble */
|
322 |
|
|
// OBSOLETE default:
|
323 |
|
|
// OBSOLETE fprintf_filtered (gdb_stderr,
|
324 |
|
|
// OBSOLETE "Trouble reading target during wait\n");
|
325 |
|
|
// OBSOLETE break;
|
326 |
|
|
// OBSOLETE }
|
327 |
|
|
// OBSOLETE
|
328 |
|
|
// OBSOLETE sr_set_timeout (old_timeout);
|
329 |
|
|
// OBSOLETE immediate_quit = old_immediate_quit;
|
330 |
|
|
// OBSOLETE return inferior_ptid;
|
331 |
|
|
// OBSOLETE }
|
332 |
|
|
// OBSOLETE
|
333 |
|
|
// OBSOLETE /* Return the name of register number REGNO
|
334 |
|
|
// OBSOLETE in the form input and output by bug.
|
335 |
|
|
// OBSOLETE
|
336 |
|
|
// OBSOLETE Returns a pointer to a static buffer containing the answer. */
|
337 |
|
|
// OBSOLETE static char *
|
338 |
|
|
// OBSOLETE get_reg_name (int regno)
|
339 |
|
|
// OBSOLETE {
|
340 |
|
|
// OBSOLETE static char *rn[] =
|
341 |
|
|
// OBSOLETE {
|
342 |
|
|
// OBSOLETE "r00", "r01", "r02", "r03", "r04", "r05", "r06", "r07",
|
343 |
|
|
// OBSOLETE "r08", "r09", "r10", "r11", "r12", "r13", "r14", "r15",
|
344 |
|
|
// OBSOLETE "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
345 |
|
|
// OBSOLETE "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
|
346 |
|
|
// OBSOLETE
|
347 |
|
|
// OBSOLETE /* these get confusing because we omit a few and switch some ordering around. */
|
348 |
|
|
// OBSOLETE
|
349 |
|
|
// OBSOLETE "cr01", /* 32 = psr */
|
350 |
|
|
// OBSOLETE "fcr62", /* 33 = fpsr */
|
351 |
|
|
// OBSOLETE "fcr63", /* 34 = fpcr */
|
352 |
|
|
// OBSOLETE "ip", /* this is something of a cheat. */
|
353 |
|
|
// OBSOLETE /* 35 = sxip */
|
354 |
|
|
// OBSOLETE "cr05", /* 36 = snip */
|
355 |
|
|
// OBSOLETE "cr06", /* 37 = sfip */
|
356 |
|
|
// OBSOLETE
|
357 |
|
|
// OBSOLETE "x00", "x01", "x02", "x03", "x04", "x05", "x06", "x07",
|
358 |
|
|
// OBSOLETE "x08", "x09", "x10", "x11", "x12", "x13", "x14", "x15",
|
359 |
|
|
// OBSOLETE "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
|
360 |
|
|
// OBSOLETE "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31",
|
361 |
|
|
// OBSOLETE };
|
362 |
|
|
// OBSOLETE
|
363 |
|
|
// OBSOLETE return rn[regno];
|
364 |
|
|
// OBSOLETE }
|
365 |
|
|
// OBSOLETE
|
366 |
|
|
// OBSOLETE #if 0 /* not currently used */
|
367 |
|
|
// OBSOLETE /* Read from remote while the input matches STRING. Return zero on
|
368 |
|
|
// OBSOLETE success, -1 on failure. */
|
369 |
|
|
// OBSOLETE
|
370 |
|
|
// OBSOLETE static int
|
371 |
|
|
// OBSOLETE bug_scan (char *s)
|
372 |
|
|
// OBSOLETE {
|
373 |
|
|
// OBSOLETE int c;
|
374 |
|
|
// OBSOLETE
|
375 |
|
|
// OBSOLETE while (*s)
|
376 |
|
|
// OBSOLETE {
|
377 |
|
|
// OBSOLETE c = sr_readchar ();
|
378 |
|
|
// OBSOLETE if (c != *s++)
|
379 |
|
|
// OBSOLETE {
|
380 |
|
|
// OBSOLETE fflush (stdout);
|
381 |
|
|
// OBSOLETE printf ("\nNext character is '%c' - %d and s is \"%s\".\n", c, c, --s);
|
382 |
|
|
// OBSOLETE return (-1);
|
383 |
|
|
// OBSOLETE }
|
384 |
|
|
// OBSOLETE }
|
385 |
|
|
// OBSOLETE
|
386 |
|
|
// OBSOLETE return (0);
|
387 |
|
|
// OBSOLETE }
|
388 |
|
|
// OBSOLETE #endif /* never */
|
389 |
|
|
// OBSOLETE
|
390 |
|
|
// OBSOLETE static int
|
391 |
|
|
// OBSOLETE bug_srec_write_cr (char *s)
|
392 |
|
|
// OBSOLETE {
|
393 |
|
|
// OBSOLETE char *p = s;
|
394 |
|
|
// OBSOLETE
|
395 |
|
|
// OBSOLETE if (srec_echo_pace)
|
396 |
|
|
// OBSOLETE for (p = s; *p; ++p)
|
397 |
|
|
// OBSOLETE {
|
398 |
|
|
// OBSOLETE if (sr_get_debug () > 0)
|
399 |
|
|
// OBSOLETE printf ("%c", *p);
|
400 |
|
|
// OBSOLETE
|
401 |
|
|
// OBSOLETE do
|
402 |
|
|
// OBSOLETE serial_write (sr_get_desc (), p, 1);
|
403 |
|
|
// OBSOLETE while (sr_pollchar () != *p);
|
404 |
|
|
// OBSOLETE }
|
405 |
|
|
// OBSOLETE else
|
406 |
|
|
// OBSOLETE {
|
407 |
|
|
// OBSOLETE sr_write_cr (s);
|
408 |
|
|
// OBSOLETE /* return(bug_scan (s) || bug_scan ("\n")); */
|
409 |
|
|
// OBSOLETE }
|
410 |
|
|
// OBSOLETE
|
411 |
|
|
// OBSOLETE return (0);
|
412 |
|
|
// OBSOLETE }
|
413 |
|
|
// OBSOLETE
|
414 |
|
|
// OBSOLETE /* Store register REGNO, or all if REGNO == -1. */
|
415 |
|
|
// OBSOLETE
|
416 |
|
|
// OBSOLETE static void
|
417 |
|
|
// OBSOLETE bug_fetch_register (int regno)
|
418 |
|
|
// OBSOLETE {
|
419 |
|
|
// OBSOLETE sr_check_open ();
|
420 |
|
|
// OBSOLETE
|
421 |
|
|
// OBSOLETE if (regno == -1)
|
422 |
|
|
// OBSOLETE {
|
423 |
|
|
// OBSOLETE int i;
|
424 |
|
|
// OBSOLETE
|
425 |
|
|
// OBSOLETE for (i = 0; i < NUM_REGS; ++i)
|
426 |
|
|
// OBSOLETE bug_fetch_register (i);
|
427 |
|
|
// OBSOLETE }
|
428 |
|
|
// OBSOLETE else if (target_is_m88110 && regno == SFIP_REGNUM)
|
429 |
|
|
// OBSOLETE {
|
430 |
|
|
// OBSOLETE /* m88110 has no sfip. */
|
431 |
|
|
// OBSOLETE long l = 0;
|
432 |
|
|
// OBSOLETE supply_register (regno, (char *) &l);
|
433 |
|
|
// OBSOLETE }
|
434 |
|
|
// OBSOLETE else if (regno < XFP_REGNUM)
|
435 |
|
|
// OBSOLETE {
|
436 |
|
|
// OBSOLETE char buffer[MAX_REGISTER_RAW_SIZE];
|
437 |
|
|
// OBSOLETE
|
438 |
|
|
// OBSOLETE sr_write ("rs ", 3);
|
439 |
|
|
// OBSOLETE sr_write_cr (get_reg_name (regno));
|
440 |
|
|
// OBSOLETE sr_expect ("=");
|
441 |
|
|
// OBSOLETE store_unsigned_integer (buffer, REGISTER_RAW_SIZE (regno),
|
442 |
|
|
// OBSOLETE sr_get_hex_word ());
|
443 |
|
|
// OBSOLETE gr_expect_prompt ();
|
444 |
|
|
// OBSOLETE supply_register (regno, buffer);
|
445 |
|
|
// OBSOLETE }
|
446 |
|
|
// OBSOLETE else
|
447 |
|
|
// OBSOLETE {
|
448 |
|
|
// OBSOLETE /* Float register so we need to parse a strange data format. */
|
449 |
|
|
// OBSOLETE long p;
|
450 |
|
|
// OBSOLETE unsigned char fpreg_buf[10];
|
451 |
|
|
// OBSOLETE
|
452 |
|
|
// OBSOLETE sr_write ("rs ", 3);
|
453 |
|
|
// OBSOLETE sr_write (get_reg_name (regno), strlen (get_reg_name (regno)));
|
454 |
|
|
// OBSOLETE sr_write_cr (";d");
|
455 |
|
|
// OBSOLETE sr_expect ("rs");
|
456 |
|
|
// OBSOLETE sr_expect (get_reg_name (regno));
|
457 |
|
|
// OBSOLETE sr_expect (";d");
|
458 |
|
|
// OBSOLETE sr_expect ("=");
|
459 |
|
|
// OBSOLETE
|
460 |
|
|
// OBSOLETE /* sign */
|
461 |
|
|
// OBSOLETE p = sr_get_hex_digit (1);
|
462 |
|
|
// OBSOLETE fpreg_buf[0] = p << 7;
|
463 |
|
|
// OBSOLETE
|
464 |
|
|
// OBSOLETE /* exponent */
|
465 |
|
|
// OBSOLETE sr_expect ("_");
|
466 |
|
|
// OBSOLETE p = sr_get_hex_digit (1);
|
467 |
|
|
// OBSOLETE fpreg_buf[0] += (p << 4);
|
468 |
|
|
// OBSOLETE fpreg_buf[0] += sr_get_hex_digit (1);
|
469 |
|
|
// OBSOLETE
|
470 |
|
|
// OBSOLETE fpreg_buf[1] = sr_get_hex_digit (1) << 4;
|
471 |
|
|
// OBSOLETE
|
472 |
|
|
// OBSOLETE /* fraction */
|
473 |
|
|
// OBSOLETE sr_expect ("_");
|
474 |
|
|
// OBSOLETE fpreg_buf[1] += sr_get_hex_digit (1);
|
475 |
|
|
// OBSOLETE
|
476 |
|
|
// OBSOLETE fpreg_buf[2] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1);
|
477 |
|
|
// OBSOLETE fpreg_buf[3] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1);
|
478 |
|
|
// OBSOLETE fpreg_buf[4] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1);
|
479 |
|
|
// OBSOLETE fpreg_buf[5] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1);
|
480 |
|
|
// OBSOLETE fpreg_buf[6] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1);
|
481 |
|
|
// OBSOLETE fpreg_buf[7] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1);
|
482 |
|
|
// OBSOLETE fpreg_buf[8] = 0;
|
483 |
|
|
// OBSOLETE fpreg_buf[9] = 0;
|
484 |
|
|
// OBSOLETE
|
485 |
|
|
// OBSOLETE gr_expect_prompt ();
|
486 |
|
|
// OBSOLETE supply_register (regno, fpreg_buf);
|
487 |
|
|
// OBSOLETE }
|
488 |
|
|
// OBSOLETE
|
489 |
|
|
// OBSOLETE return;
|
490 |
|
|
// OBSOLETE }
|
491 |
|
|
// OBSOLETE
|
492 |
|
|
// OBSOLETE /* Store register REGNO, or all if REGNO == -1. */
|
493 |
|
|
// OBSOLETE
|
494 |
|
|
// OBSOLETE static void
|
495 |
|
|
// OBSOLETE bug_store_register (int regno)
|
496 |
|
|
// OBSOLETE {
|
497 |
|
|
// OBSOLETE char buffer[1024];
|
498 |
|
|
// OBSOLETE sr_check_open ();
|
499 |
|
|
// OBSOLETE
|
500 |
|
|
// OBSOLETE if (regno == -1)
|
501 |
|
|
// OBSOLETE {
|
502 |
|
|
// OBSOLETE int i;
|
503 |
|
|
// OBSOLETE
|
504 |
|
|
// OBSOLETE for (i = 0; i < NUM_REGS; ++i)
|
505 |
|
|
// OBSOLETE bug_store_register (i);
|
506 |
|
|
// OBSOLETE }
|
507 |
|
|
// OBSOLETE else
|
508 |
|
|
// OBSOLETE {
|
509 |
|
|
// OBSOLETE char *regname;
|
510 |
|
|
// OBSOLETE
|
511 |
|
|
// OBSOLETE regname = get_reg_name (regno);
|
512 |
|
|
// OBSOLETE
|
513 |
|
|
// OBSOLETE if (target_is_m88110 && regno == SFIP_REGNUM)
|
514 |
|
|
// OBSOLETE return;
|
515 |
|
|
// OBSOLETE else if (regno < XFP_REGNUM)
|
516 |
|
|
// OBSOLETE sprintf (buffer, "rs %s %08lx",
|
517 |
|
|
// OBSOLETE regname,
|
518 |
|
|
// OBSOLETE (long) read_register (regno));
|
519 |
|
|
// OBSOLETE else
|
520 |
|
|
// OBSOLETE {
|
521 |
|
|
// OBSOLETE unsigned char *fpreg_buf =
|
522 |
|
|
// OBSOLETE (unsigned char *) ®isters[REGISTER_BYTE (regno)];
|
523 |
|
|
// OBSOLETE
|
524 |
|
|
// OBSOLETE sprintf (buffer, "rs %s %1x_%02x%1x_%1x%02x%02x%02x%02x%02x%02x;d",
|
525 |
|
|
// OBSOLETE regname,
|
526 |
|
|
// OBSOLETE /* sign */
|
527 |
|
|
// OBSOLETE (fpreg_buf[0] >> 7) & 0xf,
|
528 |
|
|
// OBSOLETE /* exponent */
|
529 |
|
|
// OBSOLETE fpreg_buf[0] & 0x7f,
|
530 |
|
|
// OBSOLETE (fpreg_buf[1] >> 8) & 0xf,
|
531 |
|
|
// OBSOLETE /* fraction */
|
532 |
|
|
// OBSOLETE fpreg_buf[1] & 0xf,
|
533 |
|
|
// OBSOLETE fpreg_buf[2],
|
534 |
|
|
// OBSOLETE fpreg_buf[3],
|
535 |
|
|
// OBSOLETE fpreg_buf[4],
|
536 |
|
|
// OBSOLETE fpreg_buf[5],
|
537 |
|
|
// OBSOLETE fpreg_buf[6],
|
538 |
|
|
// OBSOLETE fpreg_buf[7]);
|
539 |
|
|
// OBSOLETE }
|
540 |
|
|
// OBSOLETE
|
541 |
|
|
// OBSOLETE sr_write_cr (buffer);
|
542 |
|
|
// OBSOLETE gr_expect_prompt ();
|
543 |
|
|
// OBSOLETE }
|
544 |
|
|
// OBSOLETE
|
545 |
|
|
// OBSOLETE return;
|
546 |
|
|
// OBSOLETE }
|
547 |
|
|
// OBSOLETE
|
548 |
|
|
// OBSOLETE /* Transfer LEN bytes between GDB address MYADDR and target address
|
549 |
|
|
// OBSOLETE MEMADDR. If WRITE is non-zero, transfer them to the target,
|
550 |
|
|
// OBSOLETE otherwise transfer them from the target. TARGET is unused.
|
551 |
|
|
// OBSOLETE
|
552 |
|
|
// OBSOLETE Returns the number of bytes transferred. */
|
553 |
|
|
// OBSOLETE
|
554 |
|
|
// OBSOLETE int
|
555 |
|
|
// OBSOLETE bug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
|
556 |
|
|
// OBSOLETE struct mem_attrib *attrib, struct target_ops *target)
|
557 |
|
|
// OBSOLETE {
|
558 |
|
|
// OBSOLETE int res;
|
559 |
|
|
// OBSOLETE
|
560 |
|
|
// OBSOLETE if (len <= 0)
|
561 |
|
|
// OBSOLETE return 0;
|
562 |
|
|
// OBSOLETE
|
563 |
|
|
// OBSOLETE if (write)
|
564 |
|
|
// OBSOLETE res = bug_write_memory (memaddr, myaddr, len);
|
565 |
|
|
// OBSOLETE else
|
566 |
|
|
// OBSOLETE res = bug_read_memory (memaddr, myaddr, len);
|
567 |
|
|
// OBSOLETE
|
568 |
|
|
// OBSOLETE return res;
|
569 |
|
|
// OBSOLETE }
|
570 |
|
|
// OBSOLETE
|
571 |
|
|
// OBSOLETE static void
|
572 |
|
|
// OBSOLETE start_load (void)
|
573 |
|
|
// OBSOLETE {
|
574 |
|
|
// OBSOLETE char *command;
|
575 |
|
|
// OBSOLETE
|
576 |
|
|
// OBSOLETE command = (srec_echo_pace ? "lo 0 ;x" : "lo 0");
|
577 |
|
|
// OBSOLETE
|
578 |
|
|
// OBSOLETE sr_write_cr (command);
|
579 |
|
|
// OBSOLETE sr_expect (command);
|
580 |
|
|
// OBSOLETE sr_expect ("\r\n");
|
581 |
|
|
// OBSOLETE bug_srec_write_cr ("S0030000FC");
|
582 |
|
|
// OBSOLETE return;
|
583 |
|
|
// OBSOLETE }
|
584 |
|
|
// OBSOLETE
|
585 |
|
|
// OBSOLETE /* This is an extremely vulnerable and fragile function. I've made
|
586 |
|
|
// OBSOLETE considerable attempts to make this deterministic, but I've
|
587 |
|
|
// OBSOLETE certainly forgotten something. The trouble is that S-records are
|
588 |
|
|
// OBSOLETE only a partial file format, not a protocol. Worse, apparently the
|
589 |
|
|
// OBSOLETE m88k bug monitor does not run in real time while receiving
|
590 |
|
|
// OBSOLETE S-records. Hence, we must pay excruciating attention to when and
|
591 |
|
|
// OBSOLETE where error messages are returned, and what has actually been sent.
|
592 |
|
|
// OBSOLETE
|
593 |
|
|
// OBSOLETE Each call represents a chunk of memory to be sent to the target.
|
594 |
|
|
// OBSOLETE We break that chunk into an S0 header record, some number of S3
|
595 |
|
|
// OBSOLETE data records each containing srec_bytes, and an S7 termination
|
596 |
|
|
// OBSOLETE record. */
|
597 |
|
|
// OBSOLETE
|
598 |
|
|
// OBSOLETE static char *srecord_strings[] =
|
599 |
|
|
// OBSOLETE {
|
600 |
|
|
// OBSOLETE "S-RECORD",
|
601 |
|
|
// OBSOLETE "-Bug>",
|
602 |
|
|
// OBSOLETE NULL,
|
603 |
|
|
// OBSOLETE };
|
604 |
|
|
// OBSOLETE
|
605 |
|
|
// OBSOLETE static int
|
606 |
|
|
// OBSOLETE bug_write_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
|
607 |
|
|
// OBSOLETE {
|
608 |
|
|
// OBSOLETE int done;
|
609 |
|
|
// OBSOLETE int checksum;
|
610 |
|
|
// OBSOLETE int x;
|
611 |
|
|
// OBSOLETE int retries;
|
612 |
|
|
// OBSOLETE char *buffer = alloca ((srec_bytes + 8) << 1);
|
613 |
|
|
// OBSOLETE
|
614 |
|
|
// OBSOLETE retries = 0;
|
615 |
|
|
// OBSOLETE
|
616 |
|
|
// OBSOLETE do
|
617 |
|
|
// OBSOLETE {
|
618 |
|
|
// OBSOLETE done = 0;
|
619 |
|
|
// OBSOLETE
|
620 |
|
|
// OBSOLETE if (retries > srec_max_retries)
|
621 |
|
|
// OBSOLETE return (-1);
|
622 |
|
|
// OBSOLETE
|
623 |
|
|
// OBSOLETE if (retries > 0)
|
624 |
|
|
// OBSOLETE {
|
625 |
|
|
// OBSOLETE if (sr_get_debug () > 0)
|
626 |
|
|
// OBSOLETE printf ("\n<retrying...>\n");
|
627 |
|
|
// OBSOLETE
|
628 |
|
|
// OBSOLETE /* This gr_expect_prompt call is extremely important. Without
|
629 |
|
|
// OBSOLETE it, we will tend to resend our packet so fast that it
|
630 |
|
|
// OBSOLETE will arrive before the bug monitor is ready to receive
|
631 |
|
|
// OBSOLETE it. This would lead to a very ugly resend loop. */
|
632 |
|
|
// OBSOLETE
|
633 |
|
|
// OBSOLETE gr_expect_prompt ();
|
634 |
|
|
// OBSOLETE }
|
635 |
|
|
// OBSOLETE
|
636 |
|
|
// OBSOLETE start_load ();
|
637 |
|
|
// OBSOLETE
|
638 |
|
|
// OBSOLETE while (done < len)
|
639 |
|
|
// OBSOLETE {
|
640 |
|
|
// OBSOLETE int thisgo;
|
641 |
|
|
// OBSOLETE int idx;
|
642 |
|
|
// OBSOLETE char *buf = buffer;
|
643 |
|
|
// OBSOLETE CORE_ADDR address;
|
644 |
|
|
// OBSOLETE
|
645 |
|
|
// OBSOLETE checksum = 0;
|
646 |
|
|
// OBSOLETE thisgo = len - done;
|
647 |
|
|
// OBSOLETE if (thisgo > srec_bytes)
|
648 |
|
|
// OBSOLETE thisgo = srec_bytes;
|
649 |
|
|
// OBSOLETE
|
650 |
|
|
// OBSOLETE address = memaddr + done;
|
651 |
|
|
// OBSOLETE sprintf (buf, "S3%02X%08lX", thisgo + 4 + 1, (long) address);
|
652 |
|
|
// OBSOLETE buf += 12;
|
653 |
|
|
// OBSOLETE
|
654 |
|
|
// OBSOLETE checksum += (thisgo + 4 + 1
|
655 |
|
|
// OBSOLETE + (address & 0xff)
|
656 |
|
|
// OBSOLETE + ((address >> 8) & 0xff)
|
657 |
|
|
// OBSOLETE + ((address >> 16) & 0xff)
|
658 |
|
|
// OBSOLETE + ((address >> 24) & 0xff));
|
659 |
|
|
// OBSOLETE
|
660 |
|
|
// OBSOLETE for (idx = 0; idx < thisgo; idx++)
|
661 |
|
|
// OBSOLETE {
|
662 |
|
|
// OBSOLETE sprintf (buf, "%02X", myaddr[idx + done]);
|
663 |
|
|
// OBSOLETE checksum += myaddr[idx + done];
|
664 |
|
|
// OBSOLETE buf += 2;
|
665 |
|
|
// OBSOLETE }
|
666 |
|
|
// OBSOLETE
|
667 |
|
|
// OBSOLETE if (srec_noise > 0)
|
668 |
|
|
// OBSOLETE {
|
669 |
|
|
// OBSOLETE /* FIXME-NOW: insert a deliberate error every now and then.
|
670 |
|
|
// OBSOLETE This is intended for testing/debugging the error handling
|
671 |
|
|
// OBSOLETE stuff. */
|
672 |
|
|
// OBSOLETE static int counter = 0;
|
673 |
|
|
// OBSOLETE if (++counter > srec_noise)
|
674 |
|
|
// OBSOLETE {
|
675 |
|
|
// OBSOLETE counter = 0;
|
676 |
|
|
// OBSOLETE ++checksum;
|
677 |
|
|
// OBSOLETE }
|
678 |
|
|
// OBSOLETE }
|
679 |
|
|
// OBSOLETE
|
680 |
|
|
// OBSOLETE sprintf (buf, "%02X", ~checksum & 0xff);
|
681 |
|
|
// OBSOLETE bug_srec_write_cr (buffer);
|
682 |
|
|
// OBSOLETE
|
683 |
|
|
// OBSOLETE if (srec_sleep != 0)
|
684 |
|
|
// OBSOLETE sleep (srec_sleep);
|
685 |
|
|
// OBSOLETE
|
686 |
|
|
// OBSOLETE /* This pollchar is probably redundant to the gr_multi_scan
|
687 |
|
|
// OBSOLETE below. Trouble is, we can't be sure when or where an
|
688 |
|
|
// OBSOLETE error message will appear. Apparently, when running at
|
689 |
|
|
// OBSOLETE full speed from a typical sun4, error messages tend to
|
690 |
|
|
// OBSOLETE appear to arrive only *after* the s7 record. */
|
691 |
|
|
// OBSOLETE
|
692 |
|
|
// OBSOLETE if ((x = sr_pollchar ()) != 0)
|
693 |
|
|
// OBSOLETE {
|
694 |
|
|
// OBSOLETE if (sr_get_debug () > 0)
|
695 |
|
|
// OBSOLETE printf ("\n<retrying...>\n");
|
696 |
|
|
// OBSOLETE
|
697 |
|
|
// OBSOLETE ++retries;
|
698 |
|
|
// OBSOLETE
|
699 |
|
|
// OBSOLETE /* flush any remaining input and verify that we are back
|
700 |
|
|
// OBSOLETE at the prompt level. */
|
701 |
|
|
// OBSOLETE gr_expect_prompt ();
|
702 |
|
|
// OBSOLETE /* start all over again. */
|
703 |
|
|
// OBSOLETE start_load ();
|
704 |
|
|
// OBSOLETE done = 0;
|
705 |
|
|
// OBSOLETE continue;
|
706 |
|
|
// OBSOLETE }
|
707 |
|
|
// OBSOLETE
|
708 |
|
|
// OBSOLETE done += thisgo;
|
709 |
|
|
// OBSOLETE }
|
710 |
|
|
// OBSOLETE
|
711 |
|
|
// OBSOLETE bug_srec_write_cr ("S7060000000000F9");
|
712 |
|
|
// OBSOLETE ++retries;
|
713 |
|
|
// OBSOLETE
|
714 |
|
|
// OBSOLETE /* Having finished the load, we need to figure out whether we
|
715 |
|
|
// OBSOLETE had any errors. */
|
716 |
|
|
// OBSOLETE }
|
717 |
|
|
// OBSOLETE while (gr_multi_scan (srecord_strings, 0) == 0);;
|
718 |
|
|
// OBSOLETE
|
719 |
|
|
// OBSOLETE return (0);
|
720 |
|
|
// OBSOLETE }
|
721 |
|
|
// OBSOLETE
|
722 |
|
|
// OBSOLETE /* Copy LEN bytes of data from debugger memory at MYADDR
|
723 |
|
|
// OBSOLETE to inferior's memory at MEMADDR. Returns errno value.
|
724 |
|
|
// OBSOLETE * sb/sh instructions don't work on unaligned addresses, when TU=1.
|
725 |
|
|
// OBSOLETE */
|
726 |
|
|
// OBSOLETE
|
727 |
|
|
// OBSOLETE /* Read LEN bytes from inferior memory at MEMADDR. Put the result
|
728 |
|
|
// OBSOLETE at debugger address MYADDR. Returns errno value. */
|
729 |
|
|
// OBSOLETE static int
|
730 |
|
|
// OBSOLETE bug_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
|
731 |
|
|
// OBSOLETE {
|
732 |
|
|
// OBSOLETE char request[100];
|
733 |
|
|
// OBSOLETE char *buffer;
|
734 |
|
|
// OBSOLETE char *p;
|
735 |
|
|
// OBSOLETE char type;
|
736 |
|
|
// OBSOLETE char size;
|
737 |
|
|
// OBSOLETE unsigned char c;
|
738 |
|
|
// OBSOLETE unsigned int inaddr;
|
739 |
|
|
// OBSOLETE unsigned int checksum;
|
740 |
|
|
// OBSOLETE
|
741 |
|
|
// OBSOLETE sprintf (request, "du 0 %lx:&%d", (long) memaddr, len);
|
742 |
|
|
// OBSOLETE sr_write_cr (request);
|
743 |
|
|
// OBSOLETE
|
744 |
|
|
// OBSOLETE p = buffer = alloca (len);
|
745 |
|
|
// OBSOLETE
|
746 |
|
|
// OBSOLETE /* scan up through the header */
|
747 |
|
|
// OBSOLETE sr_expect ("S0030000FC");
|
748 |
|
|
// OBSOLETE
|
749 |
|
|
// OBSOLETE while (p < buffer + len)
|
750 |
|
|
// OBSOLETE {
|
751 |
|
|
// OBSOLETE /* scan off any white space. */
|
752 |
|
|
// OBSOLETE while (sr_readchar () != 'S');;
|
753 |
|
|
// OBSOLETE
|
754 |
|
|
// OBSOLETE /* what kind of s-rec? */
|
755 |
|
|
// OBSOLETE type = sr_readchar ();
|
756 |
|
|
// OBSOLETE
|
757 |
|
|
// OBSOLETE /* scan record size */
|
758 |
|
|
// OBSOLETE sr_get_hex_byte (&size);
|
759 |
|
|
// OBSOLETE checksum = size;
|
760 |
|
|
// OBSOLETE --size;
|
761 |
|
|
// OBSOLETE inaddr = 0;
|
762 |
|
|
// OBSOLETE
|
763 |
|
|
// OBSOLETE switch (type)
|
764 |
|
|
// OBSOLETE {
|
765 |
|
|
// OBSOLETE case '7':
|
766 |
|
|
// OBSOLETE case '8':
|
767 |
|
|
// OBSOLETE case '9':
|
768 |
|
|
// OBSOLETE goto done;
|
769 |
|
|
// OBSOLETE
|
770 |
|
|
// OBSOLETE case '3':
|
771 |
|
|
// OBSOLETE sr_get_hex_byte (&c);
|
772 |
|
|
// OBSOLETE inaddr = (inaddr << 8) + c;
|
773 |
|
|
// OBSOLETE checksum += c;
|
774 |
|
|
// OBSOLETE --size;
|
775 |
|
|
// OBSOLETE /* intentional fall through */
|
776 |
|
|
// OBSOLETE case '2':
|
777 |
|
|
// OBSOLETE sr_get_hex_byte (&c);
|
778 |
|
|
// OBSOLETE inaddr = (inaddr << 8) + c;
|
779 |
|
|
// OBSOLETE checksum += c;
|
780 |
|
|
// OBSOLETE --size;
|
781 |
|
|
// OBSOLETE /* intentional fall through */
|
782 |
|
|
// OBSOLETE case '1':
|
783 |
|
|
// OBSOLETE sr_get_hex_byte (&c);
|
784 |
|
|
// OBSOLETE inaddr = (inaddr << 8) + c;
|
785 |
|
|
// OBSOLETE checksum += c;
|
786 |
|
|
// OBSOLETE --size;
|
787 |
|
|
// OBSOLETE sr_get_hex_byte (&c);
|
788 |
|
|
// OBSOLETE inaddr = (inaddr << 8) + c;
|
789 |
|
|
// OBSOLETE checksum += c;
|
790 |
|
|
// OBSOLETE --size;
|
791 |
|
|
// OBSOLETE break;
|
792 |
|
|
// OBSOLETE
|
793 |
|
|
// OBSOLETE default:
|
794 |
|
|
// OBSOLETE /* bonk */
|
795 |
|
|
// OBSOLETE error ("reading s-records.");
|
796 |
|
|
// OBSOLETE }
|
797 |
|
|
// OBSOLETE
|
798 |
|
|
// OBSOLETE if (inaddr < memaddr
|
799 |
|
|
// OBSOLETE || (memaddr + len) < (inaddr + size))
|
800 |
|
|
// OBSOLETE error ("srec out of memory range.");
|
801 |
|
|
// OBSOLETE
|
802 |
|
|
// OBSOLETE if (p != buffer + inaddr - memaddr)
|
803 |
|
|
// OBSOLETE error ("srec out of sequence.");
|
804 |
|
|
// OBSOLETE
|
805 |
|
|
// OBSOLETE for (; size; --size, ++p)
|
806 |
|
|
// OBSOLETE {
|
807 |
|
|
// OBSOLETE sr_get_hex_byte (p);
|
808 |
|
|
// OBSOLETE checksum += *p;
|
809 |
|
|
// OBSOLETE }
|
810 |
|
|
// OBSOLETE
|
811 |
|
|
// OBSOLETE sr_get_hex_byte (&c);
|
812 |
|
|
// OBSOLETE if (c != (~checksum & 0xff))
|
813 |
|
|
// OBSOLETE error ("bad s-rec checksum");
|
814 |
|
|
// OBSOLETE }
|
815 |
|
|
// OBSOLETE
|
816 |
|
|
// OBSOLETE done:
|
817 |
|
|
// OBSOLETE gr_expect_prompt ();
|
818 |
|
|
// OBSOLETE if (p != buffer + len)
|
819 |
|
|
// OBSOLETE return (1);
|
820 |
|
|
// OBSOLETE
|
821 |
|
|
// OBSOLETE memcpy (myaddr, buffer, len);
|
822 |
|
|
// OBSOLETE return (0);
|
823 |
|
|
// OBSOLETE }
|
824 |
|
|
// OBSOLETE
|
825 |
|
|
// OBSOLETE #define MAX_BREAKS 16
|
826 |
|
|
// OBSOLETE static int num_brkpts = 0;
|
827 |
|
|
// OBSOLETE
|
828 |
|
|
// OBSOLETE /* Insert a breakpoint at ADDR. SAVE is normally the address of the
|
829 |
|
|
// OBSOLETE pattern buffer where the instruction that the breakpoint overwrites
|
830 |
|
|
// OBSOLETE is saved. It is unused here since the bug is responsible for
|
831 |
|
|
// OBSOLETE saving/restoring the original instruction. */
|
832 |
|
|
// OBSOLETE
|
833 |
|
|
// OBSOLETE static int
|
834 |
|
|
// OBSOLETE bug_insert_breakpoint (CORE_ADDR addr, char *save)
|
835 |
|
|
// OBSOLETE {
|
836 |
|
|
// OBSOLETE sr_check_open ();
|
837 |
|
|
// OBSOLETE
|
838 |
|
|
// OBSOLETE if (num_brkpts < MAX_BREAKS)
|
839 |
|
|
// OBSOLETE {
|
840 |
|
|
// OBSOLETE char buffer[100];
|
841 |
|
|
// OBSOLETE
|
842 |
|
|
// OBSOLETE num_brkpts++;
|
843 |
|
|
// OBSOLETE sprintf (buffer, "br %lx", (long) addr);
|
844 |
|
|
// OBSOLETE sr_write_cr (buffer);
|
845 |
|
|
// OBSOLETE gr_expect_prompt ();
|
846 |
|
|
// OBSOLETE return (0);
|
847 |
|
|
// OBSOLETE }
|
848 |
|
|
// OBSOLETE else
|
849 |
|
|
// OBSOLETE {
|
850 |
|
|
// OBSOLETE fprintf_filtered (gdb_stderr,
|
851 |
|
|
// OBSOLETE "Too many break points, break point not installed\n");
|
852 |
|
|
// OBSOLETE return (1);
|
853 |
|
|
// OBSOLETE }
|
854 |
|
|
// OBSOLETE
|
855 |
|
|
// OBSOLETE }
|
856 |
|
|
// OBSOLETE
|
857 |
|
|
// OBSOLETE /* Remove a breakpoint at ADDR. SAVE is normally the previously
|
858 |
|
|
// OBSOLETE saved pattern, but is unused here since the bug is responsible
|
859 |
|
|
// OBSOLETE for saving/restoring instructions. */
|
860 |
|
|
// OBSOLETE
|
861 |
|
|
// OBSOLETE static int
|
862 |
|
|
// OBSOLETE bug_remove_breakpoint (CORE_ADDR addr, char *save)
|
863 |
|
|
// OBSOLETE {
|
864 |
|
|
// OBSOLETE if (num_brkpts > 0)
|
865 |
|
|
// OBSOLETE {
|
866 |
|
|
// OBSOLETE char buffer[100];
|
867 |
|
|
// OBSOLETE
|
868 |
|
|
// OBSOLETE num_brkpts--;
|
869 |
|
|
// OBSOLETE sprintf (buffer, "nobr %lx", (long) addr);
|
870 |
|
|
// OBSOLETE sr_write_cr (buffer);
|
871 |
|
|
// OBSOLETE gr_expect_prompt ();
|
872 |
|
|
// OBSOLETE
|
873 |
|
|
// OBSOLETE }
|
874 |
|
|
// OBSOLETE return (0);
|
875 |
|
|
// OBSOLETE }
|
876 |
|
|
// OBSOLETE
|
877 |
|
|
// OBSOLETE /* Clear the bugs notion of what the break points are */
|
878 |
|
|
// OBSOLETE static int
|
879 |
|
|
// OBSOLETE bug_clear_breakpoints (void)
|
880 |
|
|
// OBSOLETE {
|
881 |
|
|
// OBSOLETE
|
882 |
|
|
// OBSOLETE if (sr_is_open ())
|
883 |
|
|
// OBSOLETE {
|
884 |
|
|
// OBSOLETE sr_write_cr ("nobr");
|
885 |
|
|
// OBSOLETE sr_expect ("nobr");
|
886 |
|
|
// OBSOLETE gr_expect_prompt ();
|
887 |
|
|
// OBSOLETE }
|
888 |
|
|
// OBSOLETE num_brkpts = 0;
|
889 |
|
|
// OBSOLETE return (0);
|
890 |
|
|
// OBSOLETE }
|
891 |
|
|
// OBSOLETE
|
892 |
|
|
// OBSOLETE struct target_ops bug_ops;
|
893 |
|
|
// OBSOLETE
|
894 |
|
|
// OBSOLETE static void
|
895 |
|
|
// OBSOLETE init_bug_ops (void)
|
896 |
|
|
// OBSOLETE {
|
897 |
|
|
// OBSOLETE bug_ops.to_shortname = "bug";
|
898 |
|
|
// OBSOLETE "Remote BUG monitor",
|
899 |
|
|
// OBSOLETE bug_ops.to_longname = "Use the mvme187 board running the BUG monitor connected by a serial line.";
|
900 |
|
|
// OBSOLETE bug_ops.to_doc = " ";
|
901 |
|
|
// OBSOLETE bug_ops.to_open = bug_open;
|
902 |
|
|
// OBSOLETE bug_ops.to_close = gr_close;
|
903 |
|
|
// OBSOLETE bug_ops.to_attach = 0;
|
904 |
|
|
// OBSOLETE bug_ops.to_post_attach = NULL;
|
905 |
|
|
// OBSOLETE bug_ops.to_require_attach = NULL;
|
906 |
|
|
// OBSOLETE bug_ops.to_detach = gr_detach;
|
907 |
|
|
// OBSOLETE bug_ops.to_require_detach = NULL;
|
908 |
|
|
// OBSOLETE bug_ops.to_resume = bug_resume;
|
909 |
|
|
// OBSOLETE bug_ops.to_wait = bug_wait;
|
910 |
|
|
// OBSOLETE bug_ops.to_post_wait = NULL;
|
911 |
|
|
// OBSOLETE bug_ops.to_fetch_registers = bug_fetch_register;
|
912 |
|
|
// OBSOLETE bug_ops.to_store_registers = bug_store_register;
|
913 |
|
|
// OBSOLETE bug_ops.to_prepare_to_store = gr_prepare_to_store;
|
914 |
|
|
// OBSOLETE bug_ops.to_xfer_memory = bug_xfer_memory;
|
915 |
|
|
// OBSOLETE bug_ops.to_files_info = gr_files_info;
|
916 |
|
|
// OBSOLETE bug_ops.to_insert_breakpoint = bug_insert_breakpoint;
|
917 |
|
|
// OBSOLETE bug_ops.to_remove_breakpoint = bug_remove_breakpoint;
|
918 |
|
|
// OBSOLETE bug_ops.to_terminal_init = 0;
|
919 |
|
|
// OBSOLETE bug_ops.to_terminal_inferior = 0;
|
920 |
|
|
// OBSOLETE bug_ops.to_terminal_ours_for_output = 0;
|
921 |
|
|
// OBSOLETE bug_ops.to_terminal_ours = 0;
|
922 |
|
|
// OBSOLETE bug_ops.to_terminal_info = 0;
|
923 |
|
|
// OBSOLETE bug_ops.to_kill = gr_kill;
|
924 |
|
|
// OBSOLETE bug_ops.to_load = bug_load;
|
925 |
|
|
// OBSOLETE bug_ops.to_lookup_symbol = 0;
|
926 |
|
|
// OBSOLETE bug_ops.to_create_inferior = gr_create_inferior;
|
927 |
|
|
// OBSOLETE bug_ops.to_post_startup_inferior = NULL;
|
928 |
|
|
// OBSOLETE bug_ops.to_acknowledge_created_inferior = NULL;
|
929 |
|
|
// OBSOLETE bug_ops.to_clone_and_follow_inferior = NULL;
|
930 |
|
|
// OBSOLETE bug_ops.to_post_follow_inferior_by_clone = NULL;
|
931 |
|
|
// OBSOLETE bug_ops.to_insert_fork_catchpoint = NULL;
|
932 |
|
|
// OBSOLETE bug_ops.to_remove_fork_catchpoint = NULL;
|
933 |
|
|
// OBSOLETE bug_ops.to_insert_vfork_catchpoint = NULL;
|
934 |
|
|
// OBSOLETE bug_ops.to_remove_vfork_catchpoint = NULL;
|
935 |
|
|
// OBSOLETE bug_ops.to_has_forked = NULL;
|
936 |
|
|
// OBSOLETE bug_ops.to_has_vforked = NULL;
|
937 |
|
|
// OBSOLETE bug_ops.to_can_follow_vfork_prior_to_exec = NULL;
|
938 |
|
|
// OBSOLETE bug_ops.to_post_follow_vfork = NULL;
|
939 |
|
|
// OBSOLETE bug_ops.to_insert_exec_catchpoint = NULL;
|
940 |
|
|
// OBSOLETE bug_ops.to_remove_exec_catchpoint = NULL;
|
941 |
|
|
// OBSOLETE bug_ops.to_has_execd = NULL;
|
942 |
|
|
// OBSOLETE bug_ops.to_reported_exec_events_per_exec_call = NULL;
|
943 |
|
|
// OBSOLETE bug_ops.to_has_exited = NULL;
|
944 |
|
|
// OBSOLETE bug_ops.to_mourn_inferior = gr_mourn;
|
945 |
|
|
// OBSOLETE bug_ops.to_can_run = 0;
|
946 |
|
|
// OBSOLETE bug_ops.to_notice_signals = 0;
|
947 |
|
|
// OBSOLETE bug_ops.to_thread_alive = 0;
|
948 |
|
|
// OBSOLETE bug_ops.to_stop = 0;
|
949 |
|
|
// OBSOLETE bug_ops.to_pid_to_exec_file = NULL;
|
950 |
|
|
// OBSOLETE bug_ops.to_stratum = process_stratum;
|
951 |
|
|
// OBSOLETE bug_ops.DONT_USE = 0;
|
952 |
|
|
// OBSOLETE bug_ops.to_has_all_memory = 1;
|
953 |
|
|
// OBSOLETE bug_ops.to_has_memory = 1;
|
954 |
|
|
// OBSOLETE bug_ops.to_has_stack = 1;
|
955 |
|
|
// OBSOLETE bug_ops.to_has_registers = 0;
|
956 |
|
|
// OBSOLETE bug_ops.to_has_execution = 0;
|
957 |
|
|
// OBSOLETE bug_ops.to_sections = 0;
|
958 |
|
|
// OBSOLETE bug_ops.to_sections_end = 0;
|
959 |
|
|
// OBSOLETE bug_ops.to_magic = OPS_MAGIC; /* Always the last thing */
|
960 |
|
|
// OBSOLETE } /* init_bug_ops */
|
961 |
|
|
// OBSOLETE
|
962 |
|
|
// OBSOLETE void
|
963 |
|
|
// OBSOLETE _initialize_remote_bug (void)
|
964 |
|
|
// OBSOLETE {
|
965 |
|
|
// OBSOLETE init_bug_ops ();
|
966 |
|
|
// OBSOLETE add_target (&bug_ops);
|
967 |
|
|
// OBSOLETE
|
968 |
|
|
// OBSOLETE add_show_from_set
|
969 |
|
|
// OBSOLETE (add_set_cmd ("srec-bytes", class_support, var_uinteger,
|
970 |
|
|
// OBSOLETE (char *) &srec_bytes,
|
971 |
|
|
// OBSOLETE "\
|
972 |
|
|
// OBSOLETE Set the number of bytes represented in each S-record.\n\
|
973 |
|
|
// OBSOLETE This affects the communication protocol with the remote target.",
|
974 |
|
|
// OBSOLETE &setlist),
|
975 |
|
|
// OBSOLETE &showlist);
|
976 |
|
|
// OBSOLETE
|
977 |
|
|
// OBSOLETE add_show_from_set
|
978 |
|
|
// OBSOLETE (add_set_cmd ("srec-max-retries", class_support, var_uinteger,
|
979 |
|
|
// OBSOLETE (char *) &srec_max_retries,
|
980 |
|
|
// OBSOLETE "\
|
981 |
|
|
// OBSOLETE Set the number of retries for shipping S-records.\n\
|
982 |
|
|
// OBSOLETE This affects the communication protocol with the remote target.",
|
983 |
|
|
// OBSOLETE &setlist),
|
984 |
|
|
// OBSOLETE &showlist);
|
985 |
|
|
// OBSOLETE
|
986 |
|
|
// OBSOLETE #if 0
|
987 |
|
|
// OBSOLETE /* This needs to set SREC_SIZE, not srec_frame which gets changed at the
|
988 |
|
|
// OBSOLETE end of a download. But do we need the option at all? */
|
989 |
|
|
// OBSOLETE add_show_from_set
|
990 |
|
|
// OBSOLETE (add_set_cmd ("srec-frame", class_support, var_uinteger,
|
991 |
|
|
// OBSOLETE (char *) &srec_frame,
|
992 |
|
|
// OBSOLETE "\
|
993 |
|
|
// OBSOLETE Set the number of bytes in an S-record frame.\n\
|
994 |
|
|
// OBSOLETE This affects the communication protocol with the remote target.",
|
995 |
|
|
// OBSOLETE &setlist),
|
996 |
|
|
// OBSOLETE &showlist);
|
997 |
|
|
// OBSOLETE #endif /* 0 */
|
998 |
|
|
// OBSOLETE
|
999 |
|
|
// OBSOLETE add_show_from_set
|
1000 |
|
|
// OBSOLETE (add_set_cmd ("srec-noise", class_support, var_zinteger,
|
1001 |
|
|
// OBSOLETE (char *) &srec_noise,
|
1002 |
|
|
// OBSOLETE "\
|
1003 |
|
|
// OBSOLETE Set number of S-record to send before deliberately flubbing a checksum.\n\
|
1004 |
|
|
// OBSOLETE Zero means flub none at all. This affects the communication protocol\n\
|
1005 |
|
|
// OBSOLETE with the remote target.",
|
1006 |
|
|
// OBSOLETE &setlist),
|
1007 |
|
|
// OBSOLETE &showlist);
|
1008 |
|
|
// OBSOLETE
|
1009 |
|
|
// OBSOLETE add_show_from_set
|
1010 |
|
|
// OBSOLETE (add_set_cmd ("srec-sleep", class_support, var_zinteger,
|
1011 |
|
|
// OBSOLETE (char *) &srec_sleep,
|
1012 |
|
|
// OBSOLETE "\
|
1013 |
|
|
// OBSOLETE Set number of seconds to sleep after an S-record for a possible error message to arrive.\n\
|
1014 |
|
|
// OBSOLETE This affects the communication protocol with the remote target.",
|
1015 |
|
|
// OBSOLETE &setlist),
|
1016 |
|
|
// OBSOLETE &showlist);
|
1017 |
|
|
// OBSOLETE
|
1018 |
|
|
// OBSOLETE add_show_from_set
|
1019 |
|
|
// OBSOLETE (add_set_cmd ("srec-echo-pace", class_support, var_boolean,
|
1020 |
|
|
// OBSOLETE (char *) &srec_echo_pace,
|
1021 |
|
|
// OBSOLETE "\
|
1022 |
|
|
// OBSOLETE Set echo-verification.\n\
|
1023 |
|
|
// OBSOLETE When on, use verification by echo when downloading S-records. This is\n\
|
1024 |
|
|
// OBSOLETE much slower, but generally more reliable.",
|
1025 |
|
|
// OBSOLETE &setlist),
|
1026 |
|
|
// OBSOLETE &showlist);
|
1027 |
|
|
// OBSOLETE }
|