public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Make "bt N" print correct number of frames when using a frame filter
Date: Mon, 14 Aug 2017 14:19:00 -0000	[thread overview]
Message-ID: <e42b9ccc-8e64-671a-e847-50ef6079c079@redhat.com> (raw)
In-Reply-To: <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

      reply	other threads:[~2017-08-14 14:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 16:04 Tom Tromey
2017-04-25 18:27 ` Sergio Durigan Junior
2017-04-26  0:17   ` Tom Tromey
2017-05-29 17:21 ` Tom Tromey
2017-09-30 20:38   ` Tom Tromey
2018-02-12 16:45     ` Tom Tromey
2018-02-24 17:09       ` Tom Tromey
2018-02-25 18:29         ` Simon Marchi
2018-02-26 16:35           ` Tom Tromey
2017-05-31 15:19 ` Phil Muldoon
2017-06-27 18:37 ` Pedro Alves
2017-07-14 18:56   ` Tom Tromey
2017-08-14 14:19     ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e42b9ccc-8e64-671a-e847-50ef6079c079@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).