[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/118330 >From c3226b620bc8f745b92b3aca7b189803a24db788 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 2 Dec 2024 08:29:01 -0800 Subject: [PATCH 1/3] [lldb] For a host socket, add a method to print the listening

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/118330 >From c3226b620bc8f745b92b3aca7b189803a24db788 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 2 Dec 2024 08:29:01 -0800 Subject: [PATCH 1/4] [lldb] For a host socket, add a method to print the listening

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
@@ -115,6 +121,15 @@ std::string TCPSocket::GetRemoteConnectionURI() const { return ""; } +std::string TCPSocket::GetListeningConnectionURI() const { ashgti wrote: Since the listening sockets are a `std::map` it was very straightforward to adjust this with

[Lldb-commits] [lldb] [lldb] Fix the SocketTest failure on unsupported hosts (PR #118673)

2024-12-05 Thread John Harrison via lldb-commits
@@ -116,6 +116,24 @@ bool lldb_private::HostSupportsIPv6() { return CheckIPSupport("IPv6", "[::1]:0"); } +bool lldb_private::HostSupportsLocalhostToIPv4() { + if (!HostSupportsIPv4()) +return false; + + auto addresses = SocketAddress::GetAddressInfo("localhost", nullpt

[Lldb-commits] [lldb] [lldb] Fix the SocketTest failure on unsupported hosts (PR #118673)

2024-12-05 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/118673 >From becab1c1b0a3a9237637909212f7ea7586b82321 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Wed, 4 Dec 2024 09:39:12 -0800 Subject: [PATCH 1/2] [lldb] Fix the SocketTest::TCPListen0MultiListenerGetListenin

[Lldb-commits] [lldb] [lldb] Fix the SocketTest failure on unsupported hosts (PR #118673)

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

[Lldb-commits] [lldb] [lldb] When using Socket to listen on `localhost:0` on systems supporting ting ipv4 and ipv6 the second socket to initialize will not update the listening address correctly after

2024-12-04 Thread John Harrison via lldb-commits
ashgti wrote: 118673 Should fix the fature https://github.com/llvm/llvm-project/pull/118565 ___ 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)

2024-12-04 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From 547549573aba86c9bf9b9c2c189d49a3d8f62413 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 2 Dec 2024 08:36:52 -0800 Subject: [PATCH 1/2] [lldb-dap] Refactoring lldb-dap listening mode to support mul

[Lldb-commits] [lldb] [lldb] When using Socket to listen on `localhost:0` on systems supporting ting ipv4 and ipv6 the second socket to initialize will not update the listening address correctly after

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

[Lldb-commits] [lldb] [lldb] Fix the SocketTest failure on unsupported hosts (PR #118673)

2024-12-04 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/118673 The test `SocketTest::TCPListen0MultiListenerGetListeningConnectionURI` is failing on hosts that do not map `localhost` to both an ipv4 and ipv6 address. For example this build https://lab.llvm.org/buildbot/#/bu

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

2024-12-03 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. Super useful, especially on macOS with Xcode installed https://github.com/llvm/llvm-project/pull/118547 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[Lldb-commits] [lldb] [lldb] When using Socket to listen on `localhost:0` on systems supporting ting ipv4 and ipv6 the second socket to initialize will not update the listening address correctly after

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

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
@@ -115,6 +115,18 @@ std::string TCPSocket::GetRemoteConnectionURI() const { return ""; } +std::vector TCPSocket::GetListeningConnectionURI() const { + if (m_listen_sockets.empty()) +return {}; + ashgti wrote: Applied suggestion https://github.com/llv

[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] For a host socket, add a method to print the listening address. (PR #118330)

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

[Lldb-commits] [lldb] [lldb] Improving unit test helpers by utilizing llvm helpers. (PR #119148)

2024-12-08 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/119148 This was suggested in a previous patch after the commit was already submitted. >From 4ad591f11b2dec8cf380ecbc02d18a6e6a0101a6 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Sun, 8 Dec 2024 12:15:14 -0800 Sub

[Lldb-commits] [lldb] [lldb] Improving unit test helpers by utilizing llvm helpers. (PR #119148)

2024-12-08 Thread John Harrison via lldb-commits
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/119148 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb] Improving unit test helpers by utilizing llvm helpers. (PR #119148)

2024-12-09 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/119148 ___ 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-06 Thread John Harrison via lldb-commits
ashgti wrote: @walter-erquinigo Wanted to double check with you on this since this change now will always link `lldb-dap` with `lldbHost` https://github.com/llvm/llvm-project/pull/120457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https:

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

2025-01-06 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/8] [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)

2025-01-07 Thread John Harrison via lldb-commits
https://github.com/ashgti closed 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-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-02-03 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From 88a8522f1b29b2ff392974322acdb722b7e00b70 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-02-03 Thread John Harrison via lldb-commits
ashgti wrote: > Overall, I like the StreamDescriptor changes, but I fear this patch is > starting to lose focus again. Could you separate the refactor into a separate > PR? Reverted those changes, I kept running into clang (Xcode 16.0 release of clang) crashes compiling lldb-dap for some reas

[Lldb-commits] [lldb] [lldb-dap] Partially reverting OutputRedirector changes. (PR #125136)

2025-01-30 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/125136 I just noticed with these changes lldb-dap was using 200% of my CPU and root causing the issue it seems that lldb_private::Pipe::Read() (without a timeout) is using a timeout of `std::chrono::microseconds::zero(

[Lldb-commits] [lldb] [lldb-dap] Fix build failure on Windows. (PR #125156)

2025-01-30 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/125156 A previous change is triggering a failure due to SOCKET not being defined in IOStream.h. Adjusting the Windows includes to correct the imports and using a more narrow import (winsock2.h vs windows.h). Also remo

[Lldb-commits] [lldb] [lldb-dap] Fix build failure on Windows. (PR #125156)

2025-01-30 Thread John Harrison via lldb-commits
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/125156 ___ 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-02-04 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From 88a8522f1b29b2ff392974322acdb722b7e00b70 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 28 Jan 2025 12:39:38 -0800 Subject: [PATCH 1/2] [lldb-dap] Refactoring lldb-dap port listening mode to allow

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

2025-02-04 Thread John Harrison via lldb-commits
@@ -58,12 +57,13 @@ const char DEV_NULL[] = "/dev/null"; namespace lldb_dap { -DAP::DAP(llvm::StringRef path, std::ofstream *log, ReplMode repl_mode, - StreamDescriptor input, StreamDescriptor output) -: debug_adaptor_path(path), log(log), input(std::move(input)),

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

2025-02-04 Thread John Harrison via lldb-commits
@@ -11,6 +11,8 @@ // IWYU pragma: begin_exports +#include "lldb/lldb-forward.h" ashgti wrote: Reverted https://github.com/llvm/llvm-project/pull/116392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org htt

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

2025-02-04 Thread John Harrison via lldb-commits
@@ -5058,72 +5053,144 @@ 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] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-02-04 Thread John Harrison via lldb-commits
@@ -5058,72 +5053,144 @@ 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] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-02-04 Thread John Harrison via lldb-commits
@@ -0,0 +1,3 @@ +C_SOURCES := main.c + +include Makefile.rules ashgti wrote: Done. https://github.com/llvm/llvm-project/pull/116392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[Lldb-commits] [lldb] [lldb-dap] Update npm dependencies (PR #125832)

2025-02-05 Thread John Harrison via lldb-commits
@@ -28,11 +28,11 @@ ], "devDependencies": { "@types/node": "^18.11.18", -"@types/vscode": "~1.74.0", -"@vscode/vsce": "^2.19.0", -"prettier-plugin-curly": "^0.1.3", -"prettier": "^3.1.1", -"typescript": "^4.6.4" +"@types/vscode": "1.75.0", --

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

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

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} - +FifoFile::FifoFile(StringRef path) +: m_path(path), m_file(fopen(path.data(), "r+")) { + std::error_code EC; + if (m_file == nullptr) { +EC = std:

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} - +FifoFile::FifoFile(StringRef path) +: m_path(path), m_file(fopen(path.data(), "r+")) { + std::error_code EC; + if (m_file == nullptr) { +EC = std:

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -21,21 +23,28 @@ namespace lldb_dap { /// The file is destroyed when the destructor is invoked. struct FifoFile { FifoFile(llvm::StringRef path); + FifoFile(llvm::StringRef path, FILE *f); + FifoFile(FifoFile &&other); + + FifoFile(const FifoFile &) = delete; + FifoFil

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} - +FifoFile::FifoFile(StringRef path) +: m_path(path), m_file(fopen(path.data(), "r+")) { + std::error_code EC; + if (m_file == nullptr) { +EC = std:

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -158,13 +156,25 @@ std::string RunInTerminalDebugAdapterCommChannel::GetLauncherError() { } Expected> CreateRunInTerminalCommFile() { + int comm_fd; SmallString<256> comm_file; - if (std::error_code EC = sys::fs::getPotentiallyUniqueTempFileName( - "lldb-dap-

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} +std::error_code EC; +FifoFile::FifoFile(StringRef path) +: m_path(path), m_file(fopen(path.data(), "r+")) { + if (m_file == nullptr) { +EC = std::e

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} +std::error_code EC; +FifoFile::FifoFile(StringRef path) +: m_path(path), m_file(fopen(path.data(), "r+")) { + if (m_file == nullptr) { +EC = std::e

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} - +FifoFile::FifoFile(StringRef path) +: m_path(path), m_file(fopen(path.data(), "r+")) { + std::error_code EC; + if (m_file == nullptr) { +EC = std:

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

2025-02-10 Thread John Harrison via lldb-commits
@@ -24,41 +30,95 @@ using namespace llvm; namespace lldb_dap { -FifoFile::FifoFile(StringRef path) : m_path(path) {} - +FifoFile::FifoFile(StringRef path) +: m_path(path), m_file(fopen(path.data(), "r+")) { + std::error_code EC; + if (m_file == nullptr) { +EC = std:

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

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

[Lldb-commits] [lldb] [lldb-dap] Support vscode launch URLs (PR #125843)

2025-02-05 Thread John Harrison via lldb-commits
@@ -0,0 +1,37 @@ +import * as vscode from "vscode"; + +export class LaunchUriHandler implements vscode.UriHandler { +async handleUri(uri: vscode.Uri) { +try { +const params = new URLSearchParams(uri.query); +if (uri.path == '/launch/config') { -

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

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

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

2025-02-05 Thread John Harrison via lldb-commits
@@ -5058,72 +5053,144 @@ 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] Silence Wunused-result warning (PR #126580)

2025-02-10 Thread John Harrison via lldb-commits
https://github.com/ashgti approved this pull request. https://github.com/llvm/llvm-project/pull/126580 ___ 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-02-10 Thread John Harrison via lldb-commits
ashgti wrote: @walter-erquinigo Any updates on allowing multiple connections in server mode? 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

[Lldb-commits] [lldb] [lldb-dap] Partially reverting OutputRedirector changes. (PR #125136)

2025-01-30 Thread John Harrison via lldb-commits
ashgti wrote: #125156 should fix this https://github.com/llvm/llvm-project/pull/125136 ___ 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-30 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 1/2] [lldb-dap] Refactoring lldb-dap port listening mode to allow

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

2025-01-30 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] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-30 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] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

2025-01-30 Thread John Harrison via lldb-commits
@@ -1167,21 +1168,61 @@ def __init__( if log_file: adaptor_env["LLDBDAP_LOG"] = log_file +args = [executable] + +if connection is not None: +args.append("--connection") +args.append(connection)

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

2025-01-30 Thread John Harrison via lldb-commits
@@ -4952,6 +4930,28 @@ static int DuplicateFileDescriptor(int fd) { #endif } +static llvm::Expected> +parseConnection(llvm::StringRef conn) { + if (conn.contains("://")) { ashgti wrote: Updated this to validate the connection and used the URI Parser to parse

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

2025-01-30 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 1/3] [lldb-dap] Refactoring lldb-dap port listening mode to allow

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

2025-01-30 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] Partially reverting OutputRedirector changes. (PR #125136)

2025-01-30 Thread John Harrison via lldb-commits
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/125136 ___ 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)

2024-12-18 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/120457 >From f59cf06ff3d11baabee10ba47151a8c9d4e03733 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 17 Dec 2024 17:45:34 -0800 Subject: [PATCH 1/3] [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-18 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/120457 >From f59cf06ff3d11baabee10ba47151a8c9d4e03733 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 17 Dec 2024 17:45:34 -0800 Subject: [PATCH 1/2] [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-18 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/120457 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-20 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/5] [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-20 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/4] [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-20 Thread John Harrison via lldb-commits
@@ -52,16 +52,24 @@ struct StreamDescriptor { struct InputStream { StreamDescriptor descriptor; - bool read_full(std::ofstream *log, size_t length, std::string &text); + explicit InputStream(StreamDescriptor descriptor) + : descriptor(std::move(descriptor)) {}; - b

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

2024-12-20 Thread John Harrison via lldb-commits
@@ -138,15 +140,20 @@ struct SendEventRequestHandler : public lldb::SBCommandPluginInterface { struct DAP { llvm::StringRef debug_adaptor_path; + std::optional &log; ashgti wrote: Removed the optional and just passed a plain pointer instead. https://gith

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

2024-12-20 Thread John Harrison via lldb-commits
@@ -173,6 +178,63 @@ ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const lldb::break_id_t bp_id) { return nullptr; } +llvm::Error DAP::ConfigureIO(std::optional overrideOut, ashgti wrote: Removed the optional and just passed a `std::FILE *` instead. ht

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

2024-12-20 Thread John Harrison via lldb-commits
@@ -173,6 +178,63 @@ ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const lldb::break_id_t bp_id) { return nullptr; } +llvm::Error DAP::ConfigureIO(std::optional overrideOut, + std::optional overrideErr) { + auto *inull = lldb_private::FileSys

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

2024-12-20 Thread John Harrison via lldb-commits
@@ -173,6 +178,63 @@ ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const lldb::break_id_t bp_id) { return nullptr; } +llvm::Error DAP::ConfigureIO(std::optional overrideOut, + std::optional overrideErr) { + auto *inull = lldb_private::FileSys

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

2024-12-20 Thread John Harrison via lldb-commits
@@ -1099,6 +1098,14 @@ void request_disconnect(DAP &dap, const llvm::json::Object &request) { dap.broadcaster.BroadcastEventByType(eBroadcastBitStopProgressThread); dap.progress_event_thread.join(); } + if (dap.stdout_forward_thread.joinable()) { +dap.pout.Close

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

2024-12-20 Thread John Harrison via lldb-commits
@@ -5027,43 +5019,77 @@ int main(int argc, char *argv[]) { } #endif + std::optional log = std::nullopt; + const char *log_file_path = getenv("LLDBDAP_LOG"); + if (log_file_path) +log.emplace(log_file_path); + // Initialize LLDB first before we do anything. lldb:

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

2024-12-20 Thread John Harrison via lldb-commits
@@ -5027,43 +5019,77 @@ int main(int argc, char *argv[]) { } #endif + std::optional log = std::nullopt; + const char *log_file_path = getenv("LLDBDAP_LOG"); + if (log_file_path) +log.emplace(log_file_path); + // Initialize LLDB first before we do anything. lldb:

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -250,6 +251,13 @@ def which(program): return None +def pickrandomport(): +"""Returns a random open port.""" +with socket.socket() as sock: +sock.bind(("", 0)) +return sock.getsockname()[1] ashgti wrote: I have updated this to n

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -22,8 +22,17 @@ def port: S<"port">, HelpText<"Communicate with the lldb-dap tool over the defined port.">; def: Separate<["-"], "p">, Alias, + MetaVarName<"">, HelpText<"Alias for --port">; +def unix_socket: S<"unix-socket">, + MetaVarName<"">, + HelpText<"Commu

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -22,8 +22,17 @@ def port: S<"port">, HelpText<"Communicate with the lldb-dap tool over the defined port.">; def: Separate<["-"], "p">, Alias, + MetaVarName<"">, HelpText<"Alias for --port">; +def unix_socket: S<"unix-socket">, + MetaVarName<"">, + HelpText<"Commu

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -5028,36 +5218,52 @@ 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)

2024-11-22 Thread John Harrison via lldb-commits
@@ -22,8 +22,17 @@ def port: S<"port">, HelpText<"Communicate with the lldb-dap tool over the defined port.">; def: Separate<["-"], "p">, Alias, + MetaVarName<"">, HelpText<"Alias for --port">; +def unix_socket: S<"unix-socket">, + MetaVarName<"">, + HelpText<"Commu

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

2024-11-22 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From acfdb2da30b7a49711c3d1ec3be3c9282d6c51b4 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 15 Nov 2024 09:56:43 -0500 Subject: [PATCH 1/3] [lldb-da] Refactoring lldb-dap port listening mode to allow

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -116,6 +118,8 @@ enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch }; /// Page size used for reporting addtional frames in the 'stackTrace' request. constexpr int StackPageSize = 20; +void RegisterRequestCallbacks(DAP &dap); ashgti wrote: Remov

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -137,42 +141,232 @@ lldb::SBValueList *GetTopLevelScope(DAP &dap, int64_t variablesReference) { } } -SOCKET AcceptConnection(DAP &dap, int portno) { - // Accept a socket connection from any host on "portno". - SOCKET newsockfd = -1; - struct sockaddr_in serv_addr, cli

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

2024-11-22 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)

2024-11-22 Thread John Harrison via lldb-commits
@@ -137,42 +141,232 @@ lldb::SBValueList *GetTopLevelScope(DAP &dap, int64_t variablesReference) { } } -SOCKET AcceptConnection(DAP &dap, int portno) { - // Accept a socket connection from any host on "portno". - SOCKET newsockfd = -1; - struct sockaddr_in serv_addr, cli

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -137,42 +141,232 @@ lldb::SBValueList *GetTopLevelScope(DAP &dap, int64_t variablesReference) { } } -SOCKET AcceptConnection(DAP &dap, int portno) { - // Accept a socket connection from any host on "portno". - SOCKET newsockfd = -1; - struct sockaddr_in serv_addr, cli

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -1196,6 +1200,39 @@ def terminate(self): self.process.wait() self.process = None +@classmethod +def launch( +cls, executable: str, /, port=None, unix_socket=None, log_file=None, env=None +) -> subprocess.Popen: +adaptor_e

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -137,42 +141,232 @@ lldb::SBValueList *GetTopLevelScope(DAP &dap, int64_t variablesReference) { } } -SOCKET AcceptConnection(DAP &dap, int portno) { - // Accept a socket connection from any host on "portno". - SOCKET newsockfd = -1; - struct sockaddr_in serv_addr, cli

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -137,42 +141,232 @@ lldb::SBValueList *GetTopLevelScope(DAP &dap, int64_t variablesReference) { } } -SOCKET AcceptConnection(DAP &dap, int portno) { - // Accept a socket connection from any host on "portno". - SOCKET newsockfd = -1; - struct sockaddr_in serv_addr, cli

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -140,13 +137,16 @@ struct DAP { llvm::StringRef debug_adaptor_path; InputStream input; OutputStream output; + lldb::SBFile in; + lldb::SBFile out; + lldb::SBFile err; lldb::SBDebugger debugger; lldb::SBTarget target; Variables variables; lldb::SBBroadcas

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -137,42 +141,232 @@ lldb::SBValueList *GetTopLevelScope(DAP &dap, int64_t variablesReference) { } } -SOCKET AcceptConnection(DAP &dap, int portno) { - // Accept a socket connection from any host on "portno". - SOCKET newsockfd = -1; - struct sockaddr_in serv_addr, cli

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -0,0 +1,6 @@ +#include + +int main(int argc, char const *argv[]) { + printf("hello world!\n"); // breakpoint 1 + return 0; +} ashgti wrote: Done. https://github.com/llvm/llvm-project/pull/116392 ___ lldb-commits

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

2024-11-22 Thread John Harrison via lldb-commits
@@ -22,8 +22,17 @@ def port: S<"port">, HelpText<"Communicate with the lldb-dap tool over the defined port.">; def: Separate<["-"], "p">, Alias, + MetaVarName<"">, HelpText<"Alias for --port">; +def unix_socket: S<"unix-socket">, + MetaVarName<"">, + HelpText<"Commu

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

2024-11-22 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From acfdb2da30b7a49711c3d1ec3be3c9282d6c51b4 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 15 Nov 2024 09:56:43 -0500 Subject: [PATCH 1/2] [lldb-da] Refactoring lldb-dap port listening mode to allow

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/118330 >From c3226b620bc8f745b92b3aca7b189803a24db788 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 2 Dec 2024 08:29:01 -0800 Subject: [PATCH 1/5] [lldb] For a host socket, add a method to print the listening

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
@@ -176,8 +191,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] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/118330 >From c3226b620bc8f745b92b3aca7b189803a24db788 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Mon, 2 Dec 2024 08:29:01 -0800 Subject: [PATCH 1/6] [lldb] For a host socket, add a method to print the listening

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
@@ -88,6 +88,28 @@ TEST_P(SocketTest, DomainListenConnectAccept) { CreateDomainConnectedSockets(Path, &socket_a_up, &socket_b_up); } +TEST_P(SocketTest, DomainListenGetListeningConnectionURI) { + llvm::SmallString<64> Path; + std::error_code EC = + llvm::sys::fs::crea

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
@@ -225,12 +247,29 @@ TEST_P(SocketTest, TCPListen0GetPort) { if (!HostSupportsIPv4()) return; llvm::Expected> sock = - Socket::TcpListen("10.10.12.3:0", false); + Socket::TcpListen("10.10.12.3:0", 5); ASSERT_THAT_EXPECTED(sock, llvm::Succeeded()); ASSER

[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)

2024-12-03 Thread John Harrison via lldb-commits
@@ -115,6 +115,18 @@ std::string TCPSocket::GetRemoteConnectionURI() const { return ""; } +std::vector TCPSocket::GetListeningConnectionURI() const { + if (m_listen_sockets.empty()) +return {}; + + std::vector URIs; + for (auto &s : m_listen_sockets)

[Lldb-commits] [lldb] [lldb] When using Socket to listen on `localhost:0` on systems supporting ting ipv4 and ipv6 the second socket to initialize will not update the listening address correctly after

2024-12-03 Thread John Harrison via lldb-commits
https://github.com/ashgti ready_for_review https://github.com/llvm/llvm-project/pull/118565 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb] When using Socket to listen on `localhost:0` on systems supporting ting ipv4 and ipv6 the second socket to initialize will not update the listening address correctly after

2024-12-03 Thread John Harrison via lldb-commits
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/118565 This results in the second address listed in `Socket::GetListeningConnectionURI` to have port `:0`, which is incorrect. To fix this, correct which address is used to detect the port and update the unit tests to

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

2024-12-03 Thread John Harrison via lldb-commits
@@ -28,6 +23,70 @@ export class LLDBDapDescriptorFactory return true; } + static async findDAPExecutable(): Promise { +let executable = "lldb-dap"; +if (process.platform === "win32") { + executable = "lldb-dap.exe"; +} + +// Prefer lldb-dap from Xco

[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

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