Message ID | 20250414145025.32212-1-tdevries@suse.de |
---|---|
State | Superseded |
Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> 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 4E7843857C78 for <patchwork@sourceware.org>; Mon, 14 Apr 2025 14:50:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E7843857C78 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=nBWwv42u; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1nA6Zth5; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=nBWwv42u; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1nA6Zth5 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 2BC583858C54 for <gdb-patches@sourceware.org>; Mon, 14 Apr 2025 14:50:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BC583858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2BC583858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744642203; cv=none; b=IpCilCFO5oyS+FdlSHQ3PLBQnMCjmvyKG31TX7ViZm+f2BuqoOK+MY3ZzbD2Aw5ezY5BiyoM/sV4rtpcfFBdkGKWRES499/ooVodUDoHnHrjHSk18+Wole39LPxb1v1QJSFuCrMXldADWN3Dy9WldCyASml7y/p27m9vos1SnNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744642203; c=relaxed/simple; bh=Bc0hCHNZqh7xVvwlc0g8x0NuMopvlwniaU0MCm6Bofw=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=AxmuSrHhB8fqww3hwmdWui6iE5SpefRBiThYRQnRHQmijo3p4kZVGLJv9VPhLswJTwyN1c6Z0QFu23cw+wx4rctLuI3jToDjUtJbxpshs9LCtvZfJ8ntXh6v20Yv6jnti/k/0BVx0DovANaXJ9iJkpugfonwXz2q51nS8Hp11AA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC583858C54 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0EBE71F390 for <gdb-patches@sourceware.org>; Mon, 14 Apr 2025 14:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744642202; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9Ir0byM8La+28KATf3w5Y2B2BpqiaEUq1O0HgN4JLrg=; b=nBWwv42uVd/Qi36uiciOM5W3fZCrhNXIjM/0VwwgYThhZfNeaXkylZ3Dt4iwIDvq18kcLr ez41sh6YdLgKHQ1qwDjRjG1rE93z1N8SgcQOqQlhAmQBptlzJyqAjh5pFxwU8bG3gRrvHH Qr1Nv8l4gMCoa65REjSDIHTRmXncEzA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744642202; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9Ir0byM8La+28KATf3w5Y2B2BpqiaEUq1O0HgN4JLrg=; b=1nA6Zth5abYS3B7yEPA75xki8RgYOwoPW96ju6IfnXq+jS0gVs5Hi+DsfLiqlKm6D5j2z9 bleraW12MZPFzMCQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=nBWwv42u; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=1nA6Zth5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744642202; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9Ir0byM8La+28KATf3w5Y2B2BpqiaEUq1O0HgN4JLrg=; b=nBWwv42uVd/Qi36uiciOM5W3fZCrhNXIjM/0VwwgYThhZfNeaXkylZ3Dt4iwIDvq18kcLr ez41sh6YdLgKHQ1qwDjRjG1rE93z1N8SgcQOqQlhAmQBptlzJyqAjh5pFxwU8bG3gRrvHH Qr1Nv8l4gMCoa65REjSDIHTRmXncEzA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744642202; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9Ir0byM8La+28KATf3w5Y2B2BpqiaEUq1O0HgN4JLrg=; b=1nA6Zth5abYS3B7yEPA75xki8RgYOwoPW96ju6IfnXq+jS0gVs5Hi+DsfLiqlKm6D5j2z9 bleraW12MZPFzMCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EADF31336F for <gdb-patches@sourceware.org>; Mon, 14 Apr 2025 14:50:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UZugNpkg/WeHGAAAD6G6ig (envelope-from <tdevries@suse.de>) for <gdb-patches@sourceware.org>; Mon, 14 Apr 2025 14:50:01 +0000 From: Tom de Vries <tdevries@suse.de> To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/testsuite] Fix regexp in gdb.multi/pending-bp-del-inferior.exp Date: Mon, 14 Apr 2025 16:50:25 +0200 Message-ID: <20250414145025.32212-1-tdevries@suse.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0EBE71F390 X-Spam-Level: X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_ONE(0.00)[1]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[gdb/testsuite] Fix regexp in gdb.multi/pending-bp-del-inferior.exp
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Build passed |
Commit Message
Tom de Vries
April 14, 2025, 2:50 p.m. UTC
With test-case gdb.multi/pending-bp-del-inferior.exp, occasionally I run into: ... (gdb) info breakpoints^M Num Type Disp Enb Address What^M 3 dprintf keep y <MULTIPLE> ^M printf "in foo"^M 3.1 y 0x004004dc in foo at $c:21 inf 2^M 3.2 y 0x004004dc in foo at $c:21 inf 1^M (gdb) FAIL: $exp: bp_pending=false: info breakpoints before inferior removal ... The FAIL happens because the test-case expects: - breakpoint location 3.1 to be in inferior 1, and - breakpoint location 3.2 to be in inferior 2 but it's the other way around. I managed to reproduce this with a trigger patch in compare_symbols from gdb/linespec.c: ... uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace (); uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace (); - if (uia < uib) - return true; if (uia > uib) + return true; + if (uia < uib) return false; ... Fix this by allowing the alternative order. Tested on x86_64-linux. PR testsuite/32202 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32202 --- .../gdb.multi/pending-bp-del-inferior.exp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) base-commit: e25c84752c9df2bf3a999b53afb58e5bebaf3b7c
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace ();
Tom> uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace ();
Tom> - if (uia < uib)
Tom> - return true;
Tom> if (uia > uib)
Tom> + return true;
Tom> + if (uia < uib)
Tom> return false;
Tom> ...
I wonder if the results would be more deterministic if this comparison
used pspace->num rather than the address of the pspace object itself.
This might be a little nicer for users as well, perhaps sorting the
locations by inferior.
I feel like your example change here also shows that the comment before
compare_symbols is incorrect.
I suppose if this is true then compare_msymbols also needs the same fix.
Tom
On 4/15/25 23:48, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes: > > Tom> uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace (); > Tom> uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace (); > > Tom> - if (uia < uib) > Tom> - return true; > Tom> if (uia > uib) > Tom> + return true; > Tom> + if (uia < uib) > Tom> return false; > Tom> ... > > I wonder if the results would be more deterministic if this comparison > used pspace->num rather than the address of the pspace object itself. > > This might be a little nicer for users as well, perhaps sorting the > locations by inferior. > Hi Tom, thanks for the review. Since you're suggesting to stabilize sorting order, I did a bit of further digging, and came up with an alternative solution: there is already a sorting function for bp_locations: bp_location_is_less_than, but it's only used for the bp_locations vector, not for breakpoint::m_locations. There we use a simple address comparison: ... auto ub = std::upper_bound (m_locations.begin (), m_locations.end (), loc, [] (const bp_location &left, const bp_location &right) { return left.address < right.address; }); m_locations.insert (ub, loc); ... and consequently the compare_symbol sorting leaks through if the addresses are equal. So, the alternative fix is to reuse bp_location_is_less_than for sorting breakpoint::m_locations. I've submitted a patch series here ( https://sourceware.org/pipermail/gdb-patches/2025-April/217222.html ). The series still contains the change you're suggesting, just not as the primary fix. > I feel like your example change here also shows that the comment before > compare_symbols is incorrect. > > I suppose if this is true then compare_msymbols also needs the same fix. I've tried to rework the function comment for compare_symbols to make it clear what is required and why, rather than stating that "The resulting order does not actually matter", as well making it clear where we still assume that unstable sorting results do not matter. Thanks, - Tom > > Tom
diff --git a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp index a7055d7ed8c..7a358ca6bd1 100644 --- a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp +++ b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp @@ -183,12 +183,16 @@ proc do_dprintf_test { bp_pending } { "\\s+printf \"in $bp_func\""] set bp_pattern_after $bp_pattern_before } else { - set bp_pattern_before \ - [multi_line \ - "$bp_number\\s+dprintf\\s+keep\\s+y\\s+<MULTIPLE>\\s*" \ - "\\s+printf \"in $bp_func\"" \ - "$bp_number\\.1\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf 1" \ - "$bp_number\\.2\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf 2"] + set res {} + foreach inf_a { 1 2 } inf_b { 2 1 } { + lappend res \ + [multi_line \ + "$bp_number\\s+dprintf\\s+keep\\s+y\\s+<MULTIPLE>\\s*" \ + "\\s+printf \"in $bp_func\"" \ + "$bp_number\\.1\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf $inf_a" \ + "$bp_number\\.2\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf $inf_b"] + } + set bp_pattern_before "([join $res "|"])" set bp_pattern_after \ [multi_line \