diff options
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index 61492cc..0ecea0c 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -83,7 +83,7 @@ struct cmd_list_element *showprintrawlist; /* Prototypes for local functions */ static int partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, - int len, int *errnoptr); + int len, int *errptr); static void show_print (char *, int); @@ -1711,15 +1711,15 @@ val_print_array_elements (struct type *type, /* Read LEN bytes of target memory at address MEMADDR, placing the results in GDB's memory at MYADDR. Returns a count of the bytes - actually read, and optionally an errno value in the location - pointed to by ERRNOPTR if ERRNOPTR is non-null. */ + actually read, and optionally a target_xfer_error value in the + location pointed to by ERRPTR if ERRPTR is non-null. */ /* FIXME: cagney/1999-10-14: Only used by val_print_string. Can this function be eliminated. */ static int partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, - int len, int *errnoptr) + int len, int *errptr) { int nread; /* Number of bytes actually read. */ int errcode; /* Error from last read. */ @@ -1744,9 +1744,9 @@ partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, nread--; } } - if (errnoptr != NULL) + if (errptr != NULL) { - *errnoptr = errcode; + *errptr = errcode; } return (nread); } @@ -1755,7 +1755,7 @@ partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, each. Fetch at most FETCHLIMIT characters. BUFFER will be set to a newly allocated buffer containing the string, which the caller is responsible to free, and BYTES_READ will be set to the number of bytes read. Returns 0 on - success, or errno on failure. + success, or a target_xfer_error on failure. If LEN > 0, reads exactly LEN characters (including eventual NULs in the middle or end of the string). If LEN is -1, stops at the first @@ -2524,18 +2524,14 @@ val_print_string (struct type *elttype, const char *encoding, if (errcode != 0) { - if (errcode == EIO) - { - fprintf_filtered (stream, "<Address "); - fputs_filtered (paddress (gdbarch, addr), stream); - fprintf_filtered (stream, " out of bounds>"); - } - else - { - fprintf_filtered (stream, "<Error reading address "); - fputs_filtered (paddress (gdbarch, addr), stream); - fprintf_filtered (stream, ": %s>", safe_strerror (errcode)); - } + char *str; + + str = memory_error_message (errcode, gdbarch, addr); + make_cleanup (xfree, str); + + fprintf_filtered (stream, "<error: "); + fputs_filtered (str, stream); + fprintf_filtered (stream, ">"); } gdb_flush (stream); |