From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-348d1cf5639so10109325ab.3 for ; Tue, 25 Jul 2023 09:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1690304252; x=1690909052; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b6Vx56rOp6C6RCmf150IwCP/Fb2vMmY8bocf3OVznVo=; b=XbCX1UO8tEkmT1R1eV8Xl6GvEMv6uuUtjRd5sDK1at2ysW0mL5smztOv9wI6F1fnYG 5CukxU1BDo0TrI2hY/wwfV1RuhgeRoj1uItj/fzdJZdAs2/hLkX0wuCQPW/J+R8k8AmW RldigLqNmBLf5qPPJZM1NmXaofo9O/OjYRI1QCEUCThtxYOuFQ/lu43Jg+RoCpxuRC4Z 8zRg8nOoloLGobL7hfvQ0N69whawZ+5OgzUfTbc8v8TfFstNsK0lB1M8PBTMeTjB+6Z/ ermMndg8dzzN3k9TdyL3yykjGhWacYwFSPJurE6rAxS8b1ERWcbxnLYkvKC2il7fqtVU UFQg== 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) From: Tom Tromey 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.40.1