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 gdb/19318] "kill inferior N" and "detach inferior N" commands shouldn't switch to inferior N
Date: Thu, 29 Oct 2020 14:36:16 +0000	[thread overview]
Message-ID: <bug-19318-4717-cqcH2gkJRC@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-19318-4717@http.sourceware.org/bugzilla/>

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

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tankut Baris Aktemur
<aktemur@sourceware.org>:

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

commit cfaa8f76928803afda1e1862bcd0ab5f7febd647
Author: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Date:   Thu Oct 29 15:33:39 2020 +0100

    gdb: restore thread after detaching or killing an inferior

    The "detach inferiors N" command causes the current inferior to
    switch.  E.g.:

      $ gdb a.out
      Reading symbols from a.out...
      (gdb) start
      ...
      (gdb) add-inferior
      [New inferior 2]
      Added inferior 2 on connection 1 (native)
      (gdb) inferior 2
      [Switching to inferior 2 [<null>] (<noexec>)]
      (gdb) info inferiors
        Num  Description       Connection           Executable
        1    process 18242     1 (native)           /path/to/a.out
      * 2    <null>            1 (native)
      (gdb) detach inferiors 1
      Detaching from program: /path/to/a.out, process 18242
      [Inferior 1 (process 18242) detached]
      (gdb) info inferiors
        Num  Description       Connection           Executable
      * 1    <null>                                 /path/to/a.out
        2    <null>            1 (native)
      (gdb)

    The same switch happens with the "kill inferiors N" command.  Prevent
    it by restoring the current thread.

    gdb/ChangeLog:
    2020-10-29  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

            PR gdb/19318
            * inferior.c (detach_inferior_command): Restore the current thread.
            (kill_inferior_command): Ditto.

    gdb/testsuite/ChangeLog:
    2020-10-29  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

            * gdb.base/kill-detach-inferiors-cmd.exp: Check that 'kill
            inferiors' and 'detach inferiors' do not change the current
            inferior.

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

       reply	other threads:[~2020-10-29 14:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-19318-4717@http.sourceware.org/bugzilla/>
2020-10-29 14:36 ` cvs-commit at gcc dot gnu.org [this message]
2022-01-09 23:30 ` tromey at sourceware dot org

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-19318-4717-cqcH2gkJRC@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).