This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Make "bt N" print correct number of frames when using a frame filter
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 14 Aug 2017 15:19:13 +0100
- Subject: Re: [RFA] Make "bt N" print correct number of frames when using a frame filter
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 41F43ACB0
- References: <20170423160446.17062-1-tom@tromey.com> <5aa8225f-70d1-2e69-9280-ca527b2ea981@redhat.com> <87wp7au9th.fsf@pokyo>
On 07/14/2017 07:56 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> Can you expand on the need for the PRINT_MORE_FRAMES flag and
> Pedro> having it based on from_tty? I assume that your first made
> Pedro> the printing unconditional, but then for some reason decided
> Pedro> against it?
>
> I think my reason was just to have it parallel the no-frame-filter code
> in stack.c:
>
> /* If we've stopped before the end, mention that. */
> if (fi && from_tty)
> printf_filtered (_("(More stack frames follow...)\n"));
>
> I don't know why this code is conditional on from_tty, but that seemed
> like a separate decision.
OK. I found that was added here:
+Tue Oct 2 11:20:02 1990 John Gilmore (gnu at cygint)
+
+ * stack.c (backtrace_command): Skip "more stack frames follow"
+ unless interactive.
Funny enough, around the same time the preloading of symbols
was added. See:
$ git diff 831c851165e1^..bd5635a1 -- stack.c
@@ -493,6 +515,28 @@ backtrace_command (count_exp)
else
count = -1;
+ if (info_verbose)
+ {
+ struct partial_symtab *ps;
+
+ /* 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 (frame = trailing;
+ frame != NULL && i--;
+ frame = get_prev_frame (frame))
+ {
+ QUIT;
+ fi = get_frame_info (frame);
+ ps = find_pc_psymtab (fi->pc);
+ if (ps)
+ (void) PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in */
+ }
+ }
+
for (i = 0, frame = trailing;
frame && count--;
i++, frame = get_prev_frame (frame))
@@ -503,7 +547,7 @@ backtrace_command (count_exp)
}
/* If we've stopped before the end, mention that. */
- if (frame)
+ if (frame && from_tty)
printf_filtered ("(More stack frames follow...)\n");
}
^L
Thanks,
Pedro Alves