From patchwork Thu Nov 10 22:19:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 17388 Received: (qmail 60971 invoked by alias); 10 Nov 2016 22:20:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 60682 invoked by uid 89); 10 Nov 2016 22:20:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=completion, 3206, 3308, 320, 6 X-HELO: gproxy4-pub.mail.unifiedlayer.com Received: from gproxy4-pub.mail.unifiedlayer.com (HELO gproxy4-pub.mail.unifiedlayer.com) (69.89.23.142) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Thu, 10 Nov 2016 22:19:59 +0000 Received: (qmail 29106 invoked by uid 0); 10 Nov 2016 22:19:57 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy4.mail.unifiedlayer.com with SMTP; 10 Nov 2016 22:19:57 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id 6NKu1u00s2f2jeq01NKx2J; Thu, 10 Nov 2016 15:19:57 -0700 X-Authority-Analysis: v=2.1 cv=fZg+lSgF c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=L24OOQBejmoA:10 a=zstS-IiYAAAA:8 a=xYq9E-_zJidokpcl4L4A:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-16-143-211.hlrn.qwest.net ([174.16.143.211]:60120 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1c4xhK-0002sd-Kp; Thu, 10 Nov 2016 15:19:54 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 03/20] Use gdbpy_enter in py-cmd.c Date: Thu, 10 Nov 2016 15:19:30 -0700 Message-Id: <1478816387-27064-4-git-send-email-tom@tromey.com> In-Reply-To: <1478816387-27064-1-git-send-email-tom@tromey.com> References: <1478816387-27064-1-git-send-email-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1c4xhK-0002sd-Kp X-Source-Sender: 174-16-143-211.hlrn.qwest.net (bapiya.Home) [174.16.143.211]:60120 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== Change py-cmd.c to use gdbpy_enter. 2016-11-10 Tom Tromey * python/py-cmd.c (cmdpy_destroyer) (cmdpy_completer_handle_brkchars, cmdpy_completer): Use gdbpy_enter. --- gdb/ChangeLog | 6 ++++++ gdb/python/py-cmd.c | 13 +++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ac27ee7..2478e7e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2016-11-10 Tom Tromey + * python/py-cmd.c (cmdpy_destroyer) + (cmdpy_completer_handle_brkchars, cmdpy_completer): Use + gdbpy_enter. + +2016-11-10 Tom Tromey + * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use gdbpy_enter. (gdbpy_breakpoint_has_cond): Likewise. diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 5fbd25c..3b82788 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -96,9 +96,8 @@ static void cmdpy_destroyer (struct cmd_list_element *self, void *context) { 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. */ cmd = (cmdpy_object *) context; @@ -110,8 +109,6 @@ cmdpy_destroyer (struct cmd_list_element *self, void *context) xfree ((char *) self->name); xfree ((char *) self->doc); xfree ((char *) self->prefixname); - - do_cleanups (cleanup); } /* 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) { 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 function. */ @@ -324,7 +320,6 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command, done: Py_XDECREF (resultobj); - do_cleanups (cleanup); } /* Called by gdb for command completion. */ @@ -335,9 +330,8 @@ cmdpy_completer (struct cmd_list_element *command, { PyObject *resultobj = 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 function. */ @@ -404,7 +398,6 @@ cmdpy_completer (struct cmd_list_element *command, done: Py_XDECREF (resultobj); - do_cleanups (cleanup); return result; }