From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id f/OGNnf+PGCHJAAAWB0awg (envelope-from ) for ; Mon, 01 Mar 2021 09:47:19 -0500 Received: by simark.ca (Postfix, from userid 112) id CF7521EF7C; Mon, 1 Mar 2021 09:47:19 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 160141EF64 for ; Mon, 1 Mar 2021 09:47:19 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E688A385800C; Mon, 1 Mar 2021 14:47:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E688A385800C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614610037; bh=JMLyWcZ3BHohbCvu3wh+GmXQ2j3DZH3qqqPWjLhcHr0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=cGCstO+9x3+v4UuKNuG0jVUjujZSyK3WZbrK1ljCUwPefxw7R4YUZntsI6szGob5u mvmVDMs5XRN1X7mXdqJShpnv0Us16IFT7HWzpoOih3ienOcdUbNf6KWxs8bRQ3Pg37 j78T16brTHfVo7OqqpzYAHdkoVS5HbC7rd0M/9Dc= Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2069.outbound.protection.outlook.com [40.107.236.69]) by sourceware.org (Postfix) with ESMTPS id E18CB393A430 for ; Mon, 1 Mar 2021 14:47:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E18CB393A430 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bX2mvtR0EmMLZ5UEfPtMpCiI2K/zqHILvyMI/L4CqfhGfbBlntLKohxIFHYRquP1xm5jhi0g5S4Vn8FFjB9FE/3nLXSSuhS3H7Dq/3sDSE80zLj0EAAftpu7nj9ce4qEe5Ba5pEh85thmORraw7ew5t+zNsfXDMuq+RKFqVbdpf5fvmLFKG0ffBlxxO7sLIf7ylVhV1/piIjs7EHgQ7cSyBXQAq8igSsnh0l+5jmgqLgJ4uhBJmaJ7+x/no6PpJ8j7lfzUWJaHIlshnL+WNb2rK6caQTMTWI077NXEj92X97C/XzOSgMGy58WnHAsndghtNX+9dYYz5KaOD/gt3f+A== 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=JMLyWcZ3BHohbCvu3wh+GmXQ2j3DZH3qqqPWjLhcHr0=; b=dvHAk4p12nNL/z3LKgWvSVEUYFzlf1qhT4q3Eb6cMTIrl9UijcNc58CbCsIyINNH9RSEqJFNzPap2FbALNtBd+AfZxSuDBhQuS4T46BsVbJrHUWbJzvAZplDGV/zDilj3QfGEtKJBQ+ZEUVMFHaAbbhouGqZn/IjdDF/ViB85vvMZnmQSnfWK8J92VaqMnWKcqbdWm+wVGfl6l+fRb2lWO+biC5Rv7wdKFZ4rfXJzysTDlLL0KU3SGnrPYfAnsfICgbAm36VdPogr05gF8zc8oafJVDRiuX0gxT62PEjkkSQ1Mq6mUWUzDdTVc+LvqdVGmQiOYNb/IADGRaUaAzSVQ== 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 Received: from DM6PR12MB2762.namprd12.prod.outlook.com (2603:10b6:5:45::15) by DM5PR1201MB0041.namprd12.prod.outlook.com (2603:10b6:4:56::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Mon, 1 Mar 2021 14:47:12 +0000 Received: from DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::31d8:f503:f7b2:f44]) by DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::31d8:f503:f7b2:f44%3]) with mapi id 15.20.3868.033; Mon, 1 Mar 2021 14:47:12 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 29/43] Add indirect_implicit_ptr to dwarf_location class Date: Mon, 1 Mar 2021 14:46:06 +0000 Message-Id: <20210301144620.103016-30-Zoran.Zaric@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210301144620.103016-1-Zoran.Zaric@amd.com> References: <20210301144620.103016-1-Zoran.Zaric@amd.com> Content-Type: text/plain X-Originating-IP: [2a00:23c7:5a85:6801:b4ed:fe7b:8064:d4d] X-ClientProxiedBy: AM0PR04CA0073.eurprd04.prod.outlook.com (2603:10a6:208:be::14) To DM6PR12MB2762.namprd12.prod.outlook.com (2603:10b6:5:45::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a00:23c7:5a85:6801:b4ed:fe7b:8064:d4d) by AM0PR04CA0073.eurprd04.prod.outlook.com (2603:10a6:208:be::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Mon, 1 Mar 2021 14:47:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 407b3fae-c72d-4293-e823-08d8dcc0e60f X-MS-TrafficTypeDiagnostic: DM5PR1201MB0041: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 48B5nweqK6kXg2A+D9trrgUiV1DAgkcah0fxPWZDv/V44MYs3AugSY//UN14FZQfv8obwxE13elojrns64dK8mJEqUXROO8lZ7ASOwUJntDxM2un0oaCDyhb6RU+z7+YDL1O8BLI8HuuZn2vD5NiMvigieA0T/5aoTfoOApEjp2oWJuYHpCnucLWK+OU0X/YgBBs5yMfvDVhEdFcZCDGu9BPaeIFY+r8CAOjzTf2M1+5ysSIDKbX6n/BySaOS44RhDupBh+LWLpQNtZglOsOJRy/I4RlLjXqF4bJ2Zo0/mZOflL6MV6yD/GzFJ5vFNyFDJcQq5hb0dJ9wpQ/MMYfNsaS927tPyZfTi/UnTEuKl8dXOguhBOC7aRkv4R/F0Iyhb716swwvntEa2mwoA08nubDlZO6iJrC094Hrogi38b08LyQejiBLaZrR1PX/w7dmgKpW6xxfT5MNnPABLDBJ00va36da+8k9C/MvJr106yGLBXNVMFZUp6A1tc80DnWdiXqrwB6dD12yYtH7La1xyRst2FLa0FvZcBeR59yl4NwcTMfW/r91/AKyVnY9lQWVWlVE7vSrgL4VnHOKDnrcw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB2762.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(396003)(136003)(366004)(376002)(346002)(6486002)(2906002)(186003)(316002)(6512007)(4326008)(86362001)(6916009)(2616005)(16526019)(8936002)(52116002)(83380400001)(478600001)(6506007)(8676002)(1076003)(5660300002)(66946007)(6666004)(69590400012)(66476007)(66556008)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?8LqY/zdzWyeGvV+KPHnpu6qw6GbJt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y3BZrSO/9wjjHGQu+hEE9X1YzFxtDjVo9OtXg9tnRdEoemo8dJe7q/5Ae8?= =?us-ascii?Q?Oypep0ptu7EY/YaxNE24AQFWwwBhdbRhR2+38hkfminJTOaiEbEZcgPRxQE2?= =?us-ascii?Q?XUtj6LTfaW3LUkDzT2Z1yw2LoV2GzQpyFiqnDPNQNNlRqi0RwLuAU+SLMOHY?= =?us-ascii?Q?Mwc/XDc8l5ERMZ9TaEjtEl5BGOYCsl8SJFSd2Rq10zf1B4ZmFi3chhYpSB3o?= =?us-ascii?Q?ioWlWA/2+m/X/+8xljO/jsmNeH7IS+SGEFZwxlU1eD3kqBL8j6fYnhgFj4ER?= =?us-ascii?Q?OpiIzdWmbuLqCZ1hhM7LNGdjGHhd3P7VB8oaiMEd2Ue0yr7KvoNY4bfa6l5k?= =?us-ascii?Q?eqU/PfjTI7qO0Czu9gzIqM6zEIFJ3tf6RxnFRxZD60mgBQFCxB7Zt3VA+PtI?= =?us-ascii?Q?y2pyb/tNUUEya0jVv0vwT2C7JOoxG7pSFyvLx4qKqrrIRwKBu6tVxBx6BS42?= =?us-ascii?Q?/p/U1dsnzfvnwP9xarZnxseZfUCI?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 407b3fae-c72d-4293-e823-08d8dcc0e60f X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB2762.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2021 14:47:12.6537 (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: FALIbUaJP4NBSRBHQ0HUHQl10y9+ZPII5C9X6W+TZiW4UPzK7iwMIiN1uD6YPP+8yFuGnGHqpGeicn2HXEeh5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0041 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: , From: Zoran Zaric via Gdb-patches Reply-To: Zoran Zaric Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Similarly to the is_implicit_ptr_at method, the existing function callback interface of the computed struct value, requiers a way to apply indirection to an implicit pointer on a given offset of a given length of an underlying location description. This is different then reading from a struct value object (previously described write_to_gdb_value method) in a way that the result of this operation is expected to be a struct value of a pointed source level variable instead of reading the value of that variable. In the same way this is also different operation then the deref method because the deref returns a read value of a given type from that location description. gdb/ChangeLog: * dwarf2/expr.c (dwarf_location::indirect_implicit_ptr): New method. (dwarf_implicit_pointer::indirect_implicit_ptr): New method. (dwarf_composite::indirect_implicit_ptr): New method. --- gdb/dwarf2/expr.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 5de75f570aa..2550c59dc27 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -497,6 +497,25 @@ class dwarf_location : public dwarf_entry return false; } + /* Recursive indirecting of the implicit pointer location description + if that location is or encapsulates an implicit pointer. The + operation is performed in a given FRAME context, using the TYPE as + the type of the pointer. Where POINTER_OFFSET is an offset + applied to that implicit pointer location description before the + operation. BIT_OFFSET is a bit offset applied to the location and + BIT_LENGTH is a bit length of the read. + + Indirecting is only performed on the implicit pointer location + description parts of the location. */ + virtual struct value *indirect_implicit_ptr (struct frame_info *frame, + struct type *type, + LONGEST pointer_offset = 0, + LONGEST bit_offset = 0, + int bit_length = 0) const + { + return nullptr; + } + protected: /* Architecture of the location. */ struct gdbarch *m_arch; @@ -1150,6 +1169,12 @@ class dwarf_implicit_pointer : public dwarf_location return true; } + struct value *indirect_implicit_ptr (struct frame_info *frame, + struct type *type, + LONGEST pointer_offset = 0, + LONGEST bit_offset = 0, + int bit_length = 0) const override; + private: /* Per object file data of the implicit pointer. */ dwarf2_per_objfile *m_per_objfile; @@ -1202,6 +1227,17 @@ dwarf_implicit_pointer::read (struct frame_info *frame, gdb_byte *buf, } } +struct value * +dwarf_implicit_pointer::indirect_implicit_ptr (struct frame_info *frame, + struct type *type, + LONGEST pointer_offset, + LONGEST bit_offset, + int bit_length) const +{ + return indirect_synthetic_pointer (m_die_offset, m_offset + pointer_offset, + m_per_cu, m_per_objfile, frame, type); +} + /* Composite location description entry. */ class dwarf_composite : public dwarf_location @@ -1239,6 +1275,12 @@ class dwarf_composite : public dwarf_location bool is_implicit_ptr_at (LONGEST bit_offset, int bit_length) const override; + struct value *indirect_implicit_ptr (struct frame_info *frame, + struct type *type, + LONGEST pointer_offset = 0, + LONGEST bit_offset = 0, + int bit_length = 0) const override; + private: /* Composite piece that contains a piece location description and it's size. */ @@ -1473,6 +1515,42 @@ dwarf_composite::is_implicit_ptr_at (LONGEST bit_offset, int bit_length) const return true; } +struct value * +dwarf_composite::indirect_implicit_ptr (struct frame_info *frame, + struct type *type, + LONGEST pointer_offset, + LONGEST bit_offset, + int bit_length) const +{ + /* Advance to the first non-skipped piece. */ + unsigned int pieces_num = m_pieces.size (); + LONGEST total_bit_offset = HOST_CHAR_BIT * m_offset + + m_bit_suboffset + bit_offset; + + for (unsigned int i = 0; i < pieces_num; i++) + { + ULONGEST read_bit_length = m_pieces[i].m_size; + + if (total_bit_offset >= read_bit_length) + { + total_bit_offset -= read_bit_length; + continue; + } + + read_bit_length -= total_bit_offset; + + if (bit_length < read_bit_length) + read_bit_length = bit_length; + + return m_pieces[i].m_location->indirect_implicit_ptr (frame, type, + pointer_offset, + total_bit_offset, + read_bit_length); + } + + return nullptr; +} + struct piece_closure { /* Reference count. */ -- 2.17.1