From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2083.outbound.protection.outlook.com [40.107.20.83]) by sourceware.org (Postfix) with ESMTPS id B7DBB3858D39 for ; Thu, 18 Aug 2022 16:52:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7DBB3858D39 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=YoRmGrLuayH5eyZwTyq8ZN+eR9bgJnMaB35DI2raU6VCN2SCeQN0MUl+u0YzMnRvJjfJbQu/lhf+k9vzj7nbTpkiU3AgOlpL3GhMT5qlccvVcLmBygxjNPKnIp1Pvo3gQZBQzMrFqtylo77aFGbxmO1Qx1eYfvqqXzs7/IBPnz+HWCaPudrXTh1EIDSxYSUtiInsgBk5Wjtf8MGXpVJS/VWC0YmKNC3L7SHttW6ArkQiV/Ae/F6uwlFaUlhyZoILOSL2V5nB+fem17vaaomN7qFZ37ftlPbhuqQlEG+t778oXS42yz5MtppxtzK5qjV4jyAGuz8GAWKFgZEvWLVjnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7UF7FkVfUhpcCjrVSp39Iv7ZlzsSuytwfXXN7/DmWiE=; b=H0jMQsepU8HwB159KJmLO8hBWcvAS17R95MeJa9RsTPqUOA3LQb70mQtQxgqDIBiq2MvqV+TS3vEOqmx0weNkHJTzbmpAOH35XIfLRz9flk1anNDnbULZR0JZ7DYS/BZcxMKmwpo+Hk/MZvy4fsEyhvas9mWFQ3oSV4CE6Iu3l48puoq7GXqXlcg2nd3Y3bjsgFCkaooJSnfME+URy6gXJqp67ZVweZDi/dy/VLt+qPZNrUBvYv9CUVu8o1d2BCv19dyqFG/YjoWm3XXaTy/ulXM9Xh3FtDHT5H2IXpVmCCijd2299UmhdeJfFFD7jC6Wcw4x4S7VsvkxXs/Q6vSQA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from FR0P281CA0085.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::9) by DBBPR08MB4775.eurprd08.prod.outlook.com (2603:10a6:10:da::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Thu, 18 Aug 2022 16:52:43 +0000 Received: from VE1EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:1e:cafe::f1) by FR0P281CA0085.outlook.office365.com (2603:10a6:d10:1e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.4 via Frontend Transport; Thu, 18 Aug 2022 16:52:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT031.mail.protection.outlook.com (10.152.18.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.15 via Frontend Transport; Thu, 18 Aug 2022 16:52:42 +0000 Received: ("Tessian outbound fa99bf31ee7d:v123"); Thu, 18 Aug 2022 16:52:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 280cfb3795f85cf8 X-CR-MTA-TID: 64aa7808 Received: from 717bd7251e51.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BED6FAB3-7551-4D26-B811-C428D11A9D1E.1; Thu, 18 Aug 2022 16:51:46 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 717bd7251e51.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 18 Aug 2022 16:51:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PHtrp4lZ/CnItbLNseKWw88G/0Rq3/y3GHx22KNLY7EYRsiOuPx2FqcEqDQrxyfVet1GqS7ov+gMI1BQ5lac51FoEGQrI9/foxfhJoUGLxyV70WPJelq70Jd/ECTSIfasMqcD3i6mrV0/Q5cgrcOE81BF5tuz1qtCOIrDS1MX6w799lV7D9VV0ZBmru49LM9cXAHULR0rxK8Cuuf3MeKK6bith0YXhYhTJSeXhYoc7OND7QgO3PFUSrj7q5l8cZD8izIKJzgIpRqUqqIAYVRIvpYP8m0j3orfANyW9Z7rJ5ZXOu6klL7geMCPkh1dKxL2YFaZkmjyKFmb8MzWcOeeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7UF7FkVfUhpcCjrVSp39Iv7ZlzsSuytwfXXN7/DmWiE=; b=ZPTUZo8gQ62TxU7Qfxq1qPAoTei8Ou3djyDucdqM1uL9QGLE9AWquYDWG/yHplQG8AMu9YUAVJ8m0GVUU7vaeSSyufENj7Jc8aWIeQlL5zVZeliFsbbVpLOmcCdlc/eT9M2zByk3DWYnc0xtnW26Uz87YghsNhTI9SpZ7Y6BQPBm4mK24OdteaTuSof8uX9+lHBVmgmgn2aoosiAKaW22Sos6KOED16BBfBDWBaC1d8dNdhwcywy7BbvkOdSFdO9pV+nmhSpkMIRl8/KatFmMuEFYpcOH+p1Syc8XV4fPLfJIiX05TOYrgMNurRhdWLqflPm46CIwkuPowNaXPayPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AM6PR08MB4389.eurprd08.prod.outlook.com (2603:10a6:20b:bc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Thu, 18 Aug 2022 16:51:44 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::cc64:9170:b12d:de8]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::cc64:9170:b12d:de8%4]) with mapi id 15.20.5504.028; Thu, 18 Aug 2022 16:51:44 +0000 Message-ID: <5bc46c80-545a-a530-8379-b1deb860075d@arm.com> Date: Thu, 18 Aug 2022 17:51:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v3] gdb: call check_typedef at beginning of dwarf_expr_context::fetch_result Content-Language: en-US To: Simon Marchi , Simon Marchi , gdb-patches@sourceware.org References: <20220728153340.4052079-1-simon.marchi@efficios.com> <5ed77384-970f-3e97-0e66-bce2acd28f9a@polymtl.ca> From: Luis Machado In-Reply-To: <5ed77384-970f-3e97-0e66-bce2acd28f9a@polymtl.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0342.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::18) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 552981ac-f01f-4abe-78f0-08da813a1194 X-MS-TrafficTypeDiagnostic: AM6PR08MB4389:EE_|VE1EUR03FT031:EE_|DBBPR08MB4775:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: WTCEBLBq66c09C9p1orQZB8z8Zs5S8oQvMpmkRtiSksqlFVrNS0jtylOcSZ5h+3yAbGj7KdAjGZR7I3uXSoIdyh04VaojhP/NRhbwJDOnx9ceqAL5GMLj17GC1rMqIZDvIcGET/lGN7GDWJMHejuj71GLOdjW/5SHJoteEwQSHYZ8lDrmhVx0pgsywYCL0gCH6VyNB4Er8Hcs2oXGnd2CRCNsA7TG/Z4bhbGzCREJKiFw92d2k+RjUrCE0QKQogWXZ+P13vb6slAsD7wV68eM7pMXBMm2Y9XqjKDhDUGsyuR2NUp6imfSW38Ln1OqsnCtjR09Dt+K9LygwJ3cXvrTv5HpyhD19+vHt3cgKbVzYga7iRyJzKFdw/XTSbQI+8kZZT7cKruBsANW3Z23sHmIyjMIcp5lAQLPp1mEdvHqaaQcSkRRPe/0emPLdoyA0b9+CGi7z2Eyi7ZXZp9jcCajmHWIprdtH86PC33E812rpcMK0y7HLQ/V4opyHFbNGUAMmNtKdsdYHB4iQg3ZWFEG+C7CQeeD2LO8FQvon4ucNkNt4YbxWcfQrplPW+hNV3ZU6kIs/c3IgoJCnBaWTmv0K/u7NQIWHMtnuV5ZqNhNVmFpmp43zsHAEKxcU4zGFMrmOgBa1ANWVVUS8nebnv2wQSW8ia0cMPBFPx+nQ8L3hcpm9f0Ep2zFR4hCMmp1FxxYzW4RIaLLvwY6QAF+C+3sOrJn1QwRekTchjVOxkDTAxmowMqY6jumSiF9kt+YeW9qplnXgccLc0/SkVGAEhzi+fMItbsAwgrMrjsC+4BFoLQH616PykOgd/DB7NV6gzF X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(136003)(366004)(376002)(346002)(39860400002)(26005)(6512007)(110136005)(41300700001)(6506007)(36756003)(53546011)(316002)(6486002)(966005)(478600001)(86362001)(2906002)(31696002)(66946007)(66476007)(66556008)(44832011)(8676002)(8936002)(83380400001)(5660300002)(186003)(31686004)(38100700002)(2616005)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4389 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ca071e6c-00c1-4eb2-511e-08da8139ee6d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WSlvwXDvv3WqW/fIluW6ZxMCNiIM8r+E7Q87/qYyvLzME+HlCXYcwBEJnknegnv//p9eSUAUAu0RhM9ghYyOhRxbFJlvq6VKHBYCMd0Xi2w3nYX0NvqWTk2YVh6g35cD+7hBWV15QRdOfBRNIgRoSeYXXsAebTNPrADR6rODeehbquRCLooS1vJuKZJHtmZz8tAm3GHIQG0Zl+a2bC6mrQfYWkngQ7YHHu3YG3HLEd8UZ/kd9tPiC4E3O/MQdBJEhCBxUWarWM2tebNl378hYHEzopBtsWBJb5icMprNxsYxFsNCxpniHH0/3CexxGf83IDDk4xte85A8I1AYBZKOvJeKNLnj9c1gg0IpgPAwjBjh6saO/KlFOm4EmqVtONXvx9izoI9FuQJ/rH2g6TOwc2/DjtJMHZpzVFQeozeHnDVKWUmmALxBee7uZqkNThdl3BmoyLW7UgZnYMWUeRdVACTWKx+YA0ZFuKCnOhQ/jd/DlXiXKjPgaFyFpIwLPfezrKWefWHA/YTC35q0YVJMy4iB8Wv3iO4M9nntVqLucAqcFHsp1iAUXUO7kO3l6cLevlhTDNDOR6p2LnMt0uBZOAX1GcxjP9Z50PbhRr9yez3lg6TvTsr/ZAaoNF7R2J+1JiRoGF9mvPSg/EDX8HXKfbzrm3XtA4MwSzDoGbuf/ZNELODIku13V6zQ6ZT7LN5JB5EZO1WBQJ3WYThJMZ+fOuMcNYXKxz0kAj9kNOFFG+dkjsNwHmcJssSvyc433q6ZemJjgO/5JS09ZkXitb1TKDFF3z6POjcAT7MI/pmzTVpccgozy+Z5QAlv1M0nrIR X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(346002)(136003)(376002)(396003)(40470700004)(46966006)(36840700001)(83380400001)(316002)(40460700003)(70206006)(36756003)(110136005)(31696002)(8676002)(31686004)(6486002)(478600001)(966005)(47076005)(336012)(86362001)(70586007)(6512007)(5660300002)(41300700001)(36860700001)(8936002)(82740400003)(356005)(186003)(44832011)(82310400005)(26005)(2616005)(53546011)(40480700001)(81166007)(6506007)(2906002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2022 16:52:42.7969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 552981ac-f01f-4abe-78f0-08da813a1194 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4775 X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, KAM_DMARC_NONE, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, WEIRD_PORT autolearn=no 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2022 16:52:48 -0000 On 8/18/22 17:16, Simon Marchi via Gdb-patches wrote: > On 7/28/22 11:33, Simon Marchi wrote: >> From: Simon Marchi >> >> New in this version: >> >> - add architecture check in test >> - add aarch64 version of the .S >> >> Bug 29374 shows this crash: >> >> $ ./gdb -nx --data-directory=data-directory -q -batch -ex "catch throw" -ex r -ex bt a.out >> ... >> /home/simark/src/binutils-gdb/gdb/../gdbsupport/array-view.h:217: internal-error: copy: Assertion `dest.size () == src.size ()' failed. >> >> The backtrace is: >> >> #0 internal_error (file=0x5555606504c0 "/home/simark/src/binutils-gdb/gdb/../gdbsupport/array-view.h", line=217, fmt=0x55556064b700 "%s: Assertion `%s' failed.") at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:51 >> #1 0x000055555d41c0bb in gdb::copy (src=..., dest=...) at /home/simark/src/binutils-gdb/gdb/../gdbsupport/array-view.h:217 >> #2 0x000055555deef28c in dwarf_expr_context::fetch_result (this=0x7fffffffb830, type=0x621007a86830, subobj_type=0x621007a86830, subobj_offset=0, as_lval=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/expr.c:1040 >> #3 0x000055555def0015 in dwarf_expr_context::evaluate (this=0x7fffffffb830, addr=0x62f00004313e "0", len=1, as_lval=false, per_cu=0x60b000069550, frame=0x621007c9e910, addr_info=0x0, type=0x621007a86830, subobj_type=0x621007a86830, subobj_offset=0) at /home/simark/src/binutils-gdb/gdb/dwarf2/expr.c:1091 >> #4 0x000055555e084327 in dwarf2_evaluate_loc_desc_full (type=0x621007a86830, frame=0x621007c9e910, data=0x62f00004313e "0", size=1, per_cu=0x60b000069550, per_objfile=0x613000006080, subobj_type=0x621007a86830, subobj_byte_offset=0, as_lval=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1485 >> #5 0x000055555e0849e2 in dwarf2_evaluate_loc_desc (type=0x621007a86830, frame=0x621007c9e910, data=0x62f00004313e "0", size=1, per_cu=0x60b000069550, per_objfile=0x613000006080, as_lval=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1529 >> #6 0x000055555e0828c6 in dwarf_entry_parameter_to_value (parameter=0x621007a96e58, deref_size=0x0, type=0x621007a86830, caller_frame=0x621007c9e910, per_cu=0x60b000069550, per_objfile=0x613000006080) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1235 >> #7 0x000055555e082f55 in value_of_dwarf_reg_entry (type=0x621007a86890, frame=0x621007acc510, kind=CALL_SITE_PARAMETER_DWARF_REG, kind_u=...) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1332 >> #8 0x000055555e083449 in value_of_dwarf_block_entry (type=0x621007a86890, frame=0x621007acc510, block=0x61e000033568 "T\004\205\001\240\004\004\243\001T\237\004\240\004\261\004\001T\004\261\004\304\005\004\243\001T\237\004\304\005\310\005\001T\004\310\005\311\005\004\243\001T\237", block_len=1) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1365 >> #9 0x000055555e094d40 in loclist_read_variable_at_entry (symbol=0x621007a99bd0, frame=0x621007acc510) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:3889 >> #10 0x000055555f5192e0 in read_frame_arg (fp_opts=..., sym=0x621007a99bd0, frame=0x621007acc510, argp=0x7fffffffbf20, entryargp=0x7fffffffbf60) at /home/simark/src/binutils-gdb/gdb/stack.c:559 >> #11 0x000055555f51c352 in print_frame_args (fp_opts=..., func=0x621007a99ad0, frame=0x621007acc510, num=-1, stream=0x6030000bad90) at /home/simark/src/binutils-gdb/gdb/stack.c:887 >> #12 0x000055555f521919 in print_frame (fp_opts=..., frame=0x621007acc510, print_level=1, print_what=LOCATION, print_args=1, sal=...) at /home/simark/src/binutils-gdb/gdb/stack.c:1390 >> #13 0x000055555f51f22e in print_frame_info (fp_opts=..., frame=0x621007acc510, print_level=1, print_what=LOCATION, print_args=1, set_current_sal=0) at /home/simark/src/binutils-gdb/gdb/stack.c:1116 >> #14 0x000055555f526c6d in backtrace_command_1 (fp_opts=..., bt_opts=..., count_exp=0x0, from_tty=0) at /home/simark/src/binutils-gdb/gdb/stack.c:2079 >> #15 0x000055555f527ae5 in backtrace_command (arg=0x0, from_tty=0) at /home/simark/src/binutils-gdb/gdb/stack.c:2198 >> >> The problem is that the type that gets passed down to >> dwarf_expr_context::fetch_result (the type of a variable of which we're >> trying to read the entry value) is a typedef whose size has never been >> computed yet (check_typedef has never been called on it). As we get in >> the DWARF_VALUE_STACK case (line 1028 of dwarf2/expr.c), the `len` >> variable is therefore set to 0, instead of the actual type length. We >> then call allocate_value on subobj_type, which does call check_typedef, >> so the length of the typedef gets filled in at that point. We end up >> passing to the copy function a source array view of length 0 and a >> target array view of length 4, and the assertion fails. >> >> Fix this by calling check_typedef on both type and subobj_type at the >> beginning of fetch_result. >> >> I tried writing a test for this using the DWARF assembler, but I haven't >> succeeded. It's possible that we need to get into this specific code >> path (value_of_dwarf_reg_entry and all) to manage to get to >> dwarf_expr_context::fetch_result with a typedef type that has never been >> resolved. In all my attempts, the typedef would always be resolved >> already, so the bug wouldn't show up. >> >> As a fallback, I made a gdb.dwarf2 test with compiler-generated .S >> files. I don't particularly like those, but I think it's better than no >> test. The .cpp source code is the smallest reproducer I am able to make >> from the reproducer given in the bug (thanks to Pedro for suggestions on >> how to minimize it further than I had). Since I tested on both amd64 >> and aarch64, I added versions of the test for these two architectures. >> >> Change-Id: I182733ad08e34df40d8bcc47af72c482fabf4900 >> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29374 >> --- >> gdb/dwarf2/expr.c | 5 + >> .../gdb.dwarf2/entry-value-typedef-aarch64.S | 12885 +++++++++++++ >> .../gdb.dwarf2/entry-value-typedef-amd64.S | 15545 ++++++++++++++++ >> .../gdb.dwarf2/entry-value-typedef.cpp | 36 + >> .../gdb.dwarf2/entry-value-typedef.exp | 45 + >> 5 files changed, 28516 insertions(+) >> create mode 100644 gdb/testsuite/gdb.dwarf2/entry-value-typedef-aarch64.S >> create mode 100644 gdb/testsuite/gdb.dwarf2/entry-value-typedef-amd64.S >> create mode 100644 gdb/testsuite/gdb.dwarf2/entry-value-typedef.cpp >> create mode 100644 gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp > > I pushed this patch. > > Simon It seems newer compilers on aarch64 (g++ 9.4.0 or 11.2.0) don't like this test. They complain with: gdb compile failed, /usr/bin/ld: /tmp/cc0vjoZT.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZNSsD1Ev@@GLIBCXX_3.4' which may bin d externally can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /tmp/cc0vjoZT.o(.text+0x38): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `_ZNSsD1Ev@@GLIBCXX_3.4' /usr/bin/ld: final link failed: bad value So the test doesn't run properly. Building it statically makes it work though, and still shows the problem: FAIL: gdb.dwarf2/entry-value-typedef.exp: backtrace (GDB internal error) Hopefully that will also work fine for x86_64 (haven't tried yet).