public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug remote/30129] Thread exited messages are missing for remote targets
Date: Wed, 23 Aug 2023 09:12:28 +0000	[thread overview]
Message-ID: <bug-30129-4717-a6sdvII4Ko@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30129-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30129

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Burgess <aburgess@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9d7d58e7262eff313be6a1e66b8b026e3e7fed0d

commit 9d7d58e7262eff313be6a1e66b8b026e3e7fed0d
Author: Pedro Alves <pedro@palves.net>
Date:   Mon Dec 12 20:31:00 2022 +0000

    gdb: centralize "[Thread ...exited]" notifications

    Currently, each target backend is responsible for printing "[Thread
    ...exited]" before deleting a thread.  This leads to unnecessary
    differences between targets, like e.g. with the remote target, we
    never print such messages, even though we do print "[New Thread ...]".

    E.g., debugging the gdb.threads/attach-many-short-lived-threads.exp
    with gdbserver, letting it run for a bit, and then pressing Ctrl-C, we
    currently see:

     (gdb) c
     Continuing.
     ^C[New Thread 3850398.3887449]
     [New Thread 3850398.3887500]
     [New Thread 3850398.3887551]
     [New Thread 3850398.3887602]
     [New Thread 3850398.3887653]
     ...

     Thread 1 "attach-many-sho" received signal SIGINT, Interrupt.
     0x00007ffff7e6a23f in __GI___clock_nanosleep (clock_id=clock_id@entry=0,
flags=flags@entry=0, req=req@entry=0x7fffffffda80,
rem=rem@entry=0x7fffffffda80)
         at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
     78      in ../sysdeps/unix/sysv/linux/clock_nanosleep.c
     (gdb)

    Above, we only see "New Thread" notifications, even though threads
    were deleted.

    After this patch, we'll see:

     (gdb) c
     Continuing.
     ^C[Thread 3558643.3577053 exited]
     [Thread 3558643.3577104 exited]
     [Thread 3558643.3577155 exited]
     [Thread 3558643.3579603 exited]
     ...
     [New Thread 3558643.3597415]
     [New Thread 3558643.3600015]
     [New Thread 3558643.3599965]
     ...

     Thread 1 "attach-many-sho" received signal SIGINT, Interrupt.
     0x00007ffff7e6a23f in __GI___clock_nanosleep (clock_id=clock_id@entry=0,
flags=flags@entry=0, req=req@entry=0x7fffffffda80,
rem=rem@entry=0x7fffffffda80)
         at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
     78      in ../sysdeps/unix/sysv/linux/clock_nanosleep.c
     (gdb) q

    This commit fixes this by moving the thread exit printing to common
    code instead, triggered from within delete_thread (or rather,
    set_thread_exited).

    There's one wrinkle, though.  While most targest want to print:

     [Thread ... exited]

    the Windows target wants to print:

     [Thread ... exited with code <exit_code>]

    ... and sometimes wants to suppress the notification for the main
    thread.  To address that, this commits adds a delete_thread_with_code
    function, only used by that target (so far).

    This fix was originally posted as part of a larger series:

     
https://inbox.sourceware.org/gdb-patches/20221212203101.1034916-1-pedro@palves.net/

    But didn't really need to be part of that series.  In order to get
    this fix merged sooner, I (Andrew Burgess) have rebased this commit
    outside of the original series.  Any bugs introduced while splitting
    this patch out and rebasing, are entirely my own.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30129
    Co-Authored-By: Andrew Burgess <aburgess@redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-08-23  9:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 15:38 [Bug remote/30129] New: " aburgess at redhat dot com
2023-03-09 11:31 ` [Bug remote/30129] " cvs-commit at gcc dot gnu.org
2023-08-23  9:12 ` cvs-commit at gcc dot gnu.org [this message]
2023-08-23  9:14 ` aburgess at redhat dot com

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=bug-30129-4717-a6sdvII4Ko@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).