From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690040.outbound.protection.outlook.com [40.107.69.40]) by sourceware.org (Postfix) with ESMTPS id 083CC385DC0A for ; Tue, 31 Mar 2020 13:58:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 083CC385DC0A 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=MYV2cIekbOnbycJoHpEeLTwK0VQgo09VQUTdx1zjvW5IzbI5mRQ8ZKFoOGNQzMaeENAqJFRBbtqOGitmv8Jj70sH/P4y/UslbMII5MSFAzWbfdSV7UKFnVIjkdMZR0+ZNHTMxnV3kGRZQpoem5s3txaFKwAUwIpdvw1k6NGEiLyQe+pVo5mRAFJRlIAZCyMx76ZsOS8P1v1HHj3K2mtF6OIDlrUPW32A6uEYTBNk3g+5fhve1viCDBkjFv+ukvMiyMOZGjh/NHEjKeJ9pmyTY71vACT+EinhYFVBnGNs059DOQtkBAbMjXA5gnf9WvEOpED3sYsOlAP6DcimX2AJFg== 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=GYIAae0sHKhMp6pEVgsGj/qzXdeg1Ji1t82gHfV53NY=; b=aAqVbyu6y1cc4OS/ca5TPzP8X1ModXt8Z2/x/oDqNB8zfS5VIG2EpMnsOhOsBH/EaibSdnuTBcVMXyi3Lk60sprpfL2S06MT/QbKU4+/js7+MtNOybhWwcjB+6PpbIzBefMvZ4c0LldAvpA36UHU93mSDtdOLcSSK3MjAiNSCdy4f7dONzAaEJjdMwu9Q3rNXCbbznZS1Hw7SGH6O99YdQnNLUMB55q6Vf7OM2w/OyppD4vGFF48ifesznoC+4YQ69aPuZIApiWK1oCjVgRTagRrH6cgjxxuNt9PBFgEf8OFs69XHZf+E+h2kdy/1NzR+fUgSIVAXzvc4pR5eCbt8g== 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=GYIAae0sHKhMp6pEVgsGj/qzXdeg1Ji1t82gHfV53NY=; b=3EYF3paYW75TPzVXB0CBrVknZywB+TRMDyfPYy14NPVE2erAEEUtEOEyEJqC5XS1ENpnyjL3tJRIMNr5JfqNPeDV79gNej9sLC8OSlIhKvjKGOUU6W6zDEoyDB0g7ZOsKpT3kp/NqzdQZuZhHo3wVAAZBmHydgs2XViWtwAmMZY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Nitika.Achra@amd.com; Received: from SN6PR12MB2736.namprd12.prod.outlook.com (2603:10b6:805:75::30) by SN6PR12MB2799.namprd12.prod.outlook.com (2603:10b6:805:77::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15; Tue, 31 Mar 2020 13:58:26 +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.2856.019; Tue, 31 Mar 2020 13:58:26 +0000 From: nitachra To: gdb-patches@sourceware.org, simark@simark.ca Cc: JiniSusan.George@amd.com, tom@tromey.com, nitachra Subject: [PATCH v3 3/3] DWARFv5: Info address command error in gdb with DWARFfv5. Date: Tue, 31 Mar 2020 19:27:54 +0530 Message-Id: <20200331135754.5051-3-Nitika.Achra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200331135754.5051-1-Nitika.Achra@amd.com> References: <20200331135754.5051-1-Nitika.Achra@amd.com> Content-Type: text/plain X-ClientProxiedBy: PN1PR01CA0084.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::24) To SN6PR12MB2736.namprd12.prod.outlook.com (2603:10b6:805:75::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from BLR-5CG93516QQ.amd.com (165.204.159.242) by PN1PR01CA0084.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Tue, 31 Mar 2020 13:58:23 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.159.242] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b5185626-01de-4108-70b2-08d7d57b956f X-MS-TrafficTypeDiagnostic: SN6PR12MB2799:|SN6PR12MB2799: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 0359162B6D 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:(10009020)(4636009)(39860400002)(136003)(366004)(396003)(376002)(346002)(16526019)(6666004)(316002)(1076003)(8676002)(81156014)(81166006)(4326008)(8936002)(66476007)(66556008)(5660300002)(26005)(186003)(86362001)(66946007)(478600001)(2906002)(2616005)(956004)(6486002)(7696005)(52116002)(36756003)(43062003); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tFUVZcFt5JrLLk/Y6+vdNkl/N6nIXz4UtbVO3H8wx8MqYVVC7nfiXEDbtHLKjzL+eN+gcFDO0j2voFG8nJLdQ7EXtlA3MwoXbiIW/R/xXbi4O2+OxI56nuI9EJgKfVDLxNlRkgbUarYMhXw2HvXOAWBLCzPE+Ms60nRLJf5v16tOFY9WMim1fgPr+9WQ2M5GDrYzasPW2Hoxhy+//2fR7MvbXNylqRiRSUrNgntQHozNFCB1gTAG2Y4kH4pb02JvM3HSOoN+2sEvd7U9uCFK4o5VWJ3QVt948jibZbfSZfhr+dqUgoA+q22gT5OFoFcJ1bBJ1JkwITfiRf9jRfdvQ43q1vTQ5NYE/S+uktVGyjhRFwlyBkp2DDd+rNrZ2P7/64InJDwdLbIKml50aBVWgT5aCOrqXKrFccZs2ipzv92O8s+QN60hUppEBZqadksTJ0HpKkv9h+lbnMrM9O+CMVIzKIJhmQ7mC4bkkIia1HdSwxw4mq4aSpOPVbguD15i X-MS-Exchange-AntiSpam-MessageData: 1/hp94Dq4DW0KtXWqcRQXUnsmz+GZMyv/4R7m73T6z3DKnFsNtgjaL7hVpudBQKAbJ+5BhUFKM3KFwEG6dJO0EIe7K03RbitcG3nLpaJb8IrSxiFwb129ilfQLwJFB6tXq4p7bKTsnLnp1LTwHIJ1Q== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5185626-01de-4108-70b2-08d7d57b956f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2020 13:58:26.4244 (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: oXKrgryALW/No6AnGmS3HCqRl4vBdbFUvFli+3m5f3Rr1w7EHPkG0+uLJYTKbDRW9w3ETD6HBzmVDywGsAjwAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2799 X-Spam-Status: No, score=-25.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, 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: Tue, 31 Mar 2020 13:58:29 -0000 GDB throws the error 'Unrecognized DWARF opcode 0x02 at 2' when running Info address command with the executable file compiled with -gdwarf-5 flag. This patch fixes this error. 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 -gdwarf-5 flags. Used clang version 10.0.0. This is the test case used- void bar(int arr[], int l, int m, int r) { int i, j, k, n1= m - l + 1, n2= r - m, L[n1], R[n2]; for (i = 0; i < n1; i++) L[i] = arr[l + i]; for (j = 0; j < n2; j++) R[j] = arr[m + 1+ j]; } int main() { int arr[] = {12, 11}; bar(arr,0,1,2); return 0; } clang -gdwarf-5 test.c -o test.out gdb test.out gdb> start gdb> step gdb> step gdb> step gdb> step gdb> info address L Symbol "L" is multi-location: Range 0x7c04007902bc5084-0x67fb876440700: a complex DWARF expression: 0: DW_OP_breg16 1 [$rip] Unrecognized DWARF opcode 0x02 at 2 gdb/dwarf2/ChangeLog: *loc.c (loclist_describe_location): Call the function decode_debug_loclists_ addresses if DWARF version is 5 or more because DW_LLE_start* or DW_LLE_offset_pair with DW_LLE_base_addressx are being emitted in DWARFv5. Add the newly added kind DW_LOC_OFFSET_PAIR also. The length of location description is an unsigned ULEB integer in DWARFv5 instead of unsigned integer. Signed-off-by: nitachra --- gdb/dwarf2/loc.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 62bec79035..94be09a293 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -4453,15 +4453,20 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, enum debug_loc_kind kind; const gdb_byte *new_ptr = NULL; /* init for gcc -Wall */ - if (dlbaton->from_dwo) + if (dlbaton->per_cu->version () < 5 && dlbaton->from_dwo) kind = decode_debug_loc_dwo_addresses (dlbaton->per_cu, loc_ptr, buf_end, &new_ptr, &low, &high, byte_order); - else + else if (dlbaton->per_cu->version () < 5) kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr, &low, &high, byte_order, addr_size, signed_addr_p); + else + kind = decode_debug_loclists_addresses (dlbaton->per_cu, + loc_ptr, buf_end, &new_ptr, + &low, &high, byte_order, + addr_size, signed_addr_p); loc_ptr = new_ptr; switch (kind) { @@ -4475,6 +4480,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, continue; case DEBUG_LOC_START_END: case DEBUG_LOC_START_LENGTH: + case DEBUG_LOC_OFFSET_PAIR: break; case DEBUG_LOC_BUFFER_OVERFLOW: case DEBUG_LOC_INVALID_ENTRY: @@ -4491,8 +4497,17 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, low = gdbarch_adjust_dwarf2_addr (gdbarch, low); high = gdbarch_adjust_dwarf2_addr (gdbarch, high); - length = extract_unsigned_integer (loc_ptr, 2, byte_order); - loc_ptr += 2; + if (dlbaton->per_cu->version () < 5) + { + length = extract_unsigned_integer (loc_ptr, 2, byte_order); + loc_ptr += 2; + } + else + { + unsigned int bytes_read; + length = read_unsigned_leb128 (NULL, loc_ptr, &bytes_read); + loc_ptr += bytes_read; + } /* (It would improve readability to print only the minimum necessary digits of the second number of the range.) */ -- 2.17.1