aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-mips.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1995-11-04 19:02:42 +0000
committerStu Grossman <grossman@cygnus>1995-11-04 19:02:42 +0000
commit188c635fbb8b6b15ffd3a12f2665dc17d09ff947 (patch)
treea81b260374c0fd4b5cf393f33d1bf7f2abaa1361 /gdb/remote-mips.c
parent536a7a161837680bf28ad1c8278ee1db9b3ac8a7 (diff)
downloadgdb-188c635fbb8b6b15ffd3a12f2665dc17d09ff947.zip
gdb-188c635fbb8b6b15ffd3a12f2665dc17d09ff947.tar.gz
gdb-188c635fbb8b6b15ffd3a12f2665dc17d09ff947.tar.bz2
* Makefile.in (INTERNAL_CFLAGS): Add ENABLE_CFLAGS.
* fork-child.c (fork_inferior): Add call to TARGET_CREATE_INFERIOR_HOOK to allow target specific code to get control just before the new process executes it's first instruction. * remote-mips.c (mips_initialize): Cleanup a bit. Don't try to receive a packet at first. This speeds up initialization a lot. Use TARGET_MONITOR_PROMPT instead of "<IDT>". (common_breakpoint): Use rresponse instead of rerrflg to inspect error code. * symfile.c (syms_from_objfile reread_symbols): Call TARGET_SYMFILE_POSTREAD to allow target specific code to get control after reading new symbols. * target.h: New macros TARGET_SYMFILE_POSTREAD, and TARGET_CREATE_INFERIOR_HOOK. See above for descriptions. * config/mips/{irix5.mh nm-irix5.h}: Delete nm-irix5.h. Make NAT_FILE point directly at ../nm-sysv4.h. * config/mips/{mipsm3.mh nm-m3.h}: Delete nm-m3.h. Make NAT_FILE point directly at ../nm-m3.h. * config/mips/{mipsv4.mh nm-sysv4.h}: Delete nm-sysv4.h. Make NAT_FILE point directly at ../nm-sysv4.h. * config/mips/nm-mips.h: Improve comment at top of file. * config/mips/tm-mips.h (TARGET_MONITOR_PROMPT): Change definition into a proper string. start-sanitize-gm * configure configure.in: Add support for --enable-gm. (mips*-*-magic*): Change target from magic to idt. * eval.c expprint.c expression.h parse.c remote-mips.c utils.c: Change GENERAL_MAGIC_HACKS to GENERAL_MAGIC. * magic.c magic.h: Update files from GM. * config/mips/magic.mt: Delete. No longer necessary now that we use --enable mechanism. * config/mips/tm-idt.h: Add GM stuff needed for remote GM box. * config/mips/tm-irix5.h: Add GM stuff needed for native Irix box. * config/mips/tm-magic.h: Move up to config/tm-magic.h. Move all platform specific stuff into tm-irix.h and tm-idt.h. Add defs for TARGET_SYMFILE_POSTREAD and TARGET_CREATE_INFERIOR_HOOK. end-sanitize-gm
Diffstat (limited to 'gdb/remote-mips.c')
-rw-r--r--gdb/remote-mips.c94
1 files changed, 48 insertions, 46 deletions
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 7514aa9..3265599 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1016,14 +1016,15 @@ mips_initialize_cleanups (arg)
static void
mips_initialize ()
{
- char cr, cc;
char buff[DATA_MAXLEN + 1];
int err;
struct cleanup *old_cleanups = make_cleanup (mips_initialize_cleanups, NULL);
+ int j;
/* What is this code doing here? I don't see any way it can happen, and
it might mean mips_initializing didn't get cleared properly.
So I'll make it a warning. */
+
if (mips_initializing)
{
warning ("internal error: mips_initialize called twice");
@@ -1036,50 +1037,50 @@ mips_initialize ()
mips_send_seq = 0;
mips_receive_seq = 0;
- if (mips_receive_packet (buff, 0, 3) < 0)
- {
- char cc;
- int i, j;
- char srec[10];
-
- /* We did not receive the packet we expected; try resetting the
- board and trying again. */
+ /* At this point, the packit protocol isn't responding. We'll try getting
+ into the monitor, and restarting the protocol. */
- /* Force the system into the IDT monitor. After this we *should* be at
- the <IDT> prompt. */
+ /* Force the system into the IDT monitor. After this we *should* be at the
+ <IDT> prompt. */
- for (j = 1; j <= 4; j++)
+ for (j = 1; j <= 4; j++)
+ {
+ switch (j)
{
- switch (j)
- {
- case 1: /* First, try sending a break */
- SERIAL_SEND_BREAK (mips_desc);
- break;
- case 2: /* Then, try a ^C */
- SERIAL_WRITE (mips_desc, "\003", 1); /* Send a ^C to wake up the monitor */
- break;
- case 3: /* Then, try escaping from download */
- /* We are possibly in binary download mode, having aborted in the middle
- of an S-record. ^C won't work because of binary mode. The only
- reliable way out is to send enough termination packets (8 bytes) to
- fill up and then overflow the largest size S-record (255 bytes in this
- case). This amounts to 256/8 + 1 packets. */
-
- mips_make_srec (srec, '7', 0, NULL, 0);
-
- for (i = 1; i <= 33; i++)
- {
- SERIAL_WRITE (mips_desc, srec, 8);
-
- if (SERIAL_READCHAR (mips_desc, 0) >= 0)
- break; /* Break immediatly if we get something from
+ case 1: /* First, try sending a break */
+ SERIAL_SEND_BREAK (mips_desc);
+ break;
+ case 2: /* Then, try a ^C */
+ SERIAL_WRITE (mips_desc, "\003", 1);
+ break;
+ case 3: /* Then, try escaping from download */
+ {
+ int i;
+ char srec[10];
+
+ /* We are possibly in binary download mode, having aborted in the
+ middle of an S-record. ^C won't work because of binary mode.
+ The only reliable way out is to send enough termination packets
+ (8 bytes) to fill up and then overflow the largest size S-record
+ (255 bytes in this case). This amounts to 256/8 + 1 packets.
+ */
+
+ mips_make_srec (srec, '7', 0, NULL, 0);
+
+ for (i = 1; i <= 33; i++)
+ {
+ SERIAL_WRITE (mips_desc, srec, 8);
+
+ if (SERIAL_READCHAR (mips_desc, 0) >= 0)
+ break; /* Break immediatly if we get something from
the board. */
- }
- break;
- case 4:
- mips_error ("Failed to initialize.");
- }
- if (mips_expect ("\015\012<IDT>"))
+ }
+ break;
+ case 4:
+ mips_error ("Failed to initialize.");
+ }
+
+ if (mips_expect (TARGET_MONITOR_PROMPT))
break;
}
@@ -1101,6 +1102,7 @@ mips_initialize ()
/* If this doesn't call error, we have connected; we don't care if
the request itself succeeds or fails. */
+
mips_request ('r', (unsigned int) 0, (unsigned int) 0, &err,
mips_receive_wait, NULL);
set_current_frame (create_new_frame (read_fp (), read_pc ()));
@@ -1219,12 +1221,12 @@ mips_resume (pid, step, siggnal)
{
/* start-sanitize-gm */
-#ifndef GENERAL_MAGIC_HACKS
+#ifndef GENERAL_MAGIC
if (siggnal != TARGET_SIGNAL_0)
warning
("Can't send signals to a remote system. Try `handle %s ignore'.",
target_signal_to_name (siggnal));
-#endif /* GENERAL_MAGIC_HACKS */
+#endif /* GENERAL_MAGIC */
/* end-sanitize-gm */
mips_request (step ? 's' : 'c',
@@ -1677,14 +1679,14 @@ Can't pass arguments to remote MIPS board; arguments ignored.");
/* FIXME: Should we set inferior_pid here? */
/* start-sanitize-gm */
-#ifdef GENERAL_MAGIC_HACKS
+#ifdef GENERAL_MAGIC
magic_create_inferior_hook ();
proceed (entry_pt, TARGET_SIGNAL_PWR, 0);
#else
/* end-sanitize-gm */
proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0);
/* start-sanitize-gm */
-#endif
+#endif /* GENERAL_MAGIC */
/* end-sanitize-gm */
}
@@ -1863,7 +1865,7 @@ common_breakpoint (cmd, addr, mask, flags)
if (rerrflg != 0)
{
- if (rerrflg != EINVAL)
+ if (rresponse != EINVAL)
fprintf_unfiltered (stderr, "common_breakpoint (0x%x): Got error: 0x%x\n",
addr, rresponse);
return 1;