From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by sourceware.org (Postfix) with ESMTPS id D67DE3858C62 for ; Tue, 16 Jan 2024 19:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D67DE3858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D67DE3858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::235 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705432419; cv=none; b=AVF+SQO5JxlyePpgqTxoVRca8iKpPcVv/IkcNjr7SDTcU5gyl9jd+hPOeoAY03nF7Xluu+K+dM5LsGhYCltak9OJPlm7iBR9NBT5s8B3R8NEoGQVGX02hhnKnkjUAsMajzxNWo1OUacsWtcM4vzFIWxIPYZuGIJsmbUMaZIEkPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705432419; c=relaxed/simple; bh=0l5reSYnIsURjovHwhA7/zi+b+W6+2I4dYEjQl4wMj4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=yAeZIX8yWxi0FhmW5VhRQnGLnsd8NsbTZaubuDwsb7wGT7eg7bUiD23wEwWwiufHW6cm11+XVxp7OdbSM86U98C7jkFRnivvtbrlTmNZEjarq7sOW7tM5j0fDl7gGAIpDpuipjG95ToEyji7cUiJp1dpiNmX7gSOP7PnxMCTimk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2cddb0ee311so13984051fa.0 for ; Tue, 16 Jan 2024 11:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705432416; x=1706037216; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3ZoJfF7K2V2yrDqNBmSnLhBf7eT6sjcIJHlqFGo8M3U=; b=SZHwZ2ucxPZOFPq6td6bNQlIei8RYTDm0ABoQwbUK0xKs/abCuOTVJWvseBFIzlg/Y 2HdOmKASpmKaKGjrPReDfvWAtolCnrq3wvD6ykhiOB4k2MvNw6rI0xHexVF5x7qlM7Bl /TW70grl8AoC0rNp+FT8SYii1lkFr2eQE6ndf/QDUzXDJWphwIgaCB0utuUm9xy6i+MA W3oZuAguy9y4L8BmlTdFQ6KMvMpfCRX72ifZHBt8KxHGi3QGRfkXZVXHLZtU8FUSCP+E uvmQoDopFM4D/UYj+K1Tn2RbYGKeH8lrmFszJxCIdnuZAU1vLu7RD0SowdK61pWKxKlr 3xgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705432416; x=1706037216; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3ZoJfF7K2V2yrDqNBmSnLhBf7eT6sjcIJHlqFGo8M3U=; b=P5JBReWHnwjvaT5x+33ztxKJ2sx4gwroSuxne898pUAioov2lza/N0zniFHYgRPQUJ 9YLIeyxXKQ7DBalhQyQUfKHSssSjMS2uav2BKvy97jcPYolmE9uUNX8Xe3F6mjXcKj1g lZB1McLb2a1exwbOJpYX9/zCYpvRj+0x/Q4yKa/KDTGb7Du8SGQwzJ20Qvxrgtaerymi tY5rrtEpaOgPAJ/aQWK1xrSYiOJcF3d7G5jzmVpt2umgkLhjOcOn84I6T5z9sJpEHIha lbp44PhpUgBjnOdAtKOjOS++2FWEWvDOsyOFwOOjegRvkCsL2S7Lcdoe2hEZ/HGusLXn fUTQ== X-Gm-Message-State: AOJu0Yz287bMkMNCr+ttX/QRWOIqC+JaFTSTNrmNKwWpYImoNSfymips iA2pxTUbv2ezj/CzP6uHJ0EAn8GntqA= X-Google-Smtp-Source: AGHT+IGvzEW2ZiWLdBi3VIzIqACzudo5IcyfYs7TW4mCbGN/hDyrpWxo2OdciCVj5okX+S/jenqRzQ== X-Received: by 2002:a2e:b177:0:b0:2cc:6cde:ba3 with SMTP id a23-20020a2eb177000000b002cc6cde0ba3mr1743605ljm.81.1705432415859; Tue, 16 Jan 2024 11:13:35 -0800 (PST) Received: from localhost.localdomain ([2001:2044:7c:4b00:37f8:fc67:7f51:113d]) by smtp.gmail.com with ESMTPSA id u1-20020a2eb801000000b002cdc84fdef9sm630413ljo.89.2024.01.16.11.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 11:13:35 -0800 (PST) From: Simon Farre To: gdb-patches@sourceware.org Cc: Simon Farre Subject: [PATCH 4/5] [dap & linetable]: Add breakpointLocations request Date: Tue, 16 Jan 2024 20:13:04 +0100 Message-ID: <20240116191305.126345-4-simon.farre.cx@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116191305.126345-1-simon.farre.cx@gmail.com> References: <20240116191305.126345-1-simon.farre.cx@gmail.com> 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,FREEMAIL_FROM,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: This adds the breakpointLocations request. Testing might strictly not be possible for this feature. Users are going to have wildly varying compilers and compiler versions that outputs wildly different debug symbol information. So unless we can restrain the tests to some specific toolchain that I can handroll the tests for, this will not be useful (and handrolling for a specific compiler defeats the purpose - as one can just use the eyes then to verify). --- gdb/python/lib/gdb/dap/breakpoint.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py index 9cbd7ae0c47..fe3c209051d 100644 --- a/gdb/python/lib/gdb/dap/breakpoint.py +++ b/gdb/python/lib/gdb/dap/breakpoint.py @@ -437,3 +437,29 @@ def set_exception_breakpoints( return { "breakpoints": _set_exception_catchpoints(options), } + + +@in_gdb_thread +def _get_logical_bp_locations(name: str, line: int): + linetable = gdb.lookup_linetable(name) + if linetable is not None: + return [ + {"line": lte.line, "column": lte.column} for lte in linetable.line(line) + ] + else: + return [] + + +@request("breakpointLocations") +@capability("supportsBreakpointLocationsRequest") +def breakpoint_locations( + *, + # This is a Source but we don't type-check it. + source, + line: int, + column: Optional[int], + endLine: Optional[int], + endColumn: Optional[int], +): + # for now we don't support column, endLine, endColumn. We just return per line + return {"breakpoints": _get_logical_bp_locations(source["path"], line)} -- 2.43.0