From patchwork Tue Jul 25 16:57:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 73171 Return-Path: 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 EE6A9385AF97 for ; Tue, 25 Jul 2023 16:58:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE6A9385AF97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690304309; bh=b6Vx56rOp6C6RCmf150IwCP/Fb2vMmY8bocf3OVznVo=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=F0VRA1CGVTrcnrGQsjVf8dhNv43eHkKp4X0cYdUkE0SMr3zLrIeSJTE3IlJg79bUa GhRJ0N45XuOckF4USYZnPEnuZ7xDT9ol7oOFGMrF61nRUMXsB4eVc6sWxOHBtdE+da quQSuFGrKUNV25E9ETULEpCf9o1+QVGwVZGeHMck= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 9D7223858280 for ; Tue, 25 Jul 2023 16:57:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D7223858280 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-348d1cf5639so10109325ab.3 for ; Tue, 25 Jul 2023 09:57:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690304252; x=1690909052; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b6Vx56rOp6C6RCmf150IwCP/Fb2vMmY8bocf3OVznVo=; b=dAIGsHayDNWVO0XFUsvmOpfPIb7cJxrmBno+JxxvGQoEFeORmoIGS7tnlbvccMpD9e bWkQcafFf6wt6/asT0gQtPL8DiCRsQZpYDzYtK92wf0nArBKVqHp5sd0VfDo3mSBTsQI UIlv1PKDT0xkeCcOKo/jo9fsvY20XKoV4Fpaw2gEb3bjxk/g9Kaz/i2Q/jMCbA902LEl RUbSxVrpLzG1PMwb3LYS4agf71xg6vIVGOTSQ5lWcxVNWB7sliDtE4UF42uumR/Fe6lk 6AeBOk9PVlH2XL/Tb+aeaJvPPbw+BRuSi3zmPIlX3ag0So7eunG2Jw78KJUtij6wlJHn 3i+g== X-Gm-Message-State: ABy/qLbiD2PbfuiTC3sJsdjXDIxGvWpxltewQGNsJepmB62xbTmTJT31 A3/rJhwudhhG6cnhrIJ51w6MkaoBdWdRZMybEdcM4g== X-Google-Smtp-Source: APBJJlG9PyeUDoObMilhYhVf/9uHRoYE+q+StAgjshK/JYcl43iGBPES/d4vuJwXZT/67PGHkkHVHA== X-Received: by 2002:a05:6e02:170e:b0:348:90eb:883b with SMTP id u14-20020a056e02170e00b0034890eb883bmr4128728ill.13.1690304252751; Tue, 25 Jul 2023 09:57:32 -0700 (PDT) Received: from localhost.localdomain (75-166-135-140.hlrn.qwest.net. [75.166.135.140]) by smtp.gmail.com with ESMTPSA id cw1-20020a05663849c100b0042b6cb44429sm3777688jab.46.2023.07.25.09.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 09:57:32 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Don't supply DAP 'path' for non-file shared libraries Date: Tue, 25 Jul 2023 10:57:22 -0600 Message-Id: <20230725165722.1297207-1-tromey@adacore.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The DAP 'module' event may include a 'path' component. I noticed that this is supplied even when the module in question does not come from a file. This patch only emits this field when the objfile corresponds to a real file. No test case, because I wasn't sure how to write a portable one. However, it's clear from gdb.log on Linux: {"type": "event", "event": "module", "body": {"reason": "new", "module": {"id": "system-supplied DSO at 0x7ffff7fc4000", "name": "system-supplied DSO at 0x7ffff7fc4000"}}, "seq": 21} Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30676 --- gdb/python/lib/gdb/dap/modules.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/python/lib/gdb/dap/modules.py b/gdb/python/lib/gdb/dap/modules.py index 6ba613bcd2b..1aec1cba0ac 100644 --- a/gdb/python/lib/gdb/dap/modules.py +++ b/gdb/python/lib/gdb/dap/modules.py @@ -36,11 +36,13 @@ def make_module(objf): """Return a Module representing the objfile OBJF. The objfile must pass the 'is_module' test.""" - return { + result = { "id": module_id(objf), "name": objf.username, - "path": objf.filename, } + if objf.is_file: + result["path"] = objf.filename + return result @in_gdb_thread