From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) by sourceware.org (Postfix) with ESMTPS id 34B1D383F874 for ; Mon, 11 May 2020 17:50:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 34B1D383F874 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=Nitika.Achra@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l9gJyJQy44yTuoQj8J6WB0+Byk6gMo4OiVzLUahmuYi2RZhGn/9r1Weab0PzYK9uEurDIsq/40JMe2uerunxrVwteaXHuCkC5+HfhgX+di0E8fdnJf61nO7JIviEwleSF9IA+r0Qizn/g/7JRX9WwIfLsB6hUeUGO/A7D5jiRE3M05Douexjx8YZM553zhFA6J3KQXh6R5gdyQdSgnTNdULpAUSAvWX8vos/gcCN4IjjeUG5mQEri+SGkSHx0AT4kkGBYGeyAQBXG7dJO7U9uqUnkoAfX2yUZpl+fanTRaFqUykH3fNALbeKWlURhq10elMKvxVMQJcobZCI85D1fA== 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-SenderADCheck; bh=L4IV93XRdjmxoTXchvaHaoNtmJYyppAmFWepre0/J6s=; b=k5KXyDt44D5olpVnVow9I/ed9iOcOvHGd1UcZJADvP4RcHsSRwkkE5YDHr6pwHSFQe+SyONuVmrQPToGEN+BIlLaNk0LfEXFC0OvFEqh1OMtWJW1zsIBUpgRnw06HYTfIcMQeSHwIfVFJUBsGVHrDe4996ZsKbQVOIPSAFr5qTiKBSzEFnY60mBiHOHC4oNhGlK/jdETjMT7FX14L6YwOgEnhtAl4oddTG3ZqpAUBQeHjYOqL9ubWUeaJgtxIm/Evp7KRm9dMIkJoJirUCNTbc5/BrG1erL0BtOYmhyTodIQRZvOWu+iD7RwDPvdR07c9ySBzzjMxKA/g7MFl2eMbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L4IV93XRdjmxoTXchvaHaoNtmJYyppAmFWepre0/J6s=; b=gu5wZePqlIArvjfVAVFyjlHrUIO3xc8gqBF6GX0/gR/JZfiBIOxgm7vb8wUILlru+tmLkPxMWhIFDS2MQjwQWs9gSXRDrDEns56W4TYLXpGVMQRVw4UeYIQTH/tbccZ9oayb6gKFtrFS8WL7BU6igeLlNc7zwEzC8fAtv8VKaHc= Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2736.namprd12.prod.outlook.com (2603:10b6:805:75::30) by SN6PR12MB2847.namprd12.prod.outlook.com (2603:10b6:805:76::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.29; Mon, 11 May 2020 17:50:48 +0000 Received: from SN6PR12MB2736.namprd12.prod.outlook.com ([fe80::3cdb:5c47:4de4:9bc2]) by SN6PR12MB2736.namprd12.prod.outlook.com ([fe80::3cdb:5c47:4de4:9bc2%2]) with mapi id 15.20.2979.033; Mon, 11 May 2020 17:50:48 +0000 From: nitachra To: gdb-patches@sourceware.org, tom@tromey.com, tdevries@suse.de Cc: JiniSusan.George@amd.com, nitachra Subject: [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form. Date: Mon, 11 May 2020 23:20:22 +0530 Message-Id: <20200511175022.26123-1-Nitika.Achra@amd.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: MA1PR01CA0101.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::17) To SN6PR12MB2736.namprd12.prod.outlook.com (2603:10b6:805:75::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from bglcomp-haswell-105.amd.com (165.204.156.251) by MA1PR01CA0101.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.28 via Frontend Transport; Mon, 11 May 2020 17:50:46 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d41669ac-74a9-41d7-de14-08d7f5d3d6ae X-MS-TrafficTypeDiagnostic: SN6PR12MB2847:|SN6PR12MB2847: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-Forefront-PRVS: 04004D94E2 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aF15lAxMN0s5WUZ88Ct4Pr4FXjEG3wglBf12QM0KzuVqvvwK6KmA/qyJyEMgtSwRqEAKcBSX0/mhEwY8dCtO2ySr6KVWlBMLAobEFVyF06Rvjc7rCeq1bHpWJ/EdtzyZiVErWlmNNZJqdBj3GvHKct2gEcIIAO1QERTm99aDGiFDVIUSW72hRaD8+6B0zMiVLgO2saGmgV9fInChDPko4Cu9Nt2M+RoDxpJUkWtwVVU4edLHv2yrifoWZD8cEiaxIp2TnshTAheENC8ckRCGQDUYg9pJtCAhKTXOIbP46iPhQr84aiUIvh9AvPPQPQiWHuHn3MC/v/p1rmwGbRdQiEvS3cCIPp47b5NsPNO+fIq4+484P7mvZ3LMMI0honFMG1mj574iDnxYB3gnceO6i6sR1xE0lqeTpwChLywbsGt5j96bEhu/BWya4LSz7NYc/a3PZamAyXSn9ewqIr7EPEyxzT/00D3lpU/mGmm1mzVHo0EVWZNTvmwvGdem8HJWCTPkvMvrg5dbKPz3FPCYFPhVPevi2cXA7ekiC+AC+pxq/iZXe+G0LtUQwOxsFlsVwR5CnHJ/3qUbvoCOXZJv+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR12MB2736.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(33430700001)(478600001)(8936002)(6486002)(186003)(16526019)(26005)(316002)(52116002)(66556008)(36756003)(7696005)(86362001)(66946007)(2906002)(66476007)(33440700001)(8676002)(6666004)(5660300002)(4326008)(2616005)(956004)(1076003)(43062003)(142923001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Uhx7BRuqyiZeoKsum5C6vsDDmi6jhuOgLH2O6tYh1kUXUt+08FwXrMHEeH6jvZQEo0PHU/oTb0D/aYRXSY0KW++Kv3jNlLhrwaG/unFvTBM2Yk5s1i9ogN8hrhkdRKWBuB9GZgzQYe2YbigLIXdAAyTeOzGG1KBOqWDUijHLp3RmrW1wmCtN1zMHarwjawIAmR95iklCt3rsLiJs2BiqMAwfVuhGy+Xj8kbw75cyEaHZCRAKuwneseRey9kPm0vW9d/LaTAOi4V+4aJbxI94ncYafGm10Q3HysaSg6Dxoi8V+2UdD3mJryDG7H+0Lf/PLjpzIXLQAhChx8/q9tSht2F4rFtxcYK8O+EB9qne8UQSpp3d+O/qZUDRONa7AGzj+JY/6WyezsVcWJImjJZhX9Y0ypb7xKmF0J8ivf5Rc5IN7Lnqwy61UViR6vG64uLN7nm71Q0NRqy9X7//i2Lud/25Uwjyo50auhPaR0CR207DuGeNbVI4vTtM5bfafo3T X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d41669ac-74a9-41d7-de14-08d7f5d3d6ae X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2020 17:50:48.6672 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7ikpiW3qpqC3Qu8o4C32wGjo4xpHbTo6p0Z/ZMBQ6IUXe3m8VJVtLlocCnW3USE55UC0Tkchmsxh4ElyF6/pRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2847 X-Spam-Status: No, score=-20.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Mon, 11 May 2020 17:50:52 -0000 Thanks Tom for the review. Incorporated the review comment. Thanks Tom de Vries for adding the test case. This test fails before the patch and pass afterward. --- Following complaint is observed with the executable compiled with -gdwarf-5 and -gpubnames flags- "During symbol reading: Unsupported .debug_names form DW_FORM_ref4". This is the form corresponding to DW_IDX_die_offset attribute. This patch fixes this complaint. Tested with clang 10.0.0. Test case used- int main() { int sum,a,b; sum = a + b; return sum; } clang -gdwarf-5 -gpubnames test.c -o test.out gdb -q test.out -ex "set complaints 1" -ex "start" Reading symbols from test.out... During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module /home/nitika/workspace/test.out] Temporary breakpoint 1 at 0x400484 Starting program: /home/nitika/workspace/test.out During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module /home/nitika/workspace/test.out] During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module /home/nitika/workspace/test.out] During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module /home/nitika/workspace/test.out] gdb/dwarf2/ChangeLog: *read.c (dw2_debug_names_iterator::next): Handle DW_FORM_ref* and DW_IDX_die_offset. If there is no compilation unit attribute in the index entry, then there is a single CU. Return the CU at O index of compilation unit vector. --- gdb/dwarf2/read.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 1813085d0d..08a3bed1a9 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -5352,6 +5352,18 @@ dw2_debug_names_iterator::next () ull = read_unsigned_leb128 (abfd, m_addr, &bytes_read); m_addr += bytes_read; break; + case DW_FORM_ref4: + ull = read_4_bytes (abfd, m_addr); + m_addr += 4; + break; + case DW_FORM_ref8: + ull = read_8_bytes (abfd, m_addr); + m_addr += 8; + break; + case DW_FORM_ref_sig8: + ull = read_8_bytes (abfd, m_addr); + m_addr += 8; + break; default: complaint (_("Unsupported .debug_names form %s [in module %s]"), dwarf_form_name (attr.form), @@ -5384,6 +5396,12 @@ dw2_debug_names_iterator::next () } per_cu = &dwarf2_per_objfile->get_tu (ull)->per_cu; break; + case DW_IDX_die_offset: + /* In a per_cu index, index entries without CU attribute implicitly + refer to the single CU. */ + if (per_cu == NULL) + per_cu = dwarf2_per_objfile->get_cu (0); + break; case DW_IDX_GNU_internal: if (!m_map.augmentation_is_gdb) break; -- 2.17.1