+2015-03-26 Joel Brobecker <brobecker@adacore.com>
+
+ * dtrace-probe.c (dtrace_process_dof_probe): Contain any
+ exception raised while parsing the probe arguments.
+ Force parsing to be done using the C language parser.
+ * expression.h (parse_expression_with_language): Declare.
+ * parse.c (parse_expression_with_language): New function.
+
2015-03-26 Jon Turney <jon.turney@dronecode.org.uk>
* MAINTAINERS (Write After Approval): Add "Jon Turney".
this does not work then we set the type to `long
int'. */
arg.type = builtin_type (gdbarch)->builtin_long;
- expr = parse_expression (arg.type_str);
- if (expr->elts[0].opcode == OP_TYPE)
+
+ TRY
+ {
+ expr = parse_expression_with_language (arg.type_str, language_c);
+ }
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ expr = NULL;
+ }
+ END_CATCH
+
+ if (expr != NULL && expr->elts[0].opcode == OP_TYPE)
arg.type = expr->elts[1].type;
VEC_safe_push (dtrace_probe_arg_s, ret->args, &arg);
extern struct expression *parse_expression (const char *);
+extern struct expression *parse_expression_with_language (const char *string,
+ enum language lang);
+
extern struct type *parse_expression_for_completion (const char *, char **,
enum type_code *);
return exp;
}
+/* Same as parse_expression, but using the given language (LANG)
+ to parse the expression. */
+
+struct expression *
+parse_expression_with_language (const char *string, enum language lang)
+{
+ struct cleanup *old_chain = NULL;
+ struct expression *expr;
+
+ if (current_language->la_language != lang)
+ {
+ old_chain = make_cleanup_restore_current_language ();
+ set_language (lang);
+ }
+
+ expr = parse_expression (string);
+
+ if (old_chain != NULL)
+ do_cleanups (old_chain);
+ return expr;
+}
+
/* Parse STRING as an expression. If parsing ends in the middle of a
field reference, return the type of the left-hand-side of the
reference; furthermore, if the parsing ends in the field name,