From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eqKwJYXARWfHYQAAWB0awg (envelope-from ) for ; Tue, 26 Nov 2024 07:35:17 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=HOTMAIL.DE header.i=@HOTMAIL.DE header.a=rsa-sha256 header.s=selector1 header.b=GBRMbqhD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7870B1E092; Tue, 26 Nov 2024 07:35:17 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FORGED_MUA_MOZILLA,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1D1371E05C for ; Tue, 26 Nov 2024 07:35:16 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8220E3858C35 for ; Tue, 26 Nov 2024 12:35:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8220E3858C35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=HOTMAIL.DE header.i=@HOTMAIL.DE header.a=rsa-sha256 header.s=selector1 header.b=GBRMbqhD Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03olkn2082d.outbound.protection.outlook.com [IPv6:2a01:111:f403:2e0e::82d]) by sourceware.org (Postfix) with ESMTPS id D610B3858D33 for ; Tue, 26 Nov 2024 12:34:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D610B3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D610B3858D33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2e0e::82d ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1732624478; cv=pass; b=LUKi5JTNSARFsAsN5i2RDHBiFVdVakie1vxBOHX6dokJLYz4pRX7wk+Mvro833ROUA5pJH9l0frhjygGE+mnCoO+68NF60l40wnx4Arr84yj+8J1U5PjAO0yy/lR2DWTiaJjaVqAx28SFI8I8KeVQiXs4YdlvtBgXI5zld9cMkI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1732624478; c=relaxed/simple; bh=LeXHiLI0+TBtVZNc5ng6hia/FbSlmZaCivgsSHoclac=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=NXeNoj+iDxl3+95Sy3XNHWKfdYM11s1xndeSlo7Fp2t7n6tXvp5Q8dHyUy85FMp07kxesei8/88yKTnJp6Uib6hdZejk4fmEEpza/l7h5V7fKkKsiUmDeZpophYQkjCkmmcPD2qL9lErNw7c52VNdpnFzLi0CmGvbP9CWgWKU2c= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D610B3858D33 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UBqVo+c0qOZXG4dS+k59is/5LuJFZJlpRmEfeBUdad+1/1tKNOXnorSIF3lkAKX0v28d+DegVuWiR21I5DYzYIGkJOSNs32GDUOBO5NhUFr6ALacvaeHVu8RgdCjHl55Ooq70HiYhOWYSJuxZ2+ZlE+564p5on1aVw7/O6xoDQaluN7iN38wFNAQStamxjJWTVgF4DfRT4e0nNvKGmYLw56k6JASjt9Fwxoz0u9oG0KTi2x0e1gAv94T8puj3hKnvSfuyuHID5q/G8yCU3OfQeFy0bnkjsTWDXnLTEa0cFZ71Mqv/sGQpbNt7oKVR0yyX6rRXn4ugcFwDUrddl3dQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eWJwS7O94LjzaXOgjrSnKxz4gtKcEDpSF/cp452MFIU=; b=ywW370i7DvoHjG/IymSLdaLHW2LnEOxqM3Y7uVv/3FSGeQ45htg2qff93IFgx4xzcuKUrhWXUrChUjFhfwJhyV44XdnmydT8GumRbnL1gDfcAv54ahk6WTHNv6pHgO1CtZbEh4cN8bCFCqftYmXQPL0xQ6NNvESAA48hNeukyAIbVzdbbqHbAXmuNckjAf0YC8XMFbtJz6CaADOJfJnnLt9Y5cja6ymCfBMWVUr2aBI6f8udpmWjjrVXVOWCuo8ZWjr4CB+tJIgJ+ZT8Tsg6ejZfZs8rMgOOIA15ErM/lM9Pv9JeSFNZYDH9IFuBfVnhHnkEqyyPz5wtM9FrNe33uA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=HOTMAIL.DE; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eWJwS7O94LjzaXOgjrSnKxz4gtKcEDpSF/cp452MFIU=; b=GBRMbqhDitsFWWy45ibymhIULVWtHkqLvdq6vYDl8//9LIibPERbxF1cyzhNY5YVjwlWQl0SQJ2p7DeIQ5o7PWmukJJPfUhV9YKYJOxx+86CWGku50DUGWe2n5knSBX/PrTN7z1D6eCW2z7Qdzd7v7CY1Hs52AfpLBrA9aazdhWFh6D7FjL/Ux7NThYd+oWejn1mfBpfS15b9R6ta6cPo7GxhgzvfALV+6cYWwhCbDaRm64yIkZI1ch1WmcQ0D6pjP7CCoTPPMsIbsS2A+o/MoAnRnULPil40hyQN3KhDyrIBo5gxQ1JZYR/aMeuZigPfkngEQAw6HVaOP7CoiCemA== Received: from DU2PR08MB10263.eurprd08.prod.outlook.com (2603:10a6:10:491::6) by AS2PR08MB8880.eurprd08.prod.outlook.com (2603:10a6:20b:5f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12; Tue, 26 Nov 2024 12:34:34 +0000 Received: from DU2PR08MB10263.eurprd08.prod.outlook.com ([fe80::c2a3:fed5:607f:20c8]) by DU2PR08MB10263.eurprd08.prod.outlook.com ([fe80::c2a3:fed5:607f:20c8%5]) with mapi id 15.20.8182.019; Tue, 26 Nov 2024 12:34:34 +0000 Message-ID: Date: Tue, 26 Nov 2024 13:35:39 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb: handle DW_AT_entry_pc pointing at an empty sub-range To: Andrew Burgess , gdb-patches@sourceware.org References: <34cfe440ffd0e53843bfaf92494d29a6951fa9fd.1732114887.git.aburgess@redhat.com> <87y11bw6p3.fsf@redhat.com> <877c8rmlm2.fsf@redhat.com> Content-Language: en-US From: Bernd Edlinger In-Reply-To: <877c8rmlm2.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0119.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::17) To DU2PR08MB10263.eurprd08.prod.outlook.com (2603:10a6:10:491::6) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR08MB10263:EE_|AS2PR08MB8880:EE_ X-MS-Office365-Filtering-Correlation-Id: e1bf7207-083e-4a46-5e5c-08dd0e16ae7d X-Microsoft-Antispam: BCL:0; ARA:14566002|7092599003|461199028|6090799003|5072599009|19110799003|15080799006|8060799006|440099028|3412199025; X-Microsoft-Antispam-Message-Info: =?utf-8?B?SytkMndNaVVCVXFUd1N2SFJLYlhhNmZ1ZDV2UHVyM0dFbGl4bnBqTVFGMW1F?= =?utf-8?B?dXBqZkR4dkxacE5QRHBQRGlKeFR5bUJzMlpqVDlMTGIvcXBuWXVsMHhhSDdv?= =?utf-8?B?K2xPV0ZQYkliVkRGM2Z6TWZLTnZhbnZuYkxqaUtMV3BIZWQ5azVqU2h5MlFi?= =?utf-8?B?RXdZR1UxUTBKZEFISlIxZUZDNWo4RjlrU001R2FBV05wc05TR0I3VTBYMXRa?= =?utf-8?B?MFNOVWpjcmtqRnZ6dDVUQXBtaVFjYUVOY2NENzN4SmFzY2J3djQzeTNtT2h6?= =?utf-8?B?cndZZlBuWEg0TjRFWTM3NlVRUGtvaEdUZ3l5UThHTFlHVXE3bVdoOVRWNDZC?= =?utf-8?B?Qk9kMUtNOHRXa25oWHR6TTJOaUp0MmtwdGJHbnIxbDlId3huZzl1NUFuWldx?= =?utf-8?B?RmdOMUhDRHJOTUtRUm1jajYwZmxHaVBhSmc2K01kVG9PMVZLYkoxM0dsWmJO?= =?utf-8?B?UmJjUGx3dGppUVUrYUZZbjlIZlRQa3h5MjZwc3hmOFBDbjRHek5SZ3B0QXZR?= =?utf-8?B?bmxqRlZsNWZDcVRBMEJ4TDVJU2gwazRmWiszYk42MHV6bWZlc1Y0MVdEN3N4?= =?utf-8?B?VmFmazdpOWd6dUtkcVcxUkhrNmhyRGFwVkNRWmUzTzJaQnpkS3k2S1JPZGVJ?= =?utf-8?B?VS84RytKbmlySllqanhzcVJ1YWVIV2tCWHUrNTY0SVpKdnc4cWhIYlFsUmJQ?= =?utf-8?B?Mmd6VDRvd1Nnb05YUlZKWDI0bDUyN3JuVktuc29pRGM5QjNscmc1NTV2M3JG?= =?utf-8?B?aEk3Rnd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mMVc3SVVXWTIyRGVxdS9qVU15?= =?utf-8?B?Z2ZycDlDelh2Zzgwa3l0clhJZ05wNlFvcDZYaWJ1dVJ5cDRjRVdJaHdTclZI?= =?utf-8?B?TWo0ckZBS2hKdzFXSVkzd3l0OERMZ0M5dEU5MTMwNDdwa1ltOTQ3MXQ3ODJL?= =?utf-8?B?WUI4NXpTeUN5QlQ2S0J0djhCem1uZzhXdFBDYUxzbHJtSDdocFhRSnpua2Jm?= =?utf-8?B?MU5Pc0F3R1VyZnI5T3FxRlh3UjMxQzVsemtOcXY2Mnd5YVlZKzFrTllGN1Zy?= =?utf-8?B?dDM0Z0hLZ2JaK1ZkeE1iTGs3a0JGQStvbDgvbkpublFwR01OZEVETVNQUHhi?= =?utf-8?B?dDlraWZmVDltRWkwbDN6S3B0WlFXOVhsK2JBUkEzMkxWSmFjcFNJa09ESS9D?= =?utf-8?B?YWRMU2tXeC9WclJkRG5tUEV0UjVTa2x6NTYxcWZRVzJxd2lwQ0VPOEZGSTE4?= =?utf-8?B?bWh3R1Y5Mzk4RElKL0hrTW9TVWFSVy8zSzcrcWdCZmRwbWwrLzZOU3RzWVY3?= =?utf-8?B?S3hxVDEvUWU5M05PYkV3eFh1S1hpSkkrLzlDMlNEd1BEa0xNY2lrN2xBa2VW?= =?utf-8?B?WlJYYUVOc3djWmpsTnp3dkpCRS9sTW9SdVA5RGtJSzNtQnNBWS9YM0t3VkpS?= =?utf-8?B?TXBBSXFpM3ViOTZiUFlmbTNHa2VGTXd4eG53Vnl4cUkwT200bjh3NWZtaGlm?= =?utf-8?Q?Rm19lNXn1MSmRBwIOklyvnBYX0fa/tH8mdqW5c8?= X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-de33f.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: e1bf7207-083e-4a46-5e5c-08dd0e16ae7d X-MS-Exchange-CrossTenant-AuthSource: DU2PR08MB10263.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 12:34:34.2119 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8880 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 11/25/24 15:30, Andrew Burgess wrote: > Bernd Edlinger writes: > >> Okay, I just wanted to point out that in my opinion the debug info which >> points at the end of a sub-range is not incorrect, just maybe on a border >> line, where the dwarf spec is unclear. So you should not say: >> "after all, the DWARF spec is clear that such a range covers no code." >> >> But there are obviously not only cases where the entry_pc points at >> an empty sub-range, but also in very rare cases the entry_pc points at >> the end of a non-empty sub-range. >> So could you please change the check in dwarf2_addr_in_block_ranges >> from addr >= start && addr < end to addr >= start && addr <= end. > > Could you expand on why you believe that the DWARF spec is unclear in > this regard. I came to my conclusion based on this text within the > DWARF-5 specification, section 2.17.3 Non-Contiguous Address Ranges: > > Bounded range. This kind of entry defines an address range that is > included in the range list. The starting address is the lowest address > of the address range. The ending address is the address of the first > location past the highest address of the address range > > This seems pretty clear (to me) that the end address is not part of the > region covered by a range. > Yes, but on the other hand, when we look at line table entries, each has a PC and a VIEW number, and even the DW_AT_entry_pc has a DW_AT_GNU_entry_view, just the range list does not have a view number, and that is inconsistent with the concept of location views. Consider as a simple example an inline function: int f(int x) { x++; return x; } it will most likely just be compiled into one "inc eax" or similar, and of course you may want to set a break point on the return statement, to inspect 'x' after the increment, but that will be on 'pc == end' ! But if the location view number would not be missing from the rnglist it would be obvious whether the corresponding view number is still within subroutine and not outside. So in my opinion it is a defect in the specification that it does not reflect this use case. > Additionally, if we start to accept 'addr == end' then this is going to > cause problems elsewhere. GDB will place a b/p at the 'end' address, > but when GDB then performs block lookup, GDB will not return the block > we expect, and so GDB will not report the inferior as having stopped in > the scope that the user expects. > No, because this is exactly what the core of my patch does, admittedly I also modified the block lookup code a bit, to handle that case. So I strongly disagree here: we have to accept 'addr == end' and other corner cases, otherwise my patch won't work in the end, regardless of in how many small bug-fixes it can be split up, because it depends exactly on not ignoring any information while parsing the debug info. Thanks Bernd,