diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-01-13 18:57:01 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-01-13 18:57:01 +0000 |
commit | 5b12a61c763421f05d233ebcce94d96536b5c5d4 (patch) | |
tree | 9dcece33b9b32127276554e6b48baa2c434ec80a /gdb/parse.c | |
parent | gdb/ (diff) | |
download | binutils-gdb-5b12a61c763421f05d233ebcce94d96536b5c5d4.tar.gz binutils-gdb-5b12a61c763421f05d233ebcce94d96536b5c5d4.tar.bz2 binutils-gdb-5b12a61c763421f05d233ebcce94d96536b5c5d4.zip |
gdb/
* 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.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r-- | gdb/parse.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gdb/parse.c b/gdb/parse.c index 2d530dfa7e8..09c378b98bb 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -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; } |