From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 855B9385773C for ; Mon, 21 Aug 2023 09:31:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 855B9385773C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692610295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g8CJgpEfsbAo1ebM8Ihb/mVeaZ0FGjvtBSjI3u35BzU=; b=CpSqrXt/sutCd+/a3L8+nqz2PSJ3n3Sv4bJmhlZwHcQnEjPqltNM3NH6wilFe6dGESQRP9 ocKqz1jdSiwQgfczn3MgKpnzd/wzubmBTaYzaM2279CMHQM1OS66dO+w4v1jYP/lUIlE68 VRpbJZJ/9QWnzDcV8B7TuvD991knL/s= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-M8qlEEcDMb-nFCkBB0l8gQ-1; Mon, 21 Aug 2023 05:31:33 -0400 X-MC-Unique: M8qlEEcDMb-nFCkBB0l8gQ-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2bb99d9c60eso32474381fa.2 for ; Mon, 21 Aug 2023 02:31:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692610292; x=1693215092; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g8CJgpEfsbAo1ebM8Ihb/mVeaZ0FGjvtBSjI3u35BzU=; b=TZU7rc7198MMXRmb1Yo3lImVmdrCRog71lgaSuwC/eEaEiFSXPkk/PiH4utJ47G9Vs C477vW8p0CyJcih/hmJmZPTr3GEbQA0NFw8uzQ4UoPaAMjVgogpyG5J2n2aDt2I2A59c zGLlVRcJW55jfsz1J5/enqQ5kGSk0VzKucQge3vIz4OEJch9uVesNdTcDbJfpPxxntgl Fc1qmWKV1m4eMMOPOsztcZ+B72ktkHGdezRhHXpGzIJMLXiNhvUYZ3vzK/mSM4r52P4q /MQgWPiCuliBqTzZWFLlKvlADGzAvWy4095AdO5OiizhmktuHCnBHJvz6B56EvLyeh9y RaOQ== X-Gm-Message-State: AOJu0Yxq4i8zn/3Ylnjo83hqWgjE5S005WQLQoUfubjH+dxwYxmqnQz9 +poZNb7VvIRPuG0jIwLrRfREPun/GHeI0pVkAvG+a7piFt4am1iDd/rDhJlapCNbmNxqCnZOKSC SfXg0k8FdnyGAszfv/o2YplOhsSA8taxFXagt9YRBv7rmaMN+1UAq7e/j2ZrV8UrEANIl/W3Zo6 F8cOarfg== X-Received: by 2002:a2e:9796:0:b0:2bc:c51d:daa1 with SMTP id y22-20020a2e9796000000b002bcc51ddaa1mr309785lji.39.1692610291875; Mon, 21 Aug 2023 02:31:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUizdihVuEiPvYJ7WURtpW7GuP/jmBLlycznv2zR/YiMP/5bYOyfENelicgqUqVzhnu2RMug== X-Received: by 2002:a2e:9796:0:b0:2bc:c51d:daa1 with SMTP id y22-20020a2e9796000000b002bcc51ddaa1mr309754lji.39.1692610291404; Mon, 21 Aug 2023 02:31:31 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id k19-20020a1709061c1300b00992025654c1sm6320673ejg.179.2023.08.21.02.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 02:31:31 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Pedro Alves , Andrew Burgess Subject: [PATCH 1/3] gdb: make inferior::clear_thread_list always silent Date: Mon, 21 Aug 2023 10:31:25 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Pedro Alves After this commit: commit a78ef8757418105c35685c5d82b9fdf79459321b Date: Wed Jun 22 18:10:00 2022 +0100 Always emit =thread-exited notifications, even if silent The function mi_interp::on_thread_exited (or mi_thread_exit as the function was called back then) no longer makes use of the "silent" parameter. As a result there is no difference between inferior::clear_thread_list with silent true or false, because: - None of the interpreter ::on_thread_exited functions rely on the silent parameter, and - None of GDB's thread_exit observers rely on the silent parameter either. This commit removes the silent parameter from inferior::clear_thread_list, and makes the function always silent. This commit was originally 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. I had an interest in seeing this patch merged: https://inbox.sourceware.org/gdb-patches/20221212203101.1034916-31-pedro@palves.net/ Which also didn't really need to be part of the larger series, but does depend, at least a little, on this commit. In order to get the fix I'm interested in merged quicker, 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. There should be no user visible changes after this commit. Co-Authored-By: Andrew Burgess --- 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 eee4785fbf7..7220b704f20 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -247,13 +247,13 @@ inferior::find_thread (ptid_t ptid) /* 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 /* silent */); if (thr->deletable ()) delete thr; }); @@ -272,7 +272,7 @@ notify_inferior_removed (inferior *inf) 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); @@ -307,7 +307,7 @@ notify_inferior_disappeared (inferior *inf) static void exit_inferior_1 (struct inferior *inf, int silent) { - inf->clear_thread_list (silent); + inf->clear_thread_list (); notify_inferior_disappeared (inf); diff --git a/gdb/inferior.h b/gdb/inferior.h index 74578353482..c8429b86268 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -496,9 +496,8 @@ class inferior : public refcounted_object, /* Find (non-exited) thread PTID of this inferior. */ thread_info *find_thread (ptid_t ptid); - /* 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 63ed87e9aa6..2cb9e5e36d0 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -246,7 +246,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.25.4