aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-06-27 19:21:51 +0000
committerTom Tromey <tromey@redhat.com>2011-06-27 19:21:51 +0000
commit5fe41fbfa22275d2a277b408bf52fedec34e8336 (patch)
tree9aed1be88020a4add3cfcbe7562642ad3236d91a /gdb/python
parent57eb9b5086fe082ad965e75d199dd9d536e54250 (diff)
downloadgdb-5fe41fbfa22275d2a277b408bf52fedec34e8336.zip
gdb-5fe41fbfa22275d2a277b408bf52fedec34e8336.tar.gz
gdb-5fe41fbfa22275d2a277b408bf52fedec34e8336.tar.bz2
* valops.c (find_overload_match): Call do_cleanups before early
return. * top.c (execute_command): Call do_cleanups before early return. (command_loop): Likewise. * stack.c (backtrace_command): Make a null cleanup early. Don't conditionally call do_cleanups. * python/py-value.c (TRY_CATCH): Move cleanup handling into TRY_CATCH. * python/py-breakpoint.c (gdbpy_breakpoint_has_py_cond): Rearrange so cleanups are always run. * mi/mi-cmd-var.c (mi_cmd_var_delete): Reset old_cleanups. * findcmd.c (parse_find_args): Call do_cleanups on early return path. * dbxread.c (elfstab_build_psymtabs): Make a null cleanup early. Don't conditionally call do_cleanups. * cli/cli-script.c (execute_user_command): Initialize 'old_chain' later.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-breakpoint.c5
-rw-r--r--gdb/python/py-value.c12
2 files changed, 7 insertions, 10 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index e73dc24..294e648 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -771,10 +771,9 @@ gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj)
get_current_arch ();
struct cleanup *cleanup = ensure_python_env (garch, current_language);
- if (py_bp == NULL)
- return 0;
+ if (py_bp != NULL)
+ has_func = PyObject_HasAttrString (py_bp, stop_func);
- has_func = PyObject_HasAttrString (py_bp, stop_func);
do_cleanups (cleanup);
return has_func;
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 4381d52..fc5053a 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -553,8 +553,6 @@ static PyObject *
valpy_str (PyObject *self)
{
char *s = NULL;
- struct ui_file *stb;
- struct cleanup *old_chain;
PyObject *result;
struct value_print_options opts;
volatile struct gdb_exception except;
@@ -562,19 +560,19 @@ valpy_str (PyObject *self)
get_user_print_options (&opts);
opts.deref_ref = 0;
- stb = mem_fileopen ();
- old_chain = make_cleanup_ui_file_delete (stb);
-
TRY_CATCH (except, RETURN_MASK_ALL)
{
+ struct ui_file *stb = mem_fileopen ();
+ struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
+
common_val_print (((value_object *) self)->value, stb, 0,
&opts, python_language);
s = ui_file_xstrdup (stb, NULL);
+
+ do_cleanups (old_chain);
}
GDB_PY_HANDLE_EXCEPTION (except);
- do_cleanups (old_chain);
-
result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
xfree (s);