X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fremote-mips.c;h=d4cfcda745a6ecab29deb85b76cf2626ba21c1ed;hb=25286543da71d927d59a7479e7e1bd0a1b9e1321;hp=eb86ebfd0800e9e9cdc6dd96879e49635e631dbb;hpb=83909c43b6d45ece8d6aa1acf2e82688fc2a6b17;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index eb86ebfd08..d4cfcda745 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -21,8 +21,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "inferior.h" -#include "symfile.h" #include "bfd.h" +#include "symfile.h" #include "wait.h" #include "gdbcmd.h" #include "gdbcore.h" @@ -71,7 +71,7 @@ static void mips_detach PARAMS ((char *args, int from_tty)); static void -mips_resume PARAMS ((int step, int siggnal)); +mips_resume PARAMS ((int pid, int step, int siggnal)); static int mips_wait PARAMS ((WAITTYPE *status)); @@ -855,7 +855,9 @@ mips_initialize () mips_receive_wait = 3; tries = 0; - while (catch_errors (mips_receive_packet, buff, (char *) NULL) == 0) + while (catch_errors (mips_receive_packet, buff, (char *) NULL, + RETURN_MASK_ALL) + == 0) { char cc; @@ -955,8 +957,8 @@ mips_detach (args, from_tty) from the board. */ static void -mips_resume (step, siggnal) - int step, siggnal; +mips_resume (pid, step, siggnal) + int pid, step, siggnal; { if (siggnal) error ("Can't send signals to a remote system. Try `handle %d ignore'.", @@ -1059,10 +1061,14 @@ mips_fetch_registers (regno) if (err) error ("Can't read register %d: %s", regno, safe_strerror (errno)); - /* We got the number the register holds, but gdb expects to see a - value in the target byte ordering. */ - SWAP_TARGET_AND_HOST (&val, sizeof (REGISTER_TYPE)); - supply_register (regno, (char *) &val); + { + char buf[MAX_REGISTER_RAW_SIZE]; + + /* We got the number the register holds, but gdb expects to see a + value in the target byte ordering. */ + store_unsigned_integer (buf, REGISTER_RAW_SIZE (regno), val); + supply_register (regno, buf); + } } /* Prepare to store registers. The MIPS protocol can store individual @@ -1155,7 +1161,7 @@ mips_xfer_memory (memaddr, myaddr, len, write, ignore) /* Round ending address up; get number of longwords that makes. */ register int count = (((memaddr + len) - addr) + 3) / 4; /* Allocate buffer of that many longwords. */ - register unsigned int *buffer = (unsigned int *) alloca (count * 4); + register char *buffer = alloca (count * 4); if (write) { @@ -1163,14 +1169,15 @@ mips_xfer_memory (memaddr, myaddr, len, write, ignore) if (addr != memaddr || len < 4) { /* Need part of initial word -- fetch it. */ - buffer[0] = mips_fetch_word (addr); - SWAP_TARGET_AND_HOST (buffer, 4); + store_unsigned_integer (&buffer[0], 4, mips_fetch_word (addr)); } - if (count > 1) /* FIXME, avoid if even boundary */ + if (count > 1) { - buffer[count - 1] = mips_fetch_word (addr + (count - 1) * 4); - SWAP_TARGET_AND_HOST (buffer + (count - 1) * 4, 4); + /* Need part of last word -- fetch it. FIXME: we do this even + if we don't need it. */ + store_unsigned_integer (&buffer[(count - 1) * 4], 4, + mips_fetch_word (addr + (count - 1) * 4)); } /* Copy data to be written over corresponding part of buffer */ @@ -1181,8 +1188,8 @@ mips_xfer_memory (memaddr, myaddr, len, write, ignore) for (i = 0; i < count; i++, addr += 4) { - SWAP_TARGET_AND_HOST (buffer + i, 4); - mips_store_word (addr, buffer[i]); + mips_store_word (addr, extract_unsigned_integer (&buffer[i*4], 4)); + /* FIXME: Do we want a QUIT here? */ } } else @@ -1190,13 +1197,12 @@ mips_xfer_memory (memaddr, myaddr, len, write, ignore) /* Read all the longwords */ for (i = 0; i < count; i++, addr += 4) { - buffer[i] = mips_fetch_word (addr); - SWAP_TARGET_AND_HOST (buffer + i, 4); + store_unsigned_integer (&buffer[i*4], 4, mips_fetch_word (addr)); QUIT; } /* Copy appropriate bytes out of the buffer. */ - memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); + memcpy (myaddr, buffer + (memaddr & 3), len); } return len; } @@ -1316,6 +1322,21 @@ _initialize_remote_mips () { add_target (&mips_ops); + add_show_from_set ( + add_set_cmd ("timeout", no_class, var_zinteger, + (char *) &mips_receive_wait, + "Set timeout in seconds for remote MIPS serial I/O.", + &setlist), + &showlist); + + add_show_from_set ( + add_set_cmd ("retransmit-timeout", no_class, var_zinteger, + (char *) &mips_retransmit_wait, + "Set retransmit timeout in seconds for remote MIPS serial I/O.\n\ +This is the number of seconds to wait for an acknowledgement to a packet\n\ +before resending the packet.", &setlist), + &showlist); + add_show_from_set ( add_set_cmd ("remotedebug", no_class, var_zinteger, (char *) &mips_debug, "Set debugging of remote MIPS serial I/O.\n\