diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index 491d853..5d5c5b2 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -414,6 +414,7 @@ dtrace_process_dof_probe (struct objfile *objfile, { struct dtrace_probe_arg arg; struct expression *expr; + struct cleanup *old_chain = NULL; /* Set arg.expr to ensure all fields in expr are initialized and the compiler will not warn when arg is used. */ @@ -427,8 +428,24 @@ dtrace_process_dof_probe (struct objfile *objfile, 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) + + if (current_language->la_language != language_c) + { + old_chain = make_cleanup_restore_current_language (); + set_language (language_c); + } + TRY + { + expr = parse_expression (arg.type_str); + } + CATCH (ex, RETURN_MASK_ERROR) + { + expr = NULL; + } + END_CATCH + if (old_chain != NULL) + do_cleanups (old_chain); + 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);