aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-mips.c
diff options
context:
space:
mode:
authorMark Alexander <marka@cygnus>1996-11-27 03:40:02 +0000
committerMark Alexander <marka@cygnus>1996-11-27 03:40:02 +0000
commit96431497ff2c780978d95f5fda7148ba732dcae0 (patch)
tree72d22c205c5eada89965f8efe4664e21ad428550 /gdb/remote-mips.c
parent92284aaa3550838227a9446195c04d4bfaa1a86c (diff)
downloadgdb-96431497ff2c780978d95f5fda7148ba732dcae0.zip
gdb-96431497ff2c780978d95f5fda7148ba732dcae0.tar.gz
gdb-96431497ff2c780978d95f5fda7148ba732dcae0.tar.bz2
* config/mips/tm-mips.h (ADDR_BITS_REMOVE, TARGET_READ_SP): Define.
(mips_addr_bits_remove): Declare. * mips-tdep.c (mips_push_dummy_frame): Fix heuristic-fence-post errors when hitting breakpoints during inferior function calls in 64-bit programs. (fix_sign_extension): Make public, rename to mips_addr_bits_remove. * utils.c (paddr_nz, preg_nz): New functions, similar to paddr and preg but don't print leading zeroes. * defs.h (paddr_nz, preg_nz): Declare. * remote-mips.c: Use paddr_nz instead of paddr throughout to reduce packet size. (pmon_end_download): Improve timeout error handling.
Diffstat (limited to 'gdb/remote-mips.c')
-rw-r--r--gdb/remote-mips.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 55ae2fb..ea92173 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1184,7 +1184,7 @@ mips_request (cmd, addr, data, perr, timeout, buff)
{
if (mips_need_reply)
fatal ("mips_request: Trying to send command before reply");
- sprintf (buff, "0x0 %c 0x%s 0x%s", cmd, paddr(addr), paddr(data));
+ sprintf (buff, "0x0 %c 0x%s 0x%s", cmd, paddr_nz (addr), paddr_nz (data));
mips_send_packet (buff, 1);
mips_need_reply = 1;
}
@@ -1968,7 +1968,7 @@ mips_fetch_word (addr)
mips_receive_wait, NULL);
if (err)
mips_error ("Can't read address 0x%s: %s",
- paddr(addr), safe_strerror (errno));
+ paddr_nz (addr), safe_strerror (errno));
}
return val;
}
@@ -2340,7 +2340,9 @@ pmon_remove_breakpoint (addr, contents_cache)
if (bpnum >= PMON_MAX_BP)
{
- fprintf_unfiltered (stderr, "pmon_remove_breakpoint: Failed to find breakpoint at address 0x%s\n", paddr(addr));
+ fprintf_unfiltered (stderr,
+ "pmon_remove_breakpoint: Failed to find breakpoint at address 0x%s\n",
+ paddr_nz (addr));
return 1;
}
@@ -2471,9 +2473,10 @@ common_breakpoint (cmd, addr, mask, flags)
int nfields;
if (flags)
- sprintf (buf, "0x0 %c 0x%s 0x%s %s", cmd, paddr (addr), paddr (mask), flags);
+ sprintf (buf, "0x0 %c 0x%s 0x%s %s", cmd, paddr_nz (addr), paddr_nz (mask),
+ flags);
else
- sprintf (buf, "0x0 %c 0x%s", cmd, paddr (addr));
+ sprintf (buf, "0x0 %c 0x%s", cmd, paddr_nz (addr));
mips_send_packet (buf, 1);
@@ -2494,7 +2497,7 @@ common_breakpoint (cmd, addr, mask, flags)
rresponse = rerrflg;
if (rresponse != 22) /* invalid argument */
fprintf_unfiltered (stderr, "common_breakpoint (0x%s): Got error: 0x%x\n",
- paddr(addr), rresponse);
+ paddr_nz (addr), rresponse);
return 1;
}
@@ -2906,6 +2909,20 @@ pmon_start_download ()
}
}
+static int
+mips_expect_download (char *string)
+{
+ if (!mips_expect (string))
+ {
+ fprintf_unfiltered (gdb_stderr, "Load did not complete successfully.\n");
+ if (tftp_in_use)
+ remove (tftp_localname); /* Remove temporary file */
+ return 0;
+ }
+ else
+ return 1;
+}
+
static void
pmon_end_download (final, bintotal)
int final;
@@ -2937,9 +2954,12 @@ pmon_end_download (final, bintotal)
strcat (cmd, "\r");
mips_send_command (cmd, 0);
free (cmd);
- mips_expect ("Downloading from ");
- mips_expect (tftp_name);
- mips_expect (", ^C to abort\r\n");
+ if (!mips_expect_download ("Downloading from "))
+ return;
+ if (!mips_expect_download (tftp_name))
+ return;
+ if (!mips_expect_download (", ^C to abort\r\n"))
+ return;
}
/* Wait for the stuff that PMON prints after the load has completed.
@@ -2953,8 +2973,8 @@ pmon_end_download (final, bintotal)
mips_expect ("\r\ntotal = 0x");
sprintf (hexnumber,"%x",bintotal);
mips_expect (hexnumber);
- if (!mips_expect (" bytes\r\n"))
- fprintf_unfiltered (gdb_stderr, "Load did not complete successfully.\n");
+ if (!mips_expect_download (" bytes\r\n"))
+ return;
if (tftp_in_use)
remove (tftp_localname); /* Remove temporary file */