From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NlOeBAwGX2FRbAAAWB0awg (envelope-from ) for ; Thu, 07 Oct 2021 10:37:00 -0400 Received: by simark.ca (Postfix, from userid 112) id 027AE1EE20; Thu, 7 Oct 2021 10:37:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5E3051EDDB for ; Thu, 7 Oct 2021 10:36:59 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0ED32385843E for ; Thu, 7 Oct 2021 14:36:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0ED32385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633617419; bh=ya+lE+g87be+zaHxU+9aOzohN1PjU4tbHkee0Wl1kkM=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Fj0iDD8ZlIBvFrAIOE0jdS43Fiooa2WtYWXRgHhDFparOIVi27tEsQm1rbsVocdVl k3P3l5zqN5QxjnEYgwOOsKsnMs2Yx74IPosyNvbK/BvJ3dU1VBIx2J2YAfzFq3ls/2 uunso5No4TNHXyTBVYcRJqhBu5WqG3a1EKB4IjkM= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 9D8DF385840B for ; Thu, 7 Oct 2021 14:36:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D8DF385840B Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D703B1FE6F; Thu, 7 Oct 2021 14:36:39 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BC48613CE5; Thu, 7 Oct 2021 14:36:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cmDQLPcFX2HQXgAAMHmgww (envelope-from ); Thu, 07 Oct 2021 14:36:39 +0000 Subject: [PING][PATCH][gdb/testsuite] Reimplement gdb.gdb/python-interrupts.exp as unittest To: gdb-patches@sourceware.org References: <20210911120254.GA19083@delia.home> Message-ID: Date: Thu, 7 Oct 2021 16:36:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 9/22/21 12:17 PM, Tom de Vries wrote: > On 9/11/21 2:02 PM, Tom de Vries wrote: >> +#if GDB_SELF_TEST >> +namespace selftests { >> +extern void (*hook_set_active_ext_lang) (void); >> +void (*hook_set_active_ext_lang) (void) = nullptr; >> +} >> +#endif >> + >> /* Set the currently active extension language to NOW_ACTIVE. >> The result is a pointer to a malloc'd block of memory to pass to >> restore_active_ext_lang. >> @@ -708,6 +715,11 @@ install_gdb_sigint_handler (struct signal_handler *previous) >> struct active_ext_lang_state * >> set_active_ext_lang (const struct extension_language_defn *now_active) >> { >> +#if GDB_SELF_TEST >> + if (selftests::hook_set_active_ext_lang) >> + selftests::hook_set_active_ext_lang (); >> +#endif > > In particular, I'd like feedback on whether this is acceptable. > > F.i., I could do instead the less intrusive (but also less flexible): > ... > #if GDB_SELF_TEST > namespace selftests { > extern int hook_raise_at_entry_active_ext_lang; > int hook_raise_at_entry_active_ext_lang = 0; > #endif > > struct active_ext_lang_state * > set_active_ext_lang (const struct extension_language_defn *now_active) > { > #if GDB_SELF_TEST > if (selftests::hook_raise_at_entry_active_ext_lang) > raise (hook_raise_at_entry_active_ext_lang); > #endif > ... > > The hook that is a function pointer is the most flexible, but possibly > less safe. OTOH, it is in the selftest code, which we disable by > default in release branches, so by default this is not included in > releases. OTOH, it's still possible to enable it in releases using > --enable-unit-tests. Perhaps this could be handled using a > DEVEL_GDB_SELF_TEST, which is disabled in release branches independent > of --enable-unit-tests? > > Any comment appreciated. > Ping. Thanks, - Tom