1 /* OBSOLETE /* Remote debugging interface for AMD 29k interfaced via UDI, for GDB. */
2 /* OBSOLETE Copyright 1990, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 */
3 /* OBSOLETE Free Software Foundation, Inc. */
4 /* OBSOLETE Written by Daniel Mann. Contributed by AMD. */
6 /* OBSOLETE This file is part of GDB. */
8 /* OBSOLETE This program is free software; you can redistribute it and/or modify */
9 /* OBSOLETE it under the terms of the GNU General Public License as published by */
10 /* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
11 /* OBSOLETE (at your option) any later version. */
13 /* OBSOLETE This program is distributed in the hope that it will be useful, */
14 /* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16 /* OBSOLETE GNU General Public License for more details. */
18 /* OBSOLETE You should have received a copy of the GNU General Public License */
19 /* OBSOLETE along with this program; if not, write to the Free Software */
20 /* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
21 /* OBSOLETE Boston, MA 02111-1307, USA. */ */
23 /* OBSOLETE /* This is like remote.c but uses the Universal Debug Interface (UDI) to */
24 /* OBSOLETE talk to the target hardware (or simulator). UDI is a TCP/IP based */
25 /* OBSOLETE protocol; for hardware that doesn't run TCP, an interface adapter */
26 /* OBSOLETE daemon talks UDI on one side, and talks to the hardware (typically */
27 /* OBSOLETE over a serial port) on the other side. */
29 /* OBSOLETE - Originally written by Daniel Mann at AMD for MiniMON and gdb 3.91.6. */
30 /* OBSOLETE - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this */
31 /* OBSOLETE file to gdb 3.95. I was unable to get this working on sun3os4 */
32 /* OBSOLETE with termio, only with sgtty. */
33 /* OBSOLETE - Daniel Mann at AMD took the 3.95 adaptions above and replaced */
34 /* OBSOLETE MiniMON interface with UDI-p interface. */ */
36 /* OBSOLETE #include "defs.h" */
37 /* OBSOLETE #include "frame.h" */
38 /* OBSOLETE #include "inferior.h" */
39 /* OBSOLETE #include "value.h" */
40 /* OBSOLETE #include <ctype.h> */
41 /* OBSOLETE #include <fcntl.h> */
42 /* OBSOLETE #include <errno.h> */
43 /* OBSOLETE #include "gdb_string.h" */
44 /* OBSOLETE #include "terminal.h" */
45 /* OBSOLETE #include "target.h" */
46 /* OBSOLETE #include "29k-share/udi/udiproc.h" */
47 /* OBSOLETE #include "gdbcmd.h" */
48 /* OBSOLETE #include "bfd.h" */
49 /* OBSOLETE #include "gdbcore.h" /* For download function */ */
50 /* OBSOLETE #include "regcache.h" */
52 /* OBSOLETE /* access the register store directly, without going through */
53 /* OBSOLETE the normal handler functions. This avoids an extra data copy. */ */
55 /* OBSOLETE extern int stop_soon_quietly; /* for wait_for_inferior */ */
56 /* OBSOLETE extern struct value *call_function_by_hand (); */
57 /* OBSOLETE static void udi_resume (ptid_t ptid, int step, enum target_signal sig); */
58 /* OBSOLETE static void udi_fetch_registers (int regno); */
59 /* OBSOLETE static void udi_load (char *args, int from_tty); */
60 /* OBSOLETE static void fetch_register (int regno); */
61 /* OBSOLETE static void udi_store_registers (int regno); */
62 /* OBSOLETE static int store_register (int regno); */
63 /* OBSOLETE static int regnum_to_srnum (int regno); */
64 /* OBSOLETE static void udi_close (int quitting); */
65 /* OBSOLETE static CPUSpace udi_memory_space (CORE_ADDR addr); */
66 /* OBSOLETE static int udi_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, */
67 /* OBSOLETE int len); */
68 /* OBSOLETE static int udi_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, */
69 /* OBSOLETE int len); */
70 /* OBSOLETE static void download (char *load_arg_string, int from_tty); */
71 /* OBSOLETE char CoffFileName[100] = ""; */
73 /* OBSOLETE #define FREEZE_MODE (read_register(CPS_REGNUM) & 0x400) */
74 /* OBSOLETE #define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) */
76 /* OBSOLETE static int timeout = 5; */
77 /* OBSOLETE extern struct target_ops udi_ops; /* Forward declaration */ */
79 /* OBSOLETE /* Special register enumeration. */
82 /* OBSOLETE /******************************************************************* UDI DATA*/ */
83 /* OBSOLETE #define MAXDATA 2*1024 /* max UDI[read/write] byte size */ */
84 /* OBSOLETE /* Descriptor for I/O to remote machine. Initialize it to -1 so that */
85 /* OBSOLETE udi_open knows that we don't have a file open when the program */
86 /* OBSOLETE starts. */ */
88 /* OBSOLETE UDISessionId udi_session_id = -1; */
89 /* OBSOLETE static char *udi_config_id; */
91 /* OBSOLETE CPUOffset IMemStart = 0; */
92 /* OBSOLETE CPUSizeT IMemSize = 0; */
93 /* OBSOLETE CPUOffset DMemStart = 0; */
94 /* OBSOLETE CPUSizeT DMemSize = 0; */
95 /* OBSOLETE CPUOffset RMemStart = 0; */
96 /* OBSOLETE CPUSizeT RMemSize = 0; */
97 /* OBSOLETE UDIUInt32 CPUPRL; */
98 /* OBSOLETE UDIUInt32 CoProcPRL; */
100 /* OBSOLETE UDIMemoryRange address_ranges[2]; /* Text and data */ */
101 /* OBSOLETE UDIResource entry = */
102 /* OBSOLETE {0, 0}; /* Entry point */ */
103 /* OBSOLETE CPUSizeT stack_sizes[2]; /* Regular and memory stacks */ */
105 /* OBSOLETE #define SBUF_MAX 1024 /* maximum size of string handling buffer */ */
106 /* OBSOLETE char sbuf[SBUF_MAX]; */
108 /* OBSOLETE typedef struct bkpt_entry_str */
110 /* OBSOLETE UDIResource Addr; */
111 /* OBSOLETE UDIUInt32 PassCount; */
112 /* OBSOLETE UDIBreakType Type; */
113 /* OBSOLETE unsigned int BreakId; */
115 /* OBSOLETE bkpt_entry_t; */
116 /* OBSOLETE #define BKPT_TABLE_SIZE 40 */
117 /* OBSOLETE static bkpt_entry_t bkpt_table[BKPT_TABLE_SIZE]; */
118 /* OBSOLETE extern char dfe_errmsg[]; /* error string */ */
120 /* OBSOLETE /* malloc'd name of the program on the remote system. */ */
121 /* OBSOLETE static char *prog_name = NULL; */
123 /* OBSOLETE /* This is called not only when we first attach, but also when the */
124 /* OBSOLETE user types "run" after having attached. */ */
126 /* OBSOLETE static void */
127 /* OBSOLETE udi_create_inferior (char *execfile, char *args, char **env) */
129 /* OBSOLETE char *args1; */
131 /* OBSOLETE if (execfile) */
133 /* OBSOLETE if (prog_name != NULL) */
134 /* OBSOLETE xfree (prog_name); */
135 /* OBSOLETE prog_name = savestring (execfile, strlen (execfile)); */
137 /* OBSOLETE else if (entry.Offset) */
138 /* OBSOLETE execfile = ""; */
140 /* OBSOLETE error ("No image loaded into target."); */
142 /* OBSOLETE if (udi_session_id < 0) */
144 /* OBSOLETE /* If the TIP is not open, open it. */ */
145 /* OBSOLETE if (UDIConnect (udi_config_id, &udi_session_id)) */
146 /* OBSOLETE error ("UDIConnect() failed: %s\n", dfe_errmsg); */
147 /* OBSOLETE /* We will need to download the program. */ */
148 /* OBSOLETE entry.Offset = 0; */
151 /* OBSOLETE inferior_ptid = pid_to_ptid (40000); */
153 /* OBSOLETE if (!entry.Offset) */
154 /* OBSOLETE download (execfile, 0); */
156 /* OBSOLETE args1 = alloca (strlen (execfile) + strlen (args) + 2); */
158 /* OBSOLETE if (execfile[0] == '\0') */
160 /* OBSOLETE /* It is empty. We need to quote it somehow, or else the target */
161 /* OBSOLETE will think there is no argument being passed here. According */
162 /* OBSOLETE to the UDI spec it is quoted "according to TIP OS rules" which */
163 /* OBSOLETE I guess means quoting it like the Unix shell should work */
164 /* OBSOLETE (sounds pretty bogus to me...). In fact it doesn't work (with */
165 /* OBSOLETE isstip anyway), but passing in two quotes as the argument seems */
166 /* OBSOLETE like a reasonable enough behavior anyway (I guess). */ */
168 /* OBSOLETE strcpy (args1, "''"); */
170 /* OBSOLETE strcpy (args1, execfile); */
171 /* OBSOLETE strcat (args1, " "); */
172 /* OBSOLETE strcat (args1, args); */
174 /* OBSOLETE UDIInitializeProcess (address_ranges, /* ProcessMemory[] */ */
175 /* OBSOLETE (UDIInt) 2, /* NumberOfRanges */ */
176 /* OBSOLETE entry, /* EntryPoint */ */
177 /* OBSOLETE stack_sizes, /* *StackSizes */ */
178 /* OBSOLETE (UDIInt) 2, /* NumberOfStacks */ */
179 /* OBSOLETE args1); /* ArgString */ */
181 /* OBSOLETE init_wait_for_inferior (); */
182 /* OBSOLETE clear_proceed_status (); */
183 /* OBSOLETE proceed (-1, TARGET_SIGNAL_DEFAULT, 0); */
186 /* OBSOLETE static void */
187 /* OBSOLETE udi_mourn (void) */
190 /* OBSOLETE /* Requiring "target udi" each time you run is a major pain. I suspect */
191 /* OBSOLETE this was just blindy copied from remote.c, in which "target" and */
192 /* OBSOLETE "run" are combined. Having a udi target without an inferior seems */
193 /* OBSOLETE to work between "target udi" and "run", so why not now? */ */
194 /* OBSOLETE pop_target (); /* Pop back to no-child state */ */
195 /* OBSOLETE #endif */
196 /* OBSOLETE /* But if we're going to want to run it again, we better remove the */
197 /* OBSOLETE breakpoints... */ */
198 /* OBSOLETE remove_breakpoints (); */
199 /* OBSOLETE generic_mourn_inferior (); */
202 /* OBSOLETE /******************************************************************** UDI_OPEN */
203 /* OBSOLETE ** Open a connection to remote TIP. */
204 /* OBSOLETE NAME is the socket domain used for communication with the TIP, */
205 /* OBSOLETE then a space and the socket name or TIP-host name. */
206 /* OBSOLETE '<udi_udi_config_id>' for example. */
209 /* OBSOLETE /* XXX - need cleanups for udiconnect for various failures!!! */ */
211 /* OBSOLETE static void */
212 /* OBSOLETE udi_open (char *name, int from_tty) */
214 /* OBSOLETE unsigned int prl; */
215 /* OBSOLETE char *p; */
216 /* OBSOLETE int cnt; */
217 /* OBSOLETE UDIMemoryRange KnownMemory[10]; */
218 /* OBSOLETE UDIUInt32 ChipVersions[10]; */
219 /* OBSOLETE UDIInt NumberOfRanges = 10; */
220 /* OBSOLETE UDIInt NumberOfChips = 10; */
221 /* OBSOLETE UDIPId PId; */
222 /* OBSOLETE UDIUInt32 TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId; */
224 /* OBSOLETE target_preopen (from_tty); */
226 /* OBSOLETE entry.Offset = 0; */
228 /* OBSOLETE for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) */
229 /* OBSOLETE bkpt_table[cnt].Type = 0; */
231 /* OBSOLETE if (udi_config_id) */
232 /* OBSOLETE xfree (udi_config_id); */
234 /* OBSOLETE if (!name) */
235 /* OBSOLETE error ("Usage: target udi config_id, where config_id appears in udi_soc file"); */
237 /* OBSOLETE udi_config_id = xstrdup (strtok (name, " \t")); */
239 /* OBSOLETE if (UDIConnect (udi_config_id, &udi_session_id)) */
240 /* OBSOLETE /* FIXME: Should set udi_session_id to -1 here. */ */
241 /* OBSOLETE error ("UDIConnect() failed: %s\n", dfe_errmsg); */
243 /* OBSOLETE push_target (&udi_ops); */
246 /* OBSOLETE ** Initialize target configuration structure (global) */
248 /* OBSOLETE if (UDIGetTargetConfig (KnownMemory, &NumberOfRanges, */
249 /* OBSOLETE ChipVersions, &NumberOfChips)) */
250 /* OBSOLETE error ("UDIGetTargetConfig() failed"); */
251 /* OBSOLETE if (NumberOfChips > 2) */
252 /* OBSOLETE fprintf_unfiltered (gdb_stderr, "Target has more than one processor\n"); */
253 /* OBSOLETE for (cnt = 0; cnt < NumberOfRanges; cnt++) */
255 /* OBSOLETE switch (KnownMemory[cnt].Space) */
257 /* OBSOLETE default: */
258 /* OBSOLETE fprintf_unfiltered (gdb_stderr, "UDIGetTargetConfig() unknown memory space\n"); */
259 /* OBSOLETE break; */
260 /* OBSOLETE case UDI29KCP_S: */
261 /* OBSOLETE break; */
262 /* OBSOLETE case UDI29KIROMSpace: */
263 /* OBSOLETE RMemStart = KnownMemory[cnt].Offset; */
264 /* OBSOLETE RMemSize = KnownMemory[cnt].Size; */
265 /* OBSOLETE break; */
266 /* OBSOLETE case UDI29KIRAMSpace: */
267 /* OBSOLETE IMemStart = KnownMemory[cnt].Offset; */
268 /* OBSOLETE IMemSize = KnownMemory[cnt].Size; */
269 /* OBSOLETE break; */
270 /* OBSOLETE case UDI29KDRAMSpace: */
271 /* OBSOLETE DMemStart = KnownMemory[cnt].Offset; */
272 /* OBSOLETE DMemSize = KnownMemory[cnt].Size; */
273 /* OBSOLETE break; */
277 /* OBSOLETE a29k_get_processor_type (); */
279 /* OBSOLETE if (UDICreateProcess (&PId)) */
280 /* OBSOLETE fprintf_unfiltered (gdb_stderr, "UDICreateProcess() failed\n"); */
282 /* OBSOLETE /* Print out some stuff, letting the user now what's going on */ */
283 /* OBSOLETE if (UDICapabilities (&TIPId, &TargetId, DFEId, DFE, &TIP, &DFEIPCId, */
284 /* OBSOLETE &TIPIPCId, sbuf)) */
285 /* OBSOLETE error ("UDICapabilities() failed"); */
286 /* OBSOLETE if (from_tty) */
288 /* OBSOLETE printf_filtered ("Connected via UDI socket,\n\ */
289 /* OBSOLETE DFE-IPC version %x.%x.%x TIP-IPC version %x.%x.%x TIP version %x.%x.%x\n %s\n", */
290 /* OBSOLETE (DFEIPCId >> 8) & 0xf, (DFEIPCId >> 4) & 0xf, DFEIPCId & 0xf, */
291 /* OBSOLETE (TIPIPCId >> 8) & 0xf, (TIPIPCId >> 4) & 0xf, TIPIPCId & 0xf, */
292 /* OBSOLETE (TargetId >> 8) & 0xf, (TargetId >> 4) & 0xf, TargetId & 0xf, */
293 /* OBSOLETE sbuf); */
297 /* OBSOLETE /******************************************************************* UDI_CLOSE */
298 /* OBSOLETE Close the open connection to the TIP process. */
299 /* OBSOLETE Use this when you want to detach and do something else */
300 /* OBSOLETE with your gdb. */ */
301 /* OBSOLETE static void */
302 /* OBSOLETE udi_close ( /*FIXME: how is quitting used */ */
303 /* OBSOLETE int quitting) */
305 /* OBSOLETE if (udi_session_id < 0) */
306 /* OBSOLETE return; */
308 /* OBSOLETE /* We should never get here if there isn't something valid in */
309 /* OBSOLETE udi_session_id. */ */
311 /* OBSOLETE if (UDIDisconnect (udi_session_id, UDITerminateSession)) */
313 /* OBSOLETE if (quitting) */
314 /* OBSOLETE warning ("UDIDisconnect() failed in udi_close"); */
316 /* OBSOLETE error ("UDIDisconnect() failed in udi_close"); */
319 /* OBSOLETE /* Do not try to close udi_session_id again, later in the program. */ */
320 /* OBSOLETE udi_session_id = -1; */
321 /* OBSOLETE inferior_ptid = null_ptid; */
323 /* OBSOLETE printf_filtered (" Ending remote debugging\n"); */
326 /* OBSOLETE /**************************************************************** UDI_ATACH */ */
327 /* OBSOLETE /* Attach to a program that is already loaded and running */
328 /* OBSOLETE * Upon exiting the process's execution is stopped. */
330 /* OBSOLETE static void */
331 /* OBSOLETE udi_attach (char *args, int from_tty) */
333 /* OBSOLETE UDIResource From; */
334 /* OBSOLETE UDIInt32 PC_adds; */
335 /* OBSOLETE UDICount Count = 1; */
336 /* OBSOLETE UDISizeT Size = 4; */
337 /* OBSOLETE UDICount CountDone; */
338 /* OBSOLETE UDIBool HostEndian = 0; */
339 /* OBSOLETE UDIError err; */
341 /* OBSOLETE if (args == NULL) */
342 /* OBSOLETE error_no_arg ("program to attach"); */
344 /* OBSOLETE if (udi_session_id < 0) */
345 /* OBSOLETE error ("UDI connection not opened yet, use the 'target udi' command.\n"); */
347 /* OBSOLETE if (from_tty) */
348 /* OBSOLETE printf_unfiltered ("Attaching to remote program %s...\n", prog_name); */
350 /* OBSOLETE UDIStop (); */
351 /* OBSOLETE From.Space = UDI29KSpecialRegs; */
352 /* OBSOLETE From.Offset = 11; */
353 /* OBSOLETE if (err = UDIRead (From, &PC_adds, Count, Size, &CountDone, HostEndian)) */
354 /* OBSOLETE error ("UDIRead failed in udi_attach"); */
355 /* OBSOLETE printf_unfiltered ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds); */
357 /* OBSOLETE /************************************************************* UDI_DETACH */ */
358 /* OBSOLETE /* Terminate the open connection to the TIP process. */
359 /* OBSOLETE Use this when you want to detach and do something else */
360 /* OBSOLETE with your gdb. Leave remote process running (with no breakpoints set). */ */
361 /* OBSOLETE static void */
362 /* OBSOLETE udi_detach (char *args, int from_tty) */
365 /* OBSOLETE remove_breakpoints (); /* Just in case there were any left in */ */
367 /* OBSOLETE if (UDIDisconnect (udi_session_id, UDIContinueSession)) */
368 /* OBSOLETE error ("UDIDisconnect() failed in udi_detach"); */
370 /* OBSOLETE /* Don't try to UDIDisconnect it again in udi_close, which is called from */
371 /* OBSOLETE pop_target. */ */
372 /* OBSOLETE udi_session_id = -1; */
373 /* OBSOLETE inferior_ptid = null_ptid; */
375 /* OBSOLETE pop_target (); */
377 /* OBSOLETE if (from_tty) */
378 /* OBSOLETE printf_unfiltered ("Detaching from TIP\n"); */
382 /* OBSOLETE /****************************************************************** UDI_RESUME */
383 /* OBSOLETE ** Tell the remote machine to resume. */ */
385 /* OBSOLETE static void */
386 /* OBSOLETE udi_resume (ptid_t ptid, int step, enum target_signal sig) */
388 /* OBSOLETE UDIError tip_error; */
389 /* OBSOLETE UDIUInt32 Steps = 1; */
390 /* OBSOLETE UDIStepType StepType = UDIStepNatural; */
391 /* OBSOLETE UDIRange Range; */
393 /* OBSOLETE if (step) /* step 1 instruction */ */
395 /* OBSOLETE tip_error = UDIStep (Steps, StepType, Range); */
396 /* OBSOLETE if (!tip_error) */
397 /* OBSOLETE return; */
399 /* OBSOLETE fprintf_unfiltered (gdb_stderr, "UDIStep() error = %d\n", tip_error); */
400 /* OBSOLETE error ("failed in udi_resume"); */
403 /* OBSOLETE if (UDIExecute ()) */
404 /* OBSOLETE error ("UDIExecute() failed in udi_resume"); */
407 /* OBSOLETE /******************************************************************** UDI_WAIT */
408 /* OBSOLETE ** Wait until the remote machine stops, then return, */
409 /* OBSOLETE storing status in STATUS just as `wait' would. */ */
411 /* OBSOLETE static ptid_t */
412 /* OBSOLETE udi_wait (ptid_t ptid, struct target_waitstatus *status) */
414 /* OBSOLETE UDIInt32 MaxTime; */
415 /* OBSOLETE UDIPId PId; */
416 /* OBSOLETE UDIInt32 StopReason; */
417 /* OBSOLETE UDISizeT CountDone; */
418 /* OBSOLETE int old_timeout = timeout; */
419 /* OBSOLETE int old_immediate_quit = immediate_quit; */
420 /* OBSOLETE int i; */
422 /* OBSOLETE status->kind = TARGET_WAITKIND_EXITED; */
423 /* OBSOLETE status->value.integer = 0; */
425 /* OBSOLETE /* wait for message to arrive. It should be: */
426 /* OBSOLETE If the target stops executing, udi_wait() should return. */
428 /* OBSOLETE timeout = 0; /* Wait indefinetly for a message */ */
429 /* OBSOLETE immediate_quit = 1; /* Helps ability to QUIT */ */
431 /* OBSOLETE while (1) */
433 /* OBSOLETE i = 0; */
434 /* OBSOLETE MaxTime = UDIWaitForever; */
435 /* OBSOLETE UDIWait (MaxTime, &PId, &StopReason); */
436 /* OBSOLETE QUIT; /* Let user quit if they want */ */
438 /* OBSOLETE switch (StopReason & UDIGrossState) */
440 /* OBSOLETE case UDIStdoutReady: */
441 /* OBSOLETE if (UDIGetStdout (sbuf, (UDISizeT) SBUF_MAX, &CountDone)) */
442 /* OBSOLETE /* This is said to happen if the program tries to output */
443 /* OBSOLETE a whole bunch of output (more than SBUF_MAX, I would */
444 /* OBSOLETE guess). It doesn't seem to happen with the simulator. */ */
445 /* OBSOLETE warning ("UDIGetStdout() failed in udi_wait"); */
446 /* OBSOLETE fwrite (sbuf, 1, CountDone, stdout); */
447 /* OBSOLETE gdb_flush (gdb_stdout); */
448 /* OBSOLETE continue; */
450 /* OBSOLETE case UDIStderrReady: */
451 /* OBSOLETE UDIGetStderr (sbuf, (UDISizeT) SBUF_MAX, &CountDone); */
452 /* OBSOLETE fwrite (sbuf, 1, CountDone, stderr); */
453 /* OBSOLETE gdb_flush (gdb_stderr); */
454 /* OBSOLETE continue; */
456 /* OBSOLETE case UDIStdinNeeded: */
458 /* OBSOLETE int ch; */
459 /* OBSOLETE i = 0; */
462 /* OBSOLETE ch = getchar (); */
463 /* OBSOLETE if (ch == EOF) */
464 /* OBSOLETE break; */
465 /* OBSOLETE sbuf[i++] = ch; */
467 /* OBSOLETE while (i < SBUF_MAX && ch != '\n'); */
468 /* OBSOLETE UDIPutStdin (sbuf, (UDISizeT) i, &CountDone); */
469 /* OBSOLETE continue; */
472 /* OBSOLETE case UDIRunning: */
473 /* OBSOLETE /* In spite of the fact that we told UDIWait to wait forever, it will */
474 /* OBSOLETE return spuriously sometimes. */ */
475 /* OBSOLETE case UDIStdinModeX: */
476 /* OBSOLETE continue; */
477 /* OBSOLETE default: */
478 /* OBSOLETE break; */
480 /* OBSOLETE break; */
483 /* OBSOLETE switch (StopReason & UDIGrossState) */
485 /* OBSOLETE case UDITrapped: */
486 /* OBSOLETE printf_unfiltered ("Am290*0 received vector number %d\n", StopReason >> 24); */
488 /* OBSOLETE switch ((StopReason >> 8) & 0xff) */
490 /* OBSOLETE case 0: /* Illegal opcode */ */
491 /* OBSOLETE printf_unfiltered (" (break point)\n"); */
492 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
493 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; */
494 /* OBSOLETE break; */
495 /* OBSOLETE case 1: /* Unaligned Access */ */
496 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
497 /* OBSOLETE status->value.sig = TARGET_SIGNAL_BUS; */
498 /* OBSOLETE break; */
499 /* OBSOLETE case 3: */
500 /* OBSOLETE case 4: */
501 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
502 /* OBSOLETE status->value.sig = TARGET_SIGNAL_FPE; */
503 /* OBSOLETE break; */
504 /* OBSOLETE case 5: /* Protection Violation */ */
505 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
506 /* OBSOLETE /* Why not SEGV? What is a Protection Violation? */ */
507 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ILL; */
508 /* OBSOLETE break; */
509 /* OBSOLETE case 6: */
510 /* OBSOLETE case 7: */
511 /* OBSOLETE case 8: /* User Instruction Mapping Miss */ */
512 /* OBSOLETE case 9: /* User Data Mapping Miss */ */
513 /* OBSOLETE case 10: /* Supervisor Instruction Mapping Miss */ */
514 /* OBSOLETE case 11: /* Supervisor Data Mapping Miss */ */
515 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
516 /* OBSOLETE status->value.sig = TARGET_SIGNAL_SEGV; */
517 /* OBSOLETE break; */
518 /* OBSOLETE case 12: */
519 /* OBSOLETE case 13: */
520 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
521 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ILL; */
522 /* OBSOLETE break; */
523 /* OBSOLETE case 14: /* Timer */ */
524 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
525 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ALRM; */
526 /* OBSOLETE break; */
527 /* OBSOLETE case 15: /* Trace */ */
528 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
529 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; */
530 /* OBSOLETE break; */
531 /* OBSOLETE case 16: /* INTR0 */ */
532 /* OBSOLETE case 17: /* INTR1 */ */
533 /* OBSOLETE case 18: /* INTR2 */ */
534 /* OBSOLETE case 19: /* INTR3/Internal */ */
535 /* OBSOLETE case 20: /* TRAP0 */ */
536 /* OBSOLETE case 21: /* TRAP1 */ */
537 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
538 /* OBSOLETE status->value.sig = TARGET_SIGNAL_INT; */
539 /* OBSOLETE break; */
540 /* OBSOLETE case 22: /* Floating-Point Exception */ */
541 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
542 /* OBSOLETE /* Why not FPE? */ */
543 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ILL; */
544 /* OBSOLETE break; */
545 /* OBSOLETE case 77: /* assert 77 */ */
546 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
547 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; */
548 /* OBSOLETE break; */
549 /* OBSOLETE default: */
550 /* OBSOLETE status->kind = TARGET_WAITKIND_EXITED; */
551 /* OBSOLETE status->value.integer = 0; */
553 /* OBSOLETE break; */
554 /* OBSOLETE case UDINotExecuting: */
555 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
556 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TERM; */
557 /* OBSOLETE break; */
558 /* OBSOLETE case UDIStopped: */
559 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
560 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TSTP; */
561 /* OBSOLETE break; */
562 /* OBSOLETE case UDIWarned: */
563 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
564 /* OBSOLETE status->value.sig = TARGET_SIGNAL_URG; */
565 /* OBSOLETE break; */
566 /* OBSOLETE case UDIStepped: */
567 /* OBSOLETE case UDIBreak: */
568 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
569 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; */
570 /* OBSOLETE break; */
571 /* OBSOLETE case UDIWaiting: */
572 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
573 /* OBSOLETE status->value.sig = TARGET_SIGNAL_STOP; */
574 /* OBSOLETE break; */
575 /* OBSOLETE case UDIHalted: */
576 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
577 /* OBSOLETE status->value.sig = TARGET_SIGNAL_KILL; */
578 /* OBSOLETE break; */
579 /* OBSOLETE case UDIExited: */
580 /* OBSOLETE default: */
581 /* OBSOLETE status->kind = TARGET_WAITKIND_EXITED; */
582 /* OBSOLETE status->value.integer = 0; */
585 /* OBSOLETE timeout = old_timeout; /* Restore original timeout value */ */
586 /* OBSOLETE immediate_quit = old_immediate_quit; */
587 /* OBSOLETE return inferior_ptid; */
591 /* OBSOLETE /* Handy for debugging */ */
592 /* OBSOLETE udi_pc (void) */
594 /* OBSOLETE UDIResource From; */
595 /* OBSOLETE UDIUInt32 *To; */
596 /* OBSOLETE UDICount Count; */
597 /* OBSOLETE UDISizeT Size = 4; */
598 /* OBSOLETE UDICount CountDone; */
599 /* OBSOLETE UDIBool HostEndian = 0; */
600 /* OBSOLETE UDIError err; */
601 /* OBSOLETE int pc[2]; */
602 /* OBSOLETE unsigned long myregs[256]; */
603 /* OBSOLETE int i; */
605 /* OBSOLETE From.Space = UDI29KPC; */
606 /* OBSOLETE From.Offset = 0; */
607 /* OBSOLETE To = (UDIUInt32 *) pc; */
608 /* OBSOLETE Count = 2; */
610 /* OBSOLETE err = UDIRead (From, To, Count, Size, &CountDone, HostEndian); */
612 /* OBSOLETE printf_unfiltered ("err = %d, CountDone = %d, pc[0] = 0x%x, pc[1] = 0x%x\n", */
613 /* OBSOLETE err, CountDone, pc[0], pc[1]); */
615 /* OBSOLETE udi_fetch_registers (-1); */
617 /* OBSOLETE printf_unfiltered ("other pc1 = 0x%x, pc0 = 0x%x\n", *(int *) ®isters[4 * PC_REGNUM], */
618 /* OBSOLETE *(int *) ®isters[4 * NPC_REGNUM]); */
620 /* OBSOLETE /* Now, read all the registers globally */ */
622 /* OBSOLETE From.Space = UDI29KGlobalRegs; */
623 /* OBSOLETE From.Offset = 0; */
624 /* OBSOLETE err = UDIRead (From, myregs, 256, 4, &CountDone, HostEndian); */
626 /* OBSOLETE printf ("err = %d, CountDone = %d\n", err, CountDone); */
628 /* OBSOLETE printf ("\n"); */
630 /* OBSOLETE for (i = 0; i < 256; i += 2) */
631 /* OBSOLETE printf ("%d:\t%#10x\t%11d\t%#10x\t%11d\n", i, myregs[i], myregs[i], */
632 /* OBSOLETE myregs[i + 1], myregs[i + 1]); */
633 /* OBSOLETE printf ("\n"); */
635 /* OBSOLETE return pc[0]; */
637 /* OBSOLETE #endif */
639 /* OBSOLETE /********************************************************** UDI_FETCH_REGISTERS */
640 /* OBSOLETE * Read a remote register 'regno'. */
641 /* OBSOLETE * If regno==-1 then read all the registers. */
643 /* OBSOLETE static void */
644 /* OBSOLETE udi_fetch_registers (int regno) */
646 /* OBSOLETE UDIResource From; */
647 /* OBSOLETE UDIUInt32 *To; */
648 /* OBSOLETE UDICount Count; */
649 /* OBSOLETE UDISizeT Size = 4; */
650 /* OBSOLETE UDICount CountDone; */
651 /* OBSOLETE UDIBool HostEndian = 0; */
652 /* OBSOLETE UDIError err; */
653 /* OBSOLETE int i; */
655 /* OBSOLETE if (regno >= 0) */
657 /* OBSOLETE fetch_register (regno); */
658 /* OBSOLETE return; */
661 /* OBSOLETE /* Gr1/rsp */ */
663 /* OBSOLETE From.Space = UDI29KGlobalRegs; */
664 /* OBSOLETE From.Offset = 1; */
665 /* OBSOLETE To = (UDIUInt32 *) & registers[4 * GR1_REGNUM]; */
666 /* OBSOLETE Count = 1; */
667 /* OBSOLETE if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
668 /* OBSOLETE error ("UDIRead() failed in udi_fetch_registers"); */
670 /* OBSOLETE register_valid[GR1_REGNUM] = 1; */
672 /* OBSOLETE #if defined(GR64_REGNUM) /* Read gr64-127 */ */
674 /* OBSOLETE /* Global Registers gr64-gr95 */ */
676 /* OBSOLETE From.Space = UDI29KGlobalRegs; */
677 /* OBSOLETE From.Offset = 64; */
678 /* OBSOLETE To = (UDIUInt32 *) & registers[4 * GR64_REGNUM]; */
679 /* OBSOLETE Count = 32; */
680 /* OBSOLETE if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
681 /* OBSOLETE error ("UDIRead() failed in udi_fetch_registers"); */
683 /* OBSOLETE for (i = GR64_REGNUM; i < GR64_REGNUM + 32; i++) */
684 /* OBSOLETE register_valid[i] = 1; */
686 /* OBSOLETE #endif /* GR64_REGNUM */ */
688 /* OBSOLETE /* Global Registers gr96-gr127 */ */
690 /* OBSOLETE From.Space = UDI29KGlobalRegs; */
691 /* OBSOLETE From.Offset = 96; */
692 /* OBSOLETE To = (UDIUInt32 *) & registers[4 * GR96_REGNUM]; */
693 /* OBSOLETE Count = 32; */
694 /* OBSOLETE if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
695 /* OBSOLETE error ("UDIRead() failed in udi_fetch_registers"); */
697 /* OBSOLETE for (i = GR96_REGNUM; i < GR96_REGNUM + 32; i++) */
698 /* OBSOLETE register_valid[i] = 1; */
700 /* OBSOLETE /* Local Registers */ */
702 /* OBSOLETE From.Space = UDI29KLocalRegs; */
703 /* OBSOLETE From.Offset = 0; */
704 /* OBSOLETE To = (UDIUInt32 *) & registers[4 * LR0_REGNUM]; */
705 /* OBSOLETE Count = 128; */
706 /* OBSOLETE if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
707 /* OBSOLETE error ("UDIRead() failed in udi_fetch_registers"); */
709 /* OBSOLETE for (i = LR0_REGNUM; i < LR0_REGNUM + 128; i++) */
710 /* OBSOLETE register_valid[i] = 1; */
712 /* OBSOLETE /* Protected Special Registers */ */
714 /* OBSOLETE From.Space = UDI29KSpecialRegs; */
715 /* OBSOLETE From.Offset = 0; */
716 /* OBSOLETE To = (UDIUInt32 *) & registers[4 * SR_REGNUM (0)]; */
717 /* OBSOLETE Count = 15; */
718 /* OBSOLETE if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
719 /* OBSOLETE error ("UDIRead() failed in udi_fetch_registers"); */
721 /* OBSOLETE for (i = SR_REGNUM (0); i < SR_REGNUM (0) + 15; i++) */
722 /* OBSOLETE register_valid[i] = 1; */
724 /* OBSOLETE if (USE_SHADOW_PC) */
725 /* OBSOLETE { /* Let regno_to_srnum() handle the register number */ */
726 /* OBSOLETE fetch_register (NPC_REGNUM); */
727 /* OBSOLETE fetch_register (PC_REGNUM); */
728 /* OBSOLETE fetch_register (PC2_REGNUM); */
730 /* OBSOLETE /* Unprotected Special Registers sr128-sr135 */ */
732 /* OBSOLETE From.Space = UDI29KSpecialRegs; */
733 /* OBSOLETE From.Offset = 128; */
734 /* OBSOLETE To = (UDIUInt32 *) & registers[4 * SR_REGNUM (128)]; */
735 /* OBSOLETE Count = 135 - 128 + 1; */
736 /* OBSOLETE if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
737 /* OBSOLETE error ("UDIRead() failed in udi_fetch_registers"); */
739 /* OBSOLETE for (i = SR_REGNUM (128); i < SR_REGNUM (128) + 135 - 128 + 1; i++) */
740 /* OBSOLETE register_valid[i] = 1; */
743 /* OBSOLETE if (remote_debug) */
745 /* OBSOLETE fprintf_unfiltered (gdb_stdlog, "Fetching all registers\n"); */
746 /* OBSOLETE fprintf_unfiltered (gdb_stdlog, */
747 /* OBSOLETE "Fetching PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", */
748 /* OBSOLETE read_register (NPC_REGNUM), */
749 /* OBSOLETE read_register (PC_REGNUM), */
750 /* OBSOLETE read_register (PC2_REGNUM)); */
753 /* OBSOLETE /* There doesn't seem to be any way to get these. */ */
755 /* OBSOLETE int val = -1; */
756 /* OBSOLETE supply_register (FPE_REGNUM, (char *) &val); */
757 /* OBSOLETE supply_register (INTE_REGNUM, (char *) &val); */
758 /* OBSOLETE supply_register (FPS_REGNUM, (char *) &val); */
759 /* OBSOLETE supply_register (EXO_REGNUM, (char *) &val); */
764 /* OBSOLETE /********************************************************* UDI_STORE_REGISTERS */
765 /* OBSOLETE ** Store register regno into the target. */
766 /* OBSOLETE * If regno==-1 then store all the registers. */
769 /* OBSOLETE static void */
770 /* OBSOLETE udi_store_registers (int regno) */
772 /* OBSOLETE UDIUInt32 *From; */
773 /* OBSOLETE UDIResource To; */
774 /* OBSOLETE UDICount Count; */
775 /* OBSOLETE UDISizeT Size = 4; */
776 /* OBSOLETE UDICount CountDone; */
777 /* OBSOLETE UDIBool HostEndian = 0; */
779 /* OBSOLETE if (regno >= 0) */
781 /* OBSOLETE store_register (regno); */
782 /* OBSOLETE return; */
785 /* OBSOLETE if (remote_debug) */
787 /* OBSOLETE fprintf_unfiltered (gdb_stdlog, "Storing all registers\n"); */
788 /* OBSOLETE fprintf_unfiltered (gdb_stdlog, */
789 /* OBSOLETE "PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", */
790 /* OBSOLETE read_register (NPC_REGNUM), */
791 /* OBSOLETE read_register (PC_REGNUM), */
792 /* OBSOLETE read_register (PC2_REGNUM)); */
795 /* OBSOLETE /* Gr1/rsp */ */
797 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * GR1_REGNUM]; */
798 /* OBSOLETE To.Space = UDI29KGlobalRegs; */
799 /* OBSOLETE To.Offset = 1; */
800 /* OBSOLETE Count = 1; */
801 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
802 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
804 /* OBSOLETE #if defined(GR64_REGNUM) */
806 /* OBSOLETE /* Global registers gr64-gr95 */ */
808 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * GR64_REGNUM]; */
809 /* OBSOLETE To.Space = UDI29KGlobalRegs; */
810 /* OBSOLETE To.Offset = 64; */
811 /* OBSOLETE Count = 32; */
812 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
813 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
815 /* OBSOLETE #endif /* GR64_REGNUM */ */
817 /* OBSOLETE /* Global registers gr96-gr127 */ */
819 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * GR96_REGNUM]; */
820 /* OBSOLETE To.Space = UDI29KGlobalRegs; */
821 /* OBSOLETE To.Offset = 96; */
822 /* OBSOLETE Count = 32; */
823 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
824 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
826 /* OBSOLETE /* Local Registers */ */
828 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * LR0_REGNUM]; */
829 /* OBSOLETE To.Space = UDI29KLocalRegs; */
830 /* OBSOLETE To.Offset = 0; */
831 /* OBSOLETE Count = 128; */
832 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
833 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
836 /* OBSOLETE /* Protected Special Registers *//* VAB through TMR */ */
838 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * SR_REGNUM (0)]; */
839 /* OBSOLETE To.Space = UDI29KSpecialRegs; */
840 /* OBSOLETE To.Offset = 0; */
841 /* OBSOLETE Count = 10; */
842 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
843 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
845 /* OBSOLETE /* PC0, PC1, PC2 possibly as shadow registers */ */
847 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * SR_REGNUM (10)]; */
848 /* OBSOLETE To.Space = UDI29KSpecialRegs; */
849 /* OBSOLETE Count = 3; */
850 /* OBSOLETE if (USE_SHADOW_PC) */
851 /* OBSOLETE To.Offset = 20; /* SPC0 */ */
853 /* OBSOLETE To.Offset = 10; /* PC0 */ */
854 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
855 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
857 /* OBSOLETE /* PC1 via UDI29KPC */ */
859 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * PC_REGNUM]; */
860 /* OBSOLETE To.Space = UDI29KPC; */
861 /* OBSOLETE To.Offset = 0; /* PC1 */ */
862 /* OBSOLETE Count = 1; */
863 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
864 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
866 /* OBSOLETE /* LRU and MMU */ */
868 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * SR_REGNUM (13)]; */
869 /* OBSOLETE To.Space = UDI29KSpecialRegs; */
870 /* OBSOLETE To.Offset = 13; */
871 /* OBSOLETE Count = 2; */
872 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
873 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
875 /* OBSOLETE /* Unprotected Special Registers */ */
877 /* OBSOLETE From = (UDIUInt32 *) & registers[4 * SR_REGNUM (128)]; */
878 /* OBSOLETE To.Space = UDI29KSpecialRegs; */
879 /* OBSOLETE To.Offset = 128; */
880 /* OBSOLETE Count = 135 - 128 + 1; */
881 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
882 /* OBSOLETE error ("UDIWrite() failed in udi_store_regisetrs"); */
884 /* OBSOLETE registers_changed (); */
887 /* OBSOLETE /****************************************************** UDI_PREPARE_TO_STORE */ */
888 /* OBSOLETE /* Get ready to modify the registers array. On machines which store */
889 /* OBSOLETE individual registers, this doesn't need to do anything. On machines */
890 /* OBSOLETE which store all the registers in one fell swoop, this makes sure */
891 /* OBSOLETE that registers contains all the registers from the program being */
892 /* OBSOLETE debugged. */ */
894 /* OBSOLETE static void */
895 /* OBSOLETE udi_prepare_to_store (void) */
897 /* OBSOLETE /* Do nothing, since we can store individual regs */ */
900 /* OBSOLETE /********************************************************** TRANSLATE_ADDR */ */
901 /* OBSOLETE static CORE_ADDR */
902 /* OBSOLETE translate_addr (CORE_ADDR addr) */
904 /* OBSOLETE #if defined(ULTRA3) && defined(KERNEL_DEBUGGING) */
905 /* OBSOLETE /* Check for a virtual address in the kernel */ */
906 /* OBSOLETE /* Assume physical address of ublock is in paddr_u register */ */
907 /* OBSOLETE /* FIXME: doesn't work for user virtual addresses */ */
908 /* OBSOLETE if (addr >= UVADDR) */
910 /* OBSOLETE /* PADDR_U register holds the physical address of the ublock */ */
911 /* OBSOLETE CORE_ADDR i = (CORE_ADDR) read_register (PADDR_U_REGNUM); */
912 /* OBSOLETE return (i + addr - (CORE_ADDR) UVADDR); */
916 /* OBSOLETE return (addr); */
919 /* OBSOLETE return (addr); */
920 /* OBSOLETE #endif */
922 /* OBSOLETE /************************************************* UDI_XFER_INFERIOR_MEMORY */ */
923 /* OBSOLETE /* FIXME! Merge these two. */ */
924 /* OBSOLETE static int */
925 /* OBSOLETE udi_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, */
926 /* OBSOLETE struct mem_attrib *attrib ATTRIBUTE_UNUSED, */
927 /* OBSOLETE struct target_ops *target ATTRIBUTE_UNUSED) */
930 /* OBSOLETE memaddr = translate_addr (memaddr); */
932 /* OBSOLETE if (write) */
933 /* OBSOLETE return udi_write_inferior_memory (memaddr, myaddr, len); */
935 /* OBSOLETE return udi_read_inferior_memory (memaddr, myaddr, len); */
938 /* OBSOLETE /********************************************************** UDI_FILES_INFO */ */
939 /* OBSOLETE static void */
940 /* OBSOLETE udi_files_info (struct target_ops *target) */
942 /* OBSOLETE printf_unfiltered ("\tAttached to UDI socket to %s", udi_config_id); */
943 /* OBSOLETE if (prog_name != NULL) */
944 /* OBSOLETE printf_unfiltered ("and running program %s", prog_name); */
945 /* OBSOLETE printf_unfiltered (".\n"); */
948 /* OBSOLETE /**************************************************** UDI_INSERT_BREAKPOINT */ */
949 /* OBSOLETE static int */
950 /* OBSOLETE udi_insert_breakpoint (CORE_ADDR addr, char *contents_cache) */
952 /* OBSOLETE int cnt; */
953 /* OBSOLETE UDIError err; */
955 /* OBSOLETE for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) */
956 /* OBSOLETE if (bkpt_table[cnt].Type == 0) /* Find first free slot */ */
957 /* OBSOLETE break; */
959 /* OBSOLETE if (cnt >= BKPT_TABLE_SIZE) */
960 /* OBSOLETE error ("Too many breakpoints set"); */
962 /* OBSOLETE bkpt_table[cnt].Addr.Offset = addr; */
963 /* OBSOLETE bkpt_table[cnt].Addr.Space = UDI29KIRAMSpace; */
964 /* OBSOLETE bkpt_table[cnt].PassCount = 1; */
965 /* OBSOLETE bkpt_table[cnt].Type = UDIBreakFlagExecute; */
967 /* OBSOLETE err = UDISetBreakpoint (bkpt_table[cnt].Addr, */
968 /* OBSOLETE bkpt_table[cnt].PassCount, */
969 /* OBSOLETE bkpt_table[cnt].Type, */
970 /* OBSOLETE &bkpt_table[cnt].BreakId); */
972 /* OBSOLETE if (err == 0) */
973 /* OBSOLETE return 0; /* Success */ */
975 /* OBSOLETE bkpt_table[cnt].Type = 0; */
976 /* OBSOLETE error ("UDISetBreakpoint returned error code %d\n", err); */
979 /* OBSOLETE /**************************************************** UDI_REMOVE_BREAKPOINT */ */
980 /* OBSOLETE static int */
981 /* OBSOLETE udi_remove_breakpoint (CORE_ADDR addr, char *contents_cache) */
983 /* OBSOLETE int cnt; */
984 /* OBSOLETE UDIError err; */
986 /* OBSOLETE for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) */
987 /* OBSOLETE if (bkpt_table[cnt].Addr.Offset == addr) /* Find matching breakpoint */ */
988 /* OBSOLETE break; */
990 /* OBSOLETE if (cnt >= BKPT_TABLE_SIZE) */
991 /* OBSOLETE error ("Can't find breakpoint in table"); */
993 /* OBSOLETE bkpt_table[cnt].Type = 0; */
995 /* OBSOLETE err = UDIClearBreakpoint (bkpt_table[cnt].BreakId); */
996 /* OBSOLETE if (err == 0) */
997 /* OBSOLETE return 0; /* Success */ */
999 /* OBSOLETE error ("UDIClearBreakpoint returned error code %d\n", err); */
1002 /* OBSOLETE static void */
1003 /* OBSOLETE udi_kill (void) */
1006 /* OBSOLETE #if 0 */
1008 /* OBSOLETE UDIStop does not really work as advertised. It causes the TIP to close it's */
1009 /* OBSOLETE connection, which usually results in GDB dying with a SIGPIPE. For now, we */
1010 /* OBSOLETE just invoke udi_close, which seems to get things right. */
1012 /* OBSOLETE UDIStop (); */
1014 /* OBSOLETE udi_session_id = -1; */
1015 /* OBSOLETE inferior_ptid = null_ptid; */
1017 /* OBSOLETE if (from_tty) */
1018 /* OBSOLETE printf_unfiltered ("Target has been stopped."); */
1019 /* OBSOLETE #endif /* 0 */ */
1020 /* OBSOLETE #if 0 */
1021 /* OBSOLETE udi_close (0); */
1022 /* OBSOLETE pop_target (); */
1023 /* OBSOLETE #endif /* 0 */ */
1025 /* OBSOLETE /* Keep the target around, e.g. so "run" can do the right thing when */
1026 /* OBSOLETE we are already debugging something. */ */
1028 /* OBSOLETE if (UDIDisconnect (udi_session_id, UDITerminateSession)) */
1030 /* OBSOLETE warning ("UDIDisconnect() failed"); */
1033 /* OBSOLETE /* Do not try to close udi_session_id again, later in the program. */ */
1034 /* OBSOLETE udi_session_id = -1; */
1035 /* OBSOLETE inferior_ptid = null_ptid; */
1039 /* OBSOLETE Load a program into the target. Args are: `program {options}'. The options */
1040 /* OBSOLETE are used to control loading of the program, and are NOT passed onto the */
1041 /* OBSOLETE loaded code as arguments. (You need to use the `run' command to do that.) */
1043 /* OBSOLETE The options are: */
1044 /* OBSOLETE -ms %d Set mem stack size to %d */
1045 /* OBSOLETE -rs %d Set regular stack size to %d */
1046 /* OBSOLETE -i send init info (default) */
1047 /* OBSOLETE -noi don't send init info */
1048 /* OBSOLETE -[tT] Load Text section */
1049 /* OBSOLETE -[dD] Load Data section */
1050 /* OBSOLETE -[bB] Load BSS section */
1051 /* OBSOLETE -[lL] Load Lit section */
1054 /* OBSOLETE static void */
1055 /* OBSOLETE download (char *load_arg_string, int from_tty) */
1057 /* OBSOLETE #define DEFAULT_MEM_STACK_SIZE 0x6000 */
1058 /* OBSOLETE #define DEFAULT_REG_STACK_SIZE 0x2000 */
1060 /* OBSOLETE char *token; */
1061 /* OBSOLETE char *filename; */
1062 /* OBSOLETE asection *section; */
1063 /* OBSOLETE bfd *pbfd; */
1064 /* OBSOLETE UDIError err; */
1065 /* OBSOLETE int load_text = 1, load_data = 1, load_bss = 1, load_lit = 1; */
1067 /* OBSOLETE address_ranges[0].Space = UDI29KIRAMSpace; */
1068 /* OBSOLETE address_ranges[0].Offset = 0xffffffff; */
1069 /* OBSOLETE address_ranges[0].Size = 0; */
1071 /* OBSOLETE address_ranges[1].Space = UDI29KDRAMSpace; */
1072 /* OBSOLETE address_ranges[1].Offset = 0xffffffff; */
1073 /* OBSOLETE address_ranges[1].Size = 0; */
1075 /* OBSOLETE stack_sizes[0] = DEFAULT_REG_STACK_SIZE; */
1076 /* OBSOLETE stack_sizes[1] = DEFAULT_MEM_STACK_SIZE; */
1078 /* OBSOLETE dont_repeat (); */
1080 /* OBSOLETE filename = strtok (load_arg_string, " \t"); */
1081 /* OBSOLETE if (!filename) */
1082 /* OBSOLETE error ("Must specify at least a file name with the load command"); */
1084 /* OBSOLETE filename = tilde_expand (filename); */
1085 /* OBSOLETE make_cleanup (xfree, filename); */
1087 /* OBSOLETE while (token = strtok (NULL, " \t")) */
1089 /* OBSOLETE if (token[0] == '-') */
1091 /* OBSOLETE token++; */
1093 /* OBSOLETE if (STREQ (token, "ms")) */
1094 /* OBSOLETE stack_sizes[1] = atol (strtok (NULL, " \t")); */
1095 /* OBSOLETE else if (STREQ (token, "rs")) */
1096 /* OBSOLETE stack_sizes[0] = atol (strtok (NULL, " \t")); */
1099 /* OBSOLETE load_text = load_data = load_bss = load_lit = 0; */
1101 /* OBSOLETE while (*token) */
1103 /* OBSOLETE switch (*token++) */
1105 /* OBSOLETE case 't': */
1106 /* OBSOLETE case 'T': */
1107 /* OBSOLETE load_text = 1; */
1108 /* OBSOLETE break; */
1109 /* OBSOLETE case 'd': */
1110 /* OBSOLETE case 'D': */
1111 /* OBSOLETE load_data = 1; */
1112 /* OBSOLETE break; */
1113 /* OBSOLETE case 'b': */
1114 /* OBSOLETE case 'B': */
1115 /* OBSOLETE load_bss = 1; */
1116 /* OBSOLETE break; */
1117 /* OBSOLETE case 'l': */
1118 /* OBSOLETE case 'L': */
1119 /* OBSOLETE load_lit = 1; */
1120 /* OBSOLETE break; */
1121 /* OBSOLETE default: */
1122 /* OBSOLETE error ("Unknown UDI load option -%s", token - 1); */
1129 /* OBSOLETE pbfd = bfd_openr (filename, gnutarget); */
1131 /* OBSOLETE if (!pbfd) */
1132 /* OBSOLETE /* FIXME: should be using bfd_errmsg, not assuming it was */
1133 /* OBSOLETE bfd_error_system_call. */ */
1134 /* OBSOLETE perror_with_name (filename); */
1136 /* OBSOLETE /* FIXME: should be checking for errors from bfd_close (for one thing, */
1137 /* OBSOLETE on error it does not free all the storage associated with the */
1138 /* OBSOLETE bfd). */ */
1139 /* OBSOLETE make_cleanup_bfd_close (pbfd); */
1141 /* OBSOLETE QUIT; */
1142 /* OBSOLETE immediate_quit++; */
1144 /* OBSOLETE if (!bfd_check_format (pbfd, bfd_object)) */
1145 /* OBSOLETE error ("It doesn't seem to be an object file"); */
1147 /* OBSOLETE for (section = pbfd->sections; section; section = section->next) */
1149 /* OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_ALLOC) */
1151 /* OBSOLETE UDIResource To; */
1152 /* OBSOLETE UDICount Count; */
1153 /* OBSOLETE unsigned long section_size, section_end; */
1154 /* OBSOLETE const char *section_name; */
1156 /* OBSOLETE section_name = bfd_get_section_name (pbfd, section); */
1157 /* OBSOLETE if (STREQ (section_name, ".text") && !load_text) */
1158 /* OBSOLETE continue; */
1159 /* OBSOLETE else if (STREQ (section_name, ".data") && !load_data) */
1160 /* OBSOLETE continue; */
1161 /* OBSOLETE else if (STREQ (section_name, ".bss") && !load_bss) */
1162 /* OBSOLETE continue; */
1163 /* OBSOLETE else if (STREQ (section_name, ".lit") && !load_lit) */
1164 /* OBSOLETE continue; */
1166 /* OBSOLETE To.Offset = bfd_get_section_vma (pbfd, section); */
1167 /* OBSOLETE section_size = bfd_section_size (pbfd, section); */
1168 /* OBSOLETE section_end = To.Offset + section_size; */
1170 /* OBSOLETE if (section_size == 0) */
1171 /* OBSOLETE /* This is needed at least in the BSS case, where the code */
1172 /* OBSOLETE below starts writing before it even checks the size. */ */
1173 /* OBSOLETE continue; */
1175 /* OBSOLETE printf_unfiltered ("[Loading section %s at %x (%d bytes)]\n", */
1176 /* OBSOLETE section_name, */
1177 /* OBSOLETE To.Offset, */
1178 /* OBSOLETE section_size); */
1180 /* OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_CODE) */
1182 /* OBSOLETE To.Space = UDI29KIRAMSpace; */
1184 /* OBSOLETE address_ranges[0].Offset = min (address_ranges[0].Offset, */
1185 /* OBSOLETE To.Offset); */
1186 /* OBSOLETE address_ranges[0].Size = max (address_ranges[0].Size, */
1187 /* OBSOLETE section_end */
1188 /* OBSOLETE - address_ranges[0].Offset); */
1192 /* OBSOLETE To.Space = UDI29KDRAMSpace; */
1194 /* OBSOLETE address_ranges[1].Offset = min (address_ranges[1].Offset, */
1195 /* OBSOLETE To.Offset); */
1196 /* OBSOLETE address_ranges[1].Size = max (address_ranges[1].Size, */
1197 /* OBSOLETE section_end */
1198 /* OBSOLETE - address_ranges[1].Offset); */
1201 /* OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_LOAD) /* Text, data or lit */ */
1203 /* OBSOLETE file_ptr fptr; */
1205 /* OBSOLETE fptr = 0; */
1207 /* OBSOLETE while (section_size > 0) */
1209 /* OBSOLETE char buffer[1024]; */
1211 /* OBSOLETE Count = min (section_size, 1024); */
1213 /* OBSOLETE bfd_get_section_contents (pbfd, section, buffer, fptr, */
1214 /* OBSOLETE Count); */
1216 /* OBSOLETE err = UDIWrite ((UDIHostMemPtr) buffer, /* From */ */
1217 /* OBSOLETE To, /* To */ */
1218 /* OBSOLETE Count, /* Count */ */
1219 /* OBSOLETE (UDISizeT) 1, /* Size */ */
1220 /* OBSOLETE &Count, /* CountDone */ */
1221 /* OBSOLETE (UDIBool) 0); /* HostEndian */ */
1222 /* OBSOLETE if (err) */
1223 /* OBSOLETE error ("UDIWrite failed, error = %d", err); */
1225 /* OBSOLETE To.Offset += Count; */
1226 /* OBSOLETE fptr += Count; */
1227 /* OBSOLETE section_size -= Count; */
1231 /* OBSOLETE /* BSS */ */
1233 /* OBSOLETE UDIResource From; */
1234 /* OBSOLETE unsigned long zero = 0; */
1236 /* OBSOLETE /* Write a zero byte at the vma */ */
1237 /* OBSOLETE /* FIXME: Broken for sections of 1-3 bytes (we test for */
1238 /* OBSOLETE zero above). */ */
1239 /* OBSOLETE err = UDIWrite ((UDIHostMemPtr) & zero, /* From */ */
1240 /* OBSOLETE To, /* To */ */
1241 /* OBSOLETE (UDICount) 1, /* Count */ */
1242 /* OBSOLETE (UDISizeT) 4, /* Size */ */
1243 /* OBSOLETE &Count, /* CountDone */ */
1244 /* OBSOLETE (UDIBool) 0); /* HostEndian */ */
1245 /* OBSOLETE if (err) */
1246 /* OBSOLETE error ("UDIWrite failed, error = %d", err); */
1248 /* OBSOLETE From = To; */
1249 /* OBSOLETE To.Offset += 4; */
1251 /* OBSOLETE /* Now, duplicate it for the length of the BSS */ */
1252 /* OBSOLETE err = UDICopy (From, /* From */ */
1253 /* OBSOLETE To, /* To */ */
1254 /* OBSOLETE (UDICount) (section_size / 4 - 1), /* Count */ */
1255 /* OBSOLETE (UDISizeT) 4, /* Size */ */
1256 /* OBSOLETE &Count, /* CountDone */ */
1257 /* OBSOLETE (UDIBool) 1); /* Direction */ */
1258 /* OBSOLETE if (err) */
1260 /* OBSOLETE char message[100]; */
1261 /* OBSOLETE int xerr; */
1263 /* OBSOLETE xerr = UDIGetErrorMsg (err, 100, message, &Count); */
1264 /* OBSOLETE if (!xerr) */
1265 /* OBSOLETE fprintf_unfiltered (gdb_stderr, "Error is %s\n", message); */
1267 /* OBSOLETE fprintf_unfiltered (gdb_stderr, "xerr is %d\n", xerr); */
1268 /* OBSOLETE error ("UDICopy failed, error = %d", err); */
1275 /* OBSOLETE entry.Space = UDI29KIRAMSpace; */
1276 /* OBSOLETE entry.Offset = bfd_get_start_address (pbfd); */
1278 /* OBSOLETE immediate_quit--; */
1281 /* OBSOLETE /* Function to download an image into the remote target. */ */
1283 /* OBSOLETE static void */
1284 /* OBSOLETE udi_load (char *args, int from_tty) */
1286 /* OBSOLETE download (args, from_tty); */
1288 /* OBSOLETE /* As a convenience, pick up any symbol info that is in the program */
1289 /* OBSOLETE being loaded. Note that we assume that the program is the``mainline''; */
1290 /* OBSOLETE if this is not always true, then this code will need to be augmented. */ */
1291 /* OBSOLETE symbol_file_add (strtok (args, " \t"), from_tty, NULL, 1, 0); */
1293 /* OBSOLETE /* Getting new symbols may change our opinion about what is */
1294 /* OBSOLETE frameless. */ */
1295 /* OBSOLETE reinit_frame_cache (); */
1298 /* OBSOLETE /*************************************************** UDI_WRITE_INFERIOR_MEMORY */
1299 /* OBSOLETE ** Copy LEN bytes of data from debugger memory at MYADDR */
1300 /* OBSOLETE to inferior's memory at MEMADDR. Returns number of bytes written. */ */
1301 /* OBSOLETE static int */
1302 /* OBSOLETE udi_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) */
1304 /* OBSOLETE int nwritten = 0; */
1305 /* OBSOLETE UDIUInt32 *From; */
1306 /* OBSOLETE UDIResource To; */
1307 /* OBSOLETE UDICount Count; */
1308 /* OBSOLETE UDISizeT Size = 1; */
1309 /* OBSOLETE UDICount CountDone = 0; */
1310 /* OBSOLETE UDIBool HostEndian = 0; */
1312 /* OBSOLETE To.Space = udi_memory_space (memaddr); */
1313 /* OBSOLETE From = (UDIUInt32 *) myaddr; */
1315 /* OBSOLETE while (nwritten < len) */
1317 /* OBSOLETE Count = len - nwritten; */
1318 /* OBSOLETE if (Count > MAXDATA) */
1319 /* OBSOLETE Count = MAXDATA; */
1320 /* OBSOLETE To.Offset = memaddr + nwritten; */
1321 /* OBSOLETE if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
1323 /* OBSOLETE error ("UDIWrite() failed in udi_write_inferior_memory"); */
1324 /* OBSOLETE break; */
1328 /* OBSOLETE nwritten += CountDone; */
1329 /* OBSOLETE From += CountDone; */
1332 /* OBSOLETE return (nwritten); */
1335 /* OBSOLETE /**************************************************** UDI_READ_INFERIOR_MEMORY */
1336 /* OBSOLETE ** Read LEN bytes from inferior memory at MEMADDR. Put the result */
1337 /* OBSOLETE at debugger address MYADDR. Returns number of bytes read. */ */
1338 /* OBSOLETE static int */
1339 /* OBSOLETE udi_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) */
1341 /* OBSOLETE int nread = 0; */
1342 /* OBSOLETE UDIResource From; */
1343 /* OBSOLETE UDIUInt32 *To; */
1344 /* OBSOLETE UDICount Count; */
1345 /* OBSOLETE UDISizeT Size = 1; */
1346 /* OBSOLETE UDICount CountDone = 0; */
1347 /* OBSOLETE UDIBool HostEndian = 0; */
1348 /* OBSOLETE UDIError err; */
1350 /* OBSOLETE From.Space = udi_memory_space (memaddr); */
1351 /* OBSOLETE To = (UDIUInt32 *) myaddr; */
1353 /* OBSOLETE while (nread < len) */
1355 /* OBSOLETE Count = len - nread; */
1356 /* OBSOLETE if (Count > MAXDATA) */
1357 /* OBSOLETE Count = MAXDATA; */
1358 /* OBSOLETE From.Offset = memaddr + nread; */
1359 /* OBSOLETE if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
1361 /* OBSOLETE error ("UDIRead() failed in udi_read_inferior_memory"); */
1362 /* OBSOLETE break; */
1366 /* OBSOLETE nread += CountDone; */
1367 /* OBSOLETE To += CountDone; */
1370 /* OBSOLETE return (nread); */
1373 /* OBSOLETE /********************************************************************* WARNING */
1375 /* OBSOLETE udi_warning (int num) */
1377 /* OBSOLETE error ("ERROR while loading program into remote TIP: $d\n", num); */
1381 /* OBSOLETE /*****************************************************************************/ */
1382 /* OBSOLETE /* Fetch a single register indicatated by 'regno'. */
1383 /* OBSOLETE * Returns 0/-1 on success/failure. */
1385 /* OBSOLETE static void */
1386 /* OBSOLETE fetch_register (int regno) */
1388 /* OBSOLETE UDIResource From; */
1389 /* OBSOLETE UDIUInt32 To; */
1390 /* OBSOLETE UDICount Count = 1; */
1391 /* OBSOLETE UDISizeT Size = 4; */
1392 /* OBSOLETE UDICount CountDone; */
1393 /* OBSOLETE UDIBool HostEndian = 0; */
1394 /* OBSOLETE UDIError err; */
1395 /* OBSOLETE int result; */
1397 /* OBSOLETE if (regno == GR1_REGNUM) */
1399 /* OBSOLETE From.Space = UDI29KGlobalRegs; */
1400 /* OBSOLETE From.Offset = 1; */
1402 /* OBSOLETE else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) */
1404 /* OBSOLETE From.Space = UDI29KGlobalRegs; */
1405 /* OBSOLETE From.Offset = (regno - GR96_REGNUM) + 96;; */
1408 /* OBSOLETE #if defined(GR64_REGNUM) */
1410 /* OBSOLETE else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32) */
1412 /* OBSOLETE From.Space = UDI29KGlobalRegs; */
1413 /* OBSOLETE From.Offset = (regno - GR64_REGNUM) + 64; */
1416 /* OBSOLETE #endif /* GR64_REGNUM */ */
1418 /* OBSOLETE else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) */
1420 /* OBSOLETE From.Space = UDI29KLocalRegs; */
1421 /* OBSOLETE From.Offset = (regno - LR0_REGNUM); */
1423 /* OBSOLETE else if (regno >= FPE_REGNUM && regno <= EXO_REGNUM) */
1425 /* OBSOLETE int val = -1; */
1426 /* OBSOLETE /*supply_register(160 + (regno - FPE_REGNUM),(char *) &val); */ */
1427 /* OBSOLETE supply_register (regno, (char *) &val); */
1428 /* OBSOLETE return; /* Pretend Success */ */
1432 /* OBSOLETE From.Space = UDI29KSpecialRegs; */
1433 /* OBSOLETE From.Offset = regnum_to_srnum (regno); */
1436 /* OBSOLETE if (err = UDIRead (From, &To, Count, Size, &CountDone, HostEndian)) */
1437 /* OBSOLETE error ("UDIRead() failed in udi_fetch_registers"); */
1439 /* OBSOLETE supply_register (regno, (char *) &To); */
1441 /* OBSOLETE if (remote_debug) */
1442 /* OBSOLETE fprintf_unfiltered (gdb_stdlog, "Fetching register %s = 0x%x\n", */
1443 /* OBSOLETE REGISTER_NAME (regno), To); */
1445 /* OBSOLETE /*****************************************************************************/ */
1446 /* OBSOLETE /* Store a single register indicated by 'regno'. */
1447 /* OBSOLETE * Returns 0/-1 on success/failure. */
1449 /* OBSOLETE static int */
1450 /* OBSOLETE store_register (int regno) */
1452 /* OBSOLETE int result; */
1453 /* OBSOLETE UDIUInt32 From; */
1454 /* OBSOLETE UDIResource To; */
1455 /* OBSOLETE UDICount Count = 1; */
1456 /* OBSOLETE UDISizeT Size = 4; */
1457 /* OBSOLETE UDICount CountDone; */
1458 /* OBSOLETE UDIBool HostEndian = 0; */
1460 /* OBSOLETE From = read_register (regno); /* get data value */ */
1462 /* OBSOLETE if (remote_debug) */
1463 /* OBSOLETE fprintf_unfiltered (gdb_stdlog, "Storing register %s = 0x%x\n", */
1464 /* OBSOLETE REGISTER_NAME (regno), From); */
1466 /* OBSOLETE if (regno == GR1_REGNUM) */
1468 /* OBSOLETE To.Space = UDI29KGlobalRegs; */
1469 /* OBSOLETE To.Offset = 1; */
1470 /* OBSOLETE result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1471 /* OBSOLETE /* Setting GR1 changes the numbers of all the locals, so invalidate the */
1472 /* OBSOLETE * register cache. Do this *after* calling read_register, because we want */
1473 /* OBSOLETE * read_register to return the value that write_register has just stuffed */
1474 /* OBSOLETE * into the registers array, not the value of the register fetched from */
1475 /* OBSOLETE * the inferior. */
1477 /* OBSOLETE registers_changed (); */
1479 /* OBSOLETE #if defined(GR64_REGNUM) */
1480 /* OBSOLETE else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32) */
1482 /* OBSOLETE To.Space = UDI29KGlobalRegs; */
1483 /* OBSOLETE To.Offset = (regno - GR64_REGNUM) + 64; */
1484 /* OBSOLETE result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1486 /* OBSOLETE #endif /* GR64_REGNUM */ */
1487 /* OBSOLETE else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) */
1489 /* OBSOLETE To.Space = UDI29KGlobalRegs; */
1490 /* OBSOLETE To.Offset = (regno - GR96_REGNUM) + 96; */
1491 /* OBSOLETE result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1493 /* OBSOLETE else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) */
1495 /* OBSOLETE To.Space = UDI29KLocalRegs; */
1496 /* OBSOLETE To.Offset = (regno - LR0_REGNUM); */
1497 /* OBSOLETE result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1499 /* OBSOLETE else if (regno >= FPE_REGNUM && regno <= EXO_REGNUM) */
1500 /* OBSOLETE return 0; /* Pretend Success */ */
1501 /* OBSOLETE else if (regno == PC_REGNUM) */
1503 /* OBSOLETE /* PC1 via UDI29KPC */ */
1505 /* OBSOLETE To.Space = UDI29KPC; */
1506 /* OBSOLETE To.Offset = 0; /* PC1 */ */
1507 /* OBSOLETE result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1509 /* OBSOLETE /* Writing to this loc actually changes the values of pc0 & pc1 */ */
1511 /* OBSOLETE register_valid[PC_REGNUM] = 0; /* pc1 */ */
1512 /* OBSOLETE register_valid[NPC_REGNUM] = 0; /* pc0 */ */
1515 /* OBSOLETE /* An unprotected or protected special register */ */
1517 /* OBSOLETE To.Space = UDI29KSpecialRegs; */
1518 /* OBSOLETE To.Offset = regnum_to_srnum (regno); */
1519 /* OBSOLETE result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1522 /* OBSOLETE if (result != 0) */
1523 /* OBSOLETE error ("UDIWrite() failed in store_registers"); */
1525 /* OBSOLETE return 0; */
1527 /* OBSOLETE /********************************************************** REGNUM_TO_SRNUM */ */
1529 /* OBSOLETE * Convert a gdb special register number to a 29000 special register number. */
1531 /* OBSOLETE static int */
1532 /* OBSOLETE regnum_to_srnum (int regno) */
1534 /* OBSOLETE switch (regno) */
1536 /* OBSOLETE case VAB_REGNUM: */
1537 /* OBSOLETE return (0); */
1538 /* OBSOLETE case OPS_REGNUM: */
1539 /* OBSOLETE return (1); */
1540 /* OBSOLETE case CPS_REGNUM: */
1541 /* OBSOLETE return (2); */
1542 /* OBSOLETE case CFG_REGNUM: */
1543 /* OBSOLETE return (3); */
1544 /* OBSOLETE case CHA_REGNUM: */
1545 /* OBSOLETE return (4); */
1546 /* OBSOLETE case CHD_REGNUM: */
1547 /* OBSOLETE return (5); */
1548 /* OBSOLETE case CHC_REGNUM: */
1549 /* OBSOLETE return (6); */
1550 /* OBSOLETE case RBP_REGNUM: */
1551 /* OBSOLETE return (7); */
1552 /* OBSOLETE case TMC_REGNUM: */
1553 /* OBSOLETE return (8); */
1554 /* OBSOLETE case TMR_REGNUM: */
1555 /* OBSOLETE return (9); */
1556 /* OBSOLETE case NPC_REGNUM: */
1557 /* OBSOLETE return (USE_SHADOW_PC ? (20) : (10)); */
1558 /* OBSOLETE case PC_REGNUM: */
1559 /* OBSOLETE return (USE_SHADOW_PC ? (21) : (11)); */
1560 /* OBSOLETE case PC2_REGNUM: */
1561 /* OBSOLETE return (USE_SHADOW_PC ? (22) : (12)); */
1562 /* OBSOLETE case MMU_REGNUM: */
1563 /* OBSOLETE return (13); */
1564 /* OBSOLETE case LRU_REGNUM: */
1565 /* OBSOLETE return (14); */
1566 /* OBSOLETE case IPC_REGNUM: */
1567 /* OBSOLETE return (128); */
1568 /* OBSOLETE case IPA_REGNUM: */
1569 /* OBSOLETE return (129); */
1570 /* OBSOLETE case IPB_REGNUM: */
1571 /* OBSOLETE return (130); */
1572 /* OBSOLETE case Q_REGNUM: */
1573 /* OBSOLETE return (131); */
1574 /* OBSOLETE case ALU_REGNUM: */
1575 /* OBSOLETE return (132); */
1576 /* OBSOLETE case BP_REGNUM: */
1577 /* OBSOLETE return (133); */
1578 /* OBSOLETE case FC_REGNUM: */
1579 /* OBSOLETE return (134); */
1580 /* OBSOLETE case CR_REGNUM: */
1581 /* OBSOLETE return (135); */
1582 /* OBSOLETE case FPE_REGNUM: */
1583 /* OBSOLETE return (160); */
1584 /* OBSOLETE case INTE_REGNUM: */
1585 /* OBSOLETE return (161); */
1586 /* OBSOLETE case FPS_REGNUM: */
1587 /* OBSOLETE return (162); */
1588 /* OBSOLETE case EXO_REGNUM: */
1589 /* OBSOLETE return (164); */
1590 /* OBSOLETE default: */
1591 /* OBSOLETE return (255); /* Failure ? */ */
1594 /* OBSOLETE /****************************************************************************/ */
1596 /* OBSOLETE * Determine the Target memory space qualifier based on the addr. */
1597 /* OBSOLETE * FIXME: Can't distinguis I_ROM/D_ROM. */
1598 /* OBSOLETE * FIXME: Doesn't know anything about I_CACHE/D_CACHE. */
1600 /* OBSOLETE static CPUSpace */
1601 /* OBSOLETE udi_memory_space (CORE_ADDR addr) */
1603 /* OBSOLETE UDIUInt32 tstart = IMemStart; */
1604 /* OBSOLETE UDIUInt32 tend = tstart + IMemSize; */
1605 /* OBSOLETE UDIUInt32 dstart = DMemStart; */
1606 /* OBSOLETE UDIUInt32 dend = tstart + DMemSize; */
1607 /* OBSOLETE UDIUInt32 rstart = RMemStart; */
1608 /* OBSOLETE UDIUInt32 rend = tstart + RMemSize; */
1610 /* OBSOLETE if (((UDIUInt32) addr >= tstart) && ((UDIUInt32) addr < tend)) */
1612 /* OBSOLETE return UDI29KIRAMSpace; */
1614 /* OBSOLETE else if (((UDIUInt32) addr >= dstart) && ((UDIUInt32) addr < dend)) */
1616 /* OBSOLETE return UDI29KDRAMSpace; */
1618 /* OBSOLETE else if (((UDIUInt32) addr >= rstart) && ((UDIUInt32) addr < rend)) */
1620 /* OBSOLETE /* FIXME: how do we determine between D_ROM and I_ROM */ */
1621 /* OBSOLETE return UDI29KIROMSpace; */
1623 /* OBSOLETE else /* FIXME: what do me do now? */ */
1624 /* OBSOLETE return UDI29KDRAMSpace; /* Hmmm! */ */
1626 /* OBSOLETE /*********************************************************************** STUBS */
1630 /* OBSOLETE convert16 (void) */
1634 /* OBSOLETE convert32 (void) */
1637 /* OBSOLETE struct ui_file *EchoFile = 0; /* used for debugging */ */
1638 /* OBSOLETE int QuietMode = 0; /* used for debugging */ */
1640 /* OBSOLETE #ifdef NO_HIF_SUPPORT */
1641 /* OBSOLETE service_HIF (union msg_t *msg) */
1643 /* OBSOLETE return (0); /* Emulate a failure */ */
1645 /* OBSOLETE #endif */
1647 /* OBSOLETE /* Target_ops vector. Not static because there does not seem to be */
1648 /* OBSOLETE any portable way to do a forward declaration of a static variable. */
1649 /* OBSOLETE The RS/6000 doesn't like "extern" followed by "static"; SunOS */
1650 /* OBSOLETE /bin/cc doesn't like "static" twice. */ */
1652 /* OBSOLETE struct target_ops udi_ops; */
1654 /* OBSOLETE static void */
1655 /* OBSOLETE init_udi_ops (void) */
1657 /* OBSOLETE udi_ops.to_shortname = "udi"; */
1658 /* OBSOLETE udi_ops.to_longname = "Remote UDI connected TIP"; */
1659 /* OBSOLETE udi_ops.to_doc = "Remote debug an AMD 29k using UDI socket connection to TIP process.\n\ */
1660 /* OBSOLETE Arguments are\n\ */
1661 /* OBSOLETE `configuration-id AF_INET hostname port-number'\n\ */
1662 /* OBSOLETE To connect via the network, where hostname and port-number specify the\n\ */
1663 /* OBSOLETE host and port where you can connect via UDI.\n\ */
1664 /* OBSOLETE configuration-id is unused.\n\ */
1666 /* OBSOLETE `configuration-id AF_UNIX socket-name tip-program'\n\ */
1667 /* OBSOLETE To connect using a local connection to the \"tip.exe\" program which is\n\ */
1668 /* OBSOLETE supplied by AMD. If socket-name specifies an AF_UNIX socket then the\n\ */
1669 /* OBSOLETE tip program must already be started; connect to it using that socket.\n\ */
1670 /* OBSOLETE If not, start up tip-program, which should be the name of the tip\n\ */
1671 /* OBSOLETE program. If appropriate, the PATH environment variable is searched.\n\ */
1672 /* OBSOLETE configuration-id is unused.\n\ */
1674 /* OBSOLETE `configuration-id'\n\ */
1675 /* OBSOLETE Look up the configuration in ./udi_soc or /etc/udi_soc, which\n\ */
1676 /* OBSOLETE are files containing lines in the above formats. configuration-id is\n\ */
1677 /* OBSOLETE used to pick which line of the file to use."; */
1678 /* OBSOLETE udi_ops.to_open = udi_open; */
1679 /* OBSOLETE udi_ops.to_close = udi_close; */
1680 /* OBSOLETE udi_ops.to_attach = udi_attach; */
1681 /* OBSOLETE udi_ops.to_detach = udi_detach; */
1682 /* OBSOLETE udi_ops.to_resume = udi_resume; */
1683 /* OBSOLETE udi_ops.to_wait = udi_wait; */
1684 /* OBSOLETE udi_ops.to_fetch_registers = udi_fetch_registers; */
1685 /* OBSOLETE udi_ops.to_store_registers = udi_store_registers; */
1686 /* OBSOLETE udi_ops.to_prepare_to_store = udi_prepare_to_store; */
1687 /* OBSOLETE udi_ops.to_xfer_memory = udi_xfer_inferior_memory; */
1688 /* OBSOLETE udi_ops.to_files_info = udi_files_info; */
1689 /* OBSOLETE udi_ops.to_insert_breakpoint = udi_insert_breakpoint; */
1690 /* OBSOLETE udi_ops.to_remove_breakpoint = udi_remove_breakpoint; */
1691 /* OBSOLETE udi_ops.to_terminal_init = 0; */
1692 /* OBSOLETE udi_ops.to_terminal_inferior = 0; */
1693 /* OBSOLETE udi_ops.to_terminal_ours_for_output = 0; */
1694 /* OBSOLETE udi_ops.to_terminal_ours = 0; */
1695 /* OBSOLETE udi_ops.to_terminal_info = 0; */
1696 /* OBSOLETE udi_ops.to_kill = udi_kill; */
1697 /* OBSOLETE udi_ops.to_load = udi_load; */
1698 /* OBSOLETE udi_ops.to_lookup_symbol = 0; */
1699 /* OBSOLETE udi_ops.to_create_inferior = udi_create_inferior; */
1700 /* OBSOLETE udi_ops.to_mourn_inferior = udi_mourn; */
1701 /* OBSOLETE udi_ops.to_can_run = 0; */
1702 /* OBSOLETE udi_ops.to_notice_signals = 0; */
1703 /* OBSOLETE udi_ops.to_thread_alive = 0; */
1704 /* OBSOLETE udi_ops.to_stop = 0; */
1705 /* OBSOLETE udi_ops.to_stratum = process_stratum; */
1706 /* OBSOLETE udi_ops.DONT_USE = 0; */
1707 /* OBSOLETE udi_ops.to_has_all_memory = 1; */
1708 /* OBSOLETE udi_ops.to_has_memory = 1; */
1709 /* OBSOLETE udi_ops.to_has_stack = 1; */
1710 /* OBSOLETE udi_ops.to_has_registers = 1; */
1711 /* OBSOLETE udi_ops.to_has_execution = 1; */
1712 /* OBSOLETE udi_ops.to_sections = 0; */
1713 /* OBSOLETE udi_ops.to_sections_end = 0; */
1714 /* OBSOLETE udi_ops.to_magic = OPS_MAGIC; */
1718 /* OBSOLETE _initialize_remote_udi (void) */
1720 /* OBSOLETE init_udi_ops (); */
1721 /* OBSOLETE add_target (&udi_ops); */
This page took 0.070372 seconds and 4 git commands to generate.