aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorNicholas Duffek <nsd@redhat.com>2000-04-03 03:39:09 +0000
committerNicholas Duffek <nsd@redhat.com>2000-04-03 03:39:09 +0000
commitc91ecb25c3d04094aafd260522f8d85e2286ff87 (patch)
treefd5eb6d3a6c6a2e5da10b43f1fecafa6158b842f /gdb/gdbtypes.c
parentf9e73361c87cb43b864ae542a5e1a1dd7669de86 (diff)
downloadgdb-c91ecb25c3d04094aafd260522f8d85e2286ff87.zip
gdb-c91ecb25c3d04094aafd260522f8d85e2286ff87.tar.gz
gdb-c91ecb25c3d04094aafd260522f8d85e2286ff87.tar.bz2
* gdbtypes.c (safe_parse_type): New wrapper function to ignore
error() during parse_and_eval_type(). (check_stub_method): Call safe_parse_type instead of parse_and_eval_type(). * wrapper.c (gdb_parse_and_eval_type): New wrapper function. (wrap_parse_and_eval_type): New support function. * wrapper.h (gdb_parse_and_eval_type): Prototype. (wrap_parse_and_eval_type): Prototype.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 08d194f..0d5bee8 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -33,6 +33,7 @@
#include "demangle.h"
#include "complaints.h"
#include "gdbcmd.h"
+#include "wrapper.h"
/* These variables point to the objects
representing the predefined C data types. */
@@ -1422,6 +1423,30 @@ cfront_mangle_name (type, i, j)
#undef ADD_EXTRA
/* End of new code added to support parsing of Cfront stabs strings */
+/* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
+ silently return builtin_type_void. */
+
+struct type *
+safe_parse_type (char *p, int length)
+{
+ struct ui_file *saved_gdb_stderr;
+ struct type *type;
+
+ /* Suppress error messages. */
+ saved_gdb_stderr = gdb_stderr;
+ gdb_stderr = ui_file_new ();
+
+ /* Call parse_and_eval_type() without fear of longjmp()s. */
+ if (!gdb_parse_and_eval_type (p, length, &type))
+ type = builtin_type_void;
+
+ /* Stop suppressing error messages. */
+ ui_file_delete (gdb_stderr);
+ gdb_stderr = saved_gdb_stderr;
+
+ return type;
+}
+
/* Ugly hack to convert method stubs into method types.
He ain't kiddin'. This demangles the name of the method into a string
@@ -1496,7 +1521,7 @@ check_stub_method (type, method_id, signature_id)
if (strncmp (argtypetext, "...", p - argtypetext) != 0)
{
argtypes[argcount] =
- parse_and_eval_type (argtypetext, p - argtypetext);
+ safe_parse_type (argtypetext, p - argtypetext);
argcount += 1;
}
argtypetext = p + 1;