From patchwork Tue Jan 14 07:02:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Achra, Nitika" X-Patchwork-Id: 37365 Received: (qmail 39957 invoked by alias); 14 Jan 2020 07:02:11 -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 39949 invoked by uid 89); 14 Jan 2020 07:02:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 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= X-HELO: NAM04-BN3-obe.outbound.protection.outlook.com Received: from mail-eopbgr680065.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) (40.107.68.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jan 2020 07:02:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NllyVvrS5SIyTxXJrrkmS8HHGIDXJHkS/fYCdVanK0lzZCOqGH093irJln6MAWPfZmDmbv2JPBFgACbLtm2sKP7oqpNHV3d8Z6V6v2LnTDBI/vwpyswMHz4E4diA1aIYgsfnw6zxB35nhgH0xnpw8cAEE4DBVKpcotADmwLNo/pF4Zi+tjS2/ihnZVSkY0ZqSVBaIzVNzB3VD5knnUv78BQ8NQQ6KKQTyYxojVOD9YeuOmnQv1+shqTcYYqbvmhDhMOUjDLBmk5BBfaTgNAsERMHPWKd5WsiiMrYk7LeYy6j+EOtX0n7i8EDdX8nXIEFIoP8PVVrOJ5tpC5A6YGmOw== 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=Lwtc2qSFK4552TM1C9tVStx1+ulVOTD++YV/S1IPRvo=; b=Co6ZClom9WR7xbUM78eq6RlsK/HC6fW5lypVLvB+lcn6kNkUg61So6VxGiCW8CJwkkFrkFus5GZ3oioEut2uK66u7qyB3pe7w9Lx7wscRyknEMcpOPvhfLJ/7Dzj0OyCITsuiCteyRtVpPpX0vCUD1EpN3x4JwsxbNMqhNehCkyK9rcxOhWXApjoTMmWsb1QVK4W1ROZMO1DLGXDjqLYE97g1hNRCsKo/Tk+a0utkDStfES7DI9o/4cWqTkfMQ1Ozz/7A3x41AlHBRJkbfyfowjCJ8Z6/iocZfMmaG1jji5/Stmi0PcfhqYEQGVGhh1aPwbXlzP4oEHj/DwbjuuNfg== 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=Lwtc2qSFK4552TM1C9tVStx1+ulVOTD++YV/S1IPRvo=; b=Qn+EpGkoLJtf1cuO4smKIsLFF6Pj8TNwB4vy2SmWzFOsj9SOWp1K1yKQvuvxtPsl/JjcTFHieebvOgxRb97B604jldjGpb6Eya07p9OyJ/Jpo7O3auvTXQKzQL3Vw37gxumvXhn6PC9ykDSX7CGa7XY2lG1ZaDQ5CJylnIZl9Qw= Received: from MN2PR12MB3744.namprd12.prod.outlook.com (10.255.237.80) by MN2PR12MB3104.namprd12.prod.outlook.com (20.178.243.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Tue, 14 Jan 2020 07:02:06 +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.2623.017; Tue, 14 Jan 2020 07:02:06 +0000 From: "Achra, Nitika" To: Simon Marchi , "gdb-patches@sourceware.org" CC: Ali Tamur , "George, Jini Susan" Subject: RE: [PATCH] Support for DWARF5 location lists entries Date: Tue, 14 Jan 2020 07:02:06 +0000 Message-ID: References: <48103fb5-d3ee-0ae0-92a7-f1c02debd449@simark.ca> <0d36089b-1890-c579-7715-641e94dd4bb6@simark.ca> <27bfa975-e28d-eafb-d9db-f0d2be5f5bde@simark.ca> In-Reply-To: <27bfa975-e28d-eafb-d9db-f0d2be5f5bde@simark.ca> msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_enabled: true msip_label_76546daa-41b6-470c-bb85-f6f40f044d7f_setdate: 2020-01-14T07:02:03Z 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: 77afd5c3-9207-4d27-82e9-00001c904717 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:10000; 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: y1EuOeZM2oxtbNc4BqXG+8Ziut2NODB9uvxHMi7dK5Yzdq7GBKbCaRl7cFUN0LNveCUyP3lN+1KrDYSoWWlP0g== [AMD Official Use Only - Internal Distribution Only] Hi Simon, Sorry, I missed the comment. And I will try to setup the git-send-email before the next patch. Thank you. *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: *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: Monday, January 13, 2020 10:07 PM To: Achra, Nitika ; gdb-patches@sourceware.org Cc: Ali Tamur ; George, Jini Susan Subject: Re: [PATCH] Support for DWARF5 location lists entries [CAUTION: External Email] On 2020-01-13 5:45 a.m., Achra, Nitika wrote: > [AMD Official Use Only - Internal Distribution Only] > > > > Hi Simon, > > Thanks for the detailed review. > > *** >> + return DEBUG_LOC_BUFFER_OVERFLOW; > >> Not sure if it's your email client that changed them to spaces, but the lines at this indentation level (there are a few in the patch) should be indented with a tab. > > I was sending the mail in HTML format which is converting tabs to spaces while sending. Now, I am sending in plain text format. It should fix the issue. Thanks. The best is to use git-send-email, which makes git send the patch by email directly, in the right format. It requires a bit of setup, since you need to specify your SMTP server settings, but it's really worth it. If you can't use git-send-email for some reason, the second best option is git-format-patch. git-format-patch will produce a complete patch, including the subject and the commit message. So if you want to send your patch as an attachment or paste it in an email, please use git-format-patch instead of git-diff, which just produces the diff, without the commit message. Finally, if you manually paste your patch in an email, then you need to make sure the email client doesn't change anything (like break long lines), otherwise the patch will be corrupted. > *** >> + *high += u64; >> + *new_ptr = loc_ptr; >> + return DEBUG_LOC_START_LENGTH; > >> Something I noticed while reviewing, which could be a possible cleanup made in a separate patch if you'd like. I don't really see why DEBUG_LOC_START_LENGTH exists. As we return > > the low and high addresses to the caller, it's no different than DEBUG_LOC_START_END. And indeed, the callers treat both DEBUG_LOC_START_END and DEBUG_LOC_START_LENGTH > > the same way. So I think _LENGTH could be removed. > >> And since `enum debug_loc_kind` is only used internally in GDB to communicate between functions (it's not used for parsing anything), it doesn't really need to have explicit values for > enumerators. The documentation about the encoding also seems irrelevant to me, since, again, they are not even used for parsing anything. > > I will made this cleanup in the separate patch. Thanks! > *** >> + case DW_LLE_startx_endx: >> + case DW_LLE_start_end: >> + case DW_LLE_default_location: > >> Did you add them here because you don't intend to add support for them, at least for the moment? If so, please add a comment, like: > >> /* Not supported yet. */ > > Done. Clang and gcc are not emitting the above three entries as of now. So, I didn't add the support for them. Hmm, I don't see the comment in the new version of the patch. 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; + /* Following cases are not supported yet. */ + case DW_LLE_startx_endx: + case DW_LLE_start_end: + case DW_LLE_default_location: default: return DEBUG_LOC_INVALID_ENTRY; }