aboutsummaryrefslogtreecommitdiff
path: root/gdb/p-valprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/p-valprint.c')
-rw-r--r--gdb/p-valprint.c66
1 files changed, 41 insertions, 25 deletions
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 7031a77..fc50e2a 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -38,6 +38,7 @@
#include "p-lang.h"
#include "cp-abi.h"
#include "cp-support.h"
+#include "exceptions.h"
/* See val_print for a description of the various parameters of this
@@ -900,11 +901,13 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
for (i = 0; i < n_baseclasses; i++)
{
- int boffset;
+ int boffset = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
char *basename = type_name_no_tag (baseclass);
- const gdb_byte *base_valaddr;
+ const gdb_byte *base_valaddr = NULL;
int thisoffset;
+ volatile struct gdb_exception ex;
+ int skip = 0;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
@@ -923,7 +926,38 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
thisoffset = offset;
- boffset = baseclass_offset (type, i, valaddr + offset, address + offset);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ boffset = baseclass_offset (type, i, valaddr, offset, address, val);
+ }
+ if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
+ skip = -1;
+ else if (ex.reason < 0)
+ skip = 1;
+ else
+ {
+ skip = 0;
+
+ /* The virtual base class pointer might have been clobbered by the
+ user program. Make sure that it still points to a valid memory
+ location. */
+
+ if (boffset < 0 || boffset >= TYPE_LENGTH (type))
+ {
+ /* FIXME (alloc): not safe is baseclass is really really big. */
+ gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
+
+ base_valaddr = buf;
+ if (target_read_memory (address + boffset, buf,
+ TYPE_LENGTH (baseclass)) != 0)
+ skip = 1;
+ address = address + boffset;
+ thisoffset = 0;
+ boffset = 0;
+ }
+ else
+ base_valaddr = valaddr;
+ }
if (options->pretty)
{
@@ -937,28 +971,10 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
fputs_filtered (basename ? basename : "", stream);
fputs_filtered ("> = ", stream);
- /* The virtual base class pointer might have been clobbered by the
- user program. Make sure that it still points to a valid memory
- location. */
-
- if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type)))
- {
- /* FIXME (alloc): not safe is baseclass is really really big. */
- gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
-
- base_valaddr = buf;
- if (target_read_memory (address + boffset, buf,
- TYPE_LENGTH (baseclass)) != 0)
- boffset = -1;
- address = address + boffset;
- thisoffset = 0;
- boffset = 0;
- }
- else
- base_valaddr = valaddr;
-
- if (boffset == -1)
- fprintf_filtered (stream, "<invalid address>");
+ if (skip < 0)
+ val_print_unavailable (stream);
+ else if (skip > 0)
+ val_print_invalid_address (stream);
else
pascal_object_print_value_fields (baseclass, base_valaddr,
thisoffset + boffset, address,