From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2063.outbound.protection.outlook.com [40.92.66.63]) by sourceware.org (Postfix) with ESMTPS id 956373858D39 for ; Thu, 9 May 2024 18:42:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 956373858D39 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 956373858D39 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.92.66.63 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1715280136; cv=pass; b=iKp+VYp4ffvDaAgeg9N36Kqf9U21lS/i/boSvOLwx74sn/7cqpE6VIGNF+ZTKOs6IhRF5C3tJqjD42QOO1Tt+fhLn+LrUZXM7kaAe91VDu69wrrKY/dg70jG+2kzGE5OJCa+TXGtTHzAZ5uVzqOmDwvPoaUW1+1M46L/qx7pHyY= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1715280136; c=relaxed/simple; bh=L3MJF+p2xYSCD2PppOkIEElDyoUE0XANIop0oCGAW0U=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=sYxWaX2IamlqjyoZXvK7CFjADefJ5VwMNkjlqtcHRhP871zX3yYX42Ga3BGKgXYOSSLy7ez2gibk5Z8CnIdNBlE1k9I7ixJ2aj7l3L9U4PeirNOVNsP1K8Ya05koRPscxNfHz2i9EkCWsfPlAZRCc459UV8Aj1L0ShrVUrOiIyI= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GTUu0yVtA/hexTkQPPYAfNoBg7mdozkf4zN4Q7z4+gJW4W0uARYu2K9r6ArOdT9uINehgjsXj+fsaROkGxbhZ9iDy2/eQobq+/48xap83UmmocRh+pA3Yg+HQL6Br0psFkM3IFKed45Z57ayWzBy0eB60P1YCoLz1D81TcU7DClqFvN9m6nAi3ARQkjdYBAOmfyEENtZfxXKR7q2xZHEABTgsKl4kBnBWoWUULdqC3VbwHN2dqBflVkSlc1MecNuUF3NmAbxGpwi6skmyhVAvafhFmZKXaZhqX5pUsIXjRj2u79vRE9IWoKBdjxBihgyUfIRpsxb9YWvAkpDgooI9g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iFPvL9723KWgUmb3aKjXi6xw/6yQcekQ+3xqkzM8aoM=; b=Er8dvwRcftwxvL24qKxVEhnLsm0rIjCP62641dXefYUWt6qjIinen9BGjW4m3DgppEktUbhv3d8kjFhowDqIrzfvsHR2X1wliFX2Y2r0eIQD8HrmE4hJIR1+00M9tX9I5R6Y98KtsHckHUbRQFVL5jR5xxs7KfQ6It9teKCFZ5iN4k2s+x0rxJsVwSbRwcb2Ulo3doQgQCJZy4o/THzidyQ06gZ5QvN8pCvqyhstW384QhtYnsVyAFZUcpvLLb67QFz1ooGlx53bM6hdqdlvvWPeIJVTZ6q+UT5YlqKtxvxraiKUh/TsBCMNNPhSAwRHUK4XmH7AK6hLrZOGAPsgWA== 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=iFPvL9723KWgUmb3aKjXi6xw/6yQcekQ+3xqkzM8aoM=; b=KeAI1yBCV8eckl5JI6tRPzdseAFmT7QZrguXs3bOIJiRNx7M6/KODUVTr8HIFRWl8c99jrs+YNpD13/nZuVpOJLbxp3bC0z36eyePki9LdH1oDfyC4eT22zwPpHp9zLhMbpg1LSJTDWADTfVQzcCdAJrEzrzJbdwXivWKZaToOW3MgExSGfZVSP9VgdeFGkFwcuUW6+H7ewIUyVBnxpaCDYmhu7DssifswHhVp67dDeZJQAV8c/8Iq+EYPF/n9sLcT44X6z/aUBMPOifHz6I+WZO5ULy6wz29x/7Mb13Ho0cnWDiAu0so/x+d+bsggEodW9WgVP2cH6zf81NFvCPIA== Received: from PAXP193MB1296.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:15a::24) by AM8P193MB1140.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:1e0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46; Thu, 9 May 2024 18:42:12 +0000 Received: from PAXP193MB1296.EURP193.PROD.OUTLOOK.COM ([fe80::794b:e1f9:6774:21e2]) by PAXP193MB1296.EURP193.PROD.OUTLOOK.COM ([fe80::794b:e1f9:6774:21e2%6]) with mapi id 15.20.7544.046; Thu, 9 May 2024 18:42:12 +0000 Message-ID: Date: Thu, 9 May 2024 20:44:07 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 09/12] gdb_target_is_native -> gdb_protocol_is_native To: Pedro Alves , Tom Tromey Cc: gdb-patches@sourceware.org References: <20240419151342.1592474-1-pedro@palves.net> <20240419151342.1592474-10-pedro@palves.net> <87edb1w5iq.fsf@tromey.com> <3a7ddd13-c4f7-4dcd-99d4-2c943195540a@palves.net> <275dc4af-a3ac-4e3b-96f0-6bc60a3a3f99@palves.net> Content-Language: en-US From: Bernd Edlinger In-Reply-To: <275dc4af-a3ac-4e3b-96f0-6bc60a3a3f99@palves.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TMN: [zbZkBca6iQg76fY4Zg3cX7gdobBm+VnRt4U3DP47Esj8OqteYlvJLiEaoglEdoSd] X-ClientProxiedBy: FR4P281CA0242.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f5::20) To PAXP193MB1296.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:15a::24) X-Microsoft-Original-Message-ID: <9dc3f947-2b28-48b2-a067-9c3ea98de0d4@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXP193MB1296:EE_|AM8P193MB1140:EE_ X-MS-Office365-Filtering-Correlation-Id: ce762d2a-36e2-49e4-1e86-08dc7057b6cb X-Microsoft-Antispam: BCL:0;ARA:14566002|461199019|440099019|3412199016; X-Microsoft-Antispam-Message-Info: 83+8hB0lkBCSr43GcWwckxmqnw0o9sBlftqJB0ulvdyueMTYAmRENS+lNowWTG7Rb4p+qZtd+pijn1yTgWE0XoXoBAbKcj856ODpzfJ6hyayWK/32wohDhRu+9q1X590Xm/vJwJtcZvcrzGmcDInwjJ+soPBTBgUDCHm3/lMX6SW0GJnMquOvSwtXueymUjN9reW20ajj+eMDf9sG+Cx94xz81XL5LwjFHHyjOECrxASV6/5P7LaEve14nD5b3kKaEhq1A7diXUJovCJIMCOhhkTau6X4oqynJwo1MU5bGA1O6HeEqrPrf7mrku8LsUUPGaH+1Qiku/gxhRWb7FPrjd2e+BTQTOYZJgRWiS0P3Ng6suzCHNPNeU2peq7+aK/onD5gvonqpGJzbuxZgEgmH2IN7iHshzwgS0fl6f/8/D9YS/xhwgy6T9Wyq5UIZHJH5ACRC8tqELKL2pXl56UZhxj0dJOJGowrD9pLNP3EaxsdMp0k+FOfd6Ljbx3y+ZXUQCG1UuWcLV4k6nwjpPEY+aPomyHTVh5V8S6q8kBMz2rcD5BpxdroCwhoYbXSx4aWMHh3HaafRg/cjGwOWrvsFQxpHjwg5hUQ/n2W6XyRPc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L1hoOU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-4755-11-msonline-outlook-80ceb.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: ce762d2a-36e2-49e4-1e86-08dc7057b6cb X-MS-Exchange-CrossTenant-AuthSource: PAXP193MB1296.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2024 18:42:12.3504 (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: AM8P193MB1140 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 5/9/24 17:49, Pedro Alves wrote: > On 2024-05-09 16:01, Bernd Edlinger wrote: >> On 5/9/24 15:31, Pedro Alves wrote: >>> >>> On 2024-05-09 14:19, Bernd Edlinger wrote: >>>> Hmm, okay, it is better than now, >>> >>> Indeed, seems strictly better. Some tests that are meant for the native target are now properly >>> skipped. >>> >>>> but the test casese that are affected, would probably >>>> be broken by this change, if my target toolchain would either have the -linux in the name, >>>> or the newlib would have a sleep and/or support the #include . >>> >>> I am afraid I don't know what you mean by this. Why would they be broken? Can you clarify? >> >> What I mean is this: >> >> there are in total 44 test cases failed to compile because of undefined reference to sleep, usleep or nanosleep >> with your patch it is now one less. >> >> But it would be piece of cake to implement some functions like >> sleep(), usleep(), and nanosleep in the newlib, and then make the simulator simulate it. >> >> Likewise there are currently 5 test cases failed to compile because of missing sys/mman.h header, >> and with your patch it will be one less, but what if we want to add that to the >> simulator, why cant we simulate a linux O/S? >> >> What is so special in the one test case that changed the behavior, that >> explains why the other 4 are good enough to try to include, and see if works? >> > > The gdb.base/load-command.exp testcase just doesn't make sense to test with the native > target, since with the native target, you don't use the "load" command to load programs. > So the testcase checks for that: > > if [gdb_protocol_is_native] { > unsupported "the native target does not support the load command" > return > } > > Normally, a testcase that checks whether it is testing with the native target does so because it is > testing some feature of the native target (the ptrace support, etc.), and so such an early check > isn't that much about whether sleep or sys/mman.h exists (they don't exist on native Windows, > for example, and there are native-only tests that you'd still want to run there). > > If a testcase should run against the sim target and would no longer run because we set > gdb_protocol, then that would be a problem with the testcase itself, for using the wrong > predicate to skip itself. We've had plenty of cases of testcases using the wrong > predicate over the years, that is something that we're fixing pretty frequently, so > please don't be surprised if we need to do that after this change too. > > Looking at gdb.base/many-headers.exp for example (the first in your previous message > that shows compile errors), it has: > > if { [target_info gdb_protocol] != "" } { > # Even though the feature under features being tested are supported by > # gdbserver, the way this test is written doesn't make it easy with a > # remote target. > unsupported "not native" > return > } > > Note the comment -- it is saying to skip testing on remote, but then it skips > on any board that sets gdb_protocol to anything (meaning, not native). > If this truly should only be skipped with remote targets, then it should instead > do this: > > require gdb_protocol_is_remote > > which is equivalent to: > > if { [target_info gdb_protocol] == "remote" || [target_info gdb_protocol] == "extended-remote" } { > return > } > > But, actually looking at the testcase, we see that it launches a program outside gdb, so that > the program crashes and generates a core (core_find), and then debugs the core under gdb, > with GDB stack limited to 4MB. From the commit's log (31aceee86308), it's the equivalent > of doing: > > $ ulimit -s 4096 > $ gdb -batch ./a.out core.saved > [New LWP 19379] > Segmentation fault (core dumped) > ... > > So, I don't really understand what the "features being tested are supported by gdbserver" > remark is alluding to, since gdbserver does not support loading cores. But then again, > the test doesn't even connect to the native target nor the remote target anyhow. So > we could let the testcase run when testing against a gdbserver board anyhow. > > Maybe what the comment is trying to say is, not easy to test with a "remote target" > in dejagnu sense, i.e., when you have to connect to a remote host board running on a > separate system, as in that scenario it's not easy to set ulimit. Is so, a better > predicate to check would be "require !is_remote host" or "require isnative". > > A similar analysis would have to be done to the other testcases. Ah, okay, thanks for the explanation. I was probably confused that sim looks an feels like a kind of native target, but it supports the load command, and the test cases can read and write local files, etc. Therefore it is of course easy to fix things in the wrong way. So I agree with your patch, and that any fallout can be fixed later in the test cases when necessary. Thanks Bernd.