Message ID | 20240220165605.563516-1-pedro@palves.net |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED1C63858D39 for <patchwork@sourceware.org>; Tue, 20 Feb 2024 16:56:40 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by sourceware.org (Postfix) with ESMTPS id 03CC23858D20 for <gdb-patches@sourceware.org>; Tue, 20 Feb 2024 16:56:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 03CC23858D20 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 03CC23858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708448170; cv=none; b=Y91A9uoKWVf8bvSviy9WUoHxUw+Uz4lwYteOF/Erk7QRw/l7feB3sJzV7x86XbOZ3L46Ja9bPOL/14HYuEzv5Y98gKr61R95OXaMhHwIezMNXjbbFvK3JYDyV2/gs3/P/QiuwwaaTTSGyoWusZXTaNiTW4JpyAcI8NInXOAznTA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708448170; c=relaxed/simple; bh=/SN5CnbHt9J8H0EKExRT6ijNpWkzXFKSrQCx6Fxz7Yw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=K7xtgUhh745k0bYVbOoBqM1wlH0jgw6vWlkxxI/8leks0r9cn5FP5ENB4CrlyUGE1tGr6/H8eTeKduSpdX39xGfPyHX+fZyNur9+jVsgmy37NvIXc+g3wIDNNNTgwyLxegSC+30F4S2Yo17r0AIRUgMnQ6iKF9nALudb7fEY5+o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4127109686fso3855985e9.2 for <gdb-patches@sourceware.org>; Tue, 20 Feb 2024 08:56:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708448167; x=1709052967; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LRsm9BT9MVfKG6efR6LRQ4WH4U4YJOrsWi6ebWbCZfA=; b=T6KVZPD95uYn4ZcyB9BpNeLvU8nixF+/qfdmjyhHcfv/f/d2u6/sYUksYGBW2EoqxW yr9bXiq+kAGdhDU3rMUmAkHbRlUSJdaU4EOiWXH6fHcr7IAtQv8XLuv1M67YbMeL1SzD mNq4mdQx/k5S4qYo/lJwFFruPyOWphHI2WC4wmMWz05Ssvfk5znici0+xiIZqnMDm73/ JIocx77doS5Y9hkF5vpfKQ17p5gndyvKegPxi1sFrLxJMYq6gWKKVNdyHN0oD+coSr23 12PlW1IqXFCrV3ofAr0XAlrOIJIZNwv9poo0cQ/LTz5FPaU1ReSt2kImVVIvmMm6iUNQ To7A== X-Gm-Message-State: AOJu0YxxEAzYNWkCiPCldMFbdUUo5x15yGQ6hWAVDwfq1Z7F1YOT3/LM KtrIdyG3kSqHVkjt5/fDZCLvxj9WvIb9qOSCy18DbDq6Inr9arQmZSPD3qpF1Qk= X-Google-Smtp-Source: AGHT+IFARtjZd3NE81X4ayWbknhWWTV7+elEKnb7wAN30T3WMAxvC2LFTVXqzbslPxN2u5i9sFdEnQ== X-Received: by 2002:a5d:51d1:0:b0:33d:6554:e1f9 with SMTP id n17-20020a5d51d1000000b0033d6554e1f9mr1992893wrv.50.1708448167340; Tue, 20 Feb 2024 08:56:07 -0800 (PST) Received: from localhost ([2001:8a0:f918:ab00:69e9:8530:3f47:315c]) by smtp.gmail.com with UTF8SMTPSA id c5-20020adfe705000000b0033b8305ffe2sm14038090wrm.87.2024.02.20.08.56.06 for <gdb-patches@sourceware.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Feb 2024 08:56:06 -0800 (PST) From: Pedro Alves <pedro@palves.net> To: gdb-patches@sourceware.org Subject: [PATCH 0/2] Rework Cygwin signal handling Date: Tue, 20 Feb 2024 16:56:02 +0000 Message-ID: <20240220165605.563516-1-pedro@palves.net> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Rework Cygwin signal handling
|
|
Message
Pedro Alves
Feb. 20, 2024, 4:56 p.m. UTC
This upstreams a couple GDB patches that Cygwin has been carrying downstream. In my Windows non-stop work, I was having trouble with the have_saved_context machinery, I couldn't get it to work properly. The Cygwin distro gdb was able to unwind signals properly, but my GDB did not. After some head banging, I realized that Cygwin gdb may have some downstream patches. And indeed it does. One of those patches eliminates the have_saved_context machinery... I got signal handling and non-stop working properly on top of that patch, which then means that I need that change upstream as well, if I am to upstream my non-stop changes... So here we are. That patch is patch #2 in this series. That have_saved_context patch depends on another downstream patch, which is patch #1 here. The version I show here is a polished, modernized version compared to the downstream version, but the main logic is the same. While this is not perfect, it is certainly better than what we have upstream, which just isn't able to unwind from a signal handler at all. Cygwin has been carrying these patches for many years, so while we could think about improving all this, I see no reason for holding back the patch as is. We can always improve on top, and we should be able to do that upstream. Jon Turney (2): Teach gdb how to unwind cygwin _sigbe and sigdelayed frames Drop special way of getting inferior context after a Cygwin signal gdb/amd64-windows-tdep.c | 26 ++++++ gdb/i386-windows-tdep.c | 20 ++++ gdb/windows-nat.c | 52 +++-------- gdb/windows-tdep.c | 194 +++++++++++++++++++++++++++++++++++++++ gdb/windows-tdep.h | 20 ++++ 5 files changed, 275 insertions(+), 37 deletions(-) base-commit: 94a75b0363b1e09416e9bd24cac72d98864688d8
Comments
On 20/02/2024 16:56, Pedro Alves wrote: > This upstreams a couple GDB patches that Cygwin has been carrying > downstream. > > In my Windows non-stop work, I was having trouble with the > have_saved_context machinery, I couldn't get it to work properly. The > Cygwin distro gdb was able to unwind signals properly, but my GDB did > not. After some head banging, I realized that Cygwin gdb may have > some downstream patches. And indeed it does. One of those patches > eliminates the have_saved_context machinery... I got signal handling > and non-stop working properly on top of that patch, which then means > that I need that change upstream as well, if I am to upstream my > non-stop changes... So here we are. That patch is patch #2 in this > series. > > That have_saved_context patch depends on another downstream patch, > which is patch #1 here. The version I show here is a polished, > modernized version compared to the downstream version, but the main > logic is the same. While this is not perfect, it is certainly better > than what we have upstream, which just isn't able to unwind from a > signal handler at all. Cygwin has been carrying these patches for Thanks very much for polishing and modernising this patch. Just to note that the situation is even worse than noted here: as well as being unable to unwind in a signal handler, without this patch gdb also can't unwind from functions inside the cygwin DLL where the call stack passes through these wrappers (which is nearly all of them, which makes debugging problems there even more painful). Obviously, I am very much in favour of this being applied. :) > many years, so while we could think about improving all this, I see no > reason for holding back the patch as is. We can always improve on > top, and we should be able to do that upstream. > > Jon Turney (2): > Teach gdb how to unwind cygwin _sigbe and sigdelayed frames > Drop special way of getting inferior context after a Cygwin signal > > gdb/amd64-windows-tdep.c | 26 ++++++ > gdb/i386-windows-tdep.c | 20 ++++ > gdb/windows-nat.c | 52 +++-------- > gdb/windows-tdep.c | 194 +++++++++++++++++++++++++++++++++++++++ > gdb/windows-tdep.h | 20 ++++ > 5 files changed, 275 insertions(+), 37 deletions(-)
>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:
Pedro> This upstreams a couple GDB patches that Cygwin has been carrying
Pedro> downstream.
I don't know anything about Cygwin, but considering that these seem
fairly local to that code; and Jon reports their necessity; and they
remove some special handling from windows-nat.c, I'm in favor of you
putting them in.
thanks,
Tom
On 2024-02-21 13:25, Jon Turney wrote: > Thanks very much for polishing and modernising this patch. > Thanks for writing it in the first place. :-) > Just to note that the situation is even worse than noted here: as well as being unable to unwind in a signal handler, without this patch gdb also can't unwind from functions inside the cygwin DLL where the call stack passes through these wrappers (which is nearly all of them, which makes debugging problems there even more painful). Oh, indeed. I was too focused on the tree, missed the forest. > Obviously, I am very much in favour of this being applied. :) :-)
On 2024-02-21 21:14, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes: > > Pedro> This upstreams a couple GDB patches that Cygwin has been carrying > Pedro> downstream. > > I don't know anything about Cygwin, but considering that these seem > fairly local to that code; and Jon reports their necessity; and they > remove some special handling from windows-nat.c, I'm in favor of you > putting them in. > Great, thanks. I've merged this now. Pedro Alves