* parse.c (parse_exp_in_context): New variable inner_chain.  Call
	make_cleanup_restore_current_language.  Call set_language.  Move
	OLD_CHAIN and INNER_CHAIN cleanups.
	* utils.c (do_restore_current_language)
	(make_cleanup_restore_current_language): New functions.
	* utils.h (make_cleanup_restore_current_language): New declaration.

gdb/testsuite/
	* gdb.cp/parse-lang.cc: New file.
	* gdb.cp/parse-lang.exp: New file.
This commit is contained in:
Jan Kratochvil
2013-01-13 18:57:01 +00:00
parent 57b3c00c27
commit 5b12a61c76
7 changed files with 119 additions and 3 deletions

View File

@@ -1143,7 +1143,7 @@ parse_exp_in_context (char **stringptr, CORE_ADDR pc, const struct block *block,
int comma, int void_context_p, int *out_subexp)
{
volatile struct gdb_exception except;
struct cleanup *old_chain;
struct cleanup *old_chain, *inner_chain;
const struct language_defn *lang = NULL;
int subexp;
@@ -1213,7 +1213,13 @@ parse_exp_in_context (char **stringptr, CORE_ADDR pc, const struct block *block,
else
lang = current_language;
/* get_current_arch may reset CURRENT_LANGUAGE via select_frame.
While we need CURRENT_LANGUAGE to be set to LANG (for lookup_symbol
and others called from *.y) ensure CURRENT_LANGUAGE gets restored
to the value matching SELECTED_FRAME as set by get_current_arch. */
initialize_expout (10, lang, get_current_arch ());
inner_chain = make_cleanup_restore_current_language ();
set_language (lang->la_language);
TRY_CATCH (except, RETURN_MASK_ALL)
{
@@ -1229,8 +1235,6 @@ parse_exp_in_context (char **stringptr, CORE_ADDR pc, const struct block *block,
}
}
discard_cleanups (old_chain);
reallocate_expout ();
/* Convert expression from postfix form as generated by yacc
@@ -1249,6 +1253,9 @@ parse_exp_in_context (char **stringptr, CORE_ADDR pc, const struct block *block,
if (expressiondebug)
dump_prefix_expression (expout, gdb_stdlog);
do_cleanups (inner_chain);
discard_cleanups (old_chain);
*stringptr = lexptr;
return expout;
}