From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60729 invoked by alias); 10 Nov 2016 22:20:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 60684 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=Hx-languages-length:2460 X-HELO: gproxy7-pub.mail.unifiedlayer.com Received: from gproxy7-pub.mail.unifiedlayer.com (HELO gproxy7-pub.mail.unifiedlayer.com) (70.40.196.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Thu, 10 Nov 2016 22:19:59 +0000 Received: (qmail 27872 invoked by uid 0); 10 Nov 2016 22:19:57 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy7.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 6NKu1u00F2f2jeq01NKx1n; 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=XIfkqFmowrmV1LsriN0A: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-1i; Thu, 10 Nov 2016 15:19:54 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 02/20] Use gdbpy_enter in py-breakpoint.c Date: Thu, 10 Nov 2016 22:20:00 -0000 Message-Id: <1478816387-27064-3-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-1i 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: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2016-11/txt/msg00252.txt.bz2 Change py-breakpoint.c to 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. --- gdb/ChangeLog | 6 ++++++ gdb/python/py-breakpoint.c | 14 ++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 460acf2..ac27ee7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2016-11-10 Tom Tromey + * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use + gdbpy_enter. + (gdbpy_breakpoint_has_cond): Likewise. + +2016-11-10 Tom Tromey + * python/python.c (gdbpy_enter): New constructor. (~gdbpy_enter): New destructor. (restore_python_env, ensure_python_env): Rewrite. diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index ee306c1..c23dba6 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -791,14 +791,14 @@ gdbpy_breakpoint_cond_says_stop (const struct extension_language_defn *extlang, struct gdbpy_breakpoint_object *bp_obj = b->py_bp_object; PyObject *py_bp = (PyObject *) bp_obj; struct gdbarch *garch; - struct cleanup *cleanup; if (bp_obj == NULL) return EXT_LANG_BP_STOP_UNSET; stop = -1; garch = b->gdbarch ? b->gdbarch : get_current_arch (); - cleanup = ensure_python_env (garch, current_language); + + gdbpy_enter enter_py (garch, current_language); if (bp_obj->is_finish_bp) bpfinishpy_pre_stop_hook (bp_obj); @@ -829,8 +829,6 @@ gdbpy_breakpoint_cond_says_stop (const struct extension_language_defn *extlang, if (bp_obj->is_finish_bp) bpfinishpy_post_stop_hook (bp_obj); - do_cleanups (cleanup); - if (stop < 0) return EXT_LANG_BP_STOP_UNSET; return stop ? EXT_LANG_BP_STOP_YES : EXT_LANG_BP_STOP_NO; @@ -844,21 +842,17 @@ int gdbpy_breakpoint_has_cond (const struct extension_language_defn *extlang, struct breakpoint *b) { - int has_func; PyObject *py_bp; struct gdbarch *garch; - struct cleanup *cleanup; if (b->py_bp_object == NULL) return 0; py_bp = (PyObject *) b->py_bp_object; garch = b->gdbarch ? b->gdbarch : get_current_arch (); - cleanup = ensure_python_env (garch, current_language); - has_func = PyObject_HasAttrString (py_bp, stop_func); - do_cleanups (cleanup); - return has_func; + gdbpy_enter enter_py (garch, current_language); + return PyObject_HasAttrString (py_bp, stop_func); } -- 2.7.4