gdb
[deliverable/binutils-gdb.git] / gdb / c-lang.c
index 40c417256bf9f475b64f17079cdf9b0433aae647..775a6f83e8458e8daeb1ccc3910a9540933814f7 100644 (file)
@@ -35,6 +35,7 @@
 #include "cp-support.h"
 #include "gdb_obstack.h"
 #include <ctype.h>
+#include "exceptions.h"
 
 extern void _initialize_c_language (void);
 
@@ -698,13 +699,19 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length,
     }
   else
     {
-      err = read_string (value_as_address (value), *length, width, fetchlimit,
-                        byte_order, buffer, length);
+      CORE_ADDR addr = value_as_address (value);
+
+      err = read_string (addr, *length, width, fetchlimit,
+                        byte_order, buffer, length);
       if (err)
        {
          xfree (*buffer);
-         error (_("Error reading string from inferior: %s"),
-                safe_strerror (err));
+         if (err == EIO)
+           throw_error (MEMORY_ERROR, "Address %s out of bounds",
+                        paddress (get_type_arch (type), addr));
+         else
+           error (_("Error reading string from inferior: %s"),
+                  safe_strerror (err));
        }
     }
 
@@ -933,7 +940,7 @@ parse_one_string (struct obstack *output, char *data, int len,
    are delegated to evaluate_subexp_standard; see that function for a
    description of the arguments.  */
 
-static struct value *
+struct value *
 evaluate_subexp_c (struct type *expect_type, struct expression *exp,
                   int *pos, enum noside noside)
 {
This page took 0.024352 seconds and 4 git commands to generate.