mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-25 16:57:52 +00:00
Use gdbpy_enter in py-cmd.c
Change py-cmd.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-cmd.c (cmdpy_destroyer) (cmdpy_completer_handle_brkchars, cmdpy_completer): Use gdbpy_enter.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2017-01-10 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* python/py-cmd.c (cmdpy_destroyer)
|
||||||
|
(cmdpy_completer_handle_brkchars, cmdpy_completer): Use
|
||||||
|
gdbpy_enter.
|
||||||
|
|
||||||
2017-01-10 Tom Tromey <tom@tromey.com>
|
2017-01-10 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use
|
* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use
|
||||||
|
|||||||
@@ -96,9 +96,8 @@ static void
|
|||||||
cmdpy_destroyer (struct cmd_list_element *self, void *context)
|
cmdpy_destroyer (struct cmd_list_element *self, void *context)
|
||||||
{
|
{
|
||||||
cmdpy_object *cmd;
|
cmdpy_object *cmd;
|
||||||
struct cleanup *cleanup;
|
|
||||||
|
|
||||||
cleanup = ensure_python_env (get_current_arch (), current_language);
|
gdbpy_enter enter_py (get_current_arch (), current_language);
|
||||||
|
|
||||||
/* Release our hold on the command object. */
|
/* Release our hold on the command object. */
|
||||||
cmd = (cmdpy_object *) context;
|
cmd = (cmdpy_object *) context;
|
||||||
@@ -110,8 +109,6 @@ cmdpy_destroyer (struct cmd_list_element *self, void *context)
|
|||||||
xfree ((char *) self->name);
|
xfree ((char *) self->name);
|
||||||
xfree ((char *) self->doc);
|
xfree ((char *) self->doc);
|
||||||
xfree ((char *) self->prefixname);
|
xfree ((char *) self->prefixname);
|
||||||
|
|
||||||
do_cleanups (cleanup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by gdb to invoke the command. */
|
/* Called by gdb to invoke the command. */
|
||||||
@@ -287,9 +284,8 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
|
|||||||
const char *text, const char *word)
|
const char *text, const char *word)
|
||||||
{
|
{
|
||||||
PyObject *resultobj = NULL;
|
PyObject *resultobj = NULL;
|
||||||
struct cleanup *cleanup;
|
|
||||||
|
|
||||||
cleanup = ensure_python_env (get_current_arch (), current_language);
|
gdbpy_enter enter_py (get_current_arch (), current_language);
|
||||||
|
|
||||||
/* Calling our helper to obtain the PyObject of the Python
|
/* Calling our helper to obtain the PyObject of the Python
|
||||||
function. */
|
function. */
|
||||||
@@ -324,7 +320,6 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
|
|||||||
done:
|
done:
|
||||||
|
|
||||||
Py_XDECREF (resultobj);
|
Py_XDECREF (resultobj);
|
||||||
do_cleanups (cleanup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by gdb for command completion. */
|
/* Called by gdb for command completion. */
|
||||||
@@ -335,9 +330,8 @@ cmdpy_completer (struct cmd_list_element *command,
|
|||||||
{
|
{
|
||||||
PyObject *resultobj = NULL;
|
PyObject *resultobj = NULL;
|
||||||
VEC (char_ptr) *result = NULL;
|
VEC (char_ptr) *result = NULL;
|
||||||
struct cleanup *cleanup;
|
|
||||||
|
|
||||||
cleanup = ensure_python_env (get_current_arch (), current_language);
|
gdbpy_enter enter_py (get_current_arch (), current_language);
|
||||||
|
|
||||||
/* Calling our helper to obtain the PyObject of the Python
|
/* Calling our helper to obtain the PyObject of the Python
|
||||||
function. */
|
function. */
|
||||||
@@ -404,7 +398,6 @@ cmdpy_completer (struct cmd_list_element *command,
|
|||||||
done:
|
done:
|
||||||
|
|
||||||
Py_XDECREF (resultobj);
|
Py_XDECREF (resultobj);
|
||||||
do_cleanups (cleanup);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user