From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TE1DC1mCiWD/KQAAWB0awg (envelope-from ) for ; Wed, 28 Apr 2021 11:42:17 -0400 Received: by simark.ca (Postfix, from userid 112) id 21E131F11C; Wed, 28 Apr 2021 11:42:17 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 E309F1E01F for ; Wed, 28 Apr 2021 11:42:15 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 79C123A7705C; Wed, 28 Apr 2021 15:42:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79C123A7705C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1619624535; bh=JbHX/ImhQ8VYmksAicWfLDnL2GnUbiwatJbJ8iI1iZk=; 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=iSfLNhIS0Hy/mIDFeiKJpMdvtkPCXIL4OILAjmJOq4zGOOoTb3a4Q1i1S6cOKlo4R jOvMxfSPwOalc8nTRMSrX1kJKewOxuqyZUjUPLhzDiaa6KQV+7feXllawhUG/K6kOH jCyIbp+/NrvyrveryrwjbckzxJM4ld6urQ2hwjkY= Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2067.outbound.protection.outlook.com [40.107.92.67]) by sourceware.org (Postfix) with ESMTPS id 6BFE4393D00B for ; Wed, 28 Apr 2021 15:42:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6BFE4393D00B ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mvg+wqELnhA1Y2W3MKeiD+V2ETS9ypaTT1cCUGVpxGj3G+5M1BDNcHgNWabhzgZ8r/V9aQhBueKJ2mSigrzGtxYh0NvSMPK3Tj5l+ZCbbWEK3hbMhukxqqTKOK1IZdU5GhUOsmpMzdc9iF8++WhFXjwsPGHv/ODhcghYtpnrdovTzEz9tqzHsWiHPfExCKmAP/9iMrUg+4UI5hTYzaxeY3JUbnn9lwlSpI64zO46rZHnfkP25KSyWXNHqy8odkKFwcX9edTNxFccluo1NGS5W3ZO+P3nvLtO24xGQiSetIFHslen5UZ9tclNrrigxHyXrZNyxYYndD/Z6lmWVdqUow== 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=JbHX/ImhQ8VYmksAicWfLDnL2GnUbiwatJbJ8iI1iZk=; b=YhTKJo3ZHwUQ4MCDKrGd7qsapzl3C7yiL0CPQpz/WdU7tPB2m3KCRvEfT27BLMfKsDrOgdq7U7bMiw2B8TjXVD1PWGk17uS5NqEk7d7/vwvaXmsaMqzveI0O6I9sKlt42yqjayxSZgub2ANkJa+FlAHhoE0VpLJRRwirj1ctJk9TfFiy7OBF0ZUlzDWDy/gXrsLWP0c5hZuXpYxgIbmnV4hpsVVbOOvf2ipcG8djD0BjCj498fpHZbEw5c69FQl6SW6jjuXJZMKhLypBGWFZkmJOrwzLp3NI7lmUnsPmiIhqKdlfkNM+62VqScoQ2RvB5dtLjc+Mv+8d1kpdALTVyQ== 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 DM5PR1201MB0236.namprd12.prod.outlook.com (2603:10b6:4:57::7) 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:42:11 +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:42:11 +0000 Subject: Re: [PATCH 18/43] Add new register access interface to expr.c To: Simon Marchi , gdb-patches@sourceware.org References: <20210301144620.103016-1-Zoran.Zaric@amd.com> <20210301144620.103016-19-Zoran.Zaric@amd.com> <438db2e3-c39c-311a-a915-e13843085f02@amd.com> Message-ID: <6f78a159-05ba-0e42-e874-fb83c3a4fbd6@amd.com> Date: Wed, 28 Apr 2021 16:42:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 In-Reply-To: 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: LO2P265CA0345.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::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 LO2P265CA0345.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.25 via Frontend Transport; Wed, 28 Apr 2021 15:42:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c26b3ffa-e2d5-4f03-dfca-08d90a5c302c X-MS-TrafficTypeDiagnostic: DM5PR1201MB0236: 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: aSpWq8O2ObTfWKJ7oIBg2UCw5+oC6Y3V7suZR6VyvI2O5/bo303Pq844vB8nq7SE4V3/Z+V0ukwu6wX0VvH2QoyfhZWEwLocZlSO+UxGOeqz/3e76UDP9XNNeipgmducPanrKPLb127nqCWtso0d2CBv/jADhqYsV71TppaQ3wDlN2nA02y+wgxFcDbnN7hpS4BAtMPXMibaYfSBBSaCVgI3iUxD2+vGQLACvHsDdHg5D/zI/afI3ot/hcUNIDaXpEXw1HryCX9o3zHvugLsstYjyKBZ1cV2K6Roo+YTSA00ABGcDKBIHqWPQ3Y1OR/sTaqR7AHb0eBdsLmiah+Gt+EdOlhXZbJM5Sd0Y0ossxBvyPdr5vYR0Lh9sVVqFPOu4GinKB/Ad2IKN1pbQwHPx7q/FQyAZiVYukD3e0Cagf0MGIQNSrVlQnJPgEcR0puON/Voi1+saQFgSZWTwg0lti0bfA4+9Rxt0CjJahUuW3iqY95MJ6wkI+9B7C+8iJfwvowVUpwdWhnqj9Pt1iOIK3jwfgKnJoeHwBFloRzNfJXHGg0Cp4fgcNnG85hIw0J9PrPWVBJicWuczMpcVkk7jwBflFfdvxegMdSt8JrPT9p1z8ONOfPcQm/5ixJvGgi61lQlT7wulde9IjHcy9Oq8cOemImAPZfw84inq/8h5Kz4d1WWYHy+eTq2nYwnbJoW 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)(366004)(136003)(39860400002)(376002)(346002)(6666004)(66556008)(83380400001)(8676002)(478600001)(316002)(31696002)(16526019)(38100700002)(2616005)(31686004)(8936002)(5660300002)(66946007)(53546011)(6486002)(66476007)(86362001)(52116002)(186003)(36756003)(2906002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?UzVWdEE5OVlNMjRVb0hXanZmRnpUbnB5bDZndG9mTUROaXFwell3cDM0MU9h?= =?utf-8?B?enVudlZHdElmbGJ5VzJaMmpSMTBiY3hjQ2Y2YWdiTUM1a2FyNHp0bm92ZnZO?= =?utf-8?B?UjZyb29PdDdZV01nT0p0bzhYVGpWWDB0NkFMNitJNG9oTWtpNnZmUE53Yjl2?= =?utf-8?B?dU5nWDM0c0ptRkZ5dUNDSE8vN1M3ZVpnZmxobXFNbEVVbGswbWYyNlhqWlJr?= =?utf-8?B?b1RRbS93Z1ZtQWl4OXZ6WklKSlV4R3dSRkFSSnpzZHowT21CQzVoL3BnYmZv?= =?utf-8?B?Nkp2bXR4NklCbFNDUVBCbFFmTFQ5MzIwMWdUdkRFZVhMR2ZFWlBGS1ZnZ0JE?= =?utf-8?B?Q0lNUjA0TUV0TUZwNzBYZ1lIS1Nsb1Y3V0pGc2dQb0pPMmpvU1NXNkdiVUZD?= =?utf-8?B?ZzlzTzBxL2ZWWTc2VmpQSWZyRWk0OWxKRUVKTWE5YVVXdHRDeVM1d0phNTBI?= =?utf-8?B?b2o4dFB0d21BajBQRllwSStlMGtMQkZNT0t0UGc0UVA1Q0c2TnQ1a3JWRDZC?= =?utf-8?B?TkNacEQ0Tlpaa2REczZwQm1tVXVWRFdIQmJqeHpDaUtsZ1dwM1RiSUNadGxw?= =?utf-8?B?bGFCWTgxL2JJYVhSVEEwb1pDajQrUGRJOW0zMDdURXdtT3NHT1RBc2Z3cG00?= =?utf-8?B?c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FFKS1JWZ1lz?= =?utf-8?B?a1ptZlZ2MkZpNlZCbHM0Ym5EZU9yREw1U1FHaVhMQWhFakNLN0VhS2dmMGFS?= =?utf-8?B?VHRITmQ3b1dWUVZFdEZhc1liaDVYTjhRQSt2Y2lkQVQvT01TeElzcTVjSUp2?= =?utf-8?B?dkIxT29wSktJL05HekdRcHVPZy9UTmJyOWNHL3duMDhaUzlhUWxwZThTbG4v?= =?utf-8?B?ZlhMc3VIajRNQlNUM0k2OVJrL3hxemM1TVo1Lzc0UkQ4UkVBbTMxNC9qMWd5?= =?utf-8?B?SkExOXlReUZjQmxWdzFzL055ckwzQkhic3FERm1jaExCU2pXVVRobEJDckQw?= =?utf-8?Q?FSo6fP+ldTS2e?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c26b3ffa-e2d5-4f03-dfca-08d90a5c302c 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:42:11.2271 (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: UOb3BcAq8iqbqSpkHkg9M4pGPbgBad7uhcX0QHbToOU2QX7iVAsCgD3XGxJekeiL2Xxq2y/CqYd+VbpdnN9TCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0236 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" On 4/28/21 3:48 PM, Simon Marchi wrote: > [CAUTION: External Email] > >>> Can regsize really be 0? >> >> This was part of the previously used API so my guess is that it could :) >> >> I didn't want to presume to many things if the previous code handled them. > > Ok, it's fine to keep it then, to avoid breaking some potential existing > use case (we could try to remove it, but as a separate work). > > I ask these things because if things are not supposed to happen, it's > better that we gdb_assert them, rather than handle them like this. > Otherwise, when somebody comes around to read that code later, they will > think that regsize == 0 (or frame == NULL in the other case) is a > possibility, so that makes their mental model unnecessarily more > complex. It can also cover some bugs which would be exposed by a failed > assertion. Agreed. I can go back to this and re-test it as part of a separate patch. > >>> I don't understand the code and how it relates to the comment. What >>> does it mean for a register to be inside an offset? The expression >>> `offset + length > regsize` checks that the end of the portion we want >>> to read is beyond the end of the register. But there could be a part of >>> the portion we want to read that is within the register. The code might >>> be correct, but the comment needs to express the intention more clearly. >> >> This is not allowed in DWARF. The whole length needs to be contained in a register. If only some parts of it are then the location needs to be a composite and that is not covered with this low level interface. >> >> I should probably explicitly say that in the comment in the next iteration > > Ok, the existing comment makes it sound like "if what we want to read is > _wholly_ outside of the register, we can return early". So just an > optimization things. So yeah I think the comments needs to be clearer. I will change it in the next iteration. > >>> Is `numregs < regnum` really useful? When would you encounter that? >>> >>> Simon >>> >> >> This check was part of the previous interface as well. Maybe the interface was design to be conservative or maybe there was an use case where compiler generated something that resulted in an invalid regnum? >> >> Better safe then sorry I guess but, I can remove it if it doesn't make sense. > > If it was already there (I didn't find it though), then it's ok to keep > it. > > Simon > Let me reconfirm this to be safe. Zoran