From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id rsxeFqW2YGpnBSUAWB0awg (envelope-from ) for ; Wed, 22 Jul 2026 08:25:09 -0400 Received: by simark.ca (Postfix, from userid 112) id 4916E1E099; Wed, 22 Jul 2026 08:25:09 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 76ECC1E099 for ; Wed, 22 Jul 2026 08:25:08 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E8BD44BA2E35 for ; Wed, 22 Jul 2026 12:25:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8BD44BA2E35 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by sourceware.org (Postfix) with ESMTPS id 4D55A4BA2E05 for ; Wed, 22 Jul 2026 12:24:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D55A4BA2E05 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4D55A4BA2E05 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784723081; cv=none; b=JEzNs+GAbEuO0RLoJzIrn0atRRfFco1NkofSMe4yBALkr6TBnGzdHwmaPfLE1D8nzmSBF57XPrhYp/0BNz+srheCwYiUcZR5pnsFCkYfLi1F8vB87iyOd+mtRTG5iIt5p3hKf95WllX0+FKejprNtTiAR5KXnI1OS0Wkk5pbtKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784723081; c=relaxed/simple; bh=v6a57mNToslUrhi8RpSBn0fQ9wHK7tUH8AvjjgScwk0=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=iQd5ishyzHFgkTUrQSexFXVn7fvqXV1dudcBy+dvotYBpsNYE0aemVcHJGL+Sa0KDYtepwOaTChtSmFfzs3OzJ778qOxB7KsWWV/ywXGvu9TGI8a+NRIjSvI/JDrEjDlfvwkOIm5sAjAzuesQVutn6akxOqi4Aje9wrE58rdVCA= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D55A4BA2E05 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-49548e01d02so25194285e9.0 for ; Wed, 22 Jul 2026 05:24:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784723080; x=1785327880; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GXAogzFcdymR5pAIibYNaJITjngzmprAb+1Zsu0Ax7A=; b=TE2EVDsOhBXS6BBmQQzCPIRUQdNQz5fmcK//Fm5tNvImPeTeTOns2RGEet1Oe3Jf6h 1bT8h7tzJxjW5xkzgdfPyoNoSyVpcaEe2edblVqZJlfjwCezyDy/tqO6YNZtQq+Pgse6 mpIXzNCQcNSjgTYsYC8dLguhXSqXTBEXdqqdoRnd+EjAjzYg6pR60C3F8Rqd+8kVTBrD dMV7ZUo2mq6glQQqRL1pwyhlewVExcdSDTWPko7Ab2KqOfaGwXuvaZrtBjBkKc/uVV/q 3HkG9MBJ1BSwe4aQCxkTbCGvU4CgAmIiGC/iZqCqAXbjTM3k273UygKhS3HHD7qVuSv8 ll6g== X-Gm-Message-State: AOJu0YyC/g+31OLH2ZBf0Sl+0hhDMZEQTC3+NPiz3EM/Vyrh6aBuNwWR u0TBRrKdUoMdIVakVHBo2OeY0yAeSGHxpQPPRGsRIdtfLQh6Oyop/B09VCXWPA== X-Gm-Gg: AR+sD111X18HntLexu6BG1lnQrgg5BVHj6TKLb2vNRynlQ4JPHsAp68qz4oMzDVAXJS x5EUTp7AjGJ1ACWcUEkGjexWVXvxGDg1n7upL2Iycl4Hqb1N+diSkkmNiqibKS7iYRZdjGr76So NGhXkRsCM2iAcH08bzAn0Ev8aBv4BKRiV7AlFYLnhaLVxc24XVoKY4h9tWjhhWvI1+9R/Yhjrfq /4VWCCVkplFHt+NG/06jPzZLkjPdvu2psl+JzmB4tBhU8dz6mjZ3g05W1ls+eFBMFmA5VRM0ty5 cmh2aZA/JB24fAK0iKeMyMHfmxsv3j2hVS8h6nwtf4elVh2kzdj8i4IkSgh/UBnSqoBfq1s9ydg amBtB1XSfsThgGj+e/jDgeU1Jth20UR/6uNs+wxosSj+B9GzBe33+ZfGo9EszZO+l1hrHK2NJRF 0sqPXGDPw7odg37I+Zn9ixNqDxQug/E5ISVtBIiq27U9Dj X-Received: by 2002:a05:600c:4a1a:b0:493:bacb:1341 with SMTP id 5b1f17b1804b1-4954a3d0d6emr147821625e9.4.1784723079827; Wed, 22 Jul 2026 05:24:39 -0700 (PDT) Received: from ?IPV6:2001:8a0:fae3:3700:29ae:9c1e:45d9:1a25? ([2001:8a0:fae3:3700:29ae:9c1e:45d9:1a25]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4956a4f2453sm72283165e9.3.2026.07.22.05.24.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jul 2026 05:24:39 -0700 (PDT) Message-ID: <1ce9ef92-cf15-4dec-b310-2a0140a828da@palves.net> Date: Wed, 22 Jul 2026 13:24:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Windows gdb: Fix resetting of the debug-registers bit in ContextFlags To: Tom Tromey , Hannes Domani Cc: Simon Marchi via Gdb-patches References: <1448496673.3144402.1783350109140@mail.yahoo.com> <1822552016.1384378.1784646139252@mail.yahoo.com> <874ihswakf.fsf@tromey.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <874ihswakf.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 2026-07-21 17:51, Tom Tromey wrote: >>>>>> "Hannes" == Hannes Domani writes: > > Hannes> Ping. > > I'd prefer Pedro reply, but FWIW I think the patch looks reasonable. > You can have my approval but please wait a bit to see if Pedro has some > other comments. I'm a little confused, since AFAICT, there has been no patch update to address the comments I made earlier. We've established that the patch isn't really "fixing" the resetting of registers, as the missing context flag is ignored anyway. So at the very least I was expecting that the subject and commit log would be updated to match reality. > Am Montag, 6. Juli 2026 um 17:02:35 MESZ hat Hannes Domani Folgendes geschrieben: > >> It's just great that all your mails are blocked by yahoo... Sorry, but I don't know what I can do about that. My hosting provider, including email is dreamhost, which is quite popular and I believe used by others in the community too. I don't have anything special going on with my email AFAIK. >> >> >> Am Mittwoch, 1. Juli 2026 um 21:03:09 MESZ hat Pedro Alves Folgendes geschrieben: >> >>> On 2026-06-27 15:27, Hannes Domani wrote: >>>> The CONTEXT_DEBUG_REGISTERS also includes the arch-specific bit >>>> (CONTEXT_i386 or CONTEXT_AMD64) which is included in all CONTEXT_* >>>> defines. >>>> >>>> So this basically just checks if any CONTEXT_* define is set: >>>> if ((context->ContextFlags & CONTEXT_DEBUG_REGISTERS) != 0) >>>> >>>> And similarily, unsetting CONTEXT_DEBUG_REGISTERS removes the >>> >>> similarily => similarly >> >> Right. Can you fix? >> >> >>>> arch-specific bit as well. >>>> >>>> So this creates a CONTEXT_DEBUG_REG_FLAG define with just the >>>> debug-registers bit, and uses it in these problematic locations. >>> >>> How did you notice this? Like, GDB was misbehaving and you found the >>> issue, was it by inspection? I'd be good to have that info in the commit log. >> >> I noticed because I was doing some changes in that function, and >> CONTEXT_DEBUG_REGISTERS stood out to me very quickly, because for WOW64 I >> would expect WindowsContext::debug to be used instead. OK. Can you please add this to the commit log? That does seem like something we need to fix, and should be rationale for the change, right? >> >> >>>> --- >>>> gdb/x86-windows-nat.c | 10 +++++++--- >>>> 1 file changed, 7 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/gdb/x86-windows-nat.c b/gdb/x86-windows-nat.c >>>> index 27adeb1f154..3368814ed96 100644 >>>> --- a/gdb/x86-windows-nat.c >>>> +++ b/gdb/x86-windows-nat.c >>>> @@ -42,6 +42,10 @@ enum >>>> >>>> #define DR6_CLEAR_VALUE 0xffff0ff0 >>> >>>> >>>> +/* The CONTEXT_DEBUG_REGISTERS define without the arch-specific bit >>>> + (CONTEXT_i386 or CONTEXT_AMD64). */ >>>> +#define CONTEXT_DEBUG_REG_FLAG 0x10 >>>> + >>> >>> Did you consider avoiding harcoding numbers, like: >>> >>> #ifdef __x86_64__ >>> # define CONTEXT_ARCH_BIT CONTEXT_AMD64 >>> #else >>> # define CONTEXT_ARCH_BIT CONTEXT_i386 >>> #endif >>> >>> #define CONTEXT_DEBUG_REG_FLAG (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_ARCH_BIT) >> >> I did consider this: >> >> #define CONTEXT_DEBUG_REG_FLAG (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_CONTROL) OK, so why did you decide against it? >> I did some experiments, and it looks like SetThreadContext doesn't care at >> all about the arch bit, so it is working like your original intention. >> I thought it would fail in the arch bit is missing, but I was wrong about that. >> Seeing this, FYI, I didn't know if you planed on dropping the patch, or sending an updated one with a commit log that reflects the finding. But I didn't think the current one as it was, was ready. Pedro Alves