From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id ED2703858D39 for ; Wed, 1 Nov 2023 17:09:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED2703858D39 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 ED2703858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698858589; cv=none; b=eKC6u9idpHs/RmFwMD0dOSZfnY5Q/fn0LZbgcCxdeDgjUlNwa8hh6LAb4dt2icrf1zKE83FfrFZAX7ksWUhTL91Q7wMVDQf2PzLniGYbZr4xgdFUzvVTvUFOQSC8S5dDZUnSK1uKfCgSKlPSqh4Ushb2Y99bxLB7JMq3Idlm9gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698858589; c=relaxed/simple; bh=MLgpfTbDlrxoFVrCYATyqzjs++ZtczlZTpXtNjFEvd4=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=xzGRJNDZkV4mkCrheMABUuM0QIaW5ZfyaQMC73zGCxs+qPNOrnx9JzFCPDJFeBV1rbfRXMTPmuLOHnqM/hhZPXMkQnX02z5WUxvNQLivVC/skoxNREAyrylut8JsI+8ygrI/q9T+xsv8C0lsU9ioyBsRCOKRoW/LcJOC+S1ehgk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-358ff34cd9eso18156595ab.1 for ; Wed, 01 Nov 2023 10:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1698858581; x=1699463381; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2lfMRuqgS2kiKRn890LlKHqgZ4WOL6XshBCVFjX4jvU=; b=EzIjcXLzM8n7zXyvCe0d2pZBvTqImvT+ZQr9WqI1T8NVnoN+jHd8eJBG/nxoRQE7CM 13IGp18MmQdR+RTDFnxiR0yO7GaJ+h5ZSCoxzlJuWJoNjsBAKpFTpnEFKr3ZGTbrz2KX u4TdXKBwuyVDtKqw259fMFavVfzUDeoOoVAwgyDx8GNXitw1Z/GNfOi5R1uQlIqbnIHm Cdo3pa3qOfLJBHO0mLiGw76XC4kjp4qDB0RrwyIZdpZRIAqmpTdHjmnp3CB5/2THFkAH RWT/lhYyrjHc3HPS0Ndb5Y3zAuvZ/C+f6Pm2AUUAf0/fpjdl3TVNouNSDne+TOWqw3do hzPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698858581; x=1699463381; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2lfMRuqgS2kiKRn890LlKHqgZ4WOL6XshBCVFjX4jvU=; b=N9/kN0uvCwx6eivAcOr99QwqPjxBafvkq+p3tEtn2e1I+XBkaTejZrFWoFK0REdBO5 piSWNvkc4S4ZnIjAQWEe0nUhT7YRqqQr4t+kZSitm4swcB7wPLPpcxXlrMozowStGCnP C1ZJCQmK3w8TpsQpyhkdpZErZ0XjfQgCsHVnsURktOwpD/XgWZWSS1jV3Qv52wJrpnk2 SJRWnnCk1DZFWwEYucZ3rpE7JweJqy1uzgx5hWBVaEE6t/9Gy3O8q3yfzA8JJPB4bvqh puBArN0Cwsi6l+uPUVS0PJN4FQ+bkh/tEban3aVkJLAVfNlY+57gmOXfm+mrE+aWBGFj G5ZQ== X-Gm-Message-State: AOJu0YxzSnNhmXHKoY/r04YS+dzfecPBru56nfI018BN7NA9UpBF3CeM dOxYzeP29vTbVX9KseoTgpRqgMuUXQafD9tMr7ivhA== X-Google-Smtp-Source: AGHT+IGTTEfZgYEJLKjszWSODmJRJv/6n5z7ckKtW+MvxMPuCt7coPEd2R3OybCCRQLKS8cMfBKitg== X-Received: by 2002:a92:d847:0:b0:359:4ae3:cd8d with SMTP id h7-20020a92d847000000b003594ae3cd8dmr1205011ilq.6.1698858581129; Wed, 01 Nov 2023 10:09:41 -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.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 10:09:40 -0700 (PDT) From: Tom Tromey Date: Wed, 01 Nov 2023 11:09:37 -0600 Subject: [PATCH 5/7] Fix a bug in DAP scopes code MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231101-dap-nested-function-v1-5-0b0c3b228ac7@adacore.com> References: <20231101-dap-nested-function-v1-0-0b0c3b228ac7@adacore.com> In-Reply-To: <20231101-dap-nested-function-v1-0-0b0c3b228ac7@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 List-Id: While working on static links, I noticed that the DAP scopes code does not handle the scenario where a frame decorator returns None. This situation should be handled identically to a frame decorator returning an empty iterator. --- gdb/python/lib/gdb/dap/scopes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/python/lib/gdb/dap/scopes.py b/gdb/python/lib/gdb/dap/scopes.py index 87f2ed7547f..13c35817fb6 100644 --- a/gdb/python/lib/gdb/dap/scopes.py +++ b/gdb/python/lib/gdb/dap/scopes.py @@ -107,10 +107,14 @@ def _get_scope(id): else: frame = frame_for_id(id) scopes = [] - args = frame.frame_args() + # Make sure to handle the None case as well as the empty + # iterator case. + args = tuple(frame.frame_args() or ()) if args: scopes.append(_ScopeReference("Arguments", "arguments", frame, args)) - locs = frame.frame_locals() + # Make sure to handle the None case as well as the empty + # iterator case. + locs = tuple(frame.frame_locals() or ()) if locs: scopes.append(_ScopeReference("Locals", "locals", frame, locs)) scopes.append(_RegisterReference("Registers", frame)) -- 2.40.1