aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-01-13 18:57:01 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-01-13 18:57:01 +0000
commit5b12a61c763421f05d233ebcce94d96536b5c5d4 (patch)
tree9dcece33b9b32127276554e6b48baa2c434ec80a /gdb/utils.c
parent57b3c00c27e8492b2f8342b38e2301e710e5fabf (diff)
downloadgdb-5b12a61c763421f05d233ebcce94d96536b5c5d4.zip
gdb-5b12a61c763421f05d233ebcce94d96536b5c5d4.tar.gz
gdb-5b12a61c763421f05d233ebcce94d96536b5c5d4.tar.bz2
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/utils.c')
-rw-r--r--gdb/utils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index e12888f..8bae4eb 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -503,6 +503,28 @@ make_cleanup_free_so (struct so_list *so)
return make_cleanup (do_free_so, so);
}
+/* Helper for make_cleanup_restore_current_language. */
+
+static void
+do_restore_current_language (void *p)
+{
+ enum language saved_lang = (uintptr_t) p;
+
+ set_language (saved_lang);
+}
+
+/* Remember the current value of CURRENT_LANGUAGE and make it restored when
+ the cleanup is run. */
+
+struct cleanup *
+make_cleanup_restore_current_language (void)
+{
+ enum language saved_lang = current_language->la_language;
+
+ return make_cleanup (do_restore_current_language,
+ (void *) (uintptr_t) saved_lang);
+}
+
/* This function is useful for cleanups.
Do