From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6NbwIpmFiWAoKgAAWB0awg (envelope-from ) for ; Wed, 28 Apr 2021 11:56:09 -0400 Received: by simark.ca (Postfix, from userid 112) id 8CC471F11C; Wed, 28 Apr 2021 11:56:09 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [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 44EAC1E01F for ; Wed, 28 Apr 2021 11:56:08 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C30D53A9DC14; Wed, 28 Apr 2021 15:56:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C30D53A9DC14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1619625367; bh=uv5xIjL2ayJPzk9YX7niKKEzgpyQf9Or6y10rzeqMvQ=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Ttv4Hcxq2nXaOyzlSHn7Q37c5YJCAYUlDOQv3OPlBEr9ZNtUvIKWqV/azbEKzq41/ OxcgVVDrlMUIepxwhSCkIH5rvXnGuGl5ECSF78vtAjEqfmvmKN8TKWd9SSOZ3PgiN0 80i71TwH5litrPNZiG/QFeOrAMclGfcbRr1yvwg0= Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) by sourceware.org (Postfix) with ESMTPS id 113453A78012 for ; Wed, 28 Apr 2021 15:56:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 113453A78012 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RVwBSjNCi/cNiGLQXaLkb8zAc0HJ+6BqrDmVXl66wrOShXnK4Beq0PcG5tQpEL0Cra6t6SxzapTTA5CXfTk5FXY+YLJ2qkYZe7sCQIGw+LDto147ThrNq/Gs3WrFDqHHnG4VIKD95CukK51a+Kx6iaHJ6JgBHJxDwtiZnLFaF7TEIUCLQyjQlXwfXK/3jZwWza4dH8ZSy9JK9CRwbuGufiNlfkbM8vsg0Rxk2MB63rNW3PdPUntpn++GksjrVV+COd08z4em5KtU/mmvfUjAt4CUPOmvLsmypHGVHIJzAfVvXNkjS7oGlg7FzbAqiwiDZfrO10GY3uQPSyAkHBI2PA== 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=uv5xIjL2ayJPzk9YX7niKKEzgpyQf9Or6y10rzeqMvQ=; b=ksdlCMuS1pT1FHEyhvQ4RBiiILYZGZoNHuyCuMZ88L98UZQtvP7Tuc8xqXRZconxFpFs7abC8n4XtnDj7eFFyhYMNq18qpusBOZ5ehWfXJWW+Q3n3D/sEcNI6urmwDUxf6xoIngZF7/crTOmZElgFy6n6hx+65qQtPm9XTBSw+I+aLre/pnExJghOX2/BxkWWKDF/Ej125KnG322rBVZygTDYEnaqdRyjMSuQhxarhlG8Lt4NRpjFsria6xCHabj3o8O4XIei0GisUjJ84DXRnw2rph17t/wPLP1dMLUDNRfIbIERyQ3PDNtqUR2hsFRy2IvM0ZDaJWr1jNi1XsBCg== 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 DM5PR12MB1178.namprd12.prod.outlook.com (2603:10b6:3:6c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20; Wed, 28 Apr 2021 15:56:03 +0000 Received: from DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::49d0:1ee5:47ef:e0e5]) by DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::49d0:1ee5:47ef:e0e5%7]) with mapi id 15.20.4065.023; Wed, 28 Apr 2021 15:56:03 +0000 Subject: Re: [PATCH 03/43] Move frame context info to dwarf_expr_context To: Simon Marchi , gdb-patches@sourceware.org References: <20210301144620.103016-1-Zoran.Zaric@amd.com> <20210301144620.103016-4-Zoran.Zaric@amd.com> <7f00dde3-c7dc-f839-bf8d-035f18d65ce1@polymtl.ca> <0edee4c1-9a04-9bf5-7d44-0973c675462b@amd.com> <5a2c4d75-2059-cc93-6581-59cde0d6ef40@polymtl.ca> Message-ID: <5d1ed8c1-e4a9-3333-c715-e50e88b8b10f@amd.com> Date: Wed, 28 Apr 2021 16:55:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 In-Reply-To: <5a2c4d75-2059-cc93-6581-59cde0d6ef40@polymtl.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [2a00:23c7:5a85:6801:f5b0:44e8:2b3e:76c1] X-ClientProxiedBy: LO4P123CA0124.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::21) To DM6PR12MB2762.namprd12.prod.outlook.com (2603:10b6:5:45::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2a00:23c7:5a85:6801:f5b0:44e8:2b3e:76c1] (2a00:23c7:5a85:6801:f5b0:44e8:2b3e:76c1) by LO4P123CA0124.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25 via Frontend Transport; Wed, 28 Apr 2021 15:56:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 18820b6b-ec56-4a29-f9fe-08d90a5e203e X-MS-TrafficTypeDiagnostic: DM5PR12MB1178: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s7args2WGkhzrN0W/SP8ehNkgrS/BAwmsu3auF7V1dvTAxgJlVzWSxzG2levdV/ZJ76dIDJ0de7LrNMU91qCsezi6B+1iwA+VqoJj1sHid7P75lQRHe0kJvZm5+cJ0XBtdQZqGd+/41rNGtQWaYffgo+5K/J2f2NTug+mmZnbkAJ3YFSpo2VbMd8LW5AxFKIdHfp6kIkb+yhNRSvoHbZro57KhuFCJx4p5DsaW2S2ib5i+JdH1O1U5lQZ16N0vrJQ6iquhmYqze/BRkEG9DB0x8xlP1qg959mOzUX9L2Z6Nu6dTpOFhjYBJaRml17HDUhFtC3p7KDobf4HcqzPX6jODBXBJ+UdP/NDjW/sgNpYp4l0zJRsE3xAeFfvWqydEoLfp3E8yhEXtOdZ0GkU+M96sUr5TsPakhpsLlGCAZ+TO3sDbC4m2VFpmSCeVZL0SbWnoOP1xzCPUEka3wONG/RO92V3sJZH+NZem48q/LBojsMNgH+6HB64oSb/zystjDFUJ8Q1dhhkTkrBfrL4JMYophzsixH5GEiNs36keD2Kl7Lm7+knzpjbsI9HEFyTRk4m/TcgwE+xBo7Di9Crq8DFwkwm1IQcqJ5vBtD6CWyeoQWx8+DcOWSL/TMVdLkcvFyCRjuXzUjwvNZVEuD0djovIDB1FtvxRhs/LW02y4j3XwYGBEGv63YV0njPHuhilE 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)(396003)(346002)(136003)(366004)(376002)(39860400002)(186003)(16526019)(316002)(6486002)(478600001)(8936002)(86362001)(2616005)(6666004)(66476007)(5660300002)(66556008)(31696002)(31686004)(66946007)(83380400001)(52116002)(8676002)(38100700002)(2906002)(36756003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?Y3hpZkhSSCs1bHUzMGg2R0RPVkxBTXhwanpsNXZ3QWRCTGY4U1FsdGd6TzJY?= =?utf-8?B?RjE5TU5zK1RCbGkrSTZvSnN1eDFmWjVpK0h6WkhkaDlNTFV6L0JscXZPQjVW?= =?utf-8?B?RzFrWmJrMlhRVlVjc0xXOTNDZlJHT20wRXdDTm5YU2ZIRkhtNlRFcm92Ujls?= =?utf-8?B?NHF6WFdTQXFvYnhDblhGeXJ0TS9BUkZiWm1Ib0p6cllCZGVuUU51NjJOQzFT?= =?utf-8?B?bzl3eldwNjIzODVSaE1xT0UwdUptbHhRWXJpTTltcGpxYUNBYi9tMTc4ZStE?= =?utf-8?B?eENpZHZqSzBXaVlCU1BpSGhlT25nSzJuaXliQUx3MnZoWjc1OGlIeEJ2ZjhT?= =?utf-8?B?QitEckJsNzhFdTA2WHBhTzFHZ05VQXg1NGpvWnErYldZdEFrNUVPWmc1U3hN?= =?utf-8?B?UjlEUHhnZjMwU3plWWlNc0p5UXdFNUJXM0dwTDhuKyt5MEhsOHNUWERTV0NV?= =?utf-8?B?RHBwLy9FZlNEc3VROGpxakhBakZYNlFJZXhmdDdxUkZiYVlKMmZpS2dBTVVi?= =?utf-8?B?Y2NXM2srQ0pGUis4UGtMQ3J3cS9OOXl5bHlCOTVlc0lvTTkrOTgrUVNTckZ1?= =?utf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Yk5zVkc4dUFn?= =?utf-8?B?R2M4UEZhVVE3UDNmbjVNUEg2NmN5K1Bub1d4QVM5czlOcXhlR1F0S0FNYi9X?= =?utf-8?B?NGllR1lTWHFISUJrQVo3R3JtOFpILzh6eC9BdGlyTVpaNXFia3RWMzg1Z2RP?= =?utf-8?B?dnUxaFc4Y1lwSnZxemtkUElHOW94cTg1S3pFNmtRTWw4a1JQNEpaOWdSZGY0?= =?utf-8?B?a3hyTmZCazA1L2EvUFN1dXVnNUg4VzlIYnBCRDU4TS9hUkdad1NTMkZGVmE5?= =?utf-8?B?alpiTnlVMWlRbGRwTjM1N2o5S0pHbGFPNTNYZXE2Y3NFbXBmaTNjalVHcEtr?= =?utf-8?B?WDBOa0wyQzRrQ2tsSzQxQ2pKaVgvZUdHOWI3UjZsVHViQkNBVmE4MEFFYk15?= =?utf-8?Q?zPNe/9YaIt1lG?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18820b6b-ec56-4a29-f9fe-08d90a5e203e X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB2762.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2021 15:56:03.5136 (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: XiRZOSpdfJJ5gO1iJV+JT7G5arbNRbRznrVw1/rlmMzFDFIfNg6CTTTTSiJbBzqjyfay+vEyuoZxCm0LSqTBvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1178 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" >>> dwarf_expr_context would have a `frame_safe m_frame` field and a >>> `frame (const char *op)` getter that just does >>> `return m_frame->frame (op)`. >>> >>> This way, it's impossible to get the frame and forgetting an >>> ensure_have_frame call. >> >> True, but then you end up with even more "switch" statements in different parts of the gdb that one needs to update every time they add a new operation and this is one of the problems with the current design as is. > > I don't understand what you mean, why it would mean adding more switch > statements. In practice, it would just mean changing `this->frame` to > `this->frame ()`. > >> This would force us to add two new places (one for frame and one for compilation unit) and there will be more in the future when we add a concept of a thread to the context. >> >> At least with the current implementation the implementer of the case statement that process that operation needs to know which part of the context has to be present for that operation, which is clearly defined in the DWARF standard as part of that operations definition (or at least it will be after our extensions). >> >> Another problem with the new class approach is that it makes the information about what each operation needs convoluted and hidden which in my mind adds even bigger chance of someone forgetting to add their operation to the query calls. > > What do you mean by "add their operation to the query calls"? > > I don't think see how it helps to make it explicit which operation needs > which part of the context. If an operation needs a frame, it will call > `this->frame ()` which will throw if the context does not have a > frame. > > Simon > I looked even deeper in this issue and the problem is that both frame and compilation unit information are valid to be nullptr in some cases, but for certain operations they need to be present and if they are not the evaluator needs to bail out. There seems to be a couple of reason why they can be nullptr: - some preexisting API will call the get_selected_frame (_("No frame selected.")) if the frame is nullptr. - evaluator can call another evaluator recursively that might also not need the frame or compilation unit information or may bailout it they are needed but not present. - the composite and implicit pointer location description carry the context information outside the evaluator which might never be used but if they are the exception will be thrown. There might be some other complications, but these seem to be the main ones. Zoran