From patchwork Tue Apr 23 13:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 88910 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CDCB384AB7B for ; Tue, 23 Apr 2024 13:26:05 +0000 (GMT) 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 38BDF3858C42 for ; Tue, 23 Apr 2024 13:25:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38BDF3858C42 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 38BDF3858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713878727; cv=none; b=bPtPE0sSPxgRv1uZoBHDUuQ0ODvUxHOpN/EWNxtcKiydJlZ4rt3XfanDRFdO9iVyIR6PqAxN/RqQIg+4LxgR6UkH0Ef/jVSP6lwEvYL3HZPdPGxV0sYjiv0j0SslKjz8O78QPykOfb91EKT4IvVf521SzIMxJs9Ub3BSiYZWVQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713878727; c=relaxed/simple; bh=eJ1B8HS64BywAFVtLmhHc5i/XPg/EhcpqNRHGPVpb8g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jp6/W3uz/CqLChZcwYbH53a1IB7yiDBGFxfCn2mPaY4cFEivmcd3pKQiQA6Dx4djxdKoAE5gUHZfFnY8oMJOJl7SAsVlaveOR9K/nOeHArM7deEAAo+1WaQdCs6XYlkOqMk3SFcAC30rePb1t8nv2YMhEt8nS4VHWhS3fS+SSvA= ARC-Authentication-Results: i=1; server2.sourceware.org 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 43NDPJVh056466 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 09:25:24 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NDPJVh056466 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713878724; bh=aeQgaGubUwe78QW2Eso1sCaXcx19rkYnuLBazUiGPFc=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=FWFbOF3J3HHnv0/xAXFE1242BfFdU9KSYayuGL2aDgoOHjMrgYFUh2dPoke++DOnl 0EWNE0fynkQmc3i9rZGTAD/GvY23/t8GAAg+6+R6A7DvQ4dMPcykhKw8r1rYrmhfBj XRBKXvQaGcckVlJ1D83Tg4XDuig6Mp3GW8mFeKA0= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 51BBF1E0AC; Tue, 23 Apr 2024 09:25:19 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/7] gdb: move declarations of check_quit_flag and set_quit_flag to extension.h Date: Tue, 23 Apr 2024 09:22:56 -0400 Message-ID: <20240423132517.2625632-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca> References: <20240423132517.2625632-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 13:25:19 +0000 X-Spam-Status: No, score=-3188.4 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_PASS, 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 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 Move them out of defs.h, to extension.h, since the implementations are in extension.c. Change-Id: Ie7321468bd7fecc684d70b09f72c3ee8ac75d8f4 Reviewed-By: Alexandra Petlanova Hajkova Tested-By: Alexandra Petlanova Hajkova --- gdb/defs.h | 19 ------------------- gdb/extension.c | 17 ++++------------- gdb/extension.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/gdb/defs.h b/gdb/defs.h index 91724d30195f..6f9c0d1f781a 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -94,25 +94,6 @@ extern std::string python_libdir; /* * Search path for separate debug files. */ extern std::string debug_file_directory; -/* GDB's SIGINT handler basically sets a flag; code that might take a - long time before it gets back to the event loop, and which ought to - be interruptible, checks this flag using the QUIT macro, which, if - GDB has the terminal, throws a quit exception. - - In addition to setting a flag, the SIGINT handler also marks a - select/poll-able file descriptor as read-ready. That is used by - interruptible_select in order to support interrupting blocking I/O - in a race-free manner. - - These functions use the extension_language_ops API to allow extension - language(s) and GDB SIGINT handling to coexist seamlessly. */ - -/* * Evaluate to non-zero if the quit flag is set, zero otherwise. This - will clear the quit flag as a side effect. */ -extern int check_quit_flag (void); -/* * Set the quit flag. */ -extern void set_quit_flag (void); - /* The current quit handler (and its type). This is called from the QUIT macro. See default_quit_handler below for default behavior. Parts of GDB temporarily override this to e.g., completely suppress diff --git a/gdb/extension.c b/gdb/extension.c index f4bdcc1f6110..2d692d054315 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -863,16 +863,10 @@ restore_active_ext_lang (struct active_ext_lang_state *previous) xfree (previous); } -/* Set the quit flag. - This only sets the flag in the currently active extension language. - If the currently active extension language does not have cooperative - SIGINT handling, then GDB's global flag is set, and it is up to the - extension language to call check_quit_flag. The extension language - is free to install its own SIGINT handler, but we still need to handle - the transition. */ +/* See extension.h. */ void -set_quit_flag (void) +set_quit_flag () { #if CXX_STD_THREAD std::lock_guard guard (ext_lang_mutex); @@ -894,13 +888,10 @@ set_quit_flag (void) } } -/* Return true if the quit flag has been set, false otherwise. - Note: The flag is cleared as a side-effect. - The flag is checked in all extension languages that support cooperative - SIGINT handling, not just the current one. This simplifies transitions. */ +/* See extension.h. */ int -check_quit_flag (void) +check_quit_flag () { #if CXX_STD_THREAD std::lock_guard guard (ext_lang_mutex); diff --git a/gdb/extension.h b/gdb/extension.h index 9ba1299f95e1..94a500d74586 100644 --- a/gdb/extension.h +++ b/gdb/extension.h @@ -429,4 +429,34 @@ class scoped_disable_cooperative_sigint_handling bool m_prev_cooperative_sigint_handling_disabled; }; +/* GDB's SIGINT handler basically sets a flag; code that might take a + long time before it gets back to the event loop, and which ought to + be interruptible, checks this flag using the QUIT macro, which, if + GDB has the terminal, throws a quit exception. + + In addition to setting a flag, the SIGINT handler also marks a + select/poll-able file descriptor as read-ready. That is used by + interruptible_select in order to support interrupting blocking I/O + in a race-free manner. + + These functions use the extension_language_ops API to allow extension + language(s) and GDB SIGINT handling to coexist seamlessly. */ + +/* Return true if the quit flag has been set, false otherwise. + Note: The flag is cleared as a side-effect. + The flag is checked in all extension languages that support cooperative + SIGINT handling, not just the current one. This simplifies transitions. */ + +extern int check_quit_flag (); + +/* Set the quit flag. + This only sets the flag in the currently active extension language. + If the currently active extension language does not have cooperative + SIGINT handling, then GDB's global flag is set, and it is up to the + extension language to call check_quit_flag. The extension language + is free to install its own SIGINT handler, but we still need to handle + the transition. */ + +extern void set_quit_flag (); + #endif /* EXTENSION_H */ From patchwork Tue Apr 23 13:22:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 88911 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AECDB384AB45 for ; Tue, 23 Apr 2024 13:26:07 +0000 (GMT) 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 5DB5D3858C50 for ; Tue, 23 Apr 2024 13:25:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DB5D3858C50 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 5DB5D3858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713878727; cv=none; b=IpZJm1S5r5UoVsLgBRkq7cvPzlkX+ZvPlisHA/O42CQY/n7Ijl281Cx4F8Qjlxc1G1jisUmciYf20E2wM80ceG3bJV5om/DnVEyxB1ruQ4FsM2xLn2o1c/b4GGt1lR+0LtRyv6dPJbxaJfYGofZDaZK3Y/SyqjzoL+s33Ushtks= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713878727; c=relaxed/simple; bh=4RLF6Va2aS3rxJ2gWLRRMV4c+E3PNnh210aSoID9cC8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ti4/0HjswUpuIx2d0uZdZ1I66yoFrHdZCEEbNHrzcrrt27hrXzfSeGV1lDyfpzK+gsChfGji/q0hN37uM0ruS+dp9uI6ensz1hFpKGk5kRCBOWAnxHFpK/SpyeihXJiWIhqO9A3t41cI5CpN4hxlil+xlb8wrNGXC1O5znmjMj8= ARC-Authentication-Results: i=1; server2.sourceware.org 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 43NDPJPC056473 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 09:25:24 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NDPJPC056473 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713878724; bh=i8sZE/l/WT4O3fSNwv7mF0IFR87PyFiylXF9ypJpuNo=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=cbJ//dtGx4nsilYp3Kc6+Okh/Sup9+LBsRySk8DAtWHKLOFHNo+piJ9Os1RD0g42I bZGHfa/9S2zvijJzRiSHTpeawrHGuyNnmUROS2OBI/Tx3/Ofox5UOSsfE7cFARvIP4 bPdYnbBTvkIdusxpBzqgwXMztU3dO3SMcjqlMcOs= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 926111E0C0; Tue, 23 Apr 2024 09:25:19 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/7] gdb: change return type of check_quit_flag to bool Date: Tue, 23 Apr 2024 09:22:57 -0400 Message-ID: <20240423132517.2625632-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca> References: <20240423132517.2625632-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 13:25:19 +0000 X-Spam-Status: No, score=-3188.4 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_PASS, 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 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 Change the return type of the check_quit_flag function to bool. Update a few related spots. Change-Id: I9d3a15d3f8651efb02c7d211f06222a592bd4184 --- gdb/extension-priv.h | 4 ++-- gdb/extension.c | 10 +++++----- gdb/extension.h | 2 +- gdb/python/python.c | 6 +++--- gdb/remote-fileio.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h index cb00cb6ff7b9..1365988b40dd 100644 --- a/gdb/extension-priv.h +++ b/gdb/extension-priv.h @@ -229,9 +229,9 @@ struct extension_language_ops This is called by GDB's SIGINT handler and must be async-safe. */ void (*set_quit_flag) (const struct extension_language_defn *); - /* Return non-zero if a SIGINT has occurred. + /* Return true if a SIGINT has occurred. This is expected to also clear the indicator. */ - int (*check_quit_flag) (const struct extension_language_defn *); + bool (*check_quit_flag) (const struct extension_language_defn *); /* Called before gdb prints its prompt, giving extension languages an opportunity to change it with set_prompt. diff --git a/gdb/extension.c b/gdb/extension.c index 2d692d054315..82d37fb09aea 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -890,21 +890,21 @@ set_quit_flag () /* See extension.h. */ -int +bool check_quit_flag () { #if CXX_STD_THREAD std::lock_guard guard (ext_lang_mutex); #endif /* CXX_STD_THREAD */ - int result = 0; + bool result = false; for (const struct extension_language_defn *extlang : extension_languages) { if (extlang->ops != nullptr && extlang->ops->check_quit_flag != NULL) - if (extlang->ops->check_quit_flag (extlang) != 0) - result = 1; + if (extlang->ops->check_quit_flag (extlang)) + result = true; } /* This is written in a particular way to avoid races. */ @@ -915,7 +915,7 @@ check_quit_flag () request. */ quit_serial_event_clear (); quit_flag = 0; - result = 1; + result = true; } return result; diff --git a/gdb/extension.h b/gdb/extension.h index 94a500d74586..258a77dbfccb 100644 --- a/gdb/extension.h +++ b/gdb/extension.h @@ -447,7 +447,7 @@ class scoped_disable_cooperative_sigint_handling The flag is checked in all extension languages that support cooperative SIGINT handling, not just the current one. This simplifies transitions. */ -extern int check_quit_flag (); +extern bool check_quit_flag (); /* Set the quit flag. This only sets the flag in the currently active extension language. diff --git a/gdb/python/python.c b/gdb/python/python.c index d6e5883476e1..a6875af63db7 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -121,7 +121,7 @@ static enum ext_lang_rc gdbpy_apply_type_printers static void gdbpy_free_type_printers (const struct extension_language_defn *, struct ext_lang_type_printers *); static void gdbpy_set_quit_flag (const struct extension_language_defn *); -static int gdbpy_check_quit_flag (const struct extension_language_defn *); +static bool gdbpy_check_quit_flag (const struct extension_language_defn *); static enum ext_lang_rc gdbpy_before_prompt_hook (const struct extension_language_defn *, const char *current_gdb_prompt); static std::optional gdbpy_colorize @@ -275,11 +275,11 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang) /* Return true if the quit flag has been set, false otherwise. */ -static int +static bool gdbpy_check_quit_flag (const struct extension_language_defn *extlang) { if (!gdb_python_initialized) - return 0; + return false; gdbpy_gil gil; return PyOS_InterruptOccurred (); diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index 9615dedaebd5..934ba3f8281d 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -316,7 +316,7 @@ static void remote_fileio_reply (remote_target *remote, int retcode, int error) { char buf[32]; - int ctrl_c = check_quit_flag (); + bool ctrl_c = check_quit_flag (); strcpy (buf, "F"); if (retcode < 0) From patchwork Tue Apr 23 13:22:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 88912 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E694C384AB47 for ; Tue, 23 Apr 2024 13:26:10 +0000 (GMT) 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 78A0C3858404 for ; Tue, 23 Apr 2024 13:25:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 78A0C3858404 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 78A0C3858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713878727; cv=none; b=QZ+tBfStGGIko1YvLwes0DZkvmrLZsIX4TbFrHKoKvhLpgqN+4AG5ieDvSshZ8pvtluQsORDkcp/v5PupWq25qop+czsLMRhd6xf+HfihVIkRS9Z1KgBbOsOvhtsqRwRNvVF10qaWsDXtzdyn1zFh1yzk/OpPwEY9LllLjzXZmA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713878727; c=relaxed/simple; bh=nQOnjN0PWGysKCF5vGFrQzfhDs0lYxFZVN117e+JZCs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=sF11fa+eJV7sehSQKsEgqHCswbWDcPISo3m1g225qvKJVRR9utOSdi/KXtLEhZ2/UCJMQfhy2Fst8HQaXu1tCj3yHebo3683f9w6SoIttSwxLa5T6sCXMVwz6IdIDG9+EBkAC0Xp0wQ+2x2kPTZoBjOxDZmzVzkvwRhZlqlCpqc= ARC-Authentication-Results: i=1; server2.sourceware.org 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 43NDPJWN056476 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 09:25:24 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NDPJWN056476 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713878725; bh=/zXwp5aiiHD9vWFyWj7Lwl1tz94hymPUaPuiLMEEGRI=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=slRBGJ/IRTw8E8qGat56M4JZPKG1wK3luhewEw7mPLyfUWAawqEji3FOzX0Kmmv0f aipOFMHuyphSlOxZGHqnoh9Wkj2yNjvC5ZB6EbiMO/PCdCOGepNA+H/zvxJW0FKntI Y7fqEKaNrbvQCdyy5iCtfLgdsRI4d6ArKwgleIwA= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id ABCC11E0C1; Tue, 23 Apr 2024 09:25:19 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/7] gdb: change type of quit_flag to bool Date: Tue, 23 Apr 2024 09:22:58 -0400 Message-ID: <20240423132517.2625632-4-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca> References: <20240423132517.2625632-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 13:25:19 +0000 X-Spam-Status: No, score=-3188.4 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_PASS, 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 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 Change-Id: I7dc5189ee172e82ef5b2c4a739c011f43a84258b --- gdb/event-top.c | 4 ++-- gdb/extension.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/event-top.c b/gdb/event-top.c index 6a2a75fe3dc8..8411ec5028a5 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -1113,7 +1113,7 @@ handle_sigint (int sig) /* We could be running in a loop reading in symfiles or something so it may be quite a while before we get back to the event loop. So - set quit_flag to 1 here. Then if QUIT is called before we get to + set quit_flag to true here. Then if QUIT is called before we get to the event loop, we will unwind as expected. */ set_quit_flag (); @@ -1193,7 +1193,7 @@ handle_sigterm (int sig) void async_request_quit (gdb_client_data arg) { - /* If the quit_flag has gotten reset back to 0 by the time we get + /* If the quit_flag has gotten reset back to false by the time we get back here, that means that an exception was thrown to unwind the current command before we got back to the event loop. So there is no reason to call quit again here. */ diff --git a/gdb/extension.c b/gdb/extension.c index 82d37fb09aea..99e7190d80b6 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -663,7 +663,7 @@ static std::recursive_mutex ext_lang_mutex; /* This flag tracks quit requests when we haven't called out to an extension language. it also holds quit requests when we transition to an extension language that doesn't have cooperative SIGINT handling. */ -static int quit_flag; +static bool quit_flag; /* The current extension language we've called out to, or extension_language_gdb if there isn't one. @@ -877,7 +877,7 @@ set_quit_flag () active_ext_lang->ops->set_quit_flag (active_ext_lang); else { - quit_flag = 1; + quit_flag = true; /* Now wake up the event loop, or any interruptible_select. Do this after setting the flag, because signals on Windows @@ -914,7 +914,7 @@ check_quit_flag () interruptible_select. The caller handles the quit request. */ quit_serial_event_clear (); - quit_flag = 0; + quit_flag = false; result = true; } From patchwork Tue Apr 23 13:22:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 88915 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8914D384AB56 for ; Tue, 23 Apr 2024 13:32:17 +0000 (GMT) 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 9B817385840D for ; Tue, 23 Apr 2024 13:31:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B817385840D 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 9B817385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879101; cv=none; b=r0UaGVNOntcAQ700gXVcz3mGngimxvJH/7AC8HA2u5Q8nx9oQRNvB9zQ+Z74HmGeA1F7Y+6X35MBI/2t6ahoXAaETuOqti/R1lW3rbNdDWuPTzVtzAHEbi9YXUCwYo+vmcyyiOCRAiW9N5Ta6Eg9HJl1WwHeXt5xxsG3MB5w8w4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879101; c=relaxed/simple; bh=nzYFcNPU/1ua8lGZbMMMLSe2KqrIxzBvH9W9KdIDH9U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=FUdvUarfbHzokDnVVcXDuqA/RGYvb9Nd35EDxEVHntinPKuTmX3SKvC301pyh0s4uxrpY9KKV3uyA8PM8+s5AyomKIiqhFXeP2aed+jWQAC2qCCrFVZeEP5VxOR+v257j7nANaNwUzwHgTOPTTuWOsR+WKOFxgLNDIRrNxwtn6Q= ARC-Authentication-Results: i=1; server2.sourceware.org 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 43NDVQPI059042 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 09:31:31 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NDVQPI059042 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713879091; bh=/D5siUl43xaOF8ocLsnhDfKydw+IWAS8kBvUJu60Wzo=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=DM8J52zD6E7lNkkNMDs8v0yCsW/jOsIrZdpiOaiRb0T72+3Vx6wXExVXrpBZjIFQb 91myqguzE9zUgXpkg1YSILR+n8T2r8FNSs+5Hd2L+ApiaVHv9pf02HuakUB8mmdpvC DJUwbLkyknDn3ey0RyA3YPAigQazIpStzqRTMVDo= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CAA0C1E0CE; Tue, 23 Apr 2024 09:25:19 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 4/7] gdb: move a bunch of quit-related things to event-top.{c, h} Date: Tue, 23 Apr 2024 09:22:59 -0400 Message-ID: <20240423132517.2625632-5-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca> References: <20240423132517.2625632-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 13:31:26 +0000 X-Spam-Status: No, score=-3188.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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 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 Move some declarations related to the "quit" machinery from defs.h to event-top.h. Most of the definitions associated to these declarations are in event-top.c. The exceptions are `quit()` and `maybe_quit()`, that are defined in utils.c. For consistency, move these two definitions to event-top.c. Include "event-top.h" in many files that use these things. Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378 --- gdb/ada-lang.c | 1 + gdb/ada-typeprint.c | 1 + gdb/ada-valprint.c | 1 + gdb/addrmap.c | 1 + gdb/amd64-windows-tdep.c | 1 + gdb/breakpoint.c | 1 + gdb/c-typeprint.c | 1 + gdb/cli/cli-script.c | 1 + gdb/coffread.c | 1 + gdb/corefile.c | 1 + gdb/cp-valprint.c | 1 + gdb/dbxread.c | 1 + gdb/defs.h | 44 ------------------------------- gdb/disasm.c | 1 + gdb/dwarf2/cooked-index.c | 1 + gdb/dwarf2/expr.c | 1 + gdb/dwarf2/loc.c | 1 + gdb/dwarf2/read-gdb-index.c | 1 + gdb/dwarf2/read.c | 1 + gdb/event-top.c | 48 +++++++++++++++++++++++++++++++--- gdb/event-top.h | 52 +++++++++++++++++++++++++++++++++++++ gdb/f-typeprint.c | 1 + gdb/findvar.c | 1 + gdb/frame.c | 1 + gdb/gdb_bfd.c | 1 + gdb/linux-fork.c | 1 + gdb/m2-lang.c | 1 + gdb/m2-typeprint.c | 1 + gdb/mi/mi-cmd-stack.c | 1 + gdb/objc-lang.c | 1 + gdb/p-lang.c | 1 + gdb/p-typeprint.c | 1 + gdb/printcmd.c | 1 + gdb/psymtab.c | 1 + gdb/remote-fileio.c | 1 + gdb/remote-sim.c | 1 + gdb/rust-lang.c | 1 + gdb/ser-base.c | 1 + gdb/skip.c | 1 + gdb/solib-rocm.c | 1 + gdb/sparc64-tdep.c | 1 + gdb/stabsread.c | 1 + gdb/stack.c | 1 + gdb/symmisc.c | 1 + gdb/symtab.c | 1 + gdb/tracepoint.c | 1 + gdb/tui/tui.c | 1 + gdb/utils.c | 41 ----------------------------- gdb/valops.c | 1 + gdb/valprint.c | 1 + gdb/xcoffread.c | 1 + 51 files changed, 144 insertions(+), 88 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 5ab6e8b14b72..e33a746da9e8 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -19,6 +19,7 @@ #include +#include "event-top.h" #include "extract-store-integer.h" #include "gdbsupport/gdb_regex.h" #include "frame.h" diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index deead1055dbf..915f8b54d50e 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -17,6 +17,7 @@ along with this program. If not, see . */ #include "bfd.h" +#include "event-top.h" #include "gdbtypes.h" #include "value.h" #include "c-lang.h" diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 6d3fca9bdeba..937bd39e87db 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include +#include "event-top.h" #include "extract-store-integer.h" #include "gdbtypes.h" #include "expression.h" diff --git a/gdb/addrmap.c b/gdb/addrmap.c index c6e037330ecc..b9a0f77d5d0b 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "gdbsupport/gdb_obstack.h" #include "addrmap.h" #include "gdbsupport/selftest.h" diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 3dfc80005339..9636201d13a6 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "extract-store-integer.h" #include "osabi.h" #include "amd64-tdep.h" diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6d8adc626643..03e073d78792 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -19,6 +19,7 @@ #include "arch-utils.h" #include +#include "event-top.h" #include "hashtab.h" #include "symtab.h" #include "frame.h" diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 3e299356308c..62cf7219a415 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "gdbsupport/gdb_obstack.h" #include "bfd.h" #include "symtab.h" diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 2f731807c94f..03e0a2e43e3c 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "value.h" #include diff --git a/gdb/coffread.c b/gdb/coffread.c index 327c014a5a4c..daae3ffe989c 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "symtab.h" #include "gdbtypes.h" #include "demangle.h" diff --git a/gdb/corefile.c b/gdb/corefile.c index 984c7bef8800..8caf3bff383f 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -19,6 +19,7 @@ #include #include +#include "event-top.h" #include "extract-store-integer.h" #include "inferior.h" #include "symtab.h" diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 2e776f40a637..ae28882e1789 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "extract-store-integer.h" #include "gdbsupport/gdb_obstack.h" #include "symtab.h" diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 9faaf0e7381b..830dd1cc6112 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -31,6 +31,7 @@ for real. dbx_psymtab_to_symtab() is the function that does this */ +#include "event-top.h" #include "gdbsupport/gdb_obstack.h" #include #include "symtab.h" diff --git a/gdb/defs.h b/gdb/defs.h index 6f9c0d1f781a..11e2190c3e4a 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -94,50 +94,6 @@ extern std::string python_libdir; /* * Search path for separate debug files. */ extern std::string debug_file_directory; -/* The current quit handler (and its type). This is called from the - QUIT macro. See default_quit_handler below for default behavior. - Parts of GDB temporarily override this to e.g., completely suppress - Ctrl-C because it would not be safe to throw. E.g., normally, you - wouldn't want to quit between a RSP command and its response, as - that would break the communication with the target, but you may - still want to intercept the Ctrl-C and offer to disconnect if the - user presses Ctrl-C multiple times while the target is stuck - waiting for the wedged remote stub. */ -typedef void (quit_handler_ftype) (void); -extern quit_handler_ftype *quit_handler; - -/* The default quit handler. Checks whether Ctrl-C was pressed, and - if so: - - - If GDB owns the terminal, throws a quit exception. - - - If GDB does not own the terminal, forwards the Ctrl-C to the - target. -*/ -extern void default_quit_handler (void); - -/* Flag that function quit should call quit_force. */ -extern volatile bool sync_quit_force_run; - -/* Set sync_quit_force_run and also call set_quit_flag(). */ -extern void set_force_quit_flag (); - -extern void quit (void); - -/* Helper for the QUIT macro. */ - -extern void maybe_quit (void); - -/* Check whether a Ctrl-C was typed, and if so, call the current quit - handler. */ -#define QUIT maybe_quit () - -/* Set the serial event associated with the quit flag. */ -extern void quit_serial_event_set (void); - -/* Clear the serial event associated with the quit flag. */ -extern void quit_serial_event_clear (void); - /* * Languages represented in the symbol table and elsewhere. This should probably be in language.h, but since enum's can't be forward declared to satisfy opaque references before their diff --git a/gdb/disasm.c b/gdb/disasm.c index da6f3afba7a1..e54b8521dde3 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "arch-utils.h" +#include "event-top.h" #include "target.h" #include "value.h" #include "ui-out.h" diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 190ceebe1608..3b95c075a557 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -24,6 +24,7 @@ #include "cp-support.h" #include "c-lang.h" #include "ada-lang.h" +#include "event-top.h" #include "split-name.h" #include "observable.h" #include "run-on-main-thread.h" diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index d92facbf0dcf..cb80dbf60b1f 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -20,6 +20,7 @@ along with this program. If not, see . */ #include "block.h" +#include "event-top.h" #include "symtab.h" #include "gdbtypes.h" #include "value.h" diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 205d2ba56cbb..23c57bde9391 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "ui-out.h" #include "value.h" #include "frame.h" diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index 8c0895b96393..e743ce13978d 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -22,6 +22,7 @@ #include "cli/cli-cmds.h" #include "complaints.h" #include "dwz.h" +#include "event-top.h" #include "gdb/gdb-index.h" #include "gdbsupport/gdb-checked-static-cast.h" #include "mapped-index.h" diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index af69e1d9d9e9..9480a8781cc2 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -47,6 +47,7 @@ #include "dwarf2/public.h" #include "bfd.h" #include "elf-bfd.h" +#include "event-top.h" #include "symtab.h" #include "gdbtypes.h" #include "objfiles.h" diff --git a/gdb/event-top.c b/gdb/event-top.c index 8411ec5028a5..2fcbad6b937b 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "gdbsupport/job-control.h" +#include "run-on-main-thread.h" #include "top.h" #include "ui.h" #include "inferior.h" @@ -1062,15 +1064,55 @@ gdb_init_signals (void) install_handle_sigsegv (); } -/* See defs.h. */ +/* See event-top.h. */ void -quit_serial_event_set (void) +quit (void) +{ + if (sync_quit_force_run) + { + sync_quit_force_run = false; + throw_forced_quit ("SIGTERM"); + } + +#ifdef __MSDOS__ + /* No steenking SIGINT will ever be coming our way when the + program is resumed. Don't lie. */ + throw_quit ("Quit"); +#else + if (job_control + /* If there is no terminal switching for this target, then we can't + possibly get screwed by the lack of job control. */ + || !target_supports_terminal_ours ()) + throw_quit ("Quit"); + else + throw_quit ("Quit (expect signal SIGINT when the program is resumed)"); +#endif +} + +/* See event-top.h. */ + +void +maybe_quit () +{ + if (!is_main_thread ()) + return; + + if (sync_quit_force_run) + quit (); + + quit_handler (); +} + +/* See event-top.h. */ + +void +quit_serial_event_set () { serial_event_set (quit_serial_event); } -/* See defs.h. */ +/* See event-top.h. */ void quit_serial_event_clear (void) diff --git a/gdb/event-top.h b/gdb/event-top.h index f431f2812b21..846d1e482893 100644 --- a/gdb/event-top.h +++ b/gdb/event-top.h @@ -26,9 +26,61 @@ struct cmd_list_element; +/* The current quit handler (and its type). This is called from the + QUIT macro. See default_quit_handler below for default behavior. + Parts of GDB temporarily override this to e.g., completely suppress + Ctrl-C because it would not be safe to throw. E.g., normally, you + wouldn't want to quit between a RSP command and its response, as + that would break the communication with the target, but you may + still want to intercept the Ctrl-C and offer to disconnect if the + user presses Ctrl-C multiple times while the target is stuck + waiting for the wedged remote stub. */ +typedef void (quit_handler_ftype) (); +extern quit_handler_ftype *quit_handler; + /* Exported functions from event-top.c. FIXME: these should really go into top.h. */ +/* The default quit handler. Checks whether Ctrl-C was pressed, and + if so: + + - If GDB owns the terminal, throws a quit exception. + + - If GDB does not own the terminal, forwards the Ctrl-C to the + target. +*/ + +extern void default_quit_handler (); + +/* Flag that function quit should call quit_force. */ + +extern volatile bool sync_quit_force_run; + +/* Set sync_quit_force_run and also call set_quit_flag(). */ + +extern void set_force_quit_flag (); + +/* Control C eventually causes this to be called, at a convenient time. */ + +extern void quit (); + +/* Helper for the QUIT macro. */ + +extern void maybe_quit (); + +/* Check whether a Ctrl-C was typed, and if so, call the current quit + handler. */ + +#define QUIT maybe_quit () + +/* Set the serial event associated with the quit flag. */ + +extern void quit_serial_event_set (); + +/* Clear the serial event associated with the quit flag. */ + +extern void quit_serial_event_clear (); + extern void display_gdb_prompt (const char *new_prompt); extern void gdb_setup_readline (int); extern void gdb_disable_readline (void); diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 6e9722dbeb85..42e1cfb871bb 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "gdbsupport/gdb_obstack.h" #include "bfd.h" #include "symtab.h" diff --git a/gdb/findvar.c b/gdb/findvar.c index 660eb11c8b8e..df4ab1a28b9d 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "extract-store-integer.h" #include "symtab.h" #include "gdbtypes.h" diff --git a/gdb/frame.c b/gdb/frame.c index 719fa051afc6..0232bdb6865c 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "frame.h" +#include "event-top.h" #include "extract-store-integer.h" #include "target.h" #include "value.h" diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 1462aaf0f89c..6e97b2168139 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "gdb_bfd.h" +#include "event-top.h" #include "ui-out.h" #include "gdbcmd.h" #include "hashtab.h" diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index bb8119a36d05..867cb187c8af 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "arch-utils.h" +#include "event-top.h" #include "inferior.h" #include "infrun.h" #include "regcache.h" diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 86fef96dec18..5e9faa67de39 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "symtab.h" #include "gdbtypes.h" #include "expression.h" diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index 32cc930cfb8d..c0ae72203c32 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "language.h" #include "gdbsupport/gdb_obstack.h" #include "bfd.h" diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index b78c169e70bc..5e504283fcfc 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "target.h" #include "frame.h" #include "value.h" diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index e492c82845b3..b36816898a5e 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "symtab.h" #include "gdbtypes.h" #include "expression.h" diff --git a/gdb/p-lang.c b/gdb/p-lang.c index ddacccce1b29..d3d491c54cd2 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -19,6 +19,7 @@ /* This file is derived from c-lang.c */ +#include "event-top.h" #include "extract-store-integer.h" #include "symtab.h" #include "gdbtypes.h" diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index ad98d9ef2025..95a7f6041c1d 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -18,6 +18,7 @@ /* This file is derived from p-typeprint.c */ +#include "event-top.h" #include "gdbsupport/gdb_obstack.h" #include "bfd.h" #include "symtab.h" diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 79da7ea4e22e..66669f105c5c 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "extract-store-integer.h" #include "frame.h" #include "symtab.h" diff --git a/gdb/psymtab.c b/gdb/psymtab.c index a4f5b04627c2..8edadf3a335b 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "symtab.h" #include "objfiles.h" #include "psymtab.h" diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index 934ba3f8281d..bdb3c22b6923 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -19,6 +19,7 @@ /* See the GDB User Guide for details of the GDB remote protocol. */ +#include "event-top.h" #include "extract-store-integer.h" #include "gdbcmd.h" #include "remote.h" diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 5fccefe93a16..38d7f5b7c0f5 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "gdb_bfd.h" #include "inferior.h" #include "infrun.h" diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 53e7356c451e..e7fdc287dbc4 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -25,6 +25,7 @@ #include "charset.h" #include "cp-support.h" #include "demangle.h" +#include "event-top.h" #include "gdbarch.h" #include "infcall.h" #include "objfiles.h" diff --git a/gdb/ser-base.c b/gdb/ser-base.c index ccf38d2202b6..81ef942c55f5 100644 --- a/gdb/ser-base.c +++ b/gdb/ser-base.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "serial.h" #include "ser-base.h" #include "gdbsupport/event-loop.h" diff --git a/gdb/skip.c b/gdb/skip.c index f2818eccb34c..9b8a56cadefa 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -16,6 +16,7 @@ along with this program. If not, see . */ #include "skip.h" +#include "event-top.h" #include "value.h" #include "valprint.h" #include "ui-out.h" diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c index b714e4ef6cce..9b995c7a3abe 100644 --- a/gdb/solib-rocm.c +++ b/gdb/solib-rocm.c @@ -23,6 +23,7 @@ #include "arch-utils.h" #include "elf-bfd.h" #include "elf/amdgpu.h" +#include "event-top.h" #include "gdbsupport/fileio.h" #include "inferior.h" #include "observable.h" diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 9c8deaac0210..0eaaf506b3c0 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -19,6 +19,7 @@ #include "arch-utils.h" #include "dwarf2/frame.h" +#include "event-top.h" #include "extract-store-integer.h" #include "frame.h" #include "frame-base.h" diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 85fe4000f329..115851962345 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -25,6 +25,7 @@ this file. */ #include "bfd.h" +#include "event-top.h" #include "gdbsupport/gdb_obstack.h" #include "symtab.h" #include "gdbtypes.h" diff --git a/gdb/stack.c b/gdb/stack.c index 2922265515d5..6e9312c0a0d9 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "extract-store-integer.h" #include "value.h" #include "symtab.h" diff --git a/gdb/symmisc.c b/gdb/symmisc.c index f80fc5ab196d..70435996a8ec 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "symtab.h" #include "gdbtypes.h" #include "bfd.h" diff --git a/gdb/symtab.c b/gdb/symtab.c index d931b3a694b3..63b780bb66ed 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -19,6 +19,7 @@ #include "dwarf2/call-site.h" #include "symtab.h" +#include "event-top.h" #include "gdbtypes.h" #include "gdbcore.h" #include "frame.h" diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 1586a043af69..0c0a94573bb7 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "arch-utils.h" +#include "event-top.h" #include "symtab.h" #include "frame.h" #include "gdbtypes.h" diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index eaee85f82b4e..01e8d7cb9268 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "gdbcmd.h" #include "tui/tui.h" #include "tui/tui-hooks.h" diff --git a/gdb/utils.c b/gdb/utils.c index 04f2d909cd29..8d7ef7e3ad02 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -652,47 +652,6 @@ warning_filename_and_errno (const char *filename, int saved_errno) safe_strerror (saved_errno)); } -/* Control C eventually causes this to be called, at a convenient time. */ - -void -quit (void) -{ - if (sync_quit_force_run) - { - sync_quit_force_run = false; - throw_forced_quit ("SIGTERM"); - } - -#ifdef __MSDOS__ - /* No steenking SIGINT will ever be coming our way when the - program is resumed. Don't lie. */ - throw_quit ("Quit"); -#else - if (job_control - /* If there is no terminal switching for this target, then we can't - possibly get screwed by the lack of job control. */ - || !target_supports_terminal_ours ()) - throw_quit ("Quit"); - else - throw_quit ("Quit (expect signal SIGINT when the program is resumed)"); -#endif -} - -/* See defs.h. */ - -void -maybe_quit (void) -{ - if (!is_main_thread ()) - return; - - if (sync_quit_force_run) - quit (); - - quit_handler (); -} - - /* Called when a memory allocation fails, with the number of bytes of memory requested in SIZE. */ diff --git a/gdb/valops.c b/gdb/valops.c index f9b54a5d9a93..8eae7cf79953 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "extract-store-integer.h" #include "symtab.h" #include "gdbtypes.h" diff --git a/gdb/valprint.c b/gdb/valprint.c index 13e80c06c9f7..21265ada2ddb 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "event-top.h" #include "extract-store-integer.h" #include "symtab.h" #include "gdbtypes.h" diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index c4914bdcbaf0..639dd5b8adc1 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -19,6 +19,7 @@ along with this program. If not, see . */ #include "bfd.h" +#include "event-top.h" #include #include From patchwork Tue Apr 23 13:23:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 88914 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A301E3849AC0 for ; Tue, 23 Apr 2024 13:32:16 +0000 (GMT) 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 078F63858404 for ; Tue, 23 Apr 2024 13:31:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 078F63858404 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 078F63858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879098; cv=none; b=FkJAc1NiO8TsCfdE4OaRi4utyH74j3nyJKbS4jNgFteSOnZ0giuu8AepYn6IdxsnRGND65/IgxFjJAyIX9eSDbsWGST2araFTGjPw7gygA1dsnvu5c8B05t+VZ0b0/bpYwo4nIPG0ibnvxIZH8jLLG6zF7NlEGM0/kfGZt2N04E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879098; c=relaxed/simple; bh=LtCLoouV3WhRfct/hlHSMIQwfJPjQlfKntPmOugFTsY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=q0cODZH6l8Mv7TXxs6caKc4tiRy6+K5FzEXJTEHPQ7DmiptrV8sNjH49yFoTCFrUTDd1DngZPutMXWAj08tk3LvOysAM+9XGS9Cp5ILZdFL2fySHtCLDY4juelMyvmWLIbyyfZtgoE71UvNSU0se4Zv1YN8h7QY1hs2KCQIqywE= ARC-Authentication-Results: i=1; server2.sourceware.org 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 43NDVQtQ059045 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 09:31:31 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NDVQtQ059045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713879091; bh=v+zaPnfmWp6sGUj4R94y1taUiYVwg7P8aRs7I4AD46o=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=C3+ClGB/zAFx8ZdqfD7oIvtf5GehCQpUZEduj1V3Iw7hSKsBrAWcz4u9QiP/7VwOw Mrp1CZe3prNpGSvbP2a1OfetHSAo879/DgWJYdgc/4wZGl1g3AzSLmCXtGb9d2enhD I9MvYj8NDu80K7p+A9uto2khoDDbyaKbzLRp7udw= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id F01531E0D2; Tue, 23 Apr 2024 09:25:19 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 5/7] gdb: move annotation_level declaration/definition to annotate.{h, c} Date: Tue, 23 Apr 2024 09:23:00 -0400 Message-ID: <20240423132517.2625632-6-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca> References: <20240423132517.2625632-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 13:31:26 +0000 X-Spam-Status: No, score=-3188.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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 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 The declaration of annotation_level is currently in defs.h, while the definition is in stack.c. I don't really understand why that variable would live in stack.c, it seems completely unrelated. Move it to annotate.c, and move the declaration to annotate.h. Change-Id: I6cf8e9bd20e83959bdf5ad58dd008b6e1187d7d8 --- gdb/annotate.c | 4 ++++ gdb/annotate.h | 8 ++++++++ gdb/defs.h | 6 ------ gdb/main.c | 1 + gdb/stack.c | 8 -------- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gdb/annotate.c b/gdb/annotate.c index 19195ac70970..4ff3eb89807b 100644 --- a/gdb/annotate.c +++ b/gdb/annotate.c @@ -29,6 +29,10 @@ #include "source-cache.h" #include "ui.h" +/* See annotate.h. */ + +int annotation_level = 0; + /* Prototypes for local functions. */ static void print_value_flags (struct type *); diff --git a/gdb/annotate.h b/gdb/annotate.h index b8ce63ff2332..db471db8526a 100644 --- a/gdb/annotate.h +++ b/gdb/annotate.h @@ -22,6 +22,14 @@ #include "symtab.h" #include "gdbtypes.h" +/* Zero means do things normally; we are interacting directly with the + user. One means print the full filename and linenumber when a + frame is printed, and do so in a format emacs18/emacs19.22 can + parse. Two means print similar annotations, but in many more + cases and in a slightly different syntax. */ + +extern int annotation_level; + extern void annotate_breakpoint (int); extern void annotate_catchpoint (int); extern void annotate_watchpoint (int); diff --git a/gdb/defs.h b/gdb/defs.h index 11e2190c3e4a..c3b8b0bd8f39 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -195,12 +195,6 @@ struct value; globals that are currently only available to main.c. */ extern std::string relocate_gdb_directory (const char *initial, bool relocatable); - -/* Annotation stuff. */ - -extern int annotation_level; /* in stack.c */ - - /* From symfile.c */ extern void symbol_file_command (const char *, int); diff --git a/gdb/main.c b/gdb/main.c index bf3c776dba9c..8b81640e8d22 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "annotate.h" #include "top.h" #include "ui.h" #include "target.h" diff --git a/gdb/stack.c b/gdb/stack.c index 6e9312c0a0d9..d1832540d624 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -230,14 +230,6 @@ static void print_frame (struct ui_out *uiout, static frame_info_ptr find_frame_for_function (const char *); static frame_info_ptr find_frame_for_address (CORE_ADDR); -/* Zero means do things normally; we are interacting directly with the - user. One means print the full filename and linenumber when a - frame is printed, and do so in a format emacs18/emacs19.22 can - parse. Two means print similar annotations, but in many more - cases and in a slightly different syntax. */ - -int annotation_level = 0; - /* Class used to manage tracking the last symtab we displayed. */ class last_displayed_symtab_info_type From patchwork Tue Apr 23 13:23:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 88916 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C9A13858C42 for ; Tue, 23 Apr 2024 13:32:45 +0000 (GMT) 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 E61693858C50 for ; Tue, 23 Apr 2024 13:31:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E61693858C50 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 E61693858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879094; cv=none; b=ZJjSl9I+QPph5ys3XFLY2m+uvFT2Nf+xCA8SfwBaCIoLua7P/sbwljYq+nZz1TLXvQ2UbA11ro1aavDwmzEG/HyEZ4JW8rxqtM6Bm5fnKgsftDCPKEcGgQa+RvQsHrWTV6uhmYPZPNTAtVcdMR8k8yPSjQC0dmlWWZ/OuXTSK/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879094; c=relaxed/simple; bh=UP5uq26VpptFRDJoJapM0XqIUWIZ1bFfkA0jk6DRhy4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rfTT9GY8XsdehebjosBiK1iE2vJrpXgzJDlZFFafBJHLBESGgd10xi4EwFd/iaqgH2FcplprG7Gf7O8uVZhNBIQYpcqBxoyF4Trfipgl4aa13+wmP0fSfNzCvsq6ES6T5/A4OgkF0eDCm1YanQtV+L1YVCzLC1PrhN2/eueSp6o= ARC-Authentication-Results: i=1; server2.sourceware.org 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 43NDVQTG059043 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 09:31:31 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NDVQTG059043 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713879091; bh=l1Lma4JWQhjVSkIdJ5h3QosDG+zYCfoLzIDEg6dZAHw=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=UeOdcGBTo8G4TqcNxPlNhIbdyqMDCBJhePkBKFkJLcrwGpGiLbCIEadR5xjYKr8EZ ejhlylcDhU0Z8nZ2astuuNlrFzxzl60HHIgUec01vXxkf3xenFw56pazwQRTJPTtbx +aif6TyBZ8Pdv9f9MA92HnpWOZfo6tnx8KfpDAz4= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4EF1D1E0F8; Tue, 23 Apr 2024 09:25:20 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 6/7] gdb: remove enum precision_type Date: Tue, 23 Apr 2024 09:23:01 -0400 Message-ID: <20240423132517.2625632-7-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca> References: <20240423132517.2625632-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 13:31:26 +0000 X-Spam-Status: No, score=-3188.4 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_PASS, 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 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 It is unused. Change-Id: Ic49a3ef03c21b209594cd567ae80b5441606bef6 --- gdb/defs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gdb/defs.h b/gdb/defs.h index c3b8b0bd8f39..ef5634da52c9 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -136,13 +136,6 @@ static_assert (nr_languages <= (1 << LANGUAGE_BITS)); /* The number of bytes needed to represent all languages. */ #define LANGUAGE_BYTES ((LANGUAGE_BITS + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT) -enum precision_type - { - single_precision, - double_precision, - unspecified_precision - }; - /* * A generic, not quite boolean, enumeration. This is used for set/show commands in which the options are on/off/automatic. */ enum auto_boolean From patchwork Tue Apr 23 13:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 88913 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8F9043849AD3 for ; Tue, 23 Apr 2024 13:32:13 +0000 (GMT) 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 0A9153858C42 for ; Tue, 23 Apr 2024 13:31:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A9153858C42 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 0A9153858C42 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879093; cv=none; b=i853Pm2vKojpKop9oVfSDe+Ln4uFH80/u68ilJzFtEwdsomhRdvTp1SxDJWmu2hldISGJBq8c/6kjZQE6YDtjy57eFS0nBPLh5ZlKmrnMY/ok9TOK9SGTwi3GlisIdN+i06TXo8GEfJ8aNX7dJ30C8OxgLhR9tf7RlCUlEY+jxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713879093; c=relaxed/simple; bh=K7for3vQJINUi44Ug11MJi/2PDVFfOMwnzzf3EaW0mA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tAzmxuEuQGs1cY7QXmkyJluekzhw7SCiGNWYVhP73ygvFS49s+U6T4i6YMEMFpJB90+6cKwfBiiyheWgq4YW1uOnbTX4/MlMlGvZLcubZbDr8bjcNKrwsWk7NPpuKN0W4dOpSeNOj3KdzRGPirEaGU9FNHDMA+OPu4i584oNiY8= ARC-Authentication-Results: i=1; server2.sourceware.org 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 43NDVQJG059044 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 09:31:31 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 43NDVQJG059044 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1713879091; bh=5sM/VoFjDmJzg1adxtQSgvcZEt7YmajE8IIdGt7FEGE=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=AYjfG74YuXTjzlMCxsMrY2DsCUGDSquZCLdjqVYSVj6LaT0Wg0VubkkR7LgddGxb8 PeHinAI+pcNBCbJ2itRfVxVKhX/6TjsgqztcAZOu4+H+zWmU3Lk+LoYc5HoAZcmSdm eaUbuEgZjrVYErXzGy0hu5fOkC0V2uN93VfwcUpM= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 92F211E0FB; Tue, 23 Apr 2024 09:25:20 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 7/7] gdb: move symbol_file_command declaration to symfile.h Date: Tue, 23 Apr 2024 09:23:02 -0400 Message-ID: <20240423132517.2625632-8-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca> References: <20240423132517.2625632-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Apr 2024 13:31:26 +0000 X-Spam-Status: No, score=-3188.4 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_PASS, 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 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 Move it out of defs.h, the corresponding definition is in symfile.c. Change-Id: I984666c3bcd213f8574e9ec91462e1d61f77f16b --- gdb/defs.h | 4 ---- gdb/symfile.c | 14 +------------- gdb/symfile.h | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gdb/defs.h b/gdb/defs.h index ef5634da52c9..8fde5be1cd35 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -188,10 +188,6 @@ struct value; globals that are currently only available to main.c. */ extern std::string relocate_gdb_directory (const char *initial, bool relocatable); -/* From symfile.c */ - -extern void symbol_file_command (const char *, int); - /* From top.c */ typedef void initialize_file_ftype (void); diff --git a/gdb/symfile.c b/gdb/symfile.c index b7570a32dc0b..883f1c0b0505 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1596,19 +1596,7 @@ validate_readnow_readnever (objfile_flags flags) error (_("-readnow and -readnever cannot be used simultaneously")); } -/* This is the symbol-file command. Read the file, analyze its - symbols, and add a struct symtab to a symtab list. The syntax of - the command is rather bizarre: - - 1. The function buildargv implements various quoting conventions - which are undocumented and have little or nothing in common with - the way things are quoted (or not quoted) elsewhere in GDB. - - 2. Options are used, which are not generally used in GDB (perhaps - "set mapped on", "set readnow on" would be better) - - 3. The order of options matters, which is contrary to GNU - conventions (because it is confusing and inconvenient). */ +/* See symfile.h. */ void symbol_file_command (const char *args, int from_tty) diff --git a/gdb/symfile.h b/gdb/symfile.h index 6f8b441b39fd..a5b0c91469c7 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -379,4 +379,20 @@ extern int readnow_symbol_files; extern int readnever_symbol_files; +/* This is the symbol-file command. Read the file, analyze its + symbols, and add a struct symtab to a symtab list. The syntax of + the command is rather bizarre: + + 1. The function buildargv implements various quoting conventions + which are undocumented and have little or nothing in common with + the way things are quoted (or not quoted) elsewhere in GDB. + + 2. Options are used, which are not generally used in GDB (perhaps + "set mapped on", "set readnow on" would be better) + + 3. The order of options matters, which is contrary to GNU + conventions (because it is confusing and inconvenient). */ + +extern void symbol_file_command (const char *, int); + #endif /* !defined(SYMFILE_H) */