Message ID | 20231101-dap-nested-function-v1-0-0b0c3b228ac7@adacore.com |
---|---|
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 EE8B23858024 for <patchwork@sourceware.org>; Wed, 1 Nov 2023 17:10:03 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by sourceware.org (Postfix) with ESMTPS id 7B3E43858D1E for <gdb-patches@sourceware.org>; Wed, 1 Nov 2023 17:09:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B3E43858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7B3E43858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698858588; cv=none; b=fX+Vh9YrbWogWxBaQCI4jPSAA2FkF7slv4LOjsitefFiovG6bRjWB6hGuNf8oA1Gz+ms1KAAVXFo50kh/S5HwkFtCDG33fmju7SSZ5ZDVDjDSOBQyjxsIHrU2HcgQNhSpn0LE6MOCgJWsMwglmlRm4FIYcgk5TfVUYRSb+vGtOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698858588; c=relaxed/simple; bh=m8klyUru+ovW4JqnHst3LyKrpQiDGMEwR+U3Bm4rd9c=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=KHhTNDoBA6omzG6pLi1JXYuu3BvRzJBPIG1JbBc0Q5kRKclqWUjlnHSNUbpj9UDwUQLOo03lGGFvpnBXi5//93G1v0jp8exPamTY9TMcPY4cCkSoyqUbAiAU52AenhsQnYaxJUXszMECe14cYXmHMrvD3Vse0rXWkXqQV5ID30U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7a66ff282baso1562039f.0 for <gdb-patches@sourceware.org>; Wed, 01 Nov 2023 10:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1698858577; x=1699463377; darn=sourceware.org; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:from:to:cc:subject:date:message-id:reply-to; bh=Ros9v1ltAAMsYntP7ouTkgaoiFgXbxWo+O7dO1Opk8I=; b=R8rYW6NjUkWoooPQuXMpuwDfbpGngBybSZ01Vlt25sBIJ2m/8MLvWou/zhzYJ51HU6 elhFsflnI1P+TVoJesCwRhkP/BvqwZ+2wFJwjU8KItsPUcrOZj4oHjBIbasmiZYypycY gdP/8qd8/slnzgXCgsKONUn+25DwQoY118v7oejkKGPBCuxm9mzSmxue3f+gz3/o8US5 mg5vnhM0aU6BSLJUSrTGkQv4csk4dMNiE0XC0XuSQsxuqT0fA99RAImvikMmeLb5ea2n RawdQ+5iecZzDqEdgar03aw6AGz7A5V/sZYHQVgZaM+ANVCT2K2LOIIAcnADM7E6mpkH X27A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698858577; x=1699463377; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ros9v1ltAAMsYntP7ouTkgaoiFgXbxWo+O7dO1Opk8I=; b=HyRX1qPtCrd9RdyX44VMHv4cc04j7Gg8uLLouazBUyoZzmN3ifG26nmKsBGuYNaxQr +5eeMPfczXo7YFrjV91gMVDwUXSbALDv9/GKK7kLt7NeS7B17+9225xVqATTehPgc/mE D+S3O3nlzjleK/ptpmCv1pXkOG8u27D9GPyaPzlgMelF6crtI2ljkIZeDkg+d5RiSPvv KFjtBIi4oXnHZbnQTOFLBgW1Ul545KhBrV1LJdAOBU2rtAB3KvJRGvq9cUKZqc8JBk48 XZd+HgWLZjZBaaKyAbrkjxOFihUhFHSypthtdhE+qUa/719quylC5ffZHV28t3Dct5KC JNzg== X-Gm-Message-State: AOJu0Yy0pXfq7tEDL4mjRTKkj1JXiBaPM+UYZOfu9mz5HK6+oODT2inc ZXmJHMM+WOqqYkoKJcqacmaz4LAKGFMOhDX5vg4ZFA== X-Google-Smtp-Source: AGHT+IFoPb9+HMF+lGq7F8wcUa4e4eMZlkvA7P2O++aJf9ZKQt2I/sPXsosKsuLJHTzhx31HqaOy+g== X-Received: by 2002:a5e:c914:0:b0:79d:27ef:23c3 with SMTP id z20-20020a5ec914000000b0079d27ef23c3mr2568421iol.5.1698858577579; Wed, 01 Nov 2023 10:09:37 -0700 (PDT) Received: from localhost.localdomain (97-122-77-73.hlrn.qwest.net. [97.122.77.73]) by smtp.gmail.com with ESMTPSA id gm2-20020a0566382b8200b0042b3a328ee0sm1017019jab.166.2023.11.01.10.09.36 for <gdb-patches@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 10:09:36 -0700 (PDT) From: Tom Tromey <tromey@adacore.com> Subject: [PATCH 0/7] Handle nested functions in DAP Date: Wed, 01 Nov 2023 11:09:32 -0600 Message-Id: <20231101-dap-nested-function-v1-0-0b0c3b228ac7@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAEyGQmUC/x2MQQrCQAwAv1JyNtDdUql+RTyku6nNwViSVoTSv xs9DszMDs4m7HBtdjB+i8tLA9KpgTKTPhilBkNuc5dSm7DSgsq+csVp07KGj3mg3F/64dxRhSg X40k+/+vtHjySM45GWubf60mRGxzHF86skG5+AAAA To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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 |
Handle nested functions in DAP
|
|
Message
Tom Tromey
Nov. 1, 2023, 5:09 p.m. UTC
DAP doesn't really describe what to do for nested functions. We discussed it internally a little, and I came up with this series. The idea here is that variables from the outer scope ought to be visible, so this series lets Python code follow a frame's static link, and then changes the DAP frame decorators to use this ability. At some point I think we'll need a "frame decorator v2", like we added for pretty-printers. But, I've been putting this off a little and still haven't done it here. Regression tested on x86-64 Fedora 36. --- Tom Tromey (7): Add two convenience methods to block Add block::function_block Move follow_static_link to frame.c Add gdb.Frame.static_link method Fix a bug in DAP scopes code Handle the static link in FrameDecorator Update gdb.Symbol.is_variable documentation gdb/NEWS | 3 + gdb/block.c | 13 +++++ gdb/block.h | 21 +++++++ gdb/doc/python.texi | 14 ++++- gdb/findvar.c | 64 +++------------------- gdb/frame.c | 40 ++++++++++++++ gdb/frame.h | 7 +++ gdb/python/lib/gdb/FrameDecorator.py | 64 +++++++++++++++++----- gdb/python/lib/gdb/dap/scopes.py | 8 ++- gdb/python/py-frame.c | 26 +++++++++ gdb/testsuite/gdb.dap/ada-nested.exp | 91 +++++++++++++++++++++++++++++++ gdb/testsuite/gdb.dap/ada-nested/prog.adb | 32 +++++++++++ 12 files changed, 311 insertions(+), 72 deletions(-) --- base-commit: 5fbee060e807fbc317aa265eb7e25d1cf94a4dad change-id: 20231101-dap-nested-function-28a2595863ad Best regards,
Comments
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
Tom> DAP doesn't really describe what to do for nested functions. We
Tom> discussed it internally a little, and I came up with this series. The
Tom> idea here is that variables from the outer scope ought to be visible,
Tom> so this series lets Python code follow a frame's static link, and then
Tom> changes the DAP frame decorators to use this ability.
I'm going to check this in.
I'm also going to backport it to gdb-14, since it is a change for DAP;
and the generic changes should be pretty harmless.
Tom> At some point I think we'll need a "frame decorator v2", like we added
Tom> for pretty-printers. But, I've been putting this off a little and
Tom> still haven't done it here.
I think this is a bit trickier than it first appears, because frame
filters not only generate objects that conform to the decorator API --
they also use them.
So I'm not sure what to do, if the need really arises. Maybe we need to
break the API a little.
Tom
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
Tom> I'm also going to backport it to gdb-14, since it is a change for DAP;
Tom> and the generic changes should be pretty harmless.
I regression tested the backport on x86-64 Fedora 38.
Tom