From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 27C6D3858D20 for ; Tue, 29 Aug 2023 13:00:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27C6D3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-401314e7838so9849305e9.1 for ; Tue, 29 Aug 2023 06:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693313999; x=1693918799; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=/XF/hMaGnf79PvVkUpaqOKHqrtIDKKc5WX/cGgqjkXQ=; b=eXUPhC+3qunb4PU3fVpdMmNapCvWlZ0wPRPF4iBozMSMmBSTzSId6/xc8xbhnUPK6f KPErKkpjVkwItttTUr1DKeON+V2tYJROSpxXnwJyCjVxqAYdn2mGrfXCRNWALFzo+E68 Q6lFk8Xm3ZFoETl/YpWlwzYv1hSSnPz4grfL6bepknezbAkedIsoph7Uc76lDa75v5+8 lc1hmBywu1JKfnOaGdmRJlaPjqbf0zvgmVSb/EDqGie9hyBKTxcm2CRskZkumo3ymS6g DoI5LnypFZmobTsZbrE2rdWxVKuznOuEp7IoP1SdenROG/9ZSBhCdRAdYI1F6u25+7Gl pqXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693313999; x=1693918799; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/XF/hMaGnf79PvVkUpaqOKHqrtIDKKc5WX/cGgqjkXQ=; b=GspQ2/hz8HGt4X0tGrsxQ3OGUFBUbzk8dm2olEpOX5dTwj5q0cBTM0G8yhKAfIWLNj qmdyEMjmdpR3tnoYkiKiJ1A/1q4iiVj9UpidkLlblIMpKs1ZpbEsxrIHFDZ2ReB+re/U YH2RZgVnv+qu87NDh/b1Kba+Q2X3WAKYpM2BtcGWDMct7FT/5geuqZ/T/VYSNpuwcWRu hVdO9rMqzmvEhIerZ74+J5Cm1GsguQEfwxuG+xp1w2k/g5ZTRVqIcJYf5tpNHetRAOcX 3y/yOwxlPTaZ+U27gCjz7dhx6gZsWuY1p/zF6rSGRf41iZI0R6JOdg2BCYdjFk+2y8Jh qOcA== X-Gm-Message-State: AOJu0Yzvj71qPKsTOp5OSG5ioEEyxlgkn7kREHGdMvtpFqRbIdGdf3g4 UVbukF60COGgQt6C+GYOSm6uY/VQXbI= X-Google-Smtp-Source: AGHT+IHCUKB6h3f2bPf9/FvLZ1JpLbQu92Zjz74e0so4pYAMa0vsyn/DlLy9thBjIA8nuMxiRFFzDg== X-Received: by 2002:a7b:ca58:0:b0:401:b4ad:20cf with SMTP id m24-20020a7bca58000000b00401b4ad20cfmr9360782wml.0.1693313998318; Tue, 29 Aug 2023 05:59:58 -0700 (PDT) Received: from smtpclient.apple (chp127.enscp.fr. [193.51.253.127]) by smtp.gmail.com with ESMTPSA id k2-20020a7bc302000000b003fc06169ab3sm17052410wmj.20.2023.08.29.05.59.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2023 05:59:57 -0700 (PDT) From: FX Coudert Message-Id: <874E7D4C-8406-4F39-82D3-7D08E00F60C9@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_713ACD73-554A-4FF3-9702-C1965BF08923" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: [PATCH] Testsuite, DWARF2: adjust regexp to match darwin output Date: Tue, 29 Aug 2023 14:59:47 +0200 In-Reply-To: <9A5AB3A9-0C58-4BDB-B2B2-8407C49B44CB@gmail.com> Cc: Iain Sandoe To: GCC Patches References: <9A5AB3A9-0C58-4BDB-B2B2-8407C49B44CB@gmail.com> X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,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 List-Id: --Apple-Mail=_713ACD73-554A-4FF3-9702-C1965BF08923 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 ping > Hi, >=20 > This was a painful one to fix, because I hate regexps, especially when = they are quoted. On darwin, we have this failure: >=20 > FAIL: gcc.dg/debug/dwarf2/inline4.c scan-assembler = DW_TAG_inlined_subroutine[^\\\\(]*\\\\([^\\\\)]*\\\\)[^\\\\(]*\\\\(DIE = \\\\(0x[0-9a-f]*\\\\) DW_TAG_formal_parameter[^\\\\(]*\\\\(DIE = \\\\(0x[0-9a-f]*\\\\) DW_TAG_variable >=20 > That hideous regexp is trying to match (generated on Linux): >=20 >> .uleb128 0x4 # (DIE (0x5c) DW_TAG_inlined_subroutine) >> .long 0xa0 # DW_AT_abstract_origin >> .quad .LBI4 # DW_AT_entry_pc >> .byte .LVU2 # DW_AT_GNU_entry_view >> .quad .LBB4 # DW_AT_low_pc >> .quad .LBE4-.LBB4 # DW_AT_high_pc >> .byte 0x1 # DW_AT_call_file (u.c) >> .byte 0xf # DW_AT_call_line >> .byte 0x14 # DW_AT_call_column >> .uleb128 0x5 # (DIE (0x7d) DW_TAG_formal_parameter) >> .long 0xad # DW_AT_abstract_origin >> .long .LLST0 # DW_AT_location >> .long .LVUS0 # DW_AT_GNU_locviews >> .uleb128 0x6 # (DIE (0x8a) DW_TAG_variable) >=20 > It is using the parentheses to check what is between = DW_TAG_inlined_subroutine, DW_TAG_formal_parameter and DW_TAG_variable. = There=E2=80=99s only one block of parentheses in the middle, that = "(u.c)=E2=80=9D. However, on darwin, the generated output is more = compact: >=20 >> .uleb128 0x4 ; (DIE (0x188) DW_TAG_inlined_subroutine) >> .long 0x1b8 ; DW_AT_abstract_origin >> .quad LBB4 ; DW_AT_low_pc >> .quad LBE4 ; DW_AT_high_pc >> .uleb128 0x5 ; (DIE (0x19d) DW_TAG_formal_parameter) >> .long 0x1c6 ; DW_AT_abstract_origin >> .uleb128 0x6 ; (DIE (0x1a2) DW_TAG_variable) >=20 > I think that=E2=80=99s valid as well, and the test should pass (what = the test really wants to check is that there is no DW_TAG_lexical_block = emitted there, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D37801 = for its origin). It could be achieved in two ways: >=20 > 1. making darwin emit the DW_AT_call_file > 2. adjusting the regexp to match, making the internal block of = parentheses optional=20 >=20 > I chose the second approach. It makes the test pass on darwin. If = someone can test it on linux, it=E2=80=99d be appreciated :) I don=E2=80=99= t have ready access to such a system right now. >=20 > Once that passes, OK to commit? > FX >=20 --Apple-Mail=_713ACD73-554A-4FF3-9702-C1965BF08923 Content-Disposition: attachment; filename=0001-Testsuite-DWARF2-adjust-regexp-to-match-darwin-outpu.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Testsuite-DWARF2-adjust-regexp-to-match-darwin-outpu.patch" Content-Transfer-Encoding: quoted-printable =46rom=20f5b8d46bb89ee7664731e611d937ddbbf58d9f6b=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Francois-Xavier=20Coudert=20= =0ADate:=20Sun,=2020=20Aug=202023=2012:53:19=20= +0200=0ASubject:=20[PATCH]=20Testsuite,=20DWARF2:=20adjust=20regexp=20to=20= match=20darwin=20output=0A=0Agcc/testsuite/ChangeLog:=0A=0A=09*=20= gcc.dg/debug/dwarf2/inline4.c:=20Ajdust=20regexp=20to=20match=20darwin=0A= =09output.=0A---=0A=20gcc/testsuite/gcc.dg/debug/dwarf2/inline4.c=20|=20= 2=20+-=0A=201=20file=20changed,=201=20insertion(+),=201=20deletion(-)=0A=0A= diff=20--git=20a/gcc/testsuite/gcc.dg/debug/dwarf2/inline4.c=20= b/gcc/testsuite/gcc.dg/debug/dwarf2/inline4.c=0Aindex=20= 2faef6e2a4f..22eb35fcf09=20100644=0A---=20= a/gcc/testsuite/gcc.dg/debug/dwarf2/inline4.c=0A+++=20= b/gcc/testsuite/gcc.dg/debug/dwarf2/inline4.c=0A@@=20-2,7=20+2,7=20@@=0A=20= =20=20=20the=20DW_TAG_inlined_subroutine=20and=20the=20DW_TAG_variable=20= for=20the=20local.=20=20*/=0A=20/*=20{=20dg-options=20"-O=20-gdwarf=20= -dA"=20}=20*/=0A=20/*=20{=20dg-do=20compile=20}=20*/=0A-/*=20{=20= dg-final=20{=20scan-assembler=20= "DW_TAG_inlined_subroutine\[^\\(\]*\\(\[^\\)\]*\\)\[^\\(\]*\\(DIE=20= \\(0x\[0-9a-f\]*\\)=20DW_TAG_formal_parameter\[^\\(\]*\\(DIE=20= \\(0x\[0-9a-f\]*\\)=20DW_TAG_variable"=20}=20}=20*/=0A+/*=20{=20dg-final=20= {=20scan-assembler=20= "DW_TAG_inlined_subroutine\[^\\(\]*\(\|\\(\[^\\)\]*\\)\)\[^\\(\]*\\(DIE=20= \\(0x\[0-9a-f\]*\\)=20DW_TAG_formal_parameter\[^\\(\]*\\(DIE=20= \\(0x\[0-9a-f\]*\\)=20DW_TAG_variable"=20}=20}=20*/=0A=20/*=20{=20= dg-final=20{=20scan-assembler-times=20"DW_TAG_inlined_subroutine"=202=20= }=20}=20*/=0A=20=0A=20static=20int=20foo=20(int=20i)=0A--=20=0A2.39.2=20= (Apple=20Git-143)=0A=0A= --Apple-Mail=_713ACD73-554A-4FF3-9702-C1965BF08923--