[Lldb-commits] [lldb] [lldb-dap] Adding a DAPError for showing users error messages. (PR #132255)

2025-03-27 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/132255 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Migrating DAP 'initialize' to new typed RequestHandler. (PR #133007)

2025-03-27 Thread John Harrison via lldb-commits
@@ -54,6 +54,79 @@ bool fromJSON(const llvm::json::Value &, DisconnectArguments &, /// body field is required. using DisconnectResponse = VoidResponse; +/// Arguments for `initialize` request. +struct InitializeRequestArguments { + /// The ID of the debug adapter. + std::st

[Lldb-commits] [lldb] [lldb][lldb-dap] Added support for "WriteMemory" request. (PR #131820)

2025-03-27 Thread John Harrison via lldb-commits
@@ -112,3 +112,48 @@ def test_readMemory(self): # Reads at offset 0x0 fail mem = self.dap_server.request_readMemory("0x0", 0, 6) self.assertEqual(mem["success"], False) + +def test_writeMemory(self): +""" +Tests the 'writeMemory' requ

[Lldb-commits] [lldb] [lldb] Convert Breakpoint & Watchpoints structs to classes (NFC) (PR #133780)

2025-03-31 Thread John Harrison via lldb-commits
@@ -52,14 +37,33 @@ struct SourceBreakpoint : public Breakpoint { static bool BreakpointHitCallback(void *baton, lldb::SBProcess &process, lldb::SBThread &thread, lldb::SBBreakpointLocation &location); -}

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-03-31 Thread John Harrison via lldb-commits
@@ -397,6 +402,23 @@ struct DAP { InstructionBreakpoint *GetInstructionBreakpoint(const lldb::break_id_t bp_id); InstructionBreakpoint *GetInstructionBPFromStopReason(lldb::SBThread &thread); + + /// Checks if the request is cancelled. + bool IsCancelled(const protocol

[Lldb-commits] [lldb] [lldb-dap] Do not take ownership of stdin. (PR #133811)

2025-03-31 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/133811 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-03-30 Thread John Harrison via lldb-commits
ashgti wrote: I may need to split this up into a smaller set of patches. Let me know what you think. https://github.com/llvm/llvm-project/pull/133624 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[Lldb-commits] [lldb] [lldb] Convert Breakpoint & Watchpoints structs to classes (NFC) (PR #133780)

2025-03-31 Thread John Harrison via lldb-commits
@@ -12,25 +12,35 @@ #include "DAPForward.h" #include "lldb/API/SBBreakpoint.h" #include "lldb/lldb-enumerations.h" +#include "llvm/ADT/StringRef.h" #include #include namespace lldb_dap { -struct ExceptionBreakpoint { - DAP &dap; - std::string filter; - std::string l

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-03-31 Thread John Harrison via lldb-commits
@@ -19,10 +19,39 @@ #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" -#include +#include +#include namespace lldb_dap { +class EndOfFileError : public llvm::ErrorInfo { +public: + static char ID; + + EndOfFileError() = def

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-03-31 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130169 >From c183231db80d6c97bdd5e9bd0b21d041189146e8 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 18 Mar 2025 14:05:38 -0700 Subject: [PATCH 01/12] [lldb-dap] Adding support for cancelling a request. Adding

[Lldb-commits] [lldb] [lldb] Convert Breakpoint & Watchpoints structs to classes (NFC) (PR #133780)

2025-03-31 Thread John Harrison via lldb-commits
@@ -49,6 +41,17 @@ struct BreakpointBase { /// breakpoint in one of the DAP breakpoints that we should report changes /// for. static constexpr const char *kDAPBreakpointLabel = "dap"; + +protected: + /// Associated DAP session. + DAP &dap; + + /// An optional expressi

[Lldb-commits] [lldb] [lldb] Convert Breakpoint & Watchpoints structs to classes (NFC) (PR #133780)

2025-03-31 Thread John Harrison via lldb-commits
@@ -52,14 +37,33 @@ struct SourceBreakpoint : public Breakpoint { static bool BreakpointHitCallback(void *baton, lldb::SBProcess &process, lldb::SBThread &thread, lldb::SBBreakpointLocation &location); -}

[Lldb-commits] [lldb] [lldb-dap] Make the DAP server resilient against broken pipes (PR #133791)

2025-03-31 Thread John Harrison via lldb-commits
ashgti wrote: A `SIGPIPE` is raised if your process writes a pipe that is closed on the other end. If the python script is getting that then `lldb-dap` must have closed stdin. The Transport `input` does take ownership of stdin (https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-da

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-03-31 Thread John Harrison via lldb-commits
ashgti wrote: Wanted to also double check with @labath as well, any additional thoughts? https://github.com/llvm/llvm-project/pull/130169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-com

[Lldb-commits] [lldb] [lldb-dap] Do not take ownership of stdin. (PR #133811)

2025-03-31 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/133811 >From 9053618204265ea71a6a30382937cff584f8c02d Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 31 Mar 2025 14:36:16 -0700 Subject: [PATCH 1/2] [lldb-dap] Do not take ownership of stdin. There isn't any b

[Lldb-commits] [lldb] [lldb-dap] Do not take ownership of stdin. (PR #133811)

2025-03-31 Thread John Harrison via lldb-commits
@@ -571,7 +571,7 @@ int main(int argc, char *argv[]) { } lldb::IOObjectSP input = std::make_shared( - fileno(stdin), File::eOpenOptionReadOnly, true); + fileno(stdin), File::eOpenOptionReadOnly, false); ashgti wrote: Applied. https://github.com

[Lldb-commits] [lldb] [lldb-dap] Do not take ownership of stdin. (PR #133811)

2025-03-31 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/133811 There isn't any benefit to taking ownership of stdin and it may cause issues if `Transport` is dealloced. >From 9053618204265ea71a6a30382937cff584f8c02d Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 3

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-04-01 Thread John Harrison via lldb-commits
@@ -19,10 +19,39 @@ #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" -#include +#include +#include namespace lldb_dap { +class EndOfFileError : public llvm::ErrorInfo { +public: + static char ID; + + EndOfFileError() = def

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-04-01 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130169 >From c183231db80d6c97bdd5e9bd0b21d041189146e8 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 18 Mar 2025 14:05:38 -0700 Subject: [PATCH 01/13] [lldb-dap] Adding support for cancelling a request. Adding

[Lldb-commits] [lldb] [lldb-dap] Make the DAP server resilient against broken pipes (PR #133791)

2025-04-01 Thread John Harrison via lldb-commits
ashgti wrote: Does setting the 3rd param to `false` on https://github.com/llvm/llvm-project/blob/5e2860a8d375ded2d2912894e380fefc8cb1f23a/lldb/tools/lldb-dap/lldb-dap.cpp#L574 change anything for you? https://github.com/llvm/llvm-project/pull/133791

[Lldb-commits] [lldb] [lldb-dap] Allow providing debug adapter arguments in the extension (PR #129262)

2025-03-15 Thread John Harrison via lldb-commits
@@ -0,0 +1,103 @@ +import * as vscode from "vscode"; +import * as child_process from "child_process"; +import * as util from "util"; +import { LLDBDapServer } from "./lldb-dap-server"; +import { createDebugAdapterExecutable } from "./debug-adapter-factory"; +import { ConfigureButt

[Lldb-commits] [lldb] [lldb-dap] Allow providing debug adapter arguments in the extension (PR #129262)

2025-03-15 Thread John Harrison via lldb-commits
@@ -90,117 +99,119 @@ async function getDAPExecutable( return foundPath; } - return undefined; + throw new ErrorWithNotification( +"Unable to find the path to the LLDB debug adapter executable.", +new OpenSettingsButton("lldb-dap.executable-path"), + ); } -

[Lldb-commits] [lldb] [lldb-dap] Refactoring IOStream into Transport handler. (PR #130026)

2025-03-15 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130026 >From 88f1cf3469c9f24a768f5147c22cfe414aea014e Mon Sep 17 00:00:00 2001 From: John Harrison Date: Sat, 8 Mar 2025 17:55:34 -0800 Subject: [PATCH 1/4] [lldb-dap] Adding logging helpers. Improving logging by defin

[Lldb-commits] [lldb] [lldb-dap] Allow providing debug adapter arguments in the extension (PR #129262)

2025-03-15 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. Overall looks great, a few questions / follow items https://github.com/llvm/llvm-project/pull/129262 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-14 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130090 >From f26c9a79ca234bee77ec1a9694bf8be2d0e3745c Mon Sep 17 00:00:00 2001 From: John Harrison Date: Thu, 6 Mar 2025 13:21:10 +0100 Subject: [PATCH 1/8] [lldb-dap] Updating RequestHandler to encode/decode arguments

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-14 Thread John Harrison via lldb-commits
@@ -57,235 +77,306 @@ class RequestHandler { DAP &dap; }; -class AttachRequestHandler : public RequestHandler { -public: - using RequestHandler::RequestHandler; +/// Base class for handling DAP requests. Handlers should declare their +/// arguments and response body types l

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-14 Thread John Harrison via lldb-commits
@@ -663,58 +671,65 @@ void DAP::SetTarget(const lldb::SBTarget target) { } bool DAP::HandleObject(const protocol::Message &M) { - // FIXME: Directly handle `Message` instead of serializing to JSON. - llvm::json::Value v = toJSON(M); - llvm::json::Object object = *v.getAsObj

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-14 Thread John Harrison via lldb-commits
@@ -663,58 +671,65 @@ void DAP::SetTarget(const lldb::SBTarget target) { } bool DAP::HandleObject(const protocol::Message &M) { - // FIXME: Directly handle `Message` instead of serializing to JSON. - llvm::json::Value v = toJSON(M); - llvm::json::Object object = *v.getAsObj

[Lldb-commits] [lldb] [lldb-dap] Allow providing debug adapter arguments in the extension (PR #129262)

2025-03-15 Thread John Harrison via lldb-commits
@@ -0,0 +1,130 @@ +import * as child_process from "node:child_process"; +import * as vscode from "vscode"; + +function areArraysEqual(lhs: T[], rhs: T[]): boolean { + if (lhs.length !== rhs.length) { +return false; + } + for (let i = 0; i < lhs.length; i++) { +if (lhs[i

[Lldb-commits] [lldb] [lldb-dap] Restore the override FD used by the output redirect on stop. (PR #129964)

2025-03-15 Thread John Harrison via lldb-commits
ashgti wrote: #130186 should fix the failure. https://github.com/llvm/llvm-project/pull/129964 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-17 Thread John Harrison via lldb-commits
@@ -1,12 +1,12 @@ -//===-- Protocol.cpp --===// +//===-- ProtocolBase.cpp --===// ashgti wrote: I used the names of the categories from the spec for the files,

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-17 Thread John Harrison via lldb-commits
@@ -162,4 +162,13 @@ GetEnvironmentFromArguments(const llvm::json::Object &arguments) { return envs; } +llvm::Error takeError(const lldb::SBError &error) { ashgti wrote: Done. https://github.com/llvm/llvm-project/pull/130090 __

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-17 Thread John Harrison via lldb-commits
@@ -663,58 +671,64 @@ void DAP::SetTarget(const lldb::SBTarget target) { } bool DAP::HandleObject(const protocol::Message &M) { - // FIXME: Directly handle `Message` instead of serializing to JSON. - llvm::json::Value v = toJSON(M); - llvm::json::Object object = *v.getAsObj

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-14 Thread John Harrison via lldb-commits
@@ -248,6 +246,7 @@ struct DAP { // Serialize the JSON value into a string and send the JSON packet to // the "out" stream. void SendJSON(const llvm::json::Value &json); + void Send(const protocol::Message &message); ashgti wrote: Done. https://github.

[Lldb-commits] [lldb] [lldb-dap] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-17 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/130090 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Imporve error reporting if a command's arguments fail to parse correctly. (PR #135684)

2025-04-14 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/135684 >From cab7671780bde4d4e2e137f10ced6b5fe504 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 14 Apr 2025 13:22:31 -0700 Subject: [PATCH 1/2] [lldb-dap] Imporve error reporting if a command's arguments

[Lldb-commits] [lldb] [lldb-dap] Remove an incorrect assumption on reverse requests. (PR #136210)

2025-04-19 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/136210 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Updating the 'next' request handler use well structured types (PR #136642)

2025-04-21 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/136642 This updates the 'next' request to use well structured types. While working on this I also simplified the 'RequestHandler' implementation to better handle void responses by allowing requests to return a 'llvm::E

[Lldb-commits] [lldb] [lldb-dap] Remove an incorrect assumption on reverse requests. (PR #136210)

2025-04-17 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/136210 Reverse requests do have a 'seq' set still from VSCode. I incorrectly interpreted https://github.com/microsoft/vscode/blob/dede7bb4b7e9c9ec69155a243bb84037a40588fe/src/vs/workbench/contrib/debug/common/abstractD

[Lldb-commits] [lldb] [llvm] [lldb-dap] migrate set breakpoint requests (PR #137448)

2025-04-27 Thread John Harrison via lldb-commits
@@ -322,6 +323,186 @@ enum SteppingGranularity : unsigned { bool fromJSON(const llvm::json::Value &, SteppingGranularity &, llvm::json::Path); +/// Information about a breakpoint created in `setBreakpoints`, +/// `setFunctionBreakpoints`, `setInstructionBreakpoin

[Lldb-commits] [lldb] [llvm] [lldb-dap] migrate set breakpoint requests (PR #137448)

2025-04-27 Thread John Harrison via lldb-commits
@@ -322,6 +323,186 @@ enum SteppingGranularity : unsigned { bool fromJSON(const llvm::json::Value &, SteppingGranularity &, llvm::json::Path); +/// Information about a breakpoint created in `setBreakpoints`, +/// `setFunctionBreakpoints`, `setInstructionBreakpoin

[Lldb-commits] [lldb] [llvm] [lldb-dap] migrate set breakpoint requests (PR #137448)

2025-04-27 Thread John Harrison via lldb-commits
@@ -43,6 +43,32 @@ bool fromJSON(const json::Value &Params, Source &S, json::Path P) { O.map("sourceReference", S.sourceReference); } +static llvm::json::Value ToString(PresentationHint hint) { ashgti wrote: toJSON? Then on line 67 you don't need t

[Lldb-commits] [lldb] [lldb-dap] Fix machine-overridable scope (PR #137723)

2025-04-28 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/137723 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Migrate 'stepIn' request to well structured types. (PR #137071)

2025-04-23 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/137071 Migrates the 'stepIn' request handler to have well structured types instead of raw json values. I also noticed in the 'next' request handler we were not passing the 'RunMode' flag. Updated the 'next' request ha

[Lldb-commits] [lldb] [lldb-dap] Updating the 'next' request handler use well structured types (PR #136642)

2025-04-22 Thread John Harrison via lldb-commits
@@ -8,72 +8,37 @@ #include "DAP.h" #include "EventHelper.h" -#include "JSONUtils.h" +#include "Protocol/ProtocolTypes.h" #include "RequestHandler.h" +#include "llvm/Support/Error.h" + +using namespace llvm; +using namespace lldb_dap::protocol; namespace lldb_dap { -// "N

[Lldb-commits] [lldb] [lldb-dap] Ensure we acquire the SB API lock while handling requests. (PR #137026)

2025-04-23 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/137026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Updating the 'next' request handler use well structured types (PR #136642)

2025-04-23 Thread John Harrison via lldb-commits
@@ -8,72 +8,37 @@ #include "DAP.h" #include "EventHelper.h" -#include "JSONUtils.h" +#include "Protocol/ProtocolTypes.h" #include "RequestHandler.h" +#include "llvm/Support/Error.h" + +using namespace llvm; +using namespace lldb_dap::protocol; namespace lldb_dap { -// "N

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-23 Thread John Harrison via lldb-commits
ashgti wrote: I updated my branch with main and updated the launch handler to return an `llvm::Error` to simplify the body. https://github.com/llvm/llvm-project/pull/133624 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.o

[Lldb-commits] [lldb] [lldb-dap] fix wrong assembly line number x64 (PR #136486)

2025-04-24 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/136486 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] fix wrong assembly line number x64 (PR #136486)

2025-04-24 Thread John Harrison via lldb-commits
@@ -0,0 +1,64 @@ +""" +Test lldb-dap stack trace containing x86 assembly +""" + +import lldbdap_testcase +from lldbsuite.test.decorators import skipUnlessArch, skipUnlessPlatform +from lldbsuite.test.lldbtest import line_number + + +class TestDAP_stacktrace_x86(lldbdap_testcase.DA

[Lldb-commits] [lldb] [llvm] [lldb-dap] Migrating breakpointLocations request to use typed RequestHandler (PR #137426)

2025-04-27 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. Awesome! https://github.com/llvm/llvm-project/pull/137426 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Make lldb-dap.executable-path machine specific (PR #137485)

2025-04-27 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/137485 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Updating the 'next' request handler use well structured types (PR #136642)

2025-04-23 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/136642 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Migrate attach to typed RequestHandler. (PR #137911)

2025-04-30 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/137911 >From a43b90dba56bd411b09257d47e3a3091faa09efd Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 29 Apr 2025 17:36:46 -0700 Subject: [PATCH 1/2] [lldb-dap] Migrate attach to typed RequestHandler. This upda

[Lldb-commits] [lldb] [lldb-dap] Add an RAII helper for synchronous mode (NFC) (PR #137900)

2025-04-29 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. LGTM, that’s helpful for making sure we’re consistent at least https://github.com/llvm/llvm-project/pull/137900 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[Lldb-commits] [lldb] [lldb-dap] Add an RAII helper for synchronous mode (NFC) (PR #137900)

2025-04-29 Thread John Harrison via lldb-commits
@@ -235,4 +235,15 @@ std::string GetStringValue(const lldb::SBStructuredData &data) { return str; } +ScopeSyncMode::ScopeSyncMode(lldb::SBDebugger &debugger) +: m_debugger(debugger) { + assert(m_debugger.GetAsync() && "Debugger not in asynchronous mode!");

[Lldb-commits] [lldb] [lldb-dap] Fix raciness in launch and attach tests (PR #137920)

2025-04-30 Thread John Harrison via lldb-commits
ashgti wrote: We could block the DAP queue until we get the stop event before we send the `initialized` event maybe. https://github.com/llvm/llvm-project/blob/d7f096e3fe611ae2cc7403c3cf2f88255a47b61d/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp#L70-L77 is where I am thinking we can wai

[Lldb-commits] [lldb] [lldb-dap] Migrate attach to typed RequestHandler. (PR #137911)

2025-04-29 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/137911 This updates the `attach` request to the typed `RequestHandler`. Added a few more overlapping configurations to `lldb_dap::protocol::Configuration` that are shared between launching and attaching. There may b

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-14 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/133624 >From 3240fe49515e5f59c5b9ff9c02423b77504d8a43 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 28 Mar 2025 14:02:53 -0700 Subject: [PATCH 1/6] [lldb-dap] Refactoring lldb-dap 'launch' request to use type

[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)

2025-04-14 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/135638 This enum was not fully specified. >From 1fe129959d425d8f298e111d73cfa88e429e3cfc Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 14 Apr 2025 09:07:48 -0700 Subject: [PATCH] [lldb-dap] Fix win32 build.

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-04-14 Thread John Harrison via lldb-commits
ashgti wrote: PR #135638 should fix the build failure. https://github.com/llvm/llvm-project/pull/130169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-14 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/133624 >From 3240fe49515e5f59c5b9ff9c02423b77504d8a43 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 28 Mar 2025 14:02:53 -0700 Subject: [PATCH 1/8] [lldb-dap] Refactoring lldb-dap 'launch' request to use type

[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)

2025-04-14 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/135638 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)

2025-04-14 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/130169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-14 Thread John Harrison via lldb-commits
@@ -9,127 +9,66 @@ #include "DAP.h" #include "EventHelper.h" #include "JSONUtils.h" +#include "Protocol/ProtocolRequests.h" #include "RequestHandler.h" #include "llvm/Support/FileSystem.h" namespace lldb_dap { -// "LaunchRequest": { -// "allOf": [ { "$ref": "#/definiti

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-14 Thread John Harrison via lldb-commits
@@ -33,15 +35,12 @@ MakeArgv(const llvm::ArrayRef &strs) { return argv; } -static uint32_t SetLaunchFlag(uint32_t flags, const llvm::json::Object *obj, - llvm::StringRef key, lldb::LaunchFlags mask) { - if (const auto opt_value = GetBoolean(obj,

[Lldb-commits] [lldb] [lldb-dap] Fix win32 build. (PR #135638)

2025-04-14 Thread John Harrison via lldb-commits
ashgti wrote: This should fix https://lab.llvm.org/buildbot/#/builders/197/builds/3983 https://github.com/llvm/llvm-project/pull/135638 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-comm

[Lldb-commits] [lldb] [lldb-dap] Fixing a race during disconnect. (PR #135872)

2025-04-16 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/135872 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Give attach test binaries unique names (PR #138435)

2025-05-05 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. Does attach normally only check the basename of the executable? Or is it supposed to match the entire path? I see a comment in `TestDAP_attach.test_by_name` that mentions making the path more unique, so I'm wondering if something else has c

[Lldb-commits] [lldb] [lldb][lldb-dap] use the new protocol for setVariable requests. (PR #137803)

2025-04-30 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. Looks great! https://github.com/llvm/llvm-project/pull/137803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

2025-05-02 Thread John Harrison via lldb-commits
@@ -417,8 +424,11 @@ struct DAP { lldb::SBMutex GetAPIMutex() const { return target.GetAPIMutex(); } private: - std::mutex m_queue_mutex; + /// Queue for all incoming messages. std::deque m_queue; + /// Dedicated queue for launching and attaching. + std::deque m_launc

[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

2025-05-02 Thread John Harrison via lldb-commits
@@ -893,10 +893,23 @@ llvm::Error DAP::Loop() { return errWrapper; } + // The launch sequence is special and we need to carefully handle + // packets in the right order. The launch and attach requests cannot + // be answered unt

[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

2025-05-02 Thread John Harrison via lldb-commits
@@ -938,15 +954,30 @@ llvm::Error DAP::Loop() { StopEventHandlers(); }); - while (!disconnecting || !m_queue.empty()) { + while (true) { std::unique_lock lock(m_queue_mutex); -m_queue_cv.wait(lock, [&] { return disconnecting || !m_queue.empty(); }); +m_que

[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

2025-05-02 Thread John Harrison via lldb-commits
@@ -893,10 +893,23 @@ llvm::Error DAP::Loop() { return errWrapper; } + // The launch sequence is special and we need to carefully handle + // packets in the right order. The launch and attach requests cannot + // be answered unt

[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

2025-05-02 Thread John Harrison via lldb-commits
@@ -893,10 +893,23 @@ llvm::Error DAP::Loop() { return errWrapper; } + // The launch sequence is special and we need to carefully handle + // packets in the right order. The launch and attach requests cannot + // be answered unt

[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

2025-05-02 Thread John Harrison via lldb-commits
@@ -893,10 +893,23 @@ llvm::Error DAP::Loop() { return errWrapper; } + // The launch sequence is special and we need to carefully handle + // packets in the right order. The launch and attach requests cannot + // be answered unt

[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

2025-05-01 Thread John Harrison via lldb-commits
@@ -161,20 +161,22 @@ static void EventThreadFunction(DAP &dap) { case lldb::eStateSuspended: break; case lldb::eStateStopped: -// We launch and attach in synchronous mode then the first stop -// event will not be delivere

[Lldb-commits] [lldb] [lldb-dap] Fix raciness in launch and attach tests (PR #137920)

2025-05-01 Thread John Harrison via lldb-commits
ashgti wrote: To clarify the DAP flow a little, see 'Launch Sequencing' in https://microsoft.github.io/debug-adapter-protocol/overview Once the DAP server send the response to the `initialize` request the following happen in parallel: * The `initialized` event triggers the client sending `set

[Lldb-commits] [lldb] [lldb-dap] Fix raciness in launch and attach tests (PR #137920)

2025-05-01 Thread John Harrison via lldb-commits
ashgti wrote: > Technically the response of launch/attach should be the end of the chain. Thats not how its implemented in VS Code at least: * `initialize` is sent then `launch` or `attach` https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/debug/browser/debugService.ts#L

[Lldb-commits] [lldb] [lldb-dap] Fix raciness in launch and attach tests (PR #137920)

2025-05-01 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137920 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Don't error out when the process is in eStateUnloaded (PR #138601)

2025-05-05 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/138601 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Specify the executable path in the attach info (PR #138557)

2025-05-05 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/138557 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Migrate attach to typed RequestHandler. (PR #137911)

2025-05-06 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/137911 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-se

[Lldb-commits] [lldb] [lldb-dap] Support StackFrameFormat (PR #137113)

2025-04-24 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/137113 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Support StackFrameFormat (PR #137113)

2025-04-24 Thread John Harrison via lldb-commits
@@ -180,44 +184,53 @@ void StackTraceRequestHandler::operator()( llvm::json::Object body; lldb::SBFormat frame_format = dap.frame_format; + bool include_all = false; ashgti wrote: Should this default to `dap.configuration.displayExtendedBacktrace` and th

[Lldb-commits] [lldb] [lldb] Emit diagnostics as "important" output (PR #137280)

2025-04-25 Thread John Harrison via lldb-commits
@@ -117,6 +118,9 @@ static void EventThreadFunction(DAP &dap) { lldb::SBEvent event; lldb::SBListener listener = dap.debugger.GetListener(); dap.broadcaster.AddListener(listener, eBroadcastBitStopEventThread); + dap.debugger.GetBroadcaster().AddListener( + listener,

[Lldb-commits] [lldb] [lldb] Emit diagnostics as "important" output (PR #137280)

2025-04-25 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/137280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Updating the 'next' request handler use well structured types (PR #136642)

2025-04-23 Thread John Harrison via lldb-commits
@@ -8,72 +8,37 @@ #include "DAP.h" #include "EventHelper.h" -#include "JSONUtils.h" +#include "Protocol/ProtocolTypes.h" #include "RequestHandler.h" +#include "llvm/Support/Error.h" + +using namespace llvm; +using namespace lldb_dap::protocol; namespace lldb_dap { -// "N

[Lldb-commits] [lldb] [lldb-dap] Migrate 'stepIn' request to well structured types. (PR #137071)

2025-04-23 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/137071 >From f4f2fea5cebbce550de0e0c3facaac894b9f40b8 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Wed, 23 Apr 2025 15:01:53 -0700 Subject: [PATCH 1/2] [lldb-dap] Migrate 'stepIn' request to well structured types

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-24 Thread John Harrison via lldb-commits
@@ -672,21 +670,17 @@ DAP::CreateTargetFromArguments(const llvm::json::Object &arguments, // enough information to determine correct arch and platform (or ELF can be // omitted at all), so it is good to leave the user an apportunity to specify // those. Any of those thre

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-24 Thread John Harrison via lldb-commits
@@ -9,127 +9,69 @@ #include "DAP.h" #include "EventHelper.h" #include "JSONUtils.h" +#include "Protocol/ProtocolRequests.h" #include "RequestHandler.h" +#include "llvm/Support/Error.h" #include "llvm/Support/FileSystem.h" +using namespace llvm; +using namespace lldb_dap::pr

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-24 Thread John Harrison via lldb-commits
@@ -9,127 +9,69 @@ #include "DAP.h" #include "EventHelper.h" #include "JSONUtils.h" +#include "Protocol/ProtocolRequests.h" #include "RequestHandler.h" +#include "llvm/Support/Error.h" #include "llvm/Support/FileSystem.h" +using namespace llvm; +using namespace lldb_dap::pr

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-24 Thread John Harrison via lldb-commits
@@ -37,14 +39,12 @@ MakeArgv(const llvm::ArrayRef &strs) { return argv; } -static uint32_t SetLaunchFlag(uint32_t flags, const llvm::json::Object *obj, - llvm::StringRef key, lldb::LaunchFlags mask) { - if (const auto opt_value = GetBoolean(obj,

[Lldb-commits] [lldb] [lldb-dap] Support StackFrameFormat (PR #137113)

2025-04-24 Thread John Harrison via lldb-commits
@@ -178,14 +179,45 @@ void StackTraceRequestHandler::operator()( llvm::json::Array stack_frames; llvm::json::Object body; + lldb::SBFormat frame_format = dap.frame_format; + + if (const auto *format = arguments->getObject("format")) { +const bool parameters = GetBool

[Lldb-commits] [lldb] [lldb-dap] Support StackFrameFormat (PR #137113)

2025-04-24 Thread John Harrison via lldb-commits
@@ -178,14 +179,45 @@ void StackTraceRequestHandler::operator()( llvm::json::Array stack_frames; llvm::json::Object body; + lldb::SBFormat frame_format = dap.frame_format; + + if (const auto *format = arguments->getObject("format")) { ashgti wrote: Anot

[Lldb-commits] [lldb] [lldb-dap] Support StackFrameFormat (PR #137113)

2025-04-24 Thread John Harrison via lldb-commits
@@ -178,14 +179,45 @@ void StackTraceRequestHandler::operator()( llvm::json::Array stack_frames; llvm::json::Object body; + lldb::SBFormat frame_format = dap.frame_format; + + if (const auto *format = arguments->getObject("format")) { +const bool parameters = GetBool

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-25 Thread John Harrison via lldb-commits
@@ -37,14 +39,12 @@ MakeArgv(const llvm::ArrayRef &strs) { return argv; } -static uint32_t SetLaunchFlag(uint32_t flags, const llvm::json::Object *obj, - llvm::StringRef key, lldb::LaunchFlags mask) { - if (const auto opt_value = GetBoolean(obj,

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (PR #133624)

2025-04-25 Thread John Harrison via lldb-commits
@@ -37,14 +39,12 @@ MakeArgv(const llvm::ArrayRef &strs) { return argv; } -static uint32_t SetLaunchFlag(uint32_t flags, const llvm::json::Object *obj, - llvm::StringRef key, lldb::LaunchFlags mask) { - if (const auto opt_value = GetBoolean(obj,

[Lldb-commits] [lldb] [lldb-dap] Fix formatting chrono::seconds warning. (PR #137371)

2025-04-25 Thread John Harrison via lldb-commits
https://github.com/ashgti reopened https://github.com/llvm/llvm-project/pull/137371 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb-dap] Mitigate a build error on Windows. (PR #137388)

2025-04-25 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/137388 When building with MSVC 2019 using `std::future` causes a compile time build error. ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\future(196): error C22

<    1   2   3   4   5   6   7   8   9   10   >