summaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2011-05-13 04:34:19 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2011-05-13 04:34:19 +0000
commitec6c9892eca69f91762bcaba4bb3dda73869a24c (patch)
treed8a3900f58e0d8ec4023bb2a84e0bb7a16add0ba /gdb/top.c
parentdef629881c1a7a807c2b954242b43acd3b779a16 (diff)
downloadgdb-ec6c9892eca69f91762bcaba4bb3dda73869a24c.tar.gz
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/top.c')
-rw-r--r--gdb/top.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 2b14f75c37e..b69f7d694c9 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -339,10 +339,14 @@ do_chdir_cleanup (void *old_dir)
}
#endif
-void
+struct cleanup *
prepare_execute_command (void)
{
- free_all_values ();
+ struct value *mark;
+ struct cleanup *cleanup;
+
+ mark = value_mark ();
+ cleanup = make_cleanup_value_free_to_mark (mark);
/* With multiple threads running while the one we're examining is
stopped, the dcache can get stale without us being able to detect
@@ -350,6 +354,8 @@ prepare_execute_command (void)
help things like backtrace. */
if (non_stop)
target_dcache_invalidate ();
+
+ return cleanup;
}
/* Execute the line P as a command, in the current user context.
@@ -358,12 +364,13 @@ prepare_execute_command (void)
void
execute_command (char *p, int from_tty)
{
+ struct cleanup *cleanup;
struct cmd_list_element *c;
enum language flang;
static int warned = 0;
char *line;
- prepare_execute_command ();
+ cleanup = prepare_execute_command ();
/* Force cleanup of any alloca areas if using C alloca instead of
a builtin alloca. */
@@ -462,6 +469,8 @@ execute_command (char *p, int from_tty)
warned = 1;
}
}
+
+ do_cleanups (cleanup);
}
/* Run execute_command for P and FROM_TTY. Capture its output into the