diff options
author | Fred Fish <fnf@specifix.com> | 1996-01-10 18:40:24 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1996-01-10 18:40:24 +0000 |
commit | 0d14c7df689bea7cc7d8cfb953a51ada7c700d1d (patch) | |
tree | 7005a840d6c39499480d2317207d66abf1e483b9 /gdb/remote.c | |
parent | 367c2d2aef1d1280fcf7ede175b7683ab1ed5bf5 (diff) | |
download | gdb-0d14c7df689bea7cc7d8cfb953a51ada7c700d1d.zip gdb-0d14c7df689bea7cc7d8cfb953a51ada7c700d1d.tar.gz gdb-0d14c7df689bea7cc7d8cfb953a51ada7c700d1d.tar.bz2 |
From Wilfried Moser <wilfried.moser@aut.alcatel.at>:
* gdbserver/low-linux.c: New file.
* remote.c (remote_read_bytes): Fix aborts on larger packets.
* config/i386/linux.mh (GDBSERVER_DEPFILES, GDBSERVER_LIBS):
Define.
* stabsread.c (define_symbol): If register value is too large,
tell what it is and what max is.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index c335784..d9183ad 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1,5 +1,5 @@ /* Remote target communications for serial-line targets in custom GDB protocol - Copyright 1988, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1988, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -182,7 +182,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "symfile.h" #include "target.h" #include "wait.h" -#include "terminal.h" +/*#include "terminal.h"*/ #include "gdbcmd.h" #include "objfiles.h" #include "gdb-stabs.h" @@ -741,7 +741,6 @@ remote_wait (pid, status) { unsigned char *p1; char *p_temp; - unsigned LONGEST val; regno = strtol ((const char *) p, &p_temp, 16); /* Read the register number */ p1 = (unsigned char *)p_temp; @@ -773,16 +772,13 @@ Packet: '%s'\n", Packet: '%s'\n", regno, p, buf); - val = 0L; for (i = 0; i < REGISTER_RAW_SIZE (regno); i++) { if (p[0] == 0 || p[1] == 0) warning ("Remote reply is too short: %s", buf); - val = val * 256 + fromhex (p[0]) * 16 + fromhex (p[1]); + regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]); p += 2; - } - store_unsigned_integer (regs, REGISTER_RAW_SIZE (regno), val); supply_register (regno, regs); } @@ -1112,40 +1108,54 @@ remote_read_bytes (memaddr, myaddr, len) char buf[PBUFSIZ]; int i; char *p; + int done; + /* Chop transfer down if neccessary */ +#if 0 + /* FIXME: This is wrong for larger packets */ if (len > PBUFSIZ / 2 - 1) abort (); +#endif + done = 0; + while (done < len) + { + int todo = len - done; + int cando = PBUFSIZ / 2 - 32; /* number of bytes that will fit. */ + if (todo > cando) + todo = cando; - /* FIXME-32x64: Need a version of print_address_numeric which puts the - result in a buffer like sprintf. */ - sprintf (buf, "m%lx,%x", (unsigned long) memaddr, len); - putpkt (buf); - getpkt (buf, 0); + /* FIXME-32x64: Need a version of print_address_numeric which puts the + result in a buffer like sprintf. */ + sprintf (buf, "m%lx,%x", (unsigned long) memaddr, todo); + putpkt (buf); + getpkt (buf, 0); - if (buf[0] == 'E') - { - /* There is no correspondance between what the remote protocol uses - for errors and errno codes. We would like a cleaner way of - representing errors (big enough to include errno codes, bfd_error - codes, and others). But for now just return EIO. */ - errno = EIO; - return 0; - } + if (buf[0] == 'E') + { + /* There is no correspondance between what the remote protocol uses + for errors and errno codes. We would like a cleaner way of + representing errors (big enough to include errno codes, bfd_error + codes, and others). But for now just return EIO. */ + errno = EIO; + return 0; + } /* Reply describes memory byte by byte, each byte encoded as two hex characters. */ - p = buf; - for (i = 0; i < len; i++) - { - if (p[0] == 0 || p[1] == 0) - /* Reply is short. This means that we were able to read only part - of what we wanted to. */ - break; - myaddr[i] = fromhex (p[0]) * 16 + fromhex (p[1]); - p += 2; + p = buf; + for (i = 0; i < todo; i++) + { + if (p[0] == 0 || p[1] == 0) + /* Reply is short. This means that we were able to read only part + of what we wanted to. */ + break; + myaddr[i + done] = fromhex (p[0]) * 16 + fromhex (p[1]); + p += 2; + } + done += todo; } - return i; + return len; } /* Read or write LEN bytes from inferior memory at MEMADDR, transferring |