From patchwork Tue Apr 25 19:41:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 20143 Received: (qmail 22196 invoked by alias); 25 Apr 2017 19:41:35 -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 22101 invoked by uid 89); 25 Apr 2017 19:41:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Cc, H*Ad:U*tom 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; Tue, 25 Apr 2017 19:41:32 +0000 Received: (qmail 22650 invoked by uid 0); 25 Apr 2017 19:41:33 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy7.mail.unifiedlayer.com with SMTP; 25 Apr 2017 19:41:33 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id CjhW1v0102f2jeq01jhZ3W; Tue, 25 Apr 2017 13:41:33 -0600 X-Authority-Analysis: v=2.2 cv=K+5SJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=AzvcPWV-tVgA:10 a=zstS-IiYAAAA:8 a=ZgvkkJmA0Bw1SZuE9_UA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-63-71.hlrn.qwest.net ([75.166.63.71]:40598 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1d36L4-0000OG-Es; Tue, 25 Apr 2017 13:41:30 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 06/10] Allow C-c to work in backtrace in more cases Date: Tue, 25 Apr 2017 13:41:09 -0600 Message-Id: <20170425194113.17862-7-tom@tromey.com> In-Reply-To: <20170425194113.17862-1-tom@tromey.com> References: <20170425194113.17862-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1d36L4-0000OG-Es X-Source-Sender: 75-166-63-71.hlrn.qwest.net (bapiya.Home) [75.166.63.71]:40598 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== PR cli/17716 notes that it is difficult to C-c (or "q" at a pagination prompt) while backtracing using a frame filter. One reason for this is that many places in py-framefilter.c use RETURN_MASK_ALL in a try/catch. This patch changes these spots to use RETURN_MASK_ERROR instead. This is safe to do because this entire file is exception safe now. ChangeLog 2017-04-25 Tom Tromey PR cli/17716: * python/py-framefilter.c (py_print_type, py_print_value) (enumerate_args, py_print_args, gdbpy_apply_frame_filter): Use RETURN_MASK_ERROR. --- gdb/ChangeLog | 7 +++++++ gdb/python/py-framefilter.c | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6b0c584..d0e0be4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2017-04-25 Tom Tromey + PR cli/17716: + * python/py-framefilter.c (py_print_type, py_print_value) + (enumerate_args, py_print_args, gdbpy_apply_frame_filter): Use + RETURN_MASK_ERROR. + +2017-04-25 Tom Tromey + * python/py-framefilter.c (enumerate_args): Use gdb::unique_xmalloc_ptr. diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 2ae2158..e0a7bd0 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -215,7 +215,7 @@ py_print_type (struct ui_out *out, struct value *val) type_print (value_type (val), "", &stb, -1); out->field_stream ("type", stb); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -255,7 +255,7 @@ py_print_value (struct ui_out *out, struct value *val, { type = check_typedef (value_type (val)); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -282,7 +282,7 @@ py_print_value (struct ui_out *out, struct value *val, common_val_print (val, &stb, indent, opts, language); out->field_stream ("value", stb); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -497,7 +497,7 @@ enumerate_args (PyObject *iter, { annotate_frame_args (); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -553,7 +553,7 @@ enumerate_args (PyObject *iter, { read_frame_arg (sym, frame, &arg, &entryarg); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -586,7 +586,7 @@ enumerate_args (PyObject *iter, out->text (", "); out->wrap_hint (" "); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -622,7 +622,7 @@ enumerate_args (PyObject *iter, { out->text (", "); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -636,7 +636,7 @@ enumerate_args (PyObject *iter, { annotate_arg_end (); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -867,7 +867,7 @@ py_print_args (PyObject *filter, if (! out->is_mi_like_p ()) out->text (" ("); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -884,7 +884,7 @@ py_print_args (PyObject *filter, if (! out->is_mi_like_p ()) out->text (")"); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { gdbpy_convert_exception (except); return EXT_LANG_BT_ERROR; @@ -1336,7 +1336,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, { gdbarch = get_frame_arch (frame); } - CATCH (except, RETURN_MASK_ALL) + CATCH (except, RETURN_MASK_ERROR) { /* Let gdb try to print the stack trace. */ return EXT_LANG_BT_NO_FILTERS;