public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [patch] Sort threads for thread apply all (bt)
Date: Thu, 15 Jan 2015 19:29:00 -0000	[thread overview]
Message-ID: <CADPb22R_dY8nfU4bgpPS+4K5gG9cdMzCqW--H85hMwBDdh+MRg@mail.gmail.com> (raw)
In-Reply-To: <20150115183316.GA16405@host2.jankratochvil.net>

On Thu, Jan 15, 2015 at 10:33 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> Hi,
>
> downstream Fedora request:
>         Please make it easier to find the backtrace of the crashing thread
>         https://bugzilla.redhat.com/show_bug.cgi?id=1024504
>
> Currently after loading a core file GDB prints:
>
> Core was generated by `./threadcrash1'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x000000000040062f in start (arg=0x0) at threadcrash1.c:8
> 8       *(volatile int *)0=0;
> (gdb) _
>
> there is nowhere seen which of the threads had crashed.  In reality GDB always
> numbers that thread as #1 and it is the current thread that time.  But after
> dumping all the info into a file for later analysis it is no longer obvious.
> 'thread apply all bt' even puts the thread #1 to the _end_ of the output!!!
>
> Should GDB always print after loading a core file what "thread" command would
> print?
> [Current thread is 1 (Thread 0x7fcbe28fe700 (LWP 15453))]

Sounds reasonable to me.
Though there is the concern to not even talk about threads if there are "none".
So maybe only print that if there is more than one thread?

> Or should the "thread" output be printed only in non-interactive mode?
>
> Or something different?
>
> Or is the current behavior OK as is and the tools calling GDB in batch mode
> should indicate the thread #1 on their own?
>
> ------------------------------------------------------------------------------
>
> I find maybe as good enough and with no risk of UI change flamewar to just
> sort the threads by their number.  Currently they are printed as they happen
> in the internal GDB list which has no advantage.  Printing thread #1 as the
> first one with assumed 'thread apply all bt' (after the core file is loaded)
> should make the complaint resolved I guess.
>
> No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu.

No objection to sorting the list, but if thread #1 is the important one,
then a concern could be it'll have scrolled off the screen (such a
concern has been voiced in another thread in another context),
and if not lost (say it's in an emacs buffer) one would still have
to scroll back to see it.
So one *could* still want #1 to be last.
Do we want an option to choose the sort direction?
[I wouldn't make it a global parameter, just an option to
thread apply.]

  reply	other threads:[~2015-01-15 19:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 18:33 Jan Kratochvil
2015-01-15 19:29 ` Doug Evans [this message]
2015-01-16 23:38   ` [patchv2] " Jan Kratochvil
2015-01-22  0:26     ` Doug Evans
2015-01-22 11:18       ` Pedro Alves
2015-01-22 16:43         ` Jan Kratochvil
2015-01-22 17:07           ` Pedro Alves
2015-01-22 17:18             ` Jan Kratochvil
2015-01-22 18:09               ` Doug Evans
2015-01-22 18:13                 ` Jan Kratochvil
2015-01-22 18:49       ` [patchv3] " Jan Kratochvil
2015-01-22 18:52         ` Eli Zaretskii
2015-01-22 19:24           ` [patchv4] " Jan Kratochvil
2015-01-22 19:34             ` Doug Evans
2015-01-22 20:08               ` Doug Evans
2015-01-22 21:15               ` [commit] [patchv5] " Jan Kratochvil
2015-01-22 20:52             ` [patchv4] " Eli Zaretskii
2015-01-22 19:10         ` [patchv3] " Doug Evans
2015-01-22 19:23           ` Doug Evans
2015-01-22 19:24           ` [patchv5] " Jan Kratochvil
2015-01-22 20:37           ` [patchv3] " Doug Evans
2015-01-17 20:59   ` [patch] Print current thread after loading a core file [Re: [patch] Sort threads for thread apply all (bt)] Jan Kratochvil
2015-01-22  0:36     ` Doug Evans
2015-01-22 18:36       ` [commit] " Jan Kratochvil

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=CADPb22R_dY8nfU4bgpPS+4K5gG9cdMzCqW--H85hMwBDdh+MRg@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.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).