return;
}
}
- internal_error (__FILE__, __LINE__, "Could not find config for %s",
+ internal_error (__FILE__, __LINE__, _("Could not find config for %s"),
c->name);
}
return;
}
}
- internal_error (__FILE__, __LINE__, "Could not find config for %s",
+ internal_error (__FILE__, __LINE__, _("Could not find config for %s"),
c->name);
}
struct thread_item item;
char *id;
+ struct gdb_xml_value *attr;
- id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
+ id = xml_find_attribute (attributes, "id")->value;
item.ptid = read_ptid (id, NULL);
- if (VEC_length (gdb_xml_value_s, attributes) > 1)
- item.core = *(ULONGEST *) VEC_index (gdb_xml_value_s,
- attributes, 1)->value;
+ attr = xml_find_attribute (attributes, "core");
+ if (attr != NULL)
+ item.core = *(ULONGEST *) attr->value;
else
item.core = -1;
TARGET_OBJECT_THREADS, NULL);
struct cleanup *back_to = make_cleanup (xfree, xml);
+
if (xml && *xml)
{
- struct gdb_xml_parser *parser;
struct threads_parsing_context context;
- struct cleanup *clear_parsing_context;
-
- context.items = 0;
- /* Note: this parser cleanup is already guarded by BACK_TO
- above. */
- parser = gdb_xml_create_parser_and_cleanup (_("threads"),
- threads_elements,
- &context);
-
- gdb_xml_use_dtd (parser, "threads.dtd");
- clear_parsing_context
- = make_cleanup (clear_threads_parsing_context, &context);
+ context.items = NULL;
+ make_cleanup (clear_threads_parsing_context, &context);
- if (gdb_xml_parse (parser, xml) == 0)
+ if (gdb_xml_parse_quick (_("threads"), "threads.dtd",
+ threads_elements, xml, &context) == 0)
{
int i;
struct thread_item *item;
}
}
}
-
- do_cleanups (clear_parsing_context);
}
do_cleanups (back_to);
getpkt (&rs->buf, &rs->buf_size, 0);
if (strcmp (rs->buf, "OK") != 0)
- error ("Remote refused setting non-stop mode with: %s", rs->buf);
+ error (_("Remote refused setting non-stop mode with: %s"), rs->buf);
/* Find about threads and processes the stub is already
controlling. We default to adding them in the running state.
getpkt (&rs->buf, &rs->buf_size, 0);
if (strcmp (rs->buf, "OK") != 0)
- error ("Remote refused setting all-stop mode with: %s", rs->buf);
+ error (_("Remote refused setting all-stop mode with: %s"), rs->buf);
}
/* Check whether the target is running now. */
if (p[0] == 0 || p[1] == 0)
/* This shouldn't happen - we adjusted sizeof_g_packet above. */
internal_error (__FILE__, __LINE__,
- "unexpected end of 'g' packet reply");
+ _("unexpected end of 'g' packet reply"));
if (p[0] == 'x' && p[1] == 'x')
regs[i] = 0; /* 'x' */
if (r->offset * 2 >= strlen (rs->buf))
/* This shouldn't happen - we adjusted in_g_packet above. */
internal_error (__FILE__, __LINE__,
- "unexpected end of 'g' packet reply");
+ _("unexpected end of 'g' packet reply"));
else if (rs->buf[r->offset * 2] == 'x')
{
gdb_assert (r->offset * 2 < strlen (rs->buf));
if (packet_format != 'X' && packet_format != 'M')
internal_error (__FILE__, __LINE__,
- "remote_write_bytes_aux: bad packet format");
+ _("remote_write_bytes_aux: bad packet format"));
if (len <= 0)
return 0;
Returns number of bytes transferred, or 0 (setting errno) for
error. Only transfer a single packet. */
-int
+static int
remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
{
char *packet_format = 0;
Returns number of bytes transferred, or 0 for error. */
-/* NOTE: cagney/1999-10-18: This function (and its siblings in other
- remote targets) shouldn't attempt to read the entire buffer.
- Instead it should read a single packet worth of data and then
- return the byte size of that packet to the caller. The caller (its
- caller and its callers caller ;-) already contains code for
- handling partial reads. */
-
-int
+static int
remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
struct remote_state *rs = get_remote_state ();
int max_buf_size; /* Max size of packet output buffer. */
- int origlen;
+ char *p;
+ int todo;
+ int i;
if (len <= 0)
return 0;
/* The packet buffer will be large enough for the payload;
get_memory_packet_size ensures this. */
- origlen = len;
- while (len > 0)
- {
- char *p;
- int todo;
- int i;
+ /* Number if bytes that will fit. */
+ todo = min (len, max_buf_size / 2);
- todo = min (len, max_buf_size / 2); /* num bytes that will fit. */
-
- /* construct "m"<memaddr>","<len>" */
- /* sprintf (rs->buf, "m%lx,%x", (unsigned long) memaddr, todo); */
- memaddr = remote_address_masked (memaddr);
- p = rs->buf;
- *p++ = 'm';
- p += hexnumstr (p, (ULONGEST) memaddr);
- *p++ = ',';
- p += hexnumstr (p, (ULONGEST) todo);
- *p = '\0';
-
- putpkt (rs->buf);
- getpkt (&rs->buf, &rs->buf_size, 0);
-
- if (rs->buf[0] == 'E'
- && isxdigit (rs->buf[1]) && isxdigit (rs->buf[2])
- && rs->buf[3] == '\0')
- {
- /* 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 = rs->buf;
- if ((i = hex2bin (p, myaddr, todo)) < todo)
- {
- /* Reply is short. This means that we were able to read
- only part of what we wanted to. */
- return i + (origlen - len);
- }
- myaddr += todo;
- memaddr += todo;
- len -= todo;
+ /* Construct "m"<memaddr>","<len>". */
+ memaddr = remote_address_masked (memaddr);
+ p = rs->buf;
+ *p++ = 'm';
+ p += hexnumstr (p, (ULONGEST) memaddr);
+ *p++ = ',';
+ p += hexnumstr (p, (ULONGEST) todo);
+ *p = '\0';
+ putpkt (rs->buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
+ if (rs->buf[0] == 'E'
+ && isxdigit (rs->buf[1]) && isxdigit (rs->buf[2])
+ && rs->buf[3] == '\0')
+ {
+ /* 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;
}
- return origlen;
+ /* Reply describes memory byte by byte, each byte encoded as two hex
+ characters. */
+ p = rs->buf;
+ i = hex2bin (p, myaddr, todo);
+ /* Return what we have. Let higher layers handle partial reads. */
+ return i;
}
\f
rs->buf[0] = '\0';
if (vsnprintf (rs->buf, max_size, format, ap) >= max_size)
- internal_error (__FILE__, __LINE__, "Too long remote packet.");
+ internal_error (__FILE__, __LINE__, _("Too long remote packet."));
if (putpkt (rs->buf) < 0)
error (_("Communication problem with target."));
/* Bail if the pattern is too large. */
if (used_pattern_len != pattern_len)
- error ("Pattern is too large to transmit to remote target.");
+ error (_("Pattern is too large to transmit to remote target."));
if (putpkt_binary (rs->buf, i + escaped_pattern_len) < 0
|| getpkt_sane (&rs->buf, &rs->buf_size, 0) < 0
ix++)
if (guess->bytes == bytes)
internal_error (__FILE__, __LINE__,
- "Duplicate g packet description added for size %d",
+ _("Duplicate g packet description added for size %d"),
bytes);
new_guess.bytes = bytes;
/* If it passed validation at definition but fails now,
something is very wrong. */
internal_error (__FILE__, __LINE__,
- "Fast tracepoint not valid during download");
+ _("Fast tracepoint not "
+ "valid during download"));
}
else
/* Fast tracepoints are functionally identical to regular
sprintf (p, "outside:%s:%s", phex_nz (addr1, 0), phex_nz (addr2, 0));
break;
default:
- error ("Unknown trace find type %d", type);
+ error (_("Unknown trace find type %d"), type);
}
putpkt (rs->buf);