From patchwork Mon Jan 6 07:21:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Achra, Nitika" X-Patchwork-Id: 37205 Received: (qmail 129176 invoked by alias); 6 Jan 2020 07:22:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 129167 invoked by uid 89); 6 Jan 2020 07:22:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=8:re, Ali, George, susan X-HELO: NAM10-DM6-obe.outbound.protection.outlook.com Received: from mail-dm6nam10on2060.outbound.protection.outlook.com (HELO NAM10-DM6-obe.outbound.protection.outlook.com) (40.107.93.60) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Jan 2020 07:22:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OK44Ty2703HKwJ/ybu0rewrSFKI+1tv48qkIDyh3MWJfi1y69kXy5IiAr+Rrf7jla3/h2K5kgY3JXOCaFu9OtCdqsRgY6u0AqkC5J46YRXc222NsZ1AHH2Twu+XRmLYwOJDViJBC6HrSuLBrDoF6+J3FNHiJj995ps2Q6mhH22WUo2hQg9tDbERuVbFNkWWPvy3tlNQa3+3jXTK8DAG/l6xymmmHu2BsvCDjiraq4Mq50XdHSs6dZLynw5img4hgPXzobYJOjQmAEnh81tGYFZ/Se1hfSAY4m463kOTei4KuUeiAN748KXG9/8cjGUNbNozgGhjlSTYhY8yM9ftM2A== 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=xXyKe5IxKWremojQZEmZSzsnIZujC28O8k87D2k/fIA=; b=CzpBlVsTsSPX2mcahg33379aGZTSZxClsBFg0nGRVtLuLaiVCzbx75eadekUNopmKViKF9zZYL7DA89XOsYeLnIIK7M4lKIcDwzeEgaTi0FeE9VTNnkVptGE1rWRwi6FW9AIrSZntPk+gFNB2Y/GCnfof/9YmlObnLwl/QR1czJNG/rdX14QSm3g61X2XCQdbLdZGiiC+GjTovPbni/jGR5P2Y/Rq8yvXbihRbTNeHL4W65AFYpaRUAQ+Oa1ioHvCVlD7BJePHtOVKRkE45MwZqYrP/jFh84X/n6nZI89Sjqs8s6gkUPnBbLeuee/SLgtneK39PpUzzZWr4StPjnTA== 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=xXyKe5IxKWremojQZEmZSzsnIZujC28O8k87D2k/fIA=; b=Hi/Y5bLHR46SeAquhG4DECNaHbfqWtYGG5nqKYNc7EczOWZvkF/Nrve3deH5XpsxayOuULFCTNaRCj6qXuBMcQMp/H8tktlowkKulLtIiT6U7Vu+fgA/LwqN2cCO3bsmsCwpYYAvEfoy6cYbaXUumBRDRoqYrwJ8mcwzwgI+TII= Received: from MN2PR12MB3744.namprd12.prod.outlook.com (10.255.237.80) by MN2PR12MB4077.namprd12.prod.outlook.com (52.135.50.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12; Mon, 6 Jan 2020 07:21:58 +0000 Received: from MN2PR12MB3744.namprd12.prod.outlook.com ([fe80::c1cb:697d:c30d:718c]) by MN2PR12MB3744.namprd12.prod.outlook.com ([fe80::c1cb:697d:c30d:718c%5]) with mapi id 15.20.2602.015; Mon, 6 Jan 2020 07:21:58 +0000 From: "Achra, Nitika" To: Simon Marchi , "gdb-patches@sourceware.org" CC: "George, Jini Susan" , Ali Tamur Subject: RE: [PATCH] Support for DWARF5 location lists entries Date: Mon, 6 Jan 2020 07:21:58 +0000 Message-ID: References: <48103fb5-d3ee-0ae0-92a7-f1c02debd449@simark.ca> In-Reply-To: <48103fb5-d3ee-0ae0-92a7-f1c02debd449@simark.ca> msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_enabled: true msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_setdate: 2020-01-06T07:21:54Z msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_method: Standard msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_name: Internal Use Only - Unrestricted msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_actionid: 213956bd-7299-46c6-8670-0000129366ac msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_contentbits: 0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Nitika.Achra@amd.com; x-ms-exchange-transport-forked: True x-ms-oob-tlc-oobclassifiers: OLM:7691; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /N6GVltvA8yWWM4PRYW/MIA2r2tfD0gfqxsF/RNuLq/qzqTrf5jEzV6SEqgsMSAsQqPtgpnxlzW5zu6hYkHOwA== [AMD Official Use Only - Internal Distribution Only] Hi Simon, Thanks for the review. I have reformatted it as per the GNU style. Please have a look at it. *Handle DW_LLE_base_addressx, DW_LLE_startx_length and DW_LLE_start_length. Tested by running the testsuite before and after the patch and there is no increase in the number of test cases that fails. Tested with both -gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with -gdwarf-4 as well as -gdwarf5 flags. gdb/ChangeLog: *gdb/dwarf2loc.c (decode_debug_loclists_addresses): Handle DW_LLE_base_addressx, DW_LLE_startx_length, DW_LLE_start_length. This is an effort to support DWARF5 in gdb. Regards, Nitika -----Original Message----- From: Simon Marchi Sent: Wednesday, January 1, 2020 12:03 AM To: Achra, Nitika ; gdb-patches@sourceware.org Cc: George, Jini Susan ; Ali Tamur Subject: Re: [PATCH] Support for DWARF5 location lists entries [CAUTION: External Email] On 2019-12-31 4:41 a.m., Achra, Nitika wrote: > [AMD Official Use Only - Internal Distribution Only] > > > > * Handle DW_LLE_base_addressx, DW_LLE_startx_length and DW_LLE_start_length. > > > > Tested by running the testsuite before and after the patch and there is no increase in the number of test cases that fails. > > Tested with both -gdwarf-4 and -gdwarf-5 flags. > > > > > gdb/ChangeLog: > *gdb/dwarf2loc.c (decode_debug_loclists_addresses): Handle DW_LLE_base_addressx, DW_LLE_startx_length, DW_LLE_start_length. Hi Nitika, Thanks for the patch. I don't have time to do an in-depth review right now, but I just wanted to point out the common formatting quirks of the GNU style, so you can apply it to this patch. In terms of indentation, we use two columns for each indent. However, leading groups of 8 spaces get converted to a tab. So instead of 14 spaces, you would have one tab followed by 6 spaces to reach the desired column. Most editors have a way to be set up like this. Unfortunately, VSCode can't. We use a space before opening parenthesis in function declaration/definitions/calls. So: loc_ptr·=·gdb_read_uleb128(loc_ptr,·buf_end,·&u64); would become loc_ptr·=·gdb_read_uleb128 (loc_ptr,·buf_end,·&u64); This: if·(loc_ptr·==·NULL) return·DEBUG_LOC_BUFFER_OVERFLOW; should become: if·(loc_ptr·==·NULL) return·DEBUG_LOC_BUFFER_OVERFLOW; Simon diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 99cac03a54..dd99ea35c0 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -173,6 +173,41 @@ decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu, switch (*loc_ptr++) { + case DW_LLE_base_addressx: + *low = 0; + loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64); + if (loc_ptr == NULL) + return DEBUG_LOC_BUFFER_OVERFLOW; + *high = dwarf2_read_addr_index (per_cu, u64); + *new_ptr = loc_ptr; + return DEBUG_LOC_BASE_ADDRESS; + case DW_LLE_startx_length: + loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64); + if (loc_ptr == NULL) + return DEBUG_LOC_BUFFER_OVERFLOW; + *low = dwarf2_read_addr_index (per_cu, u64); + *high = *low; + loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64); + if (loc_ptr == NULL) + return DEBUG_LOC_BUFFER_OVERFLOW; + *high += u64; + *new_ptr = loc_ptr; + return DEBUG_LOC_START_LENGTH; + case DW_LLE_start_length: + if (buf_end - loc_ptr < addr_size) + return DEBUG_LOC_BUFFER_OVERFLOW; + if (signed_addr_p) + *low = extract_signed_integer (loc_ptr, addr_size, byte_order); + else + *low = extract_unsigned_integer (loc_ptr, addr_size, byte_order); + loc_ptr += addr_size; + *high = *low; + loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64); + if (loc_ptr == NULL) + return DEBUG_LOC_BUFFER_OVERFLOW; + *high += u64; + *new_ptr = loc_ptr; + return DEBUG_LOC_START_LENGTH; case DW_LLE_end_of_list: *new_ptr = loc_ptr; return DEBUG_LOC_END_OF_LIST; @@ -197,6 +232,9 @@ decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu, *high = u64; *new_ptr = loc_ptr; return DEBUG_LOC_START_END; + case DW_LLE_startx_endx: + case DW_LLE_start_end: + case DW_LLE_default_location: default: return DEBUG_LOC_INVALID_ENTRY; }