aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-06-21 18:01:51 +0000
committerTom Tromey <tromey@redhat.com>2010-06-21 18:01:51 +0000
commitb00fdb78327b18ba0d4240724647bee58ff6b71e (patch)
treef06a4e33efde39bded42f8e1d518e2fc6904ded2 /gdb
parent84951ab5849cbb0cf00091eb8e9fe83c660fe1d6 (diff)
downloadfsf-binutils-gdb-b00fdb78327b18ba0d4240724647bee58ff6b71e.zip
fsf-binutils-gdb-b00fdb78327b18ba0d4240724647bee58ff6b71e.tar.gz
fsf-binutils-gdb-b00fdb78327b18ba0d4240724647bee58ff6b71e.tar.bz2
* p-valprint.c (pascal_val_print): Use TYPE_ERROR_NAME.
* p-typeprint.c (pascal_type_print_base): Use TYPE_ERROR_NAME. * m2-valprint.c (m2_val_print): Use TYPE_ERROR_NAME. * gdbtypes.h (TYPE_ERROR_NAME): New macro. * f-valprint.c (f_val_print): Use TYPE_ERROR_NAME. * f-typeprint.c (f_type_print_base): Use TYPE_ERROR_NAME. * dwarf2read.c (tag_type_to_type): Create a new error type on failure. * c-valprint.c (c_val_print): Use TYPE_ERROR_NAME. * c-typeprint.c (c_type_print_base): Use TYPE_ERROR_NAME.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/c-typeprint.c2
-rw-r--r--gdb/c-valprint.c2
-rw-r--r--gdb/dwarf2read.c15
-rw-r--r--gdb/f-typeprint.c2
-rw-r--r--gdb/f-valprint.c2
-rw-r--r--gdb/gdbtypes.h5
-rw-r--r--gdb/m2-valprint.c2
-rw-r--r--gdb/p-typeprint.c2
-rw-r--r--gdb/p-valprint.c2
10 files changed, 37 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fd7dd5a..de7d59b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2010-06-21 Tom Tromey <tromey@redhat.com>
+
+ * p-valprint.c (pascal_val_print): Use TYPE_ERROR_NAME.
+ * p-typeprint.c (pascal_type_print_base): Use TYPE_ERROR_NAME.
+ * m2-valprint.c (m2_val_print): Use TYPE_ERROR_NAME.
+ * gdbtypes.h (TYPE_ERROR_NAME): New macro.
+ * f-valprint.c (f_val_print): Use TYPE_ERROR_NAME.
+ * f-typeprint.c (f_type_print_base): Use TYPE_ERROR_NAME.
+ * dwarf2read.c (tag_type_to_type): Create a new error type on
+ failure.
+ * c-valprint.c (c_val_print): Use TYPE_ERROR_NAME.
+ * c-typeprint.c (c_type_print_base): Use TYPE_ERROR_NAME.
+
2010-06-21 Michael Snyder <msnyder@vmware.com>
* breakpoint.c (_initialize_breakpoint): Use add_prefix_cmd,
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 9a6bc6d..d07fb8f 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -1121,7 +1121,7 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
break;
case TYPE_CODE_ERROR:
- fprintf_filtered (stream, _("<unknown type>"));
+ fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
break;
case TYPE_CODE_RANGE:
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index e2a5b95..e205705 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -557,7 +557,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
break;
case TYPE_CODE_ERROR:
- fprintf_filtered (stream, _("<error type>"));
+ fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
break;
case TYPE_CODE_UNDEF:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 613f021..f9abf0a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9173,9 +9173,18 @@ tag_type_to_type (struct die_info *die, struct dwarf2_cu *cu)
this_type = read_type_die (die, cu);
if (!this_type)
{
- dump_die_for_error (die);
- error (_("Dwarf Error: Cannot find type of die [in module %s]"),
- cu->objfile->name);
+ char *message, *saved;
+
+ /* read_type_die already issued a complaint. */
+ message = xstrprintf (_("<unknown type in %s, CU 0x%x, DIE 0x%x>"),
+ cu->objfile->name,
+ cu->header.offset,
+ die->offset);
+ saved = obstack_copy0 (&cu->objfile->objfile_obstack,
+ message, strlen (message));
+ xfree (message);
+
+ this_type = init_type (TYPE_CODE_ERROR, 0, 0, saved, cu->objfile);
}
return this_type;
}
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index ff013d0..d35a255 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -312,7 +312,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
break;
case TYPE_CODE_ERROR:
- fprintfi_filtered (level, stream, "<unknown type>");
+ fprintfi_filtered (level, stream, "%s", TYPE_ERROR_NAME (type));
break;
case TYPE_CODE_RANGE:
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 4db0b27..85f698d 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -398,7 +398,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
break;
case TYPE_CODE_ERROR:
- fprintf_filtered (stream, "<error type>");
+ fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
break;
case TYPE_CODE_RANGE:
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 32e5f04..ce79dc2 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1054,6 +1054,11 @@ extern void allocate_gnat_aux_type (struct type *);
|| TYPE_NFN_FIELDS (thistype) == 0) && \
(TYPE_STUB (thistype) || !TYPE_STUB_SUPPORTED (thistype)))
+/* A helper macro that returns the name of an error type. If the type
+ has a name, it is used; otherwise, a default is used. */
+#define TYPE_ERROR_NAME(type) \
+ (TYPE_NAME (type) ? TYPE_NAME (type) : _("<error type>"))
+
struct builtin_type
{
/* Integral types. */
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 95a7a93..e27ce8c 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -652,7 +652,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
break;
case TYPE_CODE_ERROR:
- fprintf_filtered (stream, _("<error type>"));
+ fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
break;
case TYPE_CODE_UNDEF:
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index 1792cf8..c0752b7 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -758,7 +758,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
break;
case TYPE_CODE_ERROR:
- fprintf_filtered (stream, "<unknown type>");
+ fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
break;
/* this probably does not work for enums */
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 3d00a69..4d39bed 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -540,7 +540,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
break;
case TYPE_CODE_ERROR:
- fprintf_filtered (stream, "<error type>");
+ fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
break;
case TYPE_CODE_UNDEF: