[29/31] inferior::clear_thread_list always silent
Commit Message
Now that the MI mi_thread_exit observer ignores "silent", there's no
difference between inferior::clean_thread_list with silent true or
false. And for the CLI, clean_thread_list() never printed anything
either. So we can eliminate the 'silent' parameter.
Change-Id: I90ff9f07537d22ea70986fbcfe8819cac7e06613
---
gdb/inferior.c | 12 ++++++------
gdb/inferior.h | 5 ++---
gdb/thread.c | 2 +-
3 files changed, 9 insertions(+), 10 deletions(-)
Comments
Pedro Alves <pedro@palves.net> writes:
> Now that the MI mi_thread_exit observer ignores "silent", there's no
> difference between inferior::clean_thread_list with silent true or
> false. And for the CLI, clean_thread_list() never printed anything
> either. So we can eliminate the 'silent' parameter.
>
> Change-Id: I90ff9f07537d22ea70986fbcfe8819cac7e06613
> ---
> gdb/inferior.c | 12 ++++++------
> gdb/inferior.h | 5 ++---
> gdb/thread.c | 2 +-
> 3 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/gdb/inferior.c b/gdb/inferior.c
> index 23cbfd63bde..eacb65ec1d7 100644
> --- a/gdb/inferior.c
> +++ b/gdb/inferior.c
> @@ -168,13 +168,13 @@ add_inferior (int pid)
> /* See inferior.h. */
>
> void
> -inferior::clear_thread_list (bool silent)
> +inferior::clear_thread_list ()
> {
> thread_list.clear_and_dispose ([=] (thread_info *thr)
> {
> - threads_debug_printf ("deleting thread %s, silent = %d",
> - thr->ptid.to_string ().c_str (), silent);
> - set_thread_exited (thr, silent);
> + threads_debug_printf ("deleting thread %s",
> + thr->ptid.to_string ().c_str ());
> + set_thread_exited (thr, true);
> if (thr->deletable ())
> delete thr;
> });
> @@ -184,7 +184,7 @@ inferior::clear_thread_list (bool silent)
> void
> delete_inferior (struct inferior *inf)
> {
> - inf->clear_thread_list (true);
> + inf->clear_thread_list ();
>
> auto it = inferior_list.iterator_to (*inf);
> inferior_list.erase (it);
> @@ -204,7 +204,7 @@ delete_inferior (struct inferior *inf)
> static void
> exit_inferior_1 (struct inferior *inf, int silent)
> {
> - inf->clear_thread_list (silent);
> + inf->clear_thread_list ();
If you wanted you could also remove SILENT from exit_inferior_1 as I
don't believe it is used there now either.
Which would then allow exit_inferior and exit_inferior_silent to be
merged.
... or this can be done in a follow up patch.
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
Thanks,
Andrew
>
> gdb::observers::inferior_exit.notify (inf);
>
> diff --git a/gdb/inferior.h b/gdb/inferior.h
> index 69525a2e053..07d9527a802 100644
> --- a/gdb/inferior.h
> +++ b/gdb/inferior.h
> @@ -425,9 +425,8 @@ class inferior : public refcounted_object,
> inline safe_inf_threads_range threads_safe ()
> { return safe_inf_threads_range (this->thread_list.begin ()); }
>
> - /* Delete all threads in the thread list. If SILENT, exit threads
> - silently. */
> - void clear_thread_list (bool silent);
> + /* Delete all threads in the thread list, silently. */
> + void clear_thread_list ();
>
> /* Continuations-related methods. A continuation is an std::function
> to be called to finish the execution of a command when running
> diff --git a/gdb/thread.c b/gdb/thread.c
> index 2c45d528bba..2ca3a867d8c 100644
> --- a/gdb/thread.c
> +++ b/gdb/thread.c
> @@ -235,7 +235,7 @@ init_thread_list (void)
> highest_thread_num = 0;
>
> for (inferior *inf : all_inferiors ())
> - inf->clear_thread_list (true);
> + inf->clear_thread_list ();
> }
>
> /* Allocate a new thread of inferior INF with target id PTID and add
> --
> 2.36.0
@@ -168,13 +168,13 @@ add_inferior (int pid)
/* See inferior.h. */
void
-inferior::clear_thread_list (bool silent)
+inferior::clear_thread_list ()
{
thread_list.clear_and_dispose ([=] (thread_info *thr)
{
- threads_debug_printf ("deleting thread %s, silent = %d",
- thr->ptid.to_string ().c_str (), silent);
- set_thread_exited (thr, silent);
+ threads_debug_printf ("deleting thread %s",
+ thr->ptid.to_string ().c_str ());
+ set_thread_exited (thr, true);
if (thr->deletable ())
delete thr;
});
@@ -184,7 +184,7 @@ inferior::clear_thread_list (bool silent)
void
delete_inferior (struct inferior *inf)
{
- inf->clear_thread_list (true);
+ inf->clear_thread_list ();
auto it = inferior_list.iterator_to (*inf);
inferior_list.erase (it);
@@ -204,7 +204,7 @@ delete_inferior (struct inferior *inf)
static void
exit_inferior_1 (struct inferior *inf, int silent)
{
- inf->clear_thread_list (silent);
+ inf->clear_thread_list ();
gdb::observers::inferior_exit.notify (inf);
@@ -425,9 +425,8 @@ class inferior : public refcounted_object,
inline safe_inf_threads_range threads_safe ()
{ return safe_inf_threads_range (this->thread_list.begin ()); }
- /* Delete all threads in the thread list. If SILENT, exit threads
- silently. */
- void clear_thread_list (bool silent);
+ /* Delete all threads in the thread list, silently. */
+ void clear_thread_list ();
/* Continuations-related methods. A continuation is an std::function
to be called to finish the execution of a command when running
@@ -235,7 +235,7 @@ init_thread_list (void)
highest_thread_num = 0;
for (inferior *inf : all_inferiors ())
- inf->clear_thread_list (true);
+ inf->clear_thread_list ();
}
/* Allocate a new thread of inferior INF with target id PTID and add