From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <pedro@palves.net>, Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 2/3] gdb: remove the silent parameter from exit_inferior_1 and cleanup
Date: Mon, 21 Aug 2023 10:31:26 +0100 [thread overview]
Message-ID: <7f17b35579a7b5130db2ab44f2077a41de95d6e3.1692609662.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1692609662.git.aburgess@redhat.com>
After the previous commit, exit_inferior_1 no longer makes use of the
silent parameter. This commit removes this parameter and cleans up
the callers.
After doing this exit_inferior_1, exit_inferior, and
exit_inferior_silent are all equivalent, so rename exit_inferior_1 to
exit_inferior and delete exit_inferior_silent, update all the callers.
Also I spotted the declaration exit_inferior_num_silent in inferior.h,
but this function is not defined anywhere, so I deleted the
declaration.
There should be no user visible changes after this commit.
---
gdb/bsd-kvm.c | 2 +-
gdb/corelow.c | 2 +-
gdb/inferior.c | 23 +++++------------------
gdb/inferior.h | 7 +++----
gdb/infrun.c | 2 +-
gdb/tracectf.c | 2 +-
gdb/tracefile-tfile.c | 2 +-
7 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 49041ef99bf..7fb51dcc7f2 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -154,7 +154,7 @@ bsd_kvm_target::close ()
bsd_kvm_corefile.clear ();
switch_to_no_thread ();
- exit_inferior_silent (current_inferior ());
+ exit_inferior (current_inferior ());
}
static LONGEST
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 46bb1077b6d..4d692dc53e6 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -328,7 +328,7 @@ core_target::clear_core ()
{
switch_to_no_thread (); /* Avoid confusion from thread
stuff. */
- exit_inferior_silent (current_inferior ());
+ exit_inferior (current_inferior ());
/* Clear out solib state while the bfd is still open. See
comments in clear_solib in solib.c. */
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 7220b704f20..cf4caa923cf 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -301,11 +301,10 @@ notify_inferior_disappeared (inferior *inf)
gdb::observers::inferior_exit.notify (inf);
}
-/* If SILENT then be quiet -- don't announce a inferior exit, or the
- exit of its threads. */
+/* See inferior.h. */
-static void
-exit_inferior_1 (struct inferior *inf, int silent)
+void
+exit_inferior (struct inferior *inf)
{
inf->clear_thread_list ();
@@ -335,27 +334,15 @@ exit_inferior_1 (struct inferior *inf, int silent)
reinit_frame_cache ();
}
-void
-exit_inferior (inferior *inf)
-{
- exit_inferior_1 (inf, 0);
-}
-
-void
-exit_inferior_silent (inferior *inf)
-{
- exit_inferior_1 (inf, 1);
-}
-
/* See inferior.h. */
void
detach_inferior (inferior *inf)
{
- /* Save the pid, since exit_inferior_1 will reset it. */
+ /* Save the pid, since exit_inferior will reset it. */
int pid = inf->pid;
- exit_inferior_1 (inf, 0);
+ exit_inferior (inf);
if (print_inferior_events)
gdb_printf (_("[Inferior %d (%s) detached]\n"),
diff --git a/gdb/inferior.h b/gdb/inferior.h
index c8429b86268..04672582984 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -704,12 +704,11 @@ extern void delete_inferior (struct inferior *todel);
/* Delete an existing inferior list entry, due to inferior detaching. */
extern void detach_inferior (inferior *inf);
+/* Notify observers and interpreters that INF has gone away. Reset the INF
+ object back to an default, empty, state. Clear register and frame
+ caches. */
extern void exit_inferior (inferior *inf);
-extern void exit_inferior_silent (inferior *inf);
-
-extern void exit_inferior_num_silent (int num);
-
extern void inferior_appeared (struct inferior *inf, int pid);
/* Search function to lookup an inferior of TARG by target 'pid'. */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 72852e63906..4730d290442 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1328,7 +1328,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
following_inferior = add_inferior_with_spaces ();
swap_terminal_info (following_inferior, execing_inferior);
- exit_inferior_silent (execing_inferior);
+ exit_inferior (execing_inferior);
following_inferior->pid = pid;
}
diff --git a/gdb/tracectf.c b/gdb/tracectf.c
index 0ed2092c32b..1f3ec58227f 100644
--- a/gdb/tracectf.c
+++ b/gdb/tracectf.c
@@ -1187,7 +1187,7 @@ ctf_target::close ()
trace_dirname.reset ();
switch_to_no_thread (); /* Avoid confusion from thread stuff. */
- exit_inferior_silent (current_inferior ());
+ exit_inferior (current_inferior ());
trace_reset_local_state ();
}
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 59055e7ea1a..3440f375021 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -616,7 +616,7 @@ tfile_target::close ()
gdb_assert (trace_fd != -1);
switch_to_no_thread (); /* Avoid confusion from thread stuff. */
- exit_inferior_silent (current_inferior ());
+ exit_inferior (current_inferior ());
::close (trace_fd);
trace_fd = -1;
--
2.25.4
next prev parent reply other threads:[~2023-08-21 9:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 9:31 [PATCH 0/3] Fix thread exited messages for remote targets Andrew Burgess
2023-08-21 9:31 ` [PATCH 1/3] gdb: make inferior::clear_thread_list always silent Andrew Burgess
2023-08-21 9:31 ` Andrew Burgess [this message]
2023-08-21 9:31 ` [PATCH 3/3] gdb: centralize "[Thread ...exited]" notifications Andrew Burgess
2023-08-21 16:10 ` [PATCH 0/3] Fix thread exited messages for remote targets John Baldwin
2023-08-22 13:07 ` Pedro Alves
2023-08-22 16:54 ` John Baldwin
2023-08-22 13:02 ` Pedro Alves
2023-08-23 9:12 ` Andrew Burgess
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=7f17b35579a7b5130db2ab44f2077a41de95d6e3.1692609662.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
/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).