[pushed] Remove last traces of discard_all_inferiors (Re: [PATCH v2 18/24] Multi-target support)
Commit Message
On 1/11/20 3:12 AM, Simon Marchi wrote:
> On 2019-10-17 6:50 p.m., Pedro Alves wrote:
>> @@ -539,14 +574,14 @@ extern void exit_inferior_num_silent (int num);
>>
>> extern void inferior_appeared (struct inferior *inf, int pid);
>>
>> -/* Get rid of all inferiors. */
>> -extern void discard_all_inferiors (void);
>
> I'm rebasing my -Wmissing-declarations patch series and see this:
>
> CXX inferior.o
> /home/simark/src/binutils-gdb/gdb/inferior.c:264:1: error: no previous declaration for ‘void discard_all_inferiors()’ [-Werror=missing-declarations]
> 264 | discard_all_inferiors (void)
> | ^~~~~~~~~~~~~~~~~~~~~
>
> The declaration of discard_all_inferiors was removed, but not the definition, I
> guess the intent was to remove the definition as well?
Whoops, yes, indeed.
>
> Also grepping for it finds one remaining use:
>
> bsd-kvm.c:159: discard_all_inferiors ();
>
> I presume that this call should just be removed too?
I think we still need the exit_inferiors call. I suspect direct
calls to exit_inferior shouldn't happen -- that we should use
detach/kill/disconnect instead, but that's another story.
Here's the minimal & obvious patch, which I've just now pushed.
From 4ec89149dd83efecea15300bf425c9988f4cd5c0 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Sun, 12 Jan 2020 00:40:02 +0000
Subject: [PATCH] Remove last traces of discard_all_inferiors
The multi-target patch should have removed all traces of
discard_all_inferiors, but somehow one use stayed behind along with
the definition of the function.
discard_all_inferiors is bad now because it blindly exits inferiors of
all target connections. It's best to remove it.
gdb/ChangeLog:
2020-01-12 Pedro Alves <palves@redhat.com>
* bsd-kvm.c (bsd_kvm_target::close): Call exit_inferior_silent
directly for the current inferior instead of
discard_all_inferiors.
(discard_all_inferiors): Delete.
---
gdb/ChangeLog | 7 +++++++
gdb/bsd-kvm.c | 2 +-
gdb/inferior.c | 7 -------
3 files changed, 8 insertions(+), 8 deletions(-)
base-commit: 57d87c09a33acdce280f4c9ae4f55b885a5cee99
@@ -1,3 +1,10 @@
+2020-01-12 Pedro Alves <palves@redhat.com>
+
+ * bsd-kvm.c (bsd_kvm_target::close): Call exit_inferior_silent
+ directly for the current inferior instead of
+ discard_all_inferiors.
+ (discard_all_inferiors): Delete.
+
2020-01-11 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (box_win): Check cli_styling.
@@ -156,7 +156,7 @@ bsd_kvm_target::close ()
}
inferior_ptid = null_ptid;
- discard_all_inferiors ();
+ exit_inferior_silent (current_inferior ());
}
static LONGEST
@@ -260,13 +260,6 @@ inferior_appeared (struct inferior *inf, int pid)
gdb::observers::inferior_appeared.notify (inf);
}
-void
-discard_all_inferiors (void)
-{
- for (inferior *inf : all_non_exited_inferiors ())
- exit_inferior_silent (inf);
-}
-
struct inferior *
find_inferior_id (int num)
{