[Lldb-commits] [lldb] [lldb-dap] Support finding the lldb-dap binary (PR #118547)

2024-12-03 Thread John Harrison via lldb-commits
@@ -8,15 +11,7 @@ import { LLDBDapOptions } from "./types"; export class LLDBDapDescriptorFactory implements vscode.DebugAdapterDescriptorFactory { - private lldbDapOptions: LLDBDapOptions; - - constructor(lldbDapOptions: LLDBDapOptions) { -this.lldbDapOptions = lldbDap

[Lldb-commits] [lldb] [lldb-dap] Add attach & corefile templates (PR #118894)

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

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2025-01-08 Thread John Harrison via lldb-commits
ashgti wrote: I'll take a look https://github.com/llvm/llvm-project/pull/120457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb/windows] Make "anonymous" pipe names more unique (PR #123905)

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

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #122783)

2025-01-23 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/122783 >From 425ef0b5d0755be581ce90b6f50b818f80ecdaf7 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Thu, 23 Jan 2025 10:41:45 -0800 Subject: [PATCH] Reapply "[lldb-dap] Ensure the IO forwarding threads are managed

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #122783)

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

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #122783)

2025-01-27 Thread John Harrison via lldb-commits
ashgti wrote: > Were you able to reproduce the windows failure (and confirm the problem was > indeed in the pipe code), or is this an attempt at speculation? I was able to reproduce the issue on an x86_64 cloud host and I also verified after applying 3ea2b546a8d17014d3ecf05356ecfaadf26ed846 th

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #122783)

2025-01-27 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/122783 ___ 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 port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
@@ -5028,48 +5021,128 @@ int main(int argc, char *argv[]) { #endif // Initialize LLDB first before we do anything. - lldb::SBDebugger::Initialize(); + lldb::SBError error = lldb::SBDebugger::InitializeWithErrorHandling(); + if (error.Fail()) { +llvm::errs() << "Failed

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From 61fefbe13eaf98600d308e0873e98134fbadc452 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 28 Jan 2025 12:39:38 -0800 Subject: [PATCH] [lldb-dap] Refactoring lldb-dap port listening mode to allow mul

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/116392 ___ 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 port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From f946fd70bb550320bb153a59b8acd702dc97e75d Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 28 Jan 2025 12:39:38 -0800 Subject: [PATCH] [lldb-dap] Refactoring lldb-dap port listening mode to allow mul

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/116392 ___ 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 port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
@@ -904,11 +928,14 @@ bool StartDebuggingRequestHandler::DoExecute( "startDebugging", llvm::json::Object{{"request", request}, {"configuration", std::move(*configuration)}}, - [](llvm::Expected value) { + [](auto dap, auto value) {

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
ashgti wrote: I've updated this after splitting parts of this off into multiple smaller patches (#118330, #118565, #122783) https://github.com/llvm/llvm-project/pull/116392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.o

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
@@ -1154,34 +1154,38 @@ class DebugAdaptorServer(DebugCommunication): def __init__( self, executable=None, +launch=True, port=None, +unix_socket=None, init_commands=[], log_file=None, env=None, ):

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
@@ -32,35 +34,44 @@ using namespace lldb_dap; namespace lldb_dap { -DAP::DAP(llvm::StringRef path, ReplMode repl_mode) -: debug_adaptor_path(path), broadcaster("lldb-dap"), - exception_breakpoints(), focus_tid(LLDB_INVALID_THREAD_ID), - stop_at_entry(false), is_

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-28 Thread John Harrison via lldb-commits
@@ -180,8 +195,9 @@ Status TCPSocket::Listen(llvm::StringRef name, int backlog) { if (host_port->hostname == "*") host_port->hostname = "0.0.0.0"; - std::vector addresses = SocketAddress::GetAddressInfo( - host_port->hostname.c_str(), nullptr, AF_UNSPEC, SOCK_STRE

[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-29 Thread John Harrison via lldb-commits
@@ -5058,72 +5053,148 @@ int main(int argc, char *argv[]) { auto terminate_debugger = llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); }); - StreamDescriptor input; - StreamDescriptor output; - std::FILE *redirectOut = nullptr; - std::FILE *redirectErr = n

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #122783)

2025-01-13 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/122783 This moves the ownership of the threads that forward stdout/stderr to the DAP object itself to ensure that the threads are joined and that the forwarding is cleaned up when the DAP connection is disconnected. T

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -138,15 +140,20 @@ struct SendEventRequestHandler : public lldb::SBCommandPluginInterface { struct DAP { llvm::StringRef debug_adaptor_path; + std::ofstream *log; InputStream input; OutputStream output; + lldb::SBFile in; + OutputRedirector out; + OutputRedirec

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -17,47 +19,59 @@ #include "OutputRedirector.h" #include "llvm/ADT/StringRef.h" -using namespace llvm; +using lldb_private::Pipe; +using lldb_private::Status; +using llvm::createStringError; +using llvm::Error; +using llvm::Expected; +using llvm::StringRef; namespace lldb

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -62,6 +65,9 @@ struct InputStream { struct OutputStream { StreamDescriptor descriptor; + explicit OutputStream(StreamDescriptor descriptor) + : descriptor(std::move(descriptor)) {}; ashgti wrote: Done. https://github.com/llvm/llvm-project/pull/120

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -52,6 +52,9 @@ struct StreamDescriptor { struct InputStream { StreamDescriptor descriptor; + explicit InputStream(StreamDescriptor descriptor) + : descriptor(std::move(descriptor)) {}; ashgti wrote: Done https://github.com/llvm/llvm-project/pull/1

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/120457 >From 4131b8c5af83a219efb2513a1ac90e8b9877d2ef Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 17 Dec 2024 17:45:34 -0800 Subject: [PATCH 1/7] [lldb-dap] Ensure the IO forwarding threads are managed by t

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -9,17 +9,38 @@ #ifndef LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H #define LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H +#include "lldb/Host/Pipe.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" +#include +#include +#include namespace lldb_dap { -/// Redi

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -17,47 +19,59 @@ #include "OutputRedirector.h" #include "llvm/ADT/StringRef.h" -using namespace llvm; +using lldb_private::Pipe; +using lldb_private::Status; +using llvm::createStringError; +using llvm::Error; +using llvm::Expected; +using llvm::StringRef; namespace lldb

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -173,6 +179,55 @@ ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const lldb::break_id_t bp_id) { return nullptr; } +llvm::Error DAP::ConfigureIO(std::FILE *overrideOut, std::FILE *overrideErr) { + auto *inull = lldb_private::FileSystem::Instance().Fopen( + lldb_p

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -5030,47 +5045,81 @@ int main(int argc, char *argv[]) { } #endif + std::unique_ptr log = nullptr; + const char *log_file_path = getenv("LLDBDAP_LOG"); + if (log_file_path) +log.reset(new std::ofstream(log_file_path)); + // Initialize LLDB first before we do anyt

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
@@ -5030,47 +5045,81 @@ int main(int argc, char *argv[]) { } #endif + std::unique_ptr log = nullptr; + const char *log_file_path = getenv("LLDBDAP_LOG"); + if (log_file_path) +log.reset(new std::ofstream(log_file_path)); ashgti wrote: Done. https://

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
ashgti wrote: I have the linux tests working by avoiding the `Host/FileSystem` API, let me know if I should adjust the linkage though. https://github.com/llvm/llvm-project/pull/120457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://l

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/120457 >From 4131b8c5af83a219efb2513a1ac90e8b9877d2ef Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 17 Dec 2024 17:45:34 -0800 Subject: [PATCH 1/6] [lldb-dap] Ensure the IO forwarding threads are managed by t

[Lldb-commits] [lldb] [lldb-dap] Ensure the IO forwarding threads are managed by the DAP object lifecycle. (PR #120457)

2024-12-23 Thread John Harrison via lldb-commits
ashgti wrote: I'm running into an issue on linux with this change that is resulting in 2 instances of the `lldb_private::FileSystem::Instance` being created. ``` $ lldb lldb-dap (lldb) break set -f FileSystem.h -l 51 ... Process 1743394 resuming /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../.

[Lldb-commits] [lldb] [lldb-dap] Implement `runInTerminal` for Windows (PR #121269)

2025-01-17 Thread John Harrison via lldb-commits
ashgti wrote: Is the process stopped? I think lldb is waiting for the process to be in a stopped state. In posix terms a `SIGSTOP`, although I'm not as familiar with the win32 equiv (DebugActiveProcess maybe). https://github.com/llvm/llvm-project/pull/121269 ___

[Lldb-commits] [lldb] [lldb-dap] Ensure we do not print the close sentinel when closing stdout. (PR #126833)

2025-02-13 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/126833 ___ 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 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 c340c38a82880114471938b19512670d7f94245e Mon Sep 17 00:00:00 2001 From: John Harrison Date: Thu, 6 Mar 2025 10:18:36 +0100 Subject: [PATCH 1/7] [lldb-dap] Refactoring IOStream into Transport handler. Inste

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

2025-03-15 Thread John Harrison via lldb-commits
@@ -6,8 +6,9 @@ // //===--===// -#include "RequestHandler.h" +#include "Handler/RequestHandler.h" #include "DAP.h" +#include "Handler/ResponseHandler.h" ashgti wrote: `LogFailureResponseHan

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

2025-03-15 Thread John Harrison via lldb-commits
@@ -240,6 +240,137 @@ using Message = std::variant; bool fromJSON(const llvm::json::Value &, Message &, llvm::json::Path); llvm::json::Value toJSON(const Message &); +// MARK: Types + +// "Source": { +// "type": "object", +// "description": "A `Source` is a descriptor for

[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 closed https://github.com/llvm/llvm-project/pull/130026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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

2025-03-19 Thread John Harrison via lldb-commits
@@ -112,3 +112,23 @@ 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-dap] Ensure logging statements are written as a single chunk. (PR #131916)

2025-03-19 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/131916 >From 6aa311afe9832bbd4a4118874e411243b05e490d Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 18 Mar 2025 14:03:12 -0700 Subject: [PATCH 1/6] [lldb-dap] Ensure logging statements are written as a single

[Lldb-commits] [lldb] [lldb-dap] Ensure logging statements are written as a single chunk. (PR #131916)

2025-03-18 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/131916 I noticed this while debugging some unit tests that the logs occasionally would intersperse two log statements. Previously, it was possible for a log statement to have two messages interspersed since the timest

[Lldb-commits] [lldb] [lldb-dap] Waiting for the test binary to exit prior to dumping logs. (PR #131917)

2025-03-18 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/131917 This should ensure we have the full logs prior to dumping the logs. Additionally, printing log dumps to stderr so they are adjacent to assertion failures. >From ca59812b9b23c96354982b6c696fb2b129bf117d Mon Se

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

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

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

2025-03-18 Thread John Harrison via lldb-commits
https://github.com/ashgti ready_for_review 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][lldb-dap] Added support for "WriteMemory" request. (PR #131820)

2025-03-19 Thread John Harrison via lldb-commits
@@ -0,0 +1,147 @@ +//===-- WriteMemoryRequestHandler.cpp +//--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] [lldb-dap] Stop linking explicitly against pthread (PR #132111)

2025-03-19 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. Looking [around llvm](https://github.com/search?q=repo%3Allvm%2Fllvm-project%20HAVE_LIBPTHREAD&type=code) is this the only place using that check? Could this be cleaned up in other places as well? https://github.com/llvm/llvm-project/pull/

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

2025-03-19 Thread John Harrison via lldb-commits
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/131820 ___ 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 a DAPError for showing users error messages. (PR #132255)

2025-03-20 Thread John Harrison via lldb-commits
https://github.com/ashgti edited 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] Adding support for cancelling a request. (PR #130169)

2025-03-20 Thread John Harrison via lldb-commits
ashgti wrote: > Anyway, what I had in mind when I read your RFC and was doing the > RequestHandler work, triggered by a question from @labath, is that instead of > having one RequestHandler instance per command (which is what we have today), > we could instantiate a RequestHandler per incoming

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

2025-03-20 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/132255 The `DAPError` can be used to craft an error message that is displayed to a user (with showUser=true). Any request handler implementation using subclassing `RequestHandler<>` should be able to use this. I upda

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

2025-03-20 Thread John Harrison via lldb-commits
@@ -96,7 +115,7 @@ Expected> Transport::Read() { return createStringError( formatv("invalid content length {0}", *raw_length).str()); - Expected raw_json = ReadFull(*input, length); ashgti wrote: > I don't know if this helps you (since you still

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

2025-03-20 Thread John Harrison via lldb-commits
ashgti wrote: > If we want to support cancellation before moving all the request over to the > protocol class, can we _temporarily_ store both the JSON and the Protocol in > the class we instantiate per request (whether that's the RequestHandler > itself, or a class wrapping it) and use whiche

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

2025-03-21 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/10] [lldb-dap] Adding support for cancelling a request. Adding

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

2025-03-21 Thread John Harrison via lldb-commits
ashgti wrote: @JDevlieghere I moved some of the cancel checking logic into the BaseRequestHandler to try to consolidate things. There are some FIXME's around cleaning it up once all the requests have moved off the LegacyRequestHandler. https://github.com/llvm/llvm-project/pull/130169 _

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

2025-03-21 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/11] [lldb-dap] Adding support for cancelling a request. Adding

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

2025-03-21 Thread John Harrison via lldb-commits
@@ -671,8 +695,33 @@ void DAP::SetTarget(const lldb::SBTarget target) { } } -bool DAP::HandleObject(const protocol::Message &M) { - if (const auto *req = std::get_if(&M)) { +bool DAP::HandleObject(const Message &M) { + if (const auto *req = std::get_if(&M)) { +{ +

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

2025-03-14 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] 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/9] [lldb-dap] Updating RequestHandler to encode/decode arguments

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

2025-03-14 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] Allow providing debug adapter arguments in the extension (PR #129262)

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

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

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

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

2025-03-14 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] Updating RequestHandler to encode/decode arguments and response. (PR #130090)

2025-03-14 Thread John Harrison via lldb-commits
@@ -30,216 +30,170 @@ namespace lldb_dap::protocol { // MARK: Base Protocol -// "Request": { -// "allOf": [ { "$ref": "#/definitions/ProtocolMessage" }, { -// "type": "object", -// "description": "A client or debug adapter initiated request.", -// "properties":

[Lldb-commits] [lldb] [lldb-dap] Adding support for well typed events. (PR #130104)

2025-03-17 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130104 >From ab4e9d8a6f7146a5f9cee519f4d9787194b12b31 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Thu, 6 Mar 2025 14:13:58 +0100 Subject: [PATCH] [lldb-dap] Adding support for well typed events. This adds a mech

[Lldb-commits] [lldb] [lldb-dap] Adding support for well typed events. (PR #130104)

2025-03-17 Thread John Harrison via lldb-commits
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/130104 ___ 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-03-18 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130169 >From 6bb322fd3ed0df56adcb2bc4687f89ee7f4cdf5f Mon Sep 17 00:00:00 2001 From: John Harrison Date: Thu, 27 Feb 2025 15:17:15 -0800 Subject: [PATCH] [lldb-dap] Adding support for cancelling a request. Adding suppo

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

2025-03-18 Thread John Harrison via lldb-commits
@@ -67,7 +67,7 @@ static Status ReadExpected(IOObjectSP &descriptor, llvm::StringRef expected) { if (status.Fail()) return status; if (expected != result) { -return Status::FromErrorStringWithFormatv("expected %s, got %s", expected, +return Status::FromErrorStr

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

2025-03-18 Thread John Harrison via lldb-commits
@@ -348,6 +351,71 @@ llvm::json::Value toJSON(const ExitedEventBody &); // MARK: Requests +// "CancelRequest": { +// "allOf": [ { "$ref": "#/definitions/Request" }, { +// "type": "object", +// "description": "The `cancel` request is used by the client in two +//

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

2025-03-18 Thread John Harrison via lldb-commits
@@ -152,6 +153,8 @@ struct Response { bool fromJSON(const llvm::json::Value &, Response &, llvm::json::Path); llvm::json::Value toJSON(const Response &); +using VoidResponseBody = std::nullptr_t; ashgti wrote: Done. https://github.com/llvm/llvm-project/pull/

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

2025-03-18 Thread John Harrison via lldb-commits
@@ -0,0 +1,56 @@ +//===-- SourceRequestHandler.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

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

2025-03-18 Thread John Harrison via lldb-commits
@@ -112,3 +112,23 @@ 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][lldb-dap] Added support for "WriteMemory" request. (PR #131820)

2025-03-18 Thread John Harrison via lldb-commits
@@ -0,0 +1,147 @@ +//===-- WriteMemoryRequestHandler.cpp +//--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[Lldb-commits] [lldb] [lldb-dap] Move request capabilities into request handlers (NFC) (PR #131943)

2025-03-18 Thread John Harrison via lldb-commits
@@ -1145,4 +1145,33 @@ lldb::SBValue Variables::FindVariable(uint64_t variablesReference, return variable; } +llvm::StringMap DAP::GetCapabilities() { + llvm::StringMap capabilities; + + // Supported capabilities. + capabilities["supportTerminateDebuggee"] = true; + cap

[Lldb-commits] [lldb] [lldb-dap] Move request capabilities into request handlers (NFC) (PR #131943)

2025-03-18 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/131943 ___ 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-03-18 Thread John Harrison via lldb-commits
@@ -256,7 +257,27 @@ void DAP::SendJSON(const llvm::json::Value &json) { } return; } - auto status = transport.Write(log, M); + Send(M); +} + +void DAP::Send(const protocol::Message &M) { + lldb_private::Status status; + // If the debugger was interrupted while ha

[Lldb-commits] [lldb] [lldb][lldb-dap][NFC] Fix swapped logging directions for DAP messages. (PR #131544)

2025-03-16 Thread John Harrison via lldb-commits
ashgti wrote: > Huh, you're right, the direction was changed, but I actually think the > current direction is more intuitive. > > @ashgti did you change this on purpose? I didn’t mean to change it but I’m fine with either form. https://github.com/llvm/llvm-project/pull/131544 __

[Lldb-commits] [lldb] [lldb][lldb-dap][NFC] Fix swapped logging directions for DAP messages. (PR #131544)

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

[Lldb-commits] [lldb] [lldb-dap] Ensure logging statements are written as a single chunk. (PR #131916)

2025-03-19 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/131916 ___ 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 well typed events. (PR #130104)

2025-03-19 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/130104 ___ 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-03-19 Thread John Harrison via lldb-commits
@@ -96,7 +115,7 @@ Expected> Transport::Read() { return createStringError( formatv("invalid content length {0}", *raw_length).str()); - Expected raw_json = ReadFull(*input, length); ashgti wrote: Also, frustrating on Windows stdin is an anonymous

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

2025-04-04 Thread John Harrison via lldb-commits
@@ -671,11 +693,25 @@ void DAP::SetTarget(const lldb::SBTarget target) { } } -bool DAP::HandleObject(const protocol::Message &M) { - if (const auto *req = std::get_if(&M)) { +bool DAP::HandleObject(const Message &M) { + if (const auto *req = std::get_if(&M)) { +{ +

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

2025-04-05 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/132255 >From a696c1c3ce5cf0f652e0a016c5d5d422b2ae24d3 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Thu, 20 Mar 2025 10:08:53 -0700 Subject: [PATCH 1/3] [lldb-dap] Adding a DAPError for showing users error message

[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

2025-04-05 Thread John Harrison via lldb-commits
@@ -0,0 +1,118 @@ +//===-- GoToRequestHandler.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.

[Lldb-commits] [lldb] [lldb-dap] Protect SetBreakpoint with the API mutex (PR #134030)

2025-04-05 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. Looks great! https://github.com/llvm/llvm-project/pull/134030 ___ 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-05 Thread John Harrison via lldb-commits
https://github.com/ashgti edited 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] Convert Breakpoint & Watchpoints structs to classes (NFC) (PR #133780)

2025-04-05 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] Convert Breakpoint & Watchpoints structs to classes (NFC) (PR #133780)

2025-04-05 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] Migrating DAP 'initialize' to new typed RequestHandler. (PR #133007)

2025-04-05 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/133007 This adds new types and helpers to support the 'initialize' request with the new typed RequestHandler. While working on this I found there were a few cases where we incorrectly treated initialize arguments as ca

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

2025-04-05 Thread John Harrison via lldb-commits
ashgti wrote: I did that while I was trying to figure out how to have `cancel` request support. I was trying to close the FD to stop the reader thread, but that actually doesn't interrupt in-progress `read` calls. I should have reverted that when I did some of the `Transport` refactors. In my

[Lldb-commits] [lldb] [lldb-dap] Adding support for well typed events. (PR #130104)

2025-04-05 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130104 >From 2c51a8bdb27764a358e76e554d693a4af57074fc Mon Sep 17 00:00:00 2001 From: John Harrison Date: Thu, 6 Mar 2025 14:13:58 +0100 Subject: [PATCH] [lldb-dap] Adding support for well typed events. This adds a mech

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

2025-04-05 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/2] [lldb-dap] Refactoring lldb-dap 'launch' request to use type

[Lldb-commits] [lldb] [lldb-dap] Adding support for well typed events. (PR #130104)

2025-04-05 Thread John Harrison via lldb-commits
@@ -316,6 +316,36 @@ struct Source { bool fromJSON(const llvm::json::Value &, Source &, llvm::json::Path); llvm::json::Value toJSON(const Source &); +// MARK: Events + +// "ExitedEvent": { +// "allOf": [ { "$ref": "#/definitions/Event" }, { +// "type": "object", +//

[Lldb-commits] [lldb] [lldb-dap] Swapping to not use FLAG_ENUM and just defining typed enums. (PR #133622)

2025-04-05 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/133622 ___ 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 a DAPError for showing users error messages. (PR #132255)

2025-04-05 Thread John Harrison via lldb-commits
@@ -0,0 +1,33 @@ +//===-- DAPError.h ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

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

2025-03-25 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/133007 >From b6850bfee90229c8da5ffa5359023c682b574954 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 25 Mar 2025 14:58:03 -0700 Subject: [PATCH] [lldb-dap] Migrating DAP 'initialize' to new typed RequestHandle

[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

2025-03-26 Thread John Harrison via lldb-commits
@@ -0,0 +1,91 @@ +//===-- GoToTargetsRequestHandler.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

2025-03-26 Thread John Harrison via lldb-commits
@@ -0,0 +1,165 @@ +//===-- GoToTargetsRequestHandler.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

2025-03-26 Thread John Harrison via lldb-commits
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/130503 ___ 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-26 Thread John Harrison via lldb-commits
ashgti wrote: > This code seems quite repetitive. Would it be possible to have a > `Capabilities` enum and then representing the actual values by something like > `map` (with std::nullopt replaced by removing the > capability from the map). Or even `map` if you don't need to > access the capa

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