From patchwork Thu May 21 04:00:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 135378 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A7D04BB8F5F for ; Thu, 21 May 2026 05:10:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A7D04BB8F5F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=eB6d/7jU X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 5C87B4BA7998 for ; Thu, 21 May 2026 04:01:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C87B4BA7998 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C87B4BA7998 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779336081; cv=none; b=xDVnlP3NE4C4Kd3LRA2Q0+ue5sl1KekIBYuGc3uh4/laL9gX0RjRNt5WmVYAkJ/I6YpeUa0umYTcaVR2cPC+uzxMmMajrq0HcM0JEo4V5BWglqUsj0fVvI37VLxkEiX/XGhYpJICil5F6uzRBDC3Y1a3D21voe4cwwcDKzHVe6w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779336081; c=relaxed/simple; bh=YccqpDgtV6mBAHVf0B6ulq431zVKZl3SF8/HTjy1t7E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kP16FAFvKPmCRlq+pb+G89rANFBCrBobKFle6LxPpKlSMW5047dDaKdI7M7QjEuTIgaO9+jbnknTZTrnnNqNR2Oe7TTH22CZQvDVFjdaAIYDxY9t2lw3Cq0c3o1rUdtK4BP+fKKQBAoAcWFRrbTGXQHmUAufkGk8P9yQvN35Ygw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=eB6d/7jU DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C87B4BA7998 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 64L41DUM093774 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 May 2026 00:01:18 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 64L41DUM093774 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1779336078; bh=RvaLQtqIJcSONC+bhlzcc3b7y3k/CLZVgAElX4cRb6M=; h=From:To:Cc:Subject:Date:From; b=eB6d/7jU+X2sDgKWKNcK+9H1ydxMGouBjIPsnLEHnOTEWbuV0IGqrPPl/6TooejBq ih2vWj+92llKcWUJ94Vp1N9iFL5rtI8r0ivVQYgEl4QzOFd19dJeD52ilyF8EHNt53 1U1MMh6uCTjY6LnPJR5kdC68tCLnA/4RHbiNpdhxYGriFGFlaUjlkzfyiyH01qrniS LVT2kfEXbhmsnKFAM8DmAswP5dierzK1hRrdGsBJNwT5fcd3u2AGxMGoDU31UTMbU3 IznJDa4FDb7Ax5WB8fNl6uE7MsCBXeFD3iTHv7uYlmAG97wglzBiBd0Oex2KBUGoEL CihKVeeGGgKjA== Received: by simark.ca (Postfix) id 8C8261E062; Thu, 21 May 2026 00:01:13 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/2] gdb: lock complaint_mutex in clear_complaints Date: Thu, 21 May 2026 00:00:48 -0400 Message-ID: <20260521040112.1618748-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 21 May 2026 04:01:13 +0000 X-Spam-Status: No, score=-3034.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org From: Simon Marchi If I add a dummy complaint like complaint (_("I am a complaint")); in cooked_index_worker_debug_info::process_unit, and then load a file under a GDB built with ThreadSanitizer, I get this (trimmed for readability): WARNING: ThreadSanitizer: data race (pid=497507) Read of size 4 at 0x7208000004c8 by thread T4 (mutexes: write M0): #0 std::pair<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator*, std::__cxx1998::vector, std::allocator > > >, std::__debug::vector, std::allocator > >, std::random_access_iterator_tag>, bool> ankerl::unordered_dense::v4_8_0::detail::table, std::equal_to, std::allocator >, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false>::do_try_emplace(char const* const&) /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1227 (gdb+0xf0fd75) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #1 std::pair<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator*, std::__cxx1998::vector, std::allocator > > >, std::__debug::vector, std::allocator > >, std::random_access_iterator_tag>, bool> ankerl::unordered_dense::v4_8_0::detail::table, std::equal_to, std::allocator >, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false>::try_emplace<, int, true>(char const* const&) /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1701 (gdb+0xf0ec50) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #2 int& ankerl::unordered_dense::v4_8_0::detail::table, std::equal_to, std::allocator >, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false>::operator[](char const* const&) /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1926 (gdb+0xf0e3e2) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #3 complaint_internal(char const*, ...) /home/simark/src/binutils-gdb/gdb/complaints.c:50 (gdb+0xf0abc6) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #4 cooked_index_worker_debug_info::process_unit(dwarf2_per_cu*, dwarf2_per_objfile*, cooked_index_worker_result*) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3162 (gdb+0x11d741c) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #5 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu&)::{lambda()#1}::operator()() const /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3068 (gdb+0x122b195) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #6 void cooked_index_worker_result::catch_error(cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu&)::{lambda()#1}&&) /home/simark/src/binutils-gdb/gdb/dwarf2/cooked-index-worker.h:122 (gdb+0x1236454) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #7 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu&) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3066 (gdb+0x122b22d) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #8 cooked_index_worker_debug_info::parallel_indexing_worker::operator()(iterator_range*>) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3060 (gdb+0x122b0a3) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) ... Previous write of size 8 at 0x7208000004c8 by main thread: #0 __tsan_memset (libtsan.so.2+0x95e66) (BuildId: b5c99e8ceaf9098eb9a01fcfcc35ece8603116df) #1 ankerl::unordered_dense::v4_8_0::detail::table, std::equal_to, std::allocator >, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false>::clear_buckets() /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1116 (gdb+0xf0edd6) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #2 ankerl::unordered_dense::v4_8_0::detail::table, std::equal_to, std::allocator >, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false>::clear() /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1494 (gdb+0xf0e479) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #3 clear_complaints() /home/simark/src/binutils-gdb/gdb/complaints.c:74 (gdb+0xf0adbf) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #4 finish_new_objfile /home/simark/src/binutils-gdb/gdb/symfile.c:986 (gdb+0x1a2c65d) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #5 symbol_file_add_with_addrs /home/simark/src/binutils-gdb/gdb/symfile.c:1111 (gdb+0x1a2cdde) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #6 symbol_file_add_from_bfd(gdb::ref_ptr const&, char const*, enum_flags, std::__debug::vector >*, enum_flags, objfile*) /home/simark/src/binutils-gdb/gdb/symfile.c:1148 (gdb+0x1a2cfab) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #7 symbol_file_add(char const*, enum_flags, std::__debug::vector >*, enum_flags) /home/simark/src/binutils-gdb/gdb/symfile.c:1161 (gdb+0x1a2d03a) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #8 symbol_file_add_main_1 /home/simark/src/binutils-gdb/gdb/symfile.c:1185 (gdb+0x1a2d1a5) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #9 symbol_file_command(char const*, int) /home/simark/src/binutils-gdb/gdb/symfile.c:1615 (gdb+0x1a2ed10) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #10 file_command /home/simark/src/binutils-gdb/gdb/exec.c:580 (gdb+0x1305356) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) ... Location is heap block of size 32 at 0x7208000004c0 allocated by main thread: ... #11 __static_initialization_and_destruction_0 /home/simark/src/binutils-gdb/gdb/complaints.c:31 (gdb+0xf0df04) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) ... Mutex M0 (0x558908cdbc20) created at: #0 pthread_mutex_lock (libtsan.so.2+0x60b5a) (BuildId: b5c99e8ceaf9098eb9a01fcfcc35ece8603116df) #1 __gthread_mutex_lock(pthread_mutex_t*) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:795 (gdb+0xf0dfa6) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #2 std::mutex::lock() /usr/include/c++/16.1.1/bits/std_mutex.h:116 (gdb+0xf0dfa6) #3 std::lock_guard::lock_guard(std::mutex&) /usr/include/c++/16.1.1/bits/std_mutex.h:276 (gdb+0xf0e1f0) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #4 complaint_internal(char const*, ...) /home/simark/src/binutils-gdb/gdb/complaints.c:49 (gdb+0xf0abad) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #5 cooked_index_worker_debug_info::process_unit(dwarf2_per_cu*, dwarf2_per_objfile*, cooked_index_worker_result*) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3162 (gdb+0x11d741c) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #6 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu&)::{lambda()#1}::operator()() const /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3068 (gdb+0x122b195) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #7 void cooked_index_worker_result::catch_error(cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu&)::{lambda()#1}&&) /home/simark/src/binutils-gdb/gdb/dwarf2/cooked-index-worker.h:122 (gdb+0x1236454) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #8 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu&) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3066 (gdb+0x122b22d) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) #9 cooked_index_worker_debug_info::parallel_indexing_worker::operator()(iterator_range*>) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3060 (gdb+0x122b0a3) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f) ... This points to clear_complaints touching the global counters map in the main thread without holding a lock, while a background thread touched the map in a worker thread while holding the lock complaint_mutex. Fix this by holding the complaint_mutex lock in clear_complaints. Change-Id: Id2fe442486bcdf57156aacdc9253055702c07600 --- gdb/complaints.c | 1 + 1 file changed, 1 insertion(+) base-commit: 2bf7c41602d9da7dac7616aabb78da32c99dcc83 diff --git a/gdb/complaints.c b/gdb/complaints.c index 4a2318a7f805..ab6e2049685c 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -71,6 +71,7 @@ complaint_internal (const char *fmt, ...) void clear_complaints () { + gdb::lock_guard guard (complaint_mutex); counters.clear (); } From patchwork Thu May 21 04:00:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 135377 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6CF34BB8F45 for ; Thu, 21 May 2026 05:09:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6CF34BB8F45 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=P0UH6fmb X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 544CC4BA7985 for ; Thu, 21 May 2026 04:01:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 544CC4BA7985 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 544CC4BA7985 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779336081; cv=none; b=ZtqGYGoNrVFXuBk4Ggpxr+bMAaTaFMjI/yJhciD3t3yYitCKGsssTLF+mSvkVqHbwZNaC9Zr6tQSggYJlvIB5I+WnZG87vauGoMzzGEVyvuio2J/vgANb4SgZR5/yfgf/0ImYlsnFsR54O1PAvguSKd38J4cuui/0N/qrhVlsWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779336081; c=relaxed/simple; bh=CfycKwylq+ZlYmlp5b4sbezhQZ57NVKyU38MFSFnwsM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EClMu5H+ymzOPmjqaREfZt3zkgWbuS7xHuR+e5OPRJrrvzlsmO/80GZA/FXtR1ygwFPZb7A4nek4P0Rs3B7xUK+Bzb/owlIyXF5/spMGDXv0h5T7eB8Zg1Q8ubyywHQUybVWSSRoS2Qd41mlh613R6fMTnpiyU6f8Z0F7/jP1fI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=P0UH6fmb DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 544CC4BA7985 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 64L41ECd093779 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 May 2026 00:01:18 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 64L41ECd093779 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1779336079; bh=x+D/T7xozOfnlKlgyzp8YUS9p4owYgVL6mLwBJF73j4=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=P0UH6fmbwRMYyukqr9joCiG7UOKioOaedOezBr2TQwbSxIh+Gwk3pTKvTpI4j157/ aprbBw+YKw/kyuiChGAVJu72y545WRcNF98ckrjCk/qyvLLhWfQlMb1WYyX9TaLBd6 /v7E+0R3AJXJiatTs6AnPBNM8J6u/ibiayUGTQ2Ccy3pcLofJMIkW1no0QARb5DFaB 7s6QICKrybIYsLDGZ9yvTawYYZWG6N8QJMl6cN9ooUELl8y+zgZ/oo403igbIHyR8c aO9pYV+ySYi9uEAdX6sdFBTVkrifE48H74DIyEAUhYYsxTt0Q8TLPK8p2Gj1jT6ZmM 96ehaSuHZSdsA== Received: by simark.ca (Postfix) id 2703A1E08D; Thu, 21 May 2026 00:01:13 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/2] gdb: remove complaint_interceptor::g_complaint_interceptor Date: Thu, 21 May 2026 00:00:49 -0400 Message-ID: <20260521040112.1618748-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260521040112.1618748-1-simon.marchi@polymtl.ca> References: <20260521040112.1618748-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 21 May 2026 04:01:14 +0000 X-Spam-Status: No, score=-3034.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org From: Simon Marchi The thread_local g_complaint_interceptor pointer is unnecessary. The complaint_interceptor constructor registers itself as the warning hook via m_saved_warning_hook (this), so when complaint_internal dispatches through the warning hook, it lands in complaint_interceptor::warn with 'this' already pointing at the registered interceptor. Inside warn, g_complaint_interceptor and 'this' always refer to the same object. Replace g_complaint_interceptor->m_complaints with m_complaints in complaint_interceptor::warn and remove g_complaint_interceptor. Change-Id: I75565a5f2c0e51363f36be0e3544210c10bb5491 --- gdb/complaints.c | 9 ++------- gdb/complaints.h | 7 ------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/gdb/complaints.c b/gdb/complaints.c index ab6e2049685c..e3d68a869c99 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -77,13 +77,8 @@ clear_complaints () /* See complaints.h. */ -thread_local complaint_interceptor *complaint_interceptor::g_complaint_interceptor; - -/* See complaints.h. */ - complaint_interceptor::complaint_interceptor () - : m_saved_complaint_interceptor (&g_complaint_interceptor, this), - m_saved_warning_hook (this) + : m_saved_warning_hook (this) { } @@ -122,7 +117,7 @@ void complaint_interceptor::warn (const char *fmt, va_list args) { gdb::lock_guard guard (complaint_mutex); - g_complaint_interceptor->m_complaints.insert (string_vprintf (fmt, args)); + m_complaints.insert (string_vprintf (fmt, args)); } static void diff --git a/gdb/complaints.h b/gdb/complaints.h index c607194e265e..8f5cf24c1c9b 100644 --- a/gdb/complaints.h +++ b/gdb/complaints.h @@ -20,7 +20,6 @@ #ifndef GDB_COMPLAINTS_H #define GDB_COMPLAINTS_H -#include "gdbsupport/scoped_restore.h" #include "gdbsupport/unordered_set.h" /* Helper for complaint. */ @@ -89,17 +88,11 @@ class complaint_interceptor final : public warning_hook_handler_type /* The issued complaints. */ complaint_collection m_complaints; - /* The saved value of g_complaint_interceptor. */ - scoped_restore_tmpl m_saved_complaint_interceptor; - /* A helper function that is used by the 'complaint' implementation to issue a complaint. */ void warn (const char *, va_list) override ATTRIBUTE_PRINTF (2, 0); - /* This object. Used by the static callback function. */ - static thread_local complaint_interceptor *g_complaint_interceptor; - /* Object to initialise the warning hook. */ scoped_restore_warning_hook m_saved_warning_hook; };