From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19086 invoked by alias); 14 Aug 2017 03:41:13 -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 5113 invoked by uid 89); 14 Aug 2017 03:40:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 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=CURRENT, xxx X-HELO: gproxy9-pub.mail.unifiedlayer.com Received: from gproxy9-pub.mail.unifiedlayer.com (HELO gproxy9-pub.mail.unifiedlayer.com) (69.89.20.122) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Aug 2017 03:40:45 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy9.mail.unifiedlayer.com (Postfix) with ESMTP id 13FD61E0633 for ; Sun, 13 Aug 2017 21:40:43 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id wrgg1v0012f2jeq01rgjB2; Sun, 13 Aug 2017 21:40:43 -0600 X-Authority-Analysis: v=2.2 cv=FrR1xyjq c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=KeKAF7QvOSUA:10 a=zstS-IiYAAAA:8 a=LUC2-YRUChO0msODcdIA:9 a=l52J46qfxQlJmTs5:21 a=cMEGiEmDGWF1he1I:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-24-97.hlrn.qwest.net ([75.166.24.97]:55932 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dh6F5-0025eE-Qu; Sun, 13 Aug 2017 21:40:39 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 08/13] Move some code later in backtrace_command_1 Date: Mon, 14 Aug 2017 03:41:00 -0000 Message-Id: <20170814034030.20863-9-tom@tromey.com> In-Reply-To: <20170814034030.20863-1-tom@tromey.com> References: <20170814034030.20863-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dh6F5-0025eE-Qu X-Source-Sender: 75-166-24-97.hlrn.qwest.net (bapiya.Home) [75.166.24.97]:55932 X-Source-Auth: tom+tromey.com X-Email-Count: 9 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-08/txt/msg00276.txt.bz2 PR backtrace/15584 notes that some code in backtrace_command_1 is not useful when frame filters are in use. This patch moves this code into the no-frame-filters "if". This also removes the unused local "trailing_level", which I noticed while moving the code around. ChangeLog 2017-08-13 Tom Tromey PR backtrace/15584: * stack.c (backtrace_command_1): Move some code into no-filters "if". --- gdb/ChangeLog | 6 ++++ gdb/stack.c | 105 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 59 insertions(+), 52 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 33db802..630e27b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2017-08-13 Tom Tromey + PR backtrace/15584: + * stack.c (backtrace_command_1): Move some code into no-filters + "if". + +2017-08-13 Tom Tromey + * python/py-framefilter.c (throw_quit_or_print_exception): New function. (gdbpy_apply_frame_filter): Use it. diff --git a/gdb/stack.c b/gdb/stack.c index 30fd5ce..94f24b2 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1720,49 +1720,17 @@ backtrace_command_1 (char *count_exp, int flags, int no_filters, struct frame_info *fi; int count; int i; - struct frame_info *trailing; - int trailing_level, py_start = 0, py_end = 0; + int py_start = 0, py_end = 0; enum ext_lang_bt_status result = EXT_LANG_BT_ERROR; if (!target_has_stack) error (_("No stack.")); - /* The following code must do two things. First, it must set the - variable TRAILING to the frame from which we should start - printing. Second, it must set the variable count to the number - of frames which we should print, or -1 if all of them. */ - trailing = get_current_frame (); - - trailing_level = 0; if (count_exp) { count = parse_and_eval_long (count_exp); if (count < 0) - { - struct frame_info *current; - - py_start = count; - count = -count; - - current = trailing; - while (current && count--) - { - QUIT; - current = get_prev_frame (current); - } - - /* Will stop when CURRENT reaches the top of the stack. - TRAILING will be COUNT below it. */ - while (current) - { - QUIT; - trailing = get_prev_frame (trailing); - current = get_prev_frame (current); - trailing_level++; - } - - count = -1; - } + py_start = count; else { py_start = 0; @@ -1775,24 +1743,6 @@ backtrace_command_1 (char *count_exp, int flags, int no_filters, count = -1; } - if (info_verbose) - { - /* Read in symbols for all of the frames. Need to do this in a - separate pass so that "Reading in symbols for xxx" messages - don't screw up the appearance of the backtrace. Also if - people have strong opinions against reading symbols for - backtrace this may have to be an option. */ - i = count; - for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi)) - { - CORE_ADDR pc; - - QUIT; - pc = get_frame_address_in_block (fi); - expand_symtab_containing_pc (pc, find_pc_mapped_section (pc)); - } - } - if (! no_filters) { enum ext_lang_frame_args arg_type; @@ -1815,6 +1765,57 @@ backtrace_command_1 (char *count_exp, int flags, int no_filters, "no-filters" has been specified from the command. */ if (no_filters || result == EXT_LANG_BT_NO_FILTERS) { + struct frame_info *trailing; + + /* The following code must do two things. First, it must set the + variable TRAILING to the frame from which we should start + printing. Second, it must set the variable count to the number + of frames which we should print, or -1 if all of them. */ + trailing = get_current_frame (); + + if (count_exp != NULL && count < 0) + { + struct frame_info *current; + + count = -count; + + current = trailing; + while (current && count--) + { + QUIT; + current = get_prev_frame (current); + } + + /* Will stop when CURRENT reaches the top of the stack. + TRAILING will be COUNT below it. */ + while (current) + { + QUIT; + trailing = get_prev_frame (trailing); + current = get_prev_frame (current); + } + + count = -1; + } + + if (info_verbose) + { + /* Read in symbols for all of the frames. Need to do this in a + separate pass so that "Reading in symbols for xxx" messages + don't screw up the appearance of the backtrace. Also if + people have strong opinions against reading symbols for + backtrace this may have to be an option. */ + i = count; + for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi)) + { + CORE_ADDR pc; + + QUIT; + pc = get_frame_address_in_block (fi); + expand_symtab_containing_pc (pc, find_pc_mapped_section (pc)); + } + } + for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi)) { QUIT; -- 2.9.4