fetchlimit = UINT_MAX;
err = target_read_string (addr, *length, width, fetchlimit,
- byte_order, buffer, length);
+ buffer, length);
if (err != 0)
memory_error (TARGET_XFER_E_IO, addr);
}
bytes_read = &ignore;
/* Note that the endian-ness does not matter here. */
- int errcode = target_read_string (memaddr, -1, 1, len, BFD_ENDIAN_LITTLE,
- &buffer, bytes_read);
+ int errcode = target_read_string (memaddr, -1, 1, len, &buffer, bytes_read);
if (errcode != 0)
return {};
int
target_read_string (CORE_ADDR addr, int len, int width,
unsigned int fetchlimit,
- enum bfd_endian byte_order,
gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
int *bytes_read)
{
limit = bufptr + nfetch * width;
while (bufptr < limit)
{
- unsigned long c;
+ bool found_nonzero = false;
+
+ for (int i = 0; !found_nonzero && i < width; ++i)
+ if (bufptr[i] != 0)
+ found_nonzero = true;
- c = extract_unsigned_integer (bufptr, width, byte_order);
addr += width;
bufptr += width;
- if (c == 0)
+ if (!found_nonzero)
{
/* We don't care about any error which happened after
the NUL terminator. */
fetchlimit = (len == -1 ? options->print_max : std::min ((unsigned) len,
options->print_max));
- err = target_read_string (addr, len, width, fetchlimit, byte_order,
+ err = target_read_string (addr, len, width, fetchlimit,
&buffer, &bytes_read);
addr += bytes_read;
extern int target_read_string (CORE_ADDR addr, int len, int width,
unsigned int fetchlimit,
- enum bfd_endian byte_order,
gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
int *bytes_read);