From patchwork Mon Apr 8 12:04:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 88168 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 1023F38460BD for ; Mon, 8 Apr 2024 12:05:12 +0000 (GMT) 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 17ECC3858D20 for ; Mon, 8 Apr 2024 12:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17ECC3858D20 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 17ECC3858D20 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=1712577875; cv=none; b=qMWTAyYV06qd//SYr8JNa70IeA3um2w9PYGEY35swkU6Vp8MB0VaRjwwX3LXXfX99xAa/OD5hmdF/TQdc/7x7jr8Tmi3JnZFtpQhh6lvtNDgVJFWM2/5Az96os/qq+WqNJKOM5uWU9QXfS7GJaZ6U2O86/fA9gXe2DhDkvLwM9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712577875; c=relaxed/simple; bh=1inVw355B3VQ+rWL2VwptxvqcwyBHFGvXpVM5aT+8lM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=EyPy5snNwz48ZBKiiTEDOviD/WlEw31x8F6WGzFL/nGMZq0Knj6ZImXg2635bxEv28rME+uGx57FTyke1h6yLJ8r5WkP36MJukTbgZz62cIqvr9EC6I38SPG4Iwo7xtTQkZk0e5ruMzV4wmQgCKbVUNBVt9kh6Oj08wnlgf1Sbo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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 0A06820315 for ; Mon, 8 Apr 2024 12:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712577872; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZV5VTN9LvL3TBZQXac4ldzJ5U2bYzOvr46o2AvW3B4Q=; b=J2JjIgOtUApy2p9EUoCxDxt8cyqPOdBhYeASxrw5AdfMNQ78xFiZWgtPVeozS//POOP3ML 7CDWhCzTeuUrEFFZ67WsC1NdhcnktXEh2WhvaO+oWxYh5n4ydh79ZQ0uV8VlpYUniP1+7Z M1VGjbmsInCoolg+TWAf0fkGaZ4u54o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712577872; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZV5VTN9LvL3TBZQXac4ldzJ5U2bYzOvr46o2AvW3B4Q=; b=f+T6JPWE3awyoSt4A+Pc6ufA3lR03Jyr//9sCFvTwXB08EKWBmPc44PV6fJSG/+IXEwN9I wLASFxsYTt3WaADg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712577872; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZV5VTN9LvL3TBZQXac4ldzJ5U2bYzOvr46o2AvW3B4Q=; b=J2JjIgOtUApy2p9EUoCxDxt8cyqPOdBhYeASxrw5AdfMNQ78xFiZWgtPVeozS//POOP3ML 7CDWhCzTeuUrEFFZ67WsC1NdhcnktXEh2WhvaO+oWxYh5n4ydh79ZQ0uV8VlpYUniP1+7Z M1VGjbmsInCoolg+TWAf0fkGaZ4u54o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712577872; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZV5VTN9LvL3TBZQXac4ldzJ5U2bYzOvr46o2AvW3B4Q=; b=f+T6JPWE3awyoSt4A+Pc6ufA3lR03Jyr//9sCFvTwXB08EKWBmPc44PV6fJSG/+IXEwN9I wLASFxsYTt3WaADg== 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 E55BD1386D for ; Mon, 8 Apr 2024 12:04:31 +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 sEKuNk/dE2a6IQAAD6G6ig (envelope-from ) for ; Mon, 08 Apr 2024 12:04:31 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v2 2/4] [gdb/testsuite] Require address update for DW_LNS_copy Date: Mon, 8 Apr 2024 14:04:43 +0200 Message-Id: <20240408120445.12544-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240408120445.12544-1-tdevries@suse.de> References: <20240408120445.12544-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns] X-Spam-Status: No, score=-12.2 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org No address update before a DW_LNS_copy might mean an incorrect dwarf assembly test-case. Try to catch such incorrect dwarf assembly test-cases by: - requiring an explicit address update for each DW_LNS_copy, and - handling the cases where an update is indeed not needed, by adding "DW_LNS_advance_pc 0". Tested on aarch64-linux. --- gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 1 + gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 1 + gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 1 + gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp | 3 +++ gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 1 + gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp | 6 ++++++ gdb/testsuite/lib/dwarf.exp | 3 +++ 7 files changed, 16 insertions(+) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp index 5268e7815ad..6d12e968f41 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp @@ -129,6 +129,7 @@ proc do_test { start_label func_name tag } { DW_LNS_advance_line 1 DW_LNS_copy + DW_LNS_advance_pc 0 DW_LNS_advance_line -4 DW_LNS_set_file 1 DW_LNS_negate_stmt diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp index d3a1fd38ed2..6a5f7d6dd76 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp @@ -119,6 +119,7 @@ Dwarf::assemble $asm_file { DW_LNS_advance_line 1 DW_LNS_copy + DW_LNS_advance_pc 0 DW_LNS_advance_line -4 DW_LNS_set_file 1 DW_LNS_negate_stmt diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp index 66d9f645cf3..b3db154db25 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp @@ -108,6 +108,7 @@ Dwarf::assemble $asm_file { DW_LNS_advance_line 1 DW_LNS_copy + DW_LNS_advance_pc 0 DW_LNS_advance_line -4 DW_LNS_set_file 1 DW_LNS_negate_stmt diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp index b117c8910f0..ed7166983d5 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp @@ -91,13 +91,16 @@ Dwarf::assemble $asm_file { line $f1_l1 DW_LNS_copy + DW_LNS_advance_pc 0 line ${f1_l2} DW_LNS_copy + DW_LNS_advance_pc 0 DW_LNS_set_file 2 line ${f2_l1} DW_LNS_copy + DW_LNS_advance_pc 0 DW_LNS_negate_stmt DW_LNS_copy diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl index 4f59c9b2639..968378620a0 100644 --- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl +++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl @@ -96,6 +96,7 @@ Dwarf::assemble $asm_file { DW_LNS_advance_line 1 DW_LNS_copy + DW_LNS_advance_pc 0 DW_LNS_advance_line -4 DW_LNS_negate_stmt DW_LNS_copy diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp index a1c0e7705b3..2001b28989f 100644 --- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp +++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp @@ -278,9 +278,12 @@ Dwarf::assemble ${asm_file} { DW_LNE_set_address $foo_start line [gdb_get_line_number "foo prologue" $libsrc] DW_LNS_copy + DW_LNE_set_address foo_label line [gdb_get_line_number "foo return" $libsrc] DW_LNS_copy + + DW_LNS_advance_pc 0 line [gdb_get_line_number "foo end" $libsrc] DW_LNS_copy @@ -291,9 +294,12 @@ Dwarf::assemble ${asm_file} { DW_LNE_set_address $bar_start line [gdb_get_line_number "bar prologue" $libsrc] DW_LNS_copy + DW_LNE_set_address bar_label line [gdb_get_line_number "bar return" $libsrc] DW_LNS_copy + + DW_LNS_advance_pc 0 line [gdb_get_line_number "bar end" $libsrc] DW_LNS_copy diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 816440f975f..254f88f1055 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -2601,6 +2601,9 @@ namespace eval Dwarf { proc DW_LNS_copy {} { variable _line_address_update + if { $_line_address_update == 0 } { + error "Missing address update for copy" + } set _line_address_update 0 _op .byte 1 }