write only one packet, regardless of the requested number of bytes to
transfer. This wrapper calls remote_write_bytes() as often as needed. */
static int
-remote_fileio_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
+remote_fileio_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
int ret = 0, written;
/* Request pathname using 'm' packet */
pathname = alloca (length);
- retlength = remote_read_bytes (ptrval, pathname, length);
+ retlength = remote_read_bytes (ptrval, (gdb_byte *) pathname, length);
if (retlength != length)
{
remote_fileio_ioerror ();
LONGEST lnum;
CORE_ADDR ptrval;
int fd, ret, retlength;
- char *buffer;
+ gdb_byte *buffer;
size_t length;
off_t old_offset, new_offset;
static char *remaining_buf = NULL;
static int remaining_length = 0;
- buffer = (char *) xmalloc (32768);
+ buffer = (gdb_byte *) xmalloc (32768);
if (remaining_buf)
{
remote_fio_no_longjmp = 1;
}
else
{
- ret = ui_file_read (gdb_stdtargin, buffer, 32767);
+ ret = ui_file_read (gdb_stdtargin, (char *) buffer, 32767);
remote_fio_no_longjmp = 1;
if (ret > 0 && (size_t)ret > length)
{
}
break;
default:
- buffer = (char *) xmalloc (length);
+ buffer = (gdb_byte *) xmalloc (length);
/* POSIX defines EINTR behaviour of read in a weird way. It's allowed
for read() to return -1 even if "some" bytes have been read. It
has been corrected in SUSv2 but that doesn't help us much...
LONGEST lnum;
CORE_ADDR ptrval;
int fd, ret, retlength;
- char *buffer;
+ gdb_byte *buffer;
size_t length;
/* 1. Parameter: file descriptor */
}
length = (size_t) num;
- buffer = (char *) xmalloc (length);
+ buffer = (gdb_byte *) xmalloc (length);
retlength = remote_read_bytes (ptrval, buffer, length);
if (retlength != length)
{
remote_fileio_badfd ();
return;
case FIO_FD_CONSOLE_OUT:
- ui_file_write (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr, buffer,
- length);
+ ui_file_write (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr,
+ (char *) buffer, length);
gdb_flush (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr);
ret = length;
break;
}
/* Request oldpath using 'm' packet */
oldpath = alloca (length);
- retlength = remote_read_bytes (ptrval, oldpath, length);
+ retlength = remote_read_bytes (ptrval, (gdb_byte *) oldpath, length);
if (retlength != length)
{
remote_fileio_ioerror ();
}
/* Request newpath using 'm' packet */
newpath = alloca (length);
- retlength = remote_read_bytes (ptrval, newpath, length);
+ retlength = remote_read_bytes (ptrval, (gdb_byte *) newpath, length);
if (retlength != length)
{
remote_fileio_ioerror ();
}
/* Request pathname using 'm' packet */
pathname = alloca (length);
- retlength = remote_read_bytes (ptrval, pathname, length);
+ retlength = remote_read_bytes (ptrval, (gdb_byte *) pathname, length);
if (retlength != length)
{
remote_fileio_ioerror ();
}
/* Request pathname using 'm' packet */
pathname = alloca (length);
- retlength = remote_read_bytes (ptrval, pathname, length);
+ retlength = remote_read_bytes (ptrval, (gdb_byte *) pathname, length);
if (retlength != length)
{
remote_fileio_ioerror ();
remote_fileio_to_fio_stat (&st, &fst);
remote_fileio_to_fio_uint (0, fst.fst_dev);
- retlength = remote_fileio_write_bytes (ptrval, (char *) &fst, sizeof fst);
+ retlength = remote_fileio_write_bytes (ptrval, (gdb_byte *) &fst, sizeof fst);
if (retlength != sizeof fst)
{
remote_fileio_return_errno (-1);
{
remote_fileio_to_fio_stat (&st, &fst);
- retlength = remote_fileio_write_bytes (ptrval, (char *) &fst, sizeof fst);
+ retlength = remote_fileio_write_bytes (ptrval, (gdb_byte *) &fst, sizeof fst);
if (retlength != sizeof fst)
{
remote_fileio_return_errno (-1);
{
remote_fileio_to_fio_timeval (&tv, &ftv);
- retlength = remote_fileio_write_bytes (ptrval, (char *) &ftv, sizeof ftv);
+ retlength = remote_fileio_write_bytes (ptrval, (gdb_byte *) &ftv, sizeof ftv);
if (retlength != sizeof ftv)
{
remote_fileio_return_errno (-1);
}
/* Request commandline using 'm' packet */
cmdline = alloca (length);
- retlength = remote_read_bytes (ptrval, cmdline, length);
+ retlength = remote_read_bytes (ptrval, (gdb_byte *) cmdline, length);
if (retlength != length)
{
remote_fileio_ioerror ();
static int fromhex (int a);
-static int hex2bin (const char *hex, char *bin, int count);
+static int hex2bin (const char *hex, gdb_byte *bin, int count);
-static int bin2hex (const char *bin, char *hex, int count);
+static int bin2hex (const gdb_byte *bin, char *hex, int count);
static int putpkt_binary (char *buf, int cnt);
int i, value = 0;
unsigned char *scan;
- scan = (char *) ref;
+ scan = *ref;
scan += 4;
i = 4;
while (i-- > 0)
{
struct remote_state *rs = get_remote_state ();
int mask, length;
- unsigned int tag;
+ int tag;
threadref ref;
char *limit = pkt + rs->remote_packet_size; /* Plausible parsing limit. */
int retval = 1;
if (bufp[0] != 0)
{
n = min (strlen (bufp) / 2, sizeof (display_buf));
- result = hex2bin (bufp, display_buf, n);
+ result = hex2bin (bufp, (gdb_byte *) display_buf, n);
display_buf [result] = '\0';
return display_buf;
}
while (strncmp (reply, "qSymbol:", 8) == 0)
{
tmp = &reply[8];
- end = hex2bin (tmp, msg, strlen (tmp) / 2);
+ end = hex2bin (tmp, (gdb_byte *) msg, strlen (tmp) / 2);
msg[end] = '\0';
sym = lookup_minimal_symbol (msg, NULL, NULL);
if (sym == NULL)
}
static int
-hex2bin (const char *hex, char *bin, int count)
+hex2bin (const char *hex, gdb_byte *bin, int count)
{
int i;
}
static int
-bin2hex (const char *bin, char *hex, int count)
+bin2hex (const gdb_byte *bin, char *hex, int count)
{
int i;
/* May use a length, or a nul-terminated string as input. */
if (count == 0)
- count = strlen (bin);
+ count = strlen ((char *) bin);
for (i = 0; i < count; i++)
{
remote_wait (ptid_t ptid, struct target_waitstatus *status)
{
struct remote_state *rs = get_remote_state ();
- unsigned char *buf = alloca (rs->remote_packet_size);
+ char *buf = alloca (rs->remote_packet_size);
ULONGEST thread_num = -1;
ULONGEST addr;
while (1)
{
- unsigned char *p;
+ char *p;
ofunc = signal (SIGINT, remote_interrupt);
getpkt (buf, rs->remote_packet_size, 1);
continue;
case 'T': /* Status with PC, SP, FP, ... */
{
- char regs[MAX_REGISTER_SIZE];
+ gdb_byte regs[MAX_REGISTER_SIZE];
/* Expedited reply, containing Signal, {regno, reg} repeat. */
/* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where
while (*p)
{
- unsigned char *p1;
+ char *p1;
char *p_temp;
int fieldsize;
LONGEST pnum = 0;
{
/* Read the ``P'' register number. */
pnum = strtol (p, &p_temp, 16);
- p1 = (unsigned char *) p_temp;
+ p1 = p_temp;
}
else
p1 = p;
if (p1 == p) /* No register number present here. */
{
- p1 = (unsigned char *) strchr (p, ':');
+ p1 = strchr (p, ':');
if (p1 == NULL)
warning (_("Malformed packet(a) (missing colon): %s\n\
Packet: '%s'\n"),
{
p_temp = unpack_varlen_hex (++p1, &thread_num);
record_currthread (thread_num);
- p = (unsigned char *) p_temp;
+ p = p_temp;
}
else if ((strncmp (p, "watch", p1 - p) == 0)
|| (strncmp (p, "rwatch", p1 - p) == 0)
/* Silently skip unknown optional info. */
p_temp = strchr (p1 + 1, ';');
if (p_temp)
- p = (unsigned char *) p_temp;
+ p = p_temp;
}
}
else
Packet: '%s'\n"),
phex_nz (pnum, 0), p, buf);
- fieldsize = hex2bin (p, regs,
+ fieldsize = hex2bin (p, regs,
register_size (current_gdbarch,
reg->regnum));
p += 2 * fieldsize;
remote_async_wait (ptid_t ptid, struct target_waitstatus *status)
{
struct remote_state *rs = get_remote_state ();
- unsigned char *buf = alloca (rs->remote_packet_size);
+ char *buf = alloca (rs->remote_packet_size);
ULONGEST thread_num = -1;
ULONGEST addr;
while (1)
{
- unsigned char *p;
+ char *p;
if (!target_is_async_p ())
ofunc = signal (SIGINT, remote_interrupt);
continue;
case 'T': /* Status with PC, SP, FP, ... */
{
- char regs[MAX_REGISTER_SIZE];
+ gdb_byte regs[MAX_REGISTER_SIZE];
/* Expedited reply, containing Signal, {regno, reg} repeat. */
/* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where
while (*p)
{
- unsigned char *p1;
+ char *p1;
char *p_temp;
int fieldsize;
long pnum = 0;
{
/* Read the register number. */
pnum = strtol (p, &p_temp, 16);
- p1 = (unsigned char *) p_temp;
+ p1 = p_temp;
}
else
p1 = p;
if (p1 == p) /* No register number present here. */
{
- p1 = (unsigned char *) strchr (p, ':');
+ p1 = strchr (p, ':');
if (p1 == NULL)
error (_("Malformed packet(a) (missing colon): %s\n\
Packet: '%s'\n"),
{
p_temp = unpack_varlen_hex (++p1, &thread_num);
record_currthread (thread_num);
- p = (unsigned char *) p_temp;
+ p = p_temp;
}
else if ((strncmp (p, "watch", p1 - p) == 0)
|| (strncmp (p, "rwatch", p1 - p) == 0)
else
{
/* Silently skip unknown optional info. */
- p_temp = (unsigned char *) strchr (p1 + 1, ';');
+ p_temp = strchr (p1 + 1, ';');
if (p_temp)
p = p_temp;
}
Packet: '%s'\n"),
pnum, p, buf);
- fieldsize = hex2bin (p, regs,
+ fieldsize = hex2bin (p, regs,
register_size (current_gdbarch,
reg->regnum));
p += 2 * fieldsize;
{
struct remote_state *rs = get_remote_state ();
int i;
- char buf[MAX_REGISTER_SIZE];
+ gdb_byte buf[MAX_REGISTER_SIZE];
/* Make sure the entire registers array is valid. */
switch (remote_protocol_P.support)
struct packet_reg *reg = packet_reg_from_regnum (rs, regnum);
/* Try storing a single register. */
char *buf = alloca (rs->remote_packet_size);
- char regp[MAX_REGISTER_SIZE];
+ gdb_byte regp[MAX_REGISTER_SIZE];
char *p;
xsnprintf (buf, rs->remote_packet_size, "P%s=", phex_nz (reg->pnum, 0));
{
struct remote_state *rs = get_remote_state ();
char *buf;
- char *regs;
+ gdb_byte *regs;
char *p;
set_thread (PIDGET (inferior_ptid), 1);
error. Only transfer a single packet. */
int
-remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
+remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
- unsigned char *buf;
- unsigned char *p;
- unsigned char *plen;
+ char *buf;
+ char *p;
+ char *plen;
long sizeof_buf;
int plenlen;
int todo;
int nr_bytes;
int payload_size;
- unsigned char *payload_start;
+ char *payload_start;
/* Verify that the target can support a binary download. */
check_binary_download (memaddr);
handling partial reads. */
int
-remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
+remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
char *buf;
int max_buf_size; /* Max size of packet output buffer. */
if (i < 0)
return i;
- getpkt (readbuf, len, 0);
+ getpkt ((char *) readbuf, len, 0);
- return strlen (readbuf);
+ return strlen ((char *) readbuf);
}
static void
error (_("\"monitor\" command ``%s'' is too long."), command);
/* Encode the actual command. */
- bin2hex (command, p, 0);
+ bin2hex ((gdb_byte *) command, p, 0);
if (putpkt (buf) < 0)
error (_("Communication problem with target."));