aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2011-05-13 04:34:25 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2011-05-13 04:34:25 +0000
commit028d0ed5d19d1c164d9ee4f4f85743ca7e955e52 (patch)
tree971789eee44563ba8452513041730d09151eac1e /gdb/utils.c
parentc9eaa05f39a20ebdd807dcf8141a22e08bb613f1 (diff)
downloadgdb-028d0ed5d19d1c164d9ee4f4f85743ca7e955e52.zip
gdb-028d0ed5d19d1c164d9ee4f4f85743ca7e955e52.tar.gz
gdb-028d0ed5d19d1c164d9ee4f4f85743ca7e955e52.tar.bz2
gdb/
* mi/mi-main.c (mi_cmd_execute): Use cleanup from prepare_execute_command. * top.c (prepare_execute_command): Return cleanup. (execute_command): Use cleanup from prepare_execute_command. * top.h (prepare_execute_command): Change prototype to return cleanup. * defs.h (struct value): Add opaque declaration. (make_cleanup_value_free_to_mark): Add prototype. * utils.c (do_value_free_to_mark): New function. (make_cleanup_value_free_to_mark): Likewise. gdb/testsuite/ * gdb.python/py-function.exp: Test setting a value from a function which executes a command.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index a1dac63..3e4a54d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -431,6 +431,23 @@ make_cleanup_restore_ui_file (struct ui_file **variable)
return make_cleanup_dtor (do_restore_ui_file, (void *) c, xfree);
}
+/* Helper for make_cleanup_value_free_to_mark. */
+
+static void
+do_value_free_to_mark (void *value)
+{
+ value_free_to_mark ((struct value *) value);
+}
+
+/* Free all values allocated since MARK was obtained by value_mark
+ (except for those released) when the cleanup is run. */
+
+struct cleanup *
+make_cleanup_value_free_to_mark (struct value *mark)
+{
+ return make_my_cleanup (&cleanup_chain, do_value_free_to_mark, mark);
+}
+
struct cleanup *
make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function,
void *arg, void (*free_arg) (void *))