aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mi/mi-main.c')
-rw-r--r--gdb/mi/mi-main.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index c798c90..e2e0840 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -853,16 +853,14 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
total_bytes = word_size * nr_rows * nr_cols;
mbuf = xcalloc (total_bytes, 1);
make_cleanup (xfree, mbuf);
- nr_bytes = 0;
- while (nr_bytes < total_bytes)
+
+ nr_bytes = target_read (&current_target, TARGET_OBJECT_MEMORY, NULL,
+ mbuf, addr, total_bytes);
+ if (nr_bytes <= 0)
{
- int error;
- long num = target_read_memory_partial (addr + nr_bytes, mbuf + nr_bytes,
- total_bytes - nr_bytes,
- &error);
- if (num <= 0)
- break;
- nr_bytes += num;
+ do_cleanups (cleanups);
+ mi_error_message = xstrdup ("Unable to read memory.");
+ return MI_CMD_ERROR;
}
/* output the header information. */