From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by sourceware.org (Postfix) with ESMTPS id 8EFC6385840B for ; Thu, 10 Mar 2022 09:47:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8EFC6385840B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f44.google.com with SMTP id p184-20020a1c29c1000000b0037f76d8b484so3007108wmp.5 for ; Thu, 10 Mar 2022 01:47:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=YEh2cdV9oH+j4quZbLvfHMYmO6uElZ2AQe6ZqxR1TmU=; b=oIVSK/trbJjwptYBCdVjys/56pLw5EE+VvqsY6CCsW7lvF29ATkmyLZCx9HL0hbEIN myh0Kn/ACSmfHtrtJh6bnoslG7gBveSMqmLuwCS2W+1djC+eVwxWs9puV9FWUx5e7IFh UgETCz5QKArzXl/wxPz4335aI/3IQKG79kmtKjQ+qCOzASVfv6yQ+Wn86ayGHYtXn3i0 OOZA6eWgDjetTVf3GoHti3jLJsY1jTrP8PBT99I0m3PaTGWG5KKclpW/KPeVKs+Ltyjv QyAzFN10ZnuKlkf1vMabxnQiqF0Qh5G5sjZZolTl+R94VtNdzO51tuVkR2GlHFqzGGhT LpSg== X-Gm-Message-State: AOAM531cgAm0LSLM7IcZ8rXEE0OpoH+tY5XAx+YDP51QwZce3IYk4ibf mpApJKmVX3t8gDjy4IaenrQzrxmiYgnyqw== X-Google-Smtp-Source: ABdhPJyRThxJ361RKtzKc6LwvgEboQzoH3MEkigsdtRPFzRz1EEbtmABBajPB8uYVaHxFxsnPKwV1w== X-Received: by 2002:a05:600c:1d19:b0:389:bd65:34c8 with SMTP id l25-20020a05600c1d1900b00389bd6534c8mr2872830wms.89.1646905671430; Thu, 10 Mar 2022 01:47:51 -0800 (PST) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id u4-20020adfdb84000000b001e8d8ac5394sm3986054wri.110.2022.03.10.01.47.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Mar 2022 01:47:50 -0800 (PST) Message-ID: Date: Thu, 10 Mar 2022 09:47:48 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: Semihosting in GDB 11.1 | Proposed patch for interrupting in sync mode Content-Language: en-US To: Tom Tromey , Adrian Oltean Cc: Adrian Oltean via Gdb References: <87k0d2gb44.fsf@tromey.com> From: Pedro Alves In-Reply-To: <87k0d2gb44.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2022 09:48:03 -0000 On 2022-03-09 19:49, Tom Tromey wrote: > Adrian> Unfortunately, I could not find ways to adapt all the other components I have around GDB to > Adrian> work with target-async mode enabled. It is what it is... > > I'm a little lost about this, because my mental model is that target > async shouldn't really change anything. I think it is just an > implementation detail about where gdb waits for events -- is it in > wait() or in select()? > > So, it would be interesting to learn what the differences are. Perhaps > this can be patched up. > > Adrian> Regarding the 'H' packet, I had a second look in the RSP specs > Adrian> where it's stated that '0' indicates an arbitrary > Adrian> process/thread. So, as you mentioned, I changed the GDB server > Adrian> code to simply ensure there's a valid thread stopped marked as > Adrian> 'current'. The original implementation incorrectly assimilated > Adrian> '0' with 'first thread' (always). > > I'm a little surprised this matters as well, but anyway I think it's > fine to submit a patch like this. Maybe others have some idea of what's > going on. I'm not sure that I get what Adrian is callilng "first thread", but I take it to mean that the server was numbering threads starting at "0". But, in the RSP, you can't use '0' as thread id, as it has a special meaning. I.e., if the server is numbering threads like, 0,1,2,3,... then it will run into problems, because when GDB says "Hg0", it doesn't mean "select the first thread, the one with id "0". The typical fix is to just start numbering threads at 1 instead of 0, for example.