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

2025-02-05 Thread Pavel Labath 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 = nullptr;
-  if (portno != -1) {
-printf("Listening on port %i...\n", portno);
-SOCKET socket_fd = AcceptConnection(log.get(), portno);
-if (socket_fd < 0)
-  return EXIT_FAILURE;
+  std::vector pre_init_commands;
+  for (const std::string &arg :
+   input_args.getAllArgValues(OPT_pre_init_command)) {
+pre_init_commands.push_back(arg);
+  }
 
-input = StreamDescriptor::from_socket(socket_fd, true);
-output = StreamDescriptor::from_socket(socket_fd, false);
-  } else {
-#if defined(_WIN32)
-// Windows opens stdout and stdin in text mode which converts \n to 13,10
-// while the value is just 10 on Darwin/Linux. Setting the file mode to
-// binary fixes this.
-int result = _setmode(fileno(stdout), _O_BINARY);
-assert(result);
-result = _setmode(fileno(stdin), _O_BINARY);
-UNUSED_IF_ASSERT_DISABLED(result);
-assert(result);
-#endif
+  auto RunDAP = [](llvm::StringRef program_path, ReplMode repl_mode,
+   std::vector pre_init_commands,
+   std::ofstream *log, std::string name, StreamDescriptor 
input,
+   StreamDescriptor output, std::FILE *redirectOut = nullptr,
+   std::FILE *redirectErr = nullptr) -> bool {
+DAP dap = DAP(name, program_path, log, std::move(input), std::move(output),
+  repl_mode, pre_init_commands);
 
-int stdout_fd = DuplicateFileDescriptor(fileno(stdout));
-if (stdout_fd == -1) {
+// stdout/stderr redirection to the IDE's console
+if (auto Err = dap.ConfigureIO(redirectOut, redirectErr)) {
   llvm::logAllUnhandledErrors(
-  llvm::errorCodeToError(llvm::errnoAsErrorCode()), llvm::errs(),
-  "Failed to configure stdout redirect: ");
+  std::move(Err), llvm::errs(),
+  "Failed to configure lldb-dap IO operations: ");
+  return false;
+}
+
+RegisterRequestCallbacks(dap);
+
+// used only by TestVSCode_redirection_to_console.py
+if (getenv("LLDB_DAP_TEST_STDOUT_STDERR_REDIRECTION") != nullptr)
+  redirection_test();
+
+if (auto Err = dap.Loop()) {
+  std::string errorMessage = llvm::toString(std::move(Err));
+  if (log)
+*log << "Transport Error: " << errorMessage << "\n";
+  return false;
+}
+return true;
+  };
+
+  if (!connection.empty()) {
+auto maybeProtoclAndName = validateConnection(connection);
+if (auto Err = maybeProtoclAndName.takeError()) {
+  llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(),
+  "Invalid connection: ");
   return EXIT_FAILURE;
 }
 
-redirectOut = stdout;
-redirectErr = stderr;
+Socket::SocketProtocol protocol;
+std::string name;
+std::tie(protocol, name) = *maybeProtoclAndName;
 
-input = StreamDescriptor::from_file(fileno(stdin), false);
-output = StreamDescriptor::from_file(stdout_fd, false);
-  }
+Status error;
+std::unique_ptr listener = Socket::Create(protocol, error);
+if (error.Fail()) {
+  llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(),
+  "Failed to create socket listener: ");
+  return EXIT_FAILURE;
+}
 
-  DAP dap = DAP(program_path.str(), log.get(), default_repl_mode,
-std::move(input), std::move(output));
+error = listener->Listen(name, /* backlog */ 5);
+if (error.Fail()) {
+  llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(),
+  "Failed to listen for connections: ");
+  return EXIT_FAILURE;
+}
 
-  // stdout/stderr redirection to the IDE's console
-  if (auto Err = dap.ConfigureIO(redirectOut, redirectErr)) {
-llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(),
-"Failed to configure lldb-dap IO operations: 
");
-return EXIT_FAILURE;
-  }
+std::string address =
+llvm::join(listener->GetListeningConnectionURI(), ", ");
+if (log)
+  *log << "started with connection listeners " << address << "\n";
+
+llvm::outs() << "Listening for: " << address << "\n";
+// Ensure listening address are flushed for calles to retrieve the resolve
+// address.
+llvm::outs().flush();
+
+llvm::DefaultThreadPool pool(llvm::optimal_concurrency());

labath wrote:

Are you sure about that? I haven't tried this, but looking at the source code, 
it definitely looks like it is [limiting 
something](https://github.com/llvm/llvm-project/blob/409fa785d99b3e9f8210b72641d58947e6687fb1/llvm/lib/Support/Threading.cpp#L60).
 And although the implementation appears to be stubbed out, it looks like it 
has some ambition t

[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Pavel Labath via lldb-commits


@@ -257,8 +257,8 @@ enum StopReason {
 };
 
 /// Command Return Status Types.
-enum ReturnStatus {
-  eReturnStatusInvalid,
+enum ReturnStatus : int {
+  eReturnStatusInvalid = 0,

labath wrote:

I'm not sure I understand that. What exactly happens if you leave this out?

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,92 @@
+//===-- Telemetry.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.0 WITH LLVM-exception
+//
+//===--===//
+#include "lldb/Core/Telemetry.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Target/Statistics.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/UUID.h"
+#include "lldb/Version/Version.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/RandomNumberGenerator.h"
+#include "llvm/Telemetry/Telemetry.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private {
+
+using ::llvm::Error;
+using ::llvm::telemetry::Destination;
+using ::llvm::telemetry::TelemetryInfo;
+
+static uint64_t ToNanosec(const SteadyTimePoint Point) {
+  return nanoseconds(Point.value().time_since_epoch()).count();
+}
+
+void LldbBaseTelemetryInfo::serialize(Serializer &serializer) const {
+  serializer.write("entry_kind", getKind());
+  serializer.write("session_id", SessionId);
+  serializer.write("start_time", ToNanosec(stats.start));
+  if (stats.end.has_value())
+serializer.write("end_time", ToNanosec(stats.end.value()));
+  if (exit_desc.has_value()) {
+serializer.write("exit_code", exit_desc->exit_code);
+serializer.write("exit_msg", exit_desc->description);
+  }
+}
+
+static std::string MakeUUID(lldb_private::Debugger *debugger) {
+  std::string ret;
+  uint8_t random_bytes[16];
+  if (auto ec = llvm::getRandomBytes(random_bytes, 16)) {
+LLDB_LOG(GetLog(LLDBLog::Object),
+ "Failed to generate random bytes for UUID: {0}", ec.message());
+// fallback to using timestamp + debugger ID.
+ret = std::to_string(
+  std::chrono::steady_clock::now().time_since_epoch().count()) +
+  "_" + std::to_string(debugger->GetID());

labath wrote:

```suggestion
ret = llvm::formatv("{0}_{1}",
  std::chrono::steady_clock::now().time_since_epoch().count()), 
debugger->GetID());
```

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Pavel Labath via lldb-commits

https://github.com/labath edited 
https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,92 @@
+//===-- Telemetry.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.0 WITH LLVM-exception
+//
+//===--===//
+#include "lldb/Core/Telemetry.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Target/Statistics.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/UUID.h"
+#include "lldb/Version/Version.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/RandomNumberGenerator.h"
+#include "llvm/Telemetry/Telemetry.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private {
+
+using ::llvm::Error;
+using ::llvm::telemetry::Destination;
+using ::llvm::telemetry::TelemetryInfo;
+
+static uint64_t ToNanosec(const SteadyTimePoint Point) {
+  return nanoseconds(Point.value().time_since_epoch()).count();
+}
+
+void LldbBaseTelemetryInfo::serialize(Serializer &serializer) const {
+  serializer.write("entry_kind", getKind());
+  serializer.write("session_id", SessionId);
+  serializer.write("start_time", ToNanosec(stats.start));
+  if (stats.end.has_value())
+serializer.write("end_time", ToNanosec(stats.end.value()));
+  if (exit_desc.has_value()) {
+serializer.write("exit_code", exit_desc->exit_code);
+serializer.write("exit_msg", exit_desc->description);
+  }
+}
+
+static std::string MakeUUID(lldb_private::Debugger *debugger) {
+  std::string ret;
+  uint8_t random_bytes[16];
+  if (auto ec = llvm::getRandomBytes(random_bytes, 16)) {
+LLDB_LOG(GetLog(LLDBLog::Object),
+ "Failed to generate random bytes for UUID: {0}", ec.message());
+// fallback to using timestamp + debugger ID.
+ret = std::to_string(
+  std::chrono::steady_clock::now().time_since_epoch().count()) +
+  "_" + std::to_string(debugger->GetID());
+  } else {
+ret = lldb_private::UUID(random_bytes).GetAsString();
+  }
+
+  return ret;
+}
+
+TelemetryManager::TelemetryManager(
+std::unique_ptr config,
+lldb_private::Debugger *debugger)
+: m_config(std::move(config)), m_debugger(debugger),

labath wrote:

It looks like you expect the debugger pointer to always be valid. Could it be a 
reference? (it means the TelemetryManager object will not be 
copyable/assignable, but maybe we don't even want that?)

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Pavel Labath via lldb-commits

https://github.com/labath commented:

I think I don't see all of the updates you've made and the PR has the 
"Processing updates" forever-spinner. The same thing happened to @cmtice's PR, 
so you may want to check with her how she got the PR back on track.

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,100 @@
+//===-- Telemetry.h --*- C++
+//-*-===//
+//
+// 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.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_CORE_TELEMETRY_H
+#define LLDB_CORE_TELEMETRY_H
+
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
+#include "llvm/Telemetry/Telemetry.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private {
+
+using llvm::telemetry::Destination;

labath wrote:

This defines a type (alias) called `lldb_private::Destination`, which is way 
too generic. If you want to use names like this, then I suggest creating a 
sub-namespace.

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ad38c4c - [lldb] Document lldb `x` packet deprecation. (#125682)

2025-02-05 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-02-05T09:26:26+01:00
New Revision: ad38c4c625765c0319433b8c87852fbe40a1f7fd

URL: 
https://github.com/llvm/llvm-project/commit/ad38c4c625765c0319433b8c87852fbe40a1f7fd
DIFF: 
https://github.com/llvm/llvm-project/commit/ad38c4c625765c0319433b8c87852fbe40a1f7fd.diff

LOG: [lldb] Document lldb `x` packet deprecation. (#125682)

Added: 


Modified: 
lldb/docs/resources/lldbgdbremote.md

Removed: 




diff  --git a/lldb/docs/resources/lldbgdbremote.md 
b/lldb/docs/resources/lldbgdbremote.md
index 5cac3736337a8f..162815148a18bf 100644
--- a/lldb/docs/resources/lldbgdbremote.md
+++ b/lldb/docs/resources/lldbgdbremote.md
@@ -2412,6 +2412,11 @@ value of errno if unlink failed.
 
 ## "x" - Binary memory read
 
+> **Warning:** The format of this packet was decided before GDB 16
+> introduced its own format for `x`. Future versions of LLDB may not
+> support the format described here, and new code should produce and
+> expect the format used by GDB.
+
 Like the `m` (read) and `M` (write) packets, this is a partner to the
 `X` (write binary data) packet, `x`.
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Document lldb `x` packet deprecation. (PR #125682)

2025-02-05 Thread Pavel Labath via lldb-commits

https://github.com/labath closed 
https://github.com/llvm/llvm-project/pull/125682
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang created 
https://github.com/llvm/llvm-project/pull/125832

This commit upgrades our npm dependencies to the latest available version.

I was prompted to this change because `npm run package` failed for me with an 
error. The error disappeared after upgrade `@vscode/vsce`. I also upgraded the 
other dependencies because I think it's generally preferable to stay up-to-date.

I did not bump the `@types/vscode` and `@types/node` versions, since this would 
effectively make older VS-Code versions unsupported. I also changed 
`@types/vscode` to be a precise version match, since we are claiming 
compatibility with that version via the `enginges.vscode` property.

>From 16404a17902cf370a44d31bf60f12403ac0cce39 Mon Sep 17 00:00:00 2001
From: Adrian Vogelsgesang 
Date: Wed, 5 Feb 2025 10:28:22 +
Subject: [PATCH] [lldb-dap] Update npm dependencies

This commit upgrades our npm dependencies to the latest available
version.

I was prompted to this change because `npm run package` failed for me
with an error. The error disappeared after upgrade `@vscode/vsce`. I
also upgraded the other dependencies because I think it's generally
preferable to stay up-to-date.

I did not bump the `@types/vscode` and `@types/node` versions, since
this would effectively make older VS-Code versions unsupported. I also
changed `@types/vscode` to be a precise version match, since we are
claiming compatibility with that version via the `enginges.vscode`
property.
---
 lldb/tools/lldb-dap/package-lock.json | 1881 -
 lldb/tools/lldb-dap/package.json  |   10 +-
 2 files changed, 1552 insertions(+), 339 deletions(-)

diff --git a/lldb/tools/lldb-dap/package-lock.json 
b/lldb/tools/lldb-dap/package-lock.json
index d1cb6d00ecf566..4c184742414212 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -1,136 +1,267 @@
 {
   "name": "lldb-dap",
-  "version": "0.2.8",
+  "version": "0.2.9",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
 "": {
   "name": "lldb-dap",
-  "version": "0.2.8",
+  "version": "0.2.9",
   "license": "Apache 2.0 License with LLVM exceptions",
   "devDependencies": {
 "@types/node": "^18.11.18",
-"@types/vscode": "~1.74.0",
-"@vscode/vsce": "^2.19.0",
-"prettier": "^3.1.1",
-"prettier-plugin-curly": "^0.1.3",
-"typescript": "^4.6.4"
+"@types/vscode": "1.75.0",
+"@vscode/vsce": "^3.2.2",
+"prettier": "^3.4.2",
+"prettier-plugin-curly": "^0.3.1",
+"typescript": "^5.7.3"
   },
   "engines": {
 "vscode": "^1.75.0"
   }
 },
-"node_modules/@babel/code-frame": {
-  "version": "7.23.5",
-  "resolved": 
"https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz";,
-  "integrity": 
"sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==",
+"node_modules/@azure/abort-controller": {
+  "version": "2.1.2",
+  "resolved": 
"https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz";,
+  "integrity": 
"sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
   "dev": true,
+  "license": "MIT",
   "dependencies": {
-"@babel/highlight": "^7.23.4",
-"chalk": "^2.4.2"
+"tslib": "^2.6.2"
   },
   "engines": {
-"node": ">=6.9.0"
+"node": ">=18.0.0"
   }
 },
-"node_modules/@babel/generator": {
-  "version": "7.23.6",
-  "resolved": 
"https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz";,
-  "integrity": 
"sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==",
+"node_modules/@azure/core-auth": {
+  "version": "1.9.0",
+  "resolved": 
"https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.9.0.tgz";,
+  "integrity": 
"sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==",
   "dev": true,
+  "license": "MIT",
   "dependencies": {
-"@babel/types": "^7.23.6",
-"@jridgewell/gen-mapping": "^0.3.2",
-"@jridgewell/trace-mapping": "^0.3.17",
-"jsesc": "^2.5.1"
+"@azure/abort-controller": "^2.0.0",
+"@azure/core-util": "^1.11.0",
+"tslib": "^2.6.2"
   },
   "engines": {
-"node": ">=6.9.0"
+"node": ">=18.0.0"
   }
 },
-"node_modules/@babel/helper-environment-visitor": {
-  "version": "7.22.20",
-  "resolved": 
"https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz";,
-  "integrity": 
"sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==",
+"node_modules/@azure/core-client": {
+  "version": "1.9.2",
+  "resolved": 
"https://registry.npmjs.org/@azure

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

2025-02-05 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Vogelsgesang (vogelsgesang)


Changes

This commit upgrades our npm dependencies to the latest available version.

I was prompted to this change because `npm run package` failed for me with an 
error. The error disappeared after upgrade `@vscode/vsce`. I also 
upgraded the other dependencies because I think it's generally preferable to 
stay up-to-date.

I did not bump the `@types/vscode` and `@types/node` versions, 
since this would effectively make older VS-Code versions unsupported. I also 
changed `@types/vscode` to be a precise version match, since we are 
claiming compatibility with that version via the `enginges.vscode` property.

---

Patch is 94.29 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/125832.diff


2 Files Affected:

- (modified) lldb/tools/lldb-dap/package-lock.json (+1547-334) 
- (modified) lldb/tools/lldb-dap/package.json (+5-5) 


``diff
diff --git a/lldb/tools/lldb-dap/package-lock.json 
b/lldb/tools/lldb-dap/package-lock.json
index d1cb6d00ecf566..4c184742414212 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -1,136 +1,267 @@
 {
   "name": "lldb-dap",
-  "version": "0.2.8",
+  "version": "0.2.9",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
 "": {
   "name": "lldb-dap",
-  "version": "0.2.8",
+  "version": "0.2.9",
   "license": "Apache 2.0 License with LLVM exceptions",
   "devDependencies": {
 "@types/node": "^18.11.18",
-"@types/vscode": "~1.74.0",
-"@vscode/vsce": "^2.19.0",
-"prettier": "^3.1.1",
-"prettier-plugin-curly": "^0.1.3",
-"typescript": "^4.6.4"
+"@types/vscode": "1.75.0",
+"@vscode/vsce": "^3.2.2",
+"prettier": "^3.4.2",
+"prettier-plugin-curly": "^0.3.1",
+"typescript": "^5.7.3"
   },
   "engines": {
 "vscode": "^1.75.0"
   }
 },
-"node_modules/@babel/code-frame": {
-  "version": "7.23.5",
-  "resolved": 
"https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz";,
-  "integrity": 
"sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==",
+"node_modules/@azure/abort-controller": {
+  "version": "2.1.2",
+  "resolved": 
"https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz";,
+  "integrity": 
"sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
   "dev": true,
+  "license": "MIT",
   "dependencies": {
-"@babel/highlight": "^7.23.4",
-"chalk": "^2.4.2"
+"tslib": "^2.6.2"
   },
   "engines": {
-"node": ">=6.9.0"
+"node": ">=18.0.0"
   }
 },
-"node_modules/@babel/generator": {
-  "version": "7.23.6",
-  "resolved": 
"https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz";,
-  "integrity": 
"sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==",
+"node_modules/@azure/core-auth": {
+  "version": "1.9.0",
+  "resolved": 
"https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.9.0.tgz";,
+  "integrity": 
"sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==",
   "dev": true,
+  "license": "MIT",
   "dependencies": {
-"@babel/types": "^7.23.6",
-"@jridgewell/gen-mapping": "^0.3.2",
-"@jridgewell/trace-mapping": "^0.3.17",
-"jsesc": "^2.5.1"
+"@azure/abort-controller": "^2.0.0",
+"@azure/core-util": "^1.11.0",
+"tslib": "^2.6.2"
   },
   "engines": {
-"node": ">=6.9.0"
+"node": ">=18.0.0"
   }
 },
-"node_modules/@babel/helper-environment-visitor": {
-  "version": "7.22.20",
-  "resolved": 
"https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz";,
-  "integrity": 
"sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==",
+"node_modules/@azure/core-client": {
+  "version": "1.9.2",
+  "resolved": 
"https://registry.npmjs.org/@azure/core-client/-/core-client-1.9.2.tgz";,
+  "integrity": 
"sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w==",
   "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"@azure/abort-controller": "^2.0.0",
+"@azure/core-auth": "^1.4.0",
+"@azure/core-rest-pipeline": "^1.9.1",
+"@azure/core-tracing": "^1.0.0",
+"@azure/core-util": "^1.6.1",
+"@azure/logger": "^1.0.0",
+"tslib": "^2.6.2"
+  },
   "engines": {
-"node": ">=6.9.0"
+"node": ">=18.0.0"
   }
 },
-"node_modules/@babel/helper-function-name": {
-  "version": "7

[Lldb-commits] [lldb] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (PR #123521)

2025-02-05 Thread Pavel Labath via lldb-commits

https://github.com/labath edited 
https://github.com/llvm/llvm-project/pull/123521
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (PR #123521)

2025-02-05 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,160 @@
+//===-- DILLexerTests.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.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/ValueObject/DILLexer.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Testing/Support/Error.h"
+#include "gtest/gtest.h"
+#include 
+
+using llvm::StringRef;
+
+using namespace lldb_private::dil;
+
+llvm::Expected>>
+ExtractTokenData(llvm::StringRef input_expr) {
+
+  llvm::Expected maybe_lexer = DILLexer::Create(input_expr);
+  if (!maybe_lexer)
+return maybe_lexer.takeError();
+  DILLexer lexer(*maybe_lexer);
+
+  if (lexer.NumLexedTokens() == 0)
+return llvm::createStringError("No lexed tokens");
+
+  lexer.ResetTokenIdx(0);

labath wrote:

I think this is unnecessary now.

https://github.com/llvm/llvm-project/pull/123521
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (PR #123521)

2025-02-05 Thread Pavel Labath via lldb-commits

https://github.com/labath approved this pull request.

This looks good now, thanks for your patience.

https://github.com/llvm/llvm-project/pull/123521
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo] Make some block-start-position methods return iterators (PR #124287)

2025-02-05 Thread Harald van Dijk via lldb-commits

hvdijk wrote:

Thanks again, it ends up looking much better (IMO) with `InsertPosition`, and 
it manages to avoid the change on the users' side that I was hoping to avoid. 
https://github.com/hvdijk/llvm-project/commit/dibuilder-insertposition Since 
this allows us to have a single method rather than separate overloads (since 
`InsertPostion` handles both `Instruction *` arguments and `BasicBlock *` 
arguments via conversion) it also avoids the need for duplication in the unit 
testing. TODO (feedback welcome): Figure out what to do with the C API. In my 
commit, it compiles with a deprecation warning, but it's providing an interface 
for doing the exact thing that is meant to be deprecated, and the interface is 
inconsistent with how instructions are inserted through the C API, so my 
thinking is that this API should probably be replaced with one that uses 
`IRBuilder`?

https://github.com/llvm/llvm-project/pull/124287
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb/Host] Add ability to open URLs on macOS (PR #125893)

2025-02-05 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/125893
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Vy Nguyen via lldb-commits


@@ -0,0 +1,100 @@
+//===-- Telemetry.h --*- C++
+//-*-===//
+//
+// 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.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_CORE_TELEMETRY_H
+#define LLDB_CORE_TELEMETRY_H
+
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
+#include "llvm/Telemetry/Telemetry.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private {
+
+using llvm::telemetry::Destination;

oontvoo wrote:

Ok, I'll just use the full name  then - maybe that's better than creating 
aliases ...

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Vy Nguyen via lldb-commits


@@ -257,8 +257,8 @@ enum StopReason {
 };
 
 /// Command Return Status Types.
-enum ReturnStatus {
-  eReturnStatusInvalid,
+enum ReturnStatus : int {
+  eReturnStatusInvalid = 0,

oontvoo wrote:

when i tried to do `json::Object({"ret_stat", returnStatus})`, I got some build 
error (ambiguous types or sth like that).

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[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",

ashgti wrote:

The engine field should indicate which version of VS Code is supported, this 
should only unblock any newer APIs. 

https://github.com/llvm/llvm-project/pull/125832
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)

2025-02-05 Thread via lldb-commits

https://github.com/seehearfeel created 
https://github.com/llvm/llvm-project/pull/126020

1. [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK,WATCH}
2. [LLDB][LoongArch] Extend the maximum number of watchpoints

>From 67dd4198073a2b87f7dbaa37cd6103f2230f326e Mon Sep 17 00:00:00 2001
From: Tiezhu Yang 
Date: Thu, 23 Jan 2025 15:30:20 +0800
Subject: [PATCH 1/2] [LLDB][LoongArch] Fix build errors about
 NT_LOONGARCH_HW_{BREAK,WATCH}

On some OS distros such as LoongArch Fedora 38 mate-5 [1], there are
no macro definitions NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH
in the system header, then there exist some errors when building LLDB
on LoongArch.

(1) Description of Problem:

llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:529:16:
error: 'NT_LOONGARCH_HW_WATCH' was not declared in this scope; did you mean 
'NT_LOONGARCH_LBT'?
  529 |   int regset = NT_LOONGARCH_HW_WATCH;
  |^
  |NT_LOONGARCH_LBT
llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:543:12:
error: 'NT_LOONGARCH_HW_BREAK' was not declared in this scope; did you mean 
'NT_LOONGARCH_CSR'?
  543 |   regset = NT_LOONGARCH_HW_BREAK;
  |^
  |NT_LOONGARCH_CSR

(2) Steps to Reproduce:

git clone https://github.com/llvm/llvm-project.git
mkdir -p llvm-project/llvm/build && cd llvm-project/llvm/build
cmake .. -G "Ninja" \
 -DCMAKE_BUILD_TYPE=Release \
 -DLLVM_BUILD_RUNTIME=OFF \
 -DLLVM_ENABLE_PROJECTS="clang;lldb" \
 -DCMAKE_INSTALL_PREFIX=/usr/local/llvm \
 -DLLVM_TARGETS_TO_BUILD="LoongArch" \
 -DLLVM_HOST_TRIPLE=loongarch64-redhat-linux
ninja

(3) Additional Info:

Maybe there are no problems on the OS distros with newer glibc devel
library, so this issue is related with OS distros.

(4) Root Cause Analysis:

This is because the related Linux kernel commit [3] was merged in
2023-02-25 and the glibc devel library has some delay with kernel,
the glibc version of specified OS distros is not updated in time.

(5) Final Solution:

One way is to ask the maintainer of OS distros to update glibc devel
library, but it is better to not depend on the glibc version.

In order to avoid the build errors, just define NT_LOONGARCH_HW_BREAK
and NT_LOONGARCH_HW_WATCH in LLDB if there are no these definitions in
the system header.

[1] 
https://mirrors.wsyu.edu.cn/fedora/linux/development/rawhide/Everything/loongarch64/iso/livecd-fedora-mate-5.loongarch64.iso
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a69f7a161a7

Signed-off-by: Tiezhu Yang 
---
 .../Linux/NativeRegisterContextLinux_loongarch64.cpp  | 8 
 1 file changed, 8 insertions(+)

diff --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
index b04018ee243fd7d..889c2083aa5b9b2 100644
--- 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
+++ 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
@@ -36,6 +36,14 @@
   0xa03 /* LoongArch Advanced SIMD eXtension registers */
 #endif
 
+#ifndef NT_LOONGARCH_HW_BREAK
+#define NT_LOONGARCH_HW_BREAK  0xa05   /* LoongArch hardware breakpoint 
registers */
+#endif
+
+#ifndef NT_LOONGARCH_HW_WATCH
+#define NT_LOONGARCH_HW_WATCH  0xa06   /* LoongArch hardware watchpoint 
registers */
+#endif
+
 #define REG_CONTEXT_SIZE   
\
   (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx))
 

>From 37ef08582098aac0eb19eb0d021a998563412c46 Mon Sep 17 00:00:00 2001
From: Tiezhu Yang 
Date: Thu, 6 Feb 2025 15:10:59 +0800
Subject: [PATCH 2/2] [LLDB][LoongArch] Extend the maximum number of
 watchpoints

The maximum number of load/store watchpoints and fetch instruction
watchpoints is 14 each according to LoongArch Reference Manual [1],
so extend the maximum number of watchpoints from 8 to 14 for ptrace.

A new struct user_watch_state_v2 was added into uapi in the related
kernel commit 531936dee53e ("LoongArch: Extend the maximum number of
watchpoints") [2], but there may be no struct user_watch_state_v2 in
the system header in time, so add the definition if not exist, then
replace user_watch_state with user_watch_state_v2.

[1] 
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers-related-to-watchpoints
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=531936dee53e

Signed-off-by: Tiezhu Yang 
---
 .../NativeRegisterContextLinux_loongarch64.cpp   | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarc

[Lldb-commits] [lldb] [lldb] Clear cached unwind plans when adding symbols (PR #125839)

2025-02-05 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)


Changes

PR #86603 broke unwinding in for unwind info added via "target symbols 
add". #86770 attempted to fix this, but the fix was only partial -- it 
accepted new sources of unwind information, but didn't take into account that 
the symbol file can alter what lldb percieves as function boundaries.

A stripped file will not contain information about private (non-exported) 
symbols, which will make the public symbols appear very large. If lldb tries to 
unwind from such a function before symbols are added, then the cached unwind 
plan will prevent new (correct) unwind plans from being created.

target-symbols-add-unwind.test might have caught this, were it not for the fact 
that the "image show-unwind" command does *not* use cached unwind information 
(it recomputes it from scratch).

The changes in this patch come in three pieces:
- Clear cached unwind plans when adding symbols. Since the symbol boundaries 
can change, we cannot trust anything we've computed previously.
- Add a flag to "image show-unwind" to display the cached unwind information 
(mainly for the use in the test, but I think it's also generally useful).
- Rewrite the test to better and more reliably simulate the real-world 
scenario: I've swapped the running process for a core (minidump) file so it can 
run anywhere; used the caching version of the show-unwind command; and swapped 
C for assembly to better control the placement of symbols

---
Full diff: https://github.com/llvm/llvm-project/pull/125839.diff


6 Files Affected:

- (modified) lldb/include/lldb/Symbol/UnwindTable.h (+3-2) 
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+19-3) 
- (modified) lldb/source/Commands/Options.td (+2) 
- (modified) lldb/source/Symbol/UnwindTable.cpp (+2-1) 
- (removed) lldb/test/Shell/SymbolFile/Inputs/target-symbols-add-unwind.c (-1) 
- (modified) lldb/test/Shell/SymbolFile/target-symbols-add-unwind.test (+99-19) 


``diff
diff --git a/lldb/include/lldb/Symbol/UnwindTable.h 
b/lldb/include/lldb/Symbol/UnwindTable.h
index 29b7fa61b4849e0..3166fdec6ebaa77 100644
--- a/lldb/include/lldb/Symbol/UnwindTable.h
+++ b/lldb/include/lldb/Symbol/UnwindTable.h
@@ -38,8 +38,9 @@ class UnwindTable {
   ArmUnwindInfo *GetArmUnwindInfo();
   SymbolFile *GetSymbolFile();
 
-  lldb::FuncUnwindersSP GetFuncUnwindersContainingAddress(const Address &addr,
-  SymbolContext &sc);
+  lldb::FuncUnwindersSP
+  GetFuncUnwindersContainingAddress(const Address &addr,
+const SymbolContext &sc);
 
   bool GetAllowAssemblyEmulationUnwindPlans();
 
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index d8265e41a7384eb..db142e8f0eaee77 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3471,6 +3471,17 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
 m_type = eLookupTypeFunctionOrSymbol;
 break;
 
+  case 'c':
+bool value, success;
+value = OptionArgParser::ToBoolean(option_arg, false, &success);
+if (success) {
+  m_cached = value;
+} else {
+  return Status::FromErrorStringWithFormatv(
+  "invalid boolean value '%s' passed for -G option", option_arg);
+}
+break;
+
   default:
 llvm_unreachable("Unimplemented option");
   }
@@ -3482,6 +3493,7 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
   m_type = eLookupTypeInvalid;
   m_str.clear();
   m_addr = LLDB_INVALID_ADDRESS;
+  m_cached = false;
 }
 
 llvm::ArrayRef GetDefinitions() override {
@@ -3494,6 +3506,7 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
  // parsing options
 std::string m_str; // Holds name lookup
 lldb::addr_t m_addr = LLDB_INVALID_ADDRESS; // Holds the address to lookup
+bool m_cached = false;
   };
 
   CommandObjectTargetModulesShowUnwind(CommandInterpreter &interpreter)
@@ -3583,9 +3596,12 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
   if (abi)
 start_addr = abi->FixCodeAddress(start_addr);
 
-  FuncUnwindersSP func_unwinders_sp(
-  sc.module_sp->GetUnwindTable()
-  .GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
+  UnwindTable &uw_table = sc.module_sp->GetUnwindTable();
+  FuncUnwindersSP func_unwinders_sp =
+  m_options.m_cached
+  ? uw_table.GetFuncUnwindersContainingAddress(start_addr, sc)
+  : uw_table.GetUncachedFuncUnwindersContainingAddress(start_addr,
+   sc);
   if (!func_unwinders_sp)
 continue;
 
diff --git a/lldb/source/Command

[Lldb-commits] [lldb] [lldb] Clear cached unwind plans when adding symbols (PR #125839)

2025-02-05 Thread Pavel Labath via lldb-commits

https://github.com/labath created 
https://github.com/llvm/llvm-project/pull/125839

PR #86603 broke unwinding in for unwind info added via "target symbols add". 
#86770 attempted to fix this, but the fix was only partial -- it accepted new 
sources of unwind information, but didn't take into account that the symbol 
file can alter what lldb percieves as function boundaries.

A stripped file will not contain information about private (non-exported) 
symbols, which will make the public symbols appear very large. If lldb tries to 
unwind from such a function before symbols are added, then the cached unwind 
plan will prevent new (correct) unwind plans from being created.

target-symbols-add-unwind.test might have caught this, were it not for the fact 
that the "image show-unwind" command does *not* use cached unwind information 
(it recomputes it from scratch).

The changes in this patch come in three pieces:
- Clear cached unwind plans when adding symbols. Since the symbol boundaries 
can change, we cannot trust anything we've computed previously.
- Add a flag to "image show-unwind" to display the cached unwind information 
(mainly for the use in the test, but I think it's also generally useful).
- Rewrite the test to better and more reliably simulate the real-world 
scenario: I've swapped the running process for a core (minidump) file so it can 
run anywhere; used the caching version of the show-unwind command; and swapped 
C for assembly to better control the placement of symbols

>From 82e0ee5bf53dd6b886327021f5b145c942b43ff6 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Wed, 5 Feb 2025 11:28:48 +0100
Subject: [PATCH] [lldb] Clear cached unwind plans when adding symbols

PR #86603 broke unwinding in for unwind info added via "target symbols
add". #86770 attempted to fix this, but the fix was only partial -- it
accepted new sources of unwind information, but didn't take into account
that the symbol file can alter what lldb percieves as function
boundaries.

A stripped file will not contain information about private
(non-exported) symbols, which will make the public symbols appear very
large. If lldb tries to unwind from such a function before symbols are
added, then the cached unwind plan will prevent new (correct) unwind
plans from being created.

target-symbols-add-unwind.test might have caught this, were it not for
the fact that the "image show-unwind" command does *not* use cached
unwind information (it recomputes it from scratch).

The changes in this patch come in three pieces:
- Clear cached unwind plans when adding symbols. Since the symbol
  boundaries can change, we cannot trust anything we've computed
  previously.
- Add a flag to "image show-unwind" to display the cached unwind
  information (mainly for the use in the test, but I think it's also
  generally useful).
- Rewrite the test to better and more reliably simulate the real-world
  scenario: I've swapped the running process for a core (minidump) file
  so it can run anywhere; used the caching version of the show-unwind
  command; and swapped C for assembly to better control the placement of
  symbols
---
 lldb/include/lldb/Symbol/UnwindTable.h|   5 +-
 lldb/source/Commands/CommandObjectTarget.cpp  |  22 +++-
 lldb/source/Commands/Options.td   |   2 +
 lldb/source/Symbol/UnwindTable.cpp|   3 +-
 .../Inputs/target-symbols-add-unwind.c|   1 -
 .../SymbolFile/target-symbols-add-unwind.test | 118 +++---
 6 files changed, 125 insertions(+), 26 deletions(-)
 delete mode 100644 
lldb/test/Shell/SymbolFile/Inputs/target-symbols-add-unwind.c

diff --git a/lldb/include/lldb/Symbol/UnwindTable.h 
b/lldb/include/lldb/Symbol/UnwindTable.h
index 29b7fa61b4849e0..3166fdec6ebaa77 100644
--- a/lldb/include/lldb/Symbol/UnwindTable.h
+++ b/lldb/include/lldb/Symbol/UnwindTable.h
@@ -38,8 +38,9 @@ class UnwindTable {
   ArmUnwindInfo *GetArmUnwindInfo();
   SymbolFile *GetSymbolFile();
 
-  lldb::FuncUnwindersSP GetFuncUnwindersContainingAddress(const Address &addr,
-  SymbolContext &sc);
+  lldb::FuncUnwindersSP
+  GetFuncUnwindersContainingAddress(const Address &addr,
+const SymbolContext &sc);
 
   bool GetAllowAssemblyEmulationUnwindPlans();
 
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index d8265e41a7384eb..db142e8f0eaee77 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3471,6 +3471,17 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
 m_type = eLookupTypeFunctionOrSymbol;
 break;
 
+  case 'c':
+bool value, success;
+value = OptionArgParser::ToBoolean(option_arg, false, &success);
+if (success) {
+  m_cached = value;
+} else {
+  return Status::FromErrorStringWithFormatv(
+ 

[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Vy Nguyen via lldb-commits

oontvoo wrote:

> I think I don't see all of the updates you've made and the PR has the 
> "Processing updates" forever-spinner. The same thing happened to @cmtice's 
> PR, so you may want to check with her how she got the PR back on track.

Seems to be back to normal now! :)

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add SymbolContext::GetFunctionOrSymbolAddress (PR #123340)

2025-02-05 Thread via lldb-commits

https://github.com/jimingham approved this pull request.

Yes, that's good.

https://github.com/llvm/llvm-project/pull/123340
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)

2025-02-05 Thread via lldb-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write 
permissions for the repository. In which case you can instead tag reviewers by 
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a 
review by "ping"ing the PR by adding a comment “Ping”. The common courtesy 
"ping" rate is once a week. Please remember that you are asking for valuable 
time from other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

https://github.com/llvm/llvm-project/pull/126020
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)

2025-02-05 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (seehearfeel)


Changes

1. [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK,WATCH}
2. [LLDB][LoongArch] Extend the maximum number of watchpoints

---
Full diff: https://github.com/llvm/llvm-project/pull/126020.diff


1 Files Affected:

- (modified) 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp 
(+22-2) 


``diff
diff --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
index b04018ee243fd7d..8eb2cb65c76d2ea 100644
--- 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
+++ 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
@@ -36,9 +36,29 @@
   0xa03 /* LoongArch Advanced SIMD eXtension registers */
 #endif
 
+#ifndef NT_LOONGARCH_HW_BREAK
+#define NT_LOONGARCH_HW_BREAK  0xa05   /* LoongArch hardware breakpoint 
registers */
+#endif
+
+#ifndef NT_LOONGARCH_HW_WATCH
+#define NT_LOONGARCH_HW_WATCH  0xa06   /* LoongArch hardware watchpoint 
registers */
+#endif
+
 #define REG_CONTEXT_SIZE   
\
   (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx))
 
+#ifndef user_watch_state_v2
+struct user_watch_state_v2 {
+   uint64_t dbg_info;
+   struct {
+   uint64_taddr;
+   uint64_tmask;
+   uint32_tctrl;
+   uint32_tpad;
+   } dbg_regs[14];
+};
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::process_linux;
@@ -528,7 +548,7 @@ llvm::Error 
NativeRegisterContextLinux_loongarch64::ReadHardwareDebugInfo() {
 
   int regset = NT_LOONGARCH_HW_WATCH;
   struct iovec ioVec;
-  struct user_watch_state dreg_state;
+  struct user_watch_state_v2 dreg_state;
   Status error;
 
   ioVec.iov_base = &dreg_state;
@@ -556,7 +576,7 @@ llvm::Error 
NativeRegisterContextLinux_loongarch64::ReadHardwareDebugInfo() {
 llvm::Error NativeRegisterContextLinux_loongarch64::WriteHardwareDebugRegs(
 DREGType hwbType) {
   struct iovec ioVec;
-  struct user_watch_state dreg_state;
+  struct user_watch_state_v2 dreg_state;
   int regset;
 
   memset(&dreg_state, 0, sizeof(dreg_state));

``




https://github.com/llvm/llvm-project/pull/126020
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)

2025-02-05 Thread via lldb-commits

https://github.com/seehearfeel updated 
https://github.com/llvm/llvm-project/pull/126020

>From 67dd4198073a2b87f7dbaa37cd6103f2230f326e Mon Sep 17 00:00:00 2001
From: Tiezhu Yang 
Date: Thu, 23 Jan 2025 15:30:20 +0800
Subject: [PATCH 1/2] [LLDB][LoongArch] Fix build errors about
 NT_LOONGARCH_HW_{BREAK,WATCH}

On some OS distros such as LoongArch Fedora 38 mate-5 [1], there are
no macro definitions NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH
in the system header, then there exist some errors when building LLDB
on LoongArch.

(1) Description of Problem:

llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:529:16:
error: 'NT_LOONGARCH_HW_WATCH' was not declared in this scope; did you mean 
'NT_LOONGARCH_LBT'?
  529 |   int regset = NT_LOONGARCH_HW_WATCH;
  |^
  |NT_LOONGARCH_LBT
llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:543:12:
error: 'NT_LOONGARCH_HW_BREAK' was not declared in this scope; did you mean 
'NT_LOONGARCH_CSR'?
  543 |   regset = NT_LOONGARCH_HW_BREAK;
  |^
  |NT_LOONGARCH_CSR

(2) Steps to Reproduce:

git clone https://github.com/llvm/llvm-project.git
mkdir -p llvm-project/llvm/build && cd llvm-project/llvm/build
cmake .. -G "Ninja" \
 -DCMAKE_BUILD_TYPE=Release \
 -DLLVM_BUILD_RUNTIME=OFF \
 -DLLVM_ENABLE_PROJECTS="clang;lldb" \
 -DCMAKE_INSTALL_PREFIX=/usr/local/llvm \
 -DLLVM_TARGETS_TO_BUILD="LoongArch" \
 -DLLVM_HOST_TRIPLE=loongarch64-redhat-linux
ninja

(3) Additional Info:

Maybe there are no problems on the OS distros with newer glibc devel
library, so this issue is related with OS distros.

(4) Root Cause Analysis:

This is because the related Linux kernel commit [3] was merged in
2023-02-25 and the glibc devel library has some delay with kernel,
the glibc version of specified OS distros is not updated in time.

(5) Final Solution:

One way is to ask the maintainer of OS distros to update glibc devel
library, but it is better to not depend on the glibc version.

In order to avoid the build errors, just define NT_LOONGARCH_HW_BREAK
and NT_LOONGARCH_HW_WATCH in LLDB if there are no these definitions in
the system header.

[1] 
https://mirrors.wsyu.edu.cn/fedora/linux/development/rawhide/Everything/loongarch64/iso/livecd-fedora-mate-5.loongarch64.iso
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a69f7a161a7

Signed-off-by: Tiezhu Yang 
---
 .../Linux/NativeRegisterContextLinux_loongarch64.cpp  | 8 
 1 file changed, 8 insertions(+)

diff --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
index b04018ee243fd7d..889c2083aa5b9b2 100644
--- 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
+++ 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
@@ -36,6 +36,14 @@
   0xa03 /* LoongArch Advanced SIMD eXtension registers */
 #endif
 
+#ifndef NT_LOONGARCH_HW_BREAK
+#define NT_LOONGARCH_HW_BREAK  0xa05   /* LoongArch hardware breakpoint 
registers */
+#endif
+
+#ifndef NT_LOONGARCH_HW_WATCH
+#define NT_LOONGARCH_HW_WATCH  0xa06   /* LoongArch hardware watchpoint 
registers */
+#endif
+
 #define REG_CONTEXT_SIZE   
\
   (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx))
 

>From dcbea39d3aa583e05578d1be7cd7f1dd7771cbd4 Mon Sep 17 00:00:00 2001
From: Tiezhu Yang 
Date: Thu, 6 Feb 2025 15:10:59 +0800
Subject: [PATCH 2/2] [LLDB][LoongArch] Extend the maximum number of
 watchpoints

The maximum number of load/store watchpoints and fetch instruction
watchpoints is 14 each according to LoongArch Reference Manual [1],
so extend the maximum number of watchpoints from 8 to 14 for ptrace.

A new struct user_watch_state_v2 was added into uapi in the related
kernel commit 531936dee53e ("LoongArch: Extend the maximum number of
watchpoints") [2], but there may be no struct user_watch_state_v2 in
the system header in time.

In order to avoid undefined or redefined error, just add a new struct
loongarch_user_watch_state in LLDB which is same with the uapi struct
user_watch_state_v2, then replace the current user_watch_state with
loongarch_user_watch_state.

[1] 
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers-related-to-watchpoints
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=531936dee53e

Signed-off-by: Tiezhu Yang 
---
 ...NativeRegisterContextLinux_loongarch64.cpp | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_

[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)

2025-02-05 Thread via lldb-commits

cmtice wrote:

This is NOT ready for review at this time: I need to clean up the code in this 
PR to handle the changes made to the lexer.

https://github.com/llvm/llvm-project/pull/120971
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Clear cached unwind plans when adding symbols (PR #125839)

2025-02-05 Thread Jason Molenda via lldb-commits


@@ -3471,6 +3471,17 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
 m_type = eLookupTypeFunctionOrSymbol;
 break;
 
+  case 'c':
+bool value, success;
+value = OptionArgParser::ToBoolean(option_arg, false, &success);
+if (success) {
+  m_cached = value;
+} else {
+  return Status::FromErrorStringWithFormatv(
+  "invalid boolean value '%s' passed for -G option", option_arg);

jasonmolenda wrote:

`-c option`?

https://github.com/llvm/llvm-project/pull/125839
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Clear cached unwind plans when adding symbols (PR #125839)

2025-02-05 Thread Jason Molenda via lldb-commits


@@ -3494,6 +3506,7 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
  // parsing options
 std::string m_str; // Holds name lookup
 lldb::addr_t m_addr = LLDB_INVALID_ADDRESS; // Holds the address to lookup
+bool m_cached = false;

jasonmolenda wrote:

I'm fine with changing the behavior of the existing command if you'd like to.  
This command is very much only used by lldb maintainers and tests.

https://github.com/llvm/llvm-project/pull/125839
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Clear cached unwind plans when adding symbols (PR #125839)

2025-02-05 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda edited 
https://github.com/llvm/llvm-project/pull/125839
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Clear cached unwind plans when adding symbols (PR #125839)

2025-02-05 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda approved this pull request.

LGTM.  I'm fine with changing the default to show the current cached unwind 
plans, this command is only used by lldb maintainers (mostly, me), normal users 
won't notice a change here.  Jonas' suggestion of moving this command under 
`target modules dump` would make sense to me too, but you shouldn't need to do 
that in this PR unless you want to, I know there's a lot of mechanical code 
moving to implement a change like that.  Again this is not a normal user 
command, I don't mind changing its behavior or name if anyone thinks that is 
better.

https://github.com/llvm/llvm-project/pull/125839
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/119716

>From b7216d7c3edd5974d84612586fbabdef19037387 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Thu, 26 Dec 2024 20:50:40 -0500
Subject: [PATCH 1/5] Implement LLDB Telemetry (Part 1)

This contains only the concrete implementation of the framework to be used but 
no usages yet.

This is a subset of PR/98528.

I plan to send a few follow-up patches:
part2 : includes changes in the plugin-manager to set up the plugin stuff (ie., 
how to create a default vs vendor impl)
part3 (all of the following can be done in parallel):
* part 3_a: define DebuggerTelemetryInfo and related methods to collect data 
about debugger startup/exit
* part 3_b: define TargetTelemetryInfo and related methods to collect data 
about debug target(s)
* part 3_c: define CommandTelemetryInfo and related methods to collect data 
about debug-commands
* part 3_d: define ClientTelemtryInfo and related methods to collect data about 
lldb-dap/any other client
---
 lldb/include/lldb/Core/Telemetry.h| 101 ++
 lldb/include/lldb/lldb-enumerations.h |   4 +-
 lldb/source/Core/CMakeLists.txt   |   2 +
 lldb/source/Core/Telemetry.cpp|  92 +++
 lldb/test/CMakeLists.txt  |   3 +
 5 files changed, 200 insertions(+), 2 deletions(-)
 create mode 100644 lldb/include/lldb/Core/Telemetry.h
 create mode 100644 lldb/source/Core/Telemetry.cpp

diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
new file mode 100644
index 000..882511efd804d23
--- /dev/null
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -0,0 +1,101 @@
+//===-- Telemetry.h --*- C++
+//-*-===//
+//
+// 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.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_CORE_TELEMETRY_H
+#define LLDB_CORE_TELEMETRY_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
+#include "llvm/Telemetry/Telemetry.h"
+
+namespace lldb_private {
+
+using llvm::telemetry::Destination;
+using llvm::telemetry::KindType;
+using llvm::telemetry::Serializer;
+using llvm::telemetry::TelemetryInfo;
+
+struct LldbEntryKind : public ::llvm::telemetry::EntryKind {
+  static const KindType BaseInfo = 0b11000;
+};
+
+/// Defines a convenient type for timestamp of various events.
+/// This is used by the EventStats below.
+using SteadyTimePoint = std::chrono::time_point;
+
+/// Various time (and possibly memory) statistics of an event.
+struct EventStats {
+  // REQUIRED: Start time of an event
+  SteadyTimePoint start;
+  // OPTIONAL: End time of an event - may be empty if not meaningful.
+  std::optional end;
+  // TBD: could add some memory stats here too?
+
+  EventStats() = default;
+  EventStats(SteadyTimePoint start) : start(start) {}
+  EventStats(SteadyTimePoint start, SteadyTimePoint end)
+  : start(start), end(end) {}
+};
+
+/// Describes the exit signal of an event.
+struct ExitDescription {
+  int exit_code;
+  std::string description;
+};
+
+struct LldbBaseTelemetryInfo : public TelemetryInfo {
+  EventStats stats;
+
+  std::optional exit_desc;
+
+  Debugger *debugger;
+
+  // For dyn_cast, isa, etc operations.
+  KindType getKind() const override { return LldbEntryKind::BaseInfo; }
+
+  static bool classof(const TelemetryInfo *t) {
+// Subclasses of this is also acceptable.
+return (t->getKind() & LldbEntryKind::BaseInfo) == LldbEntryKind::BaseInfo;
+  }
+
+  void serialize(Serializer &serializer) const override;
+};
+
+/// The base Telemetry manager instance in LLDB
+/// This class declares additional instrumentation points
+/// applicable to LLDB.
+class TelemetryManager : public llvm::telemetry::Manager {
+public:
+  TelemetryManager(std::unique_ptr config);
+
+  llvm::Error dispatch(TelemetryInfo *entry) override;
+
+  void addDestination(std::unique_ptr destination) override;
+
+private:
+  std::unique_ptr m_config;
+  const std::string m_session_uuid;
+  std::vector> m_destinations;
+};
+
+} // namespace lldb_private
+#endif // LLDB_CORE_TELEMETRY_H
diff --git a/lldb/include/lldb/lldb-enumerations.h 
b/lldb/include/lldb/lldb-enumerations.h
index 0094fcd596fdf70..f63e446b6042f62 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -257,8 +257,8 @@ enum StopReason {
 };
 
 /// Command Return Status Types.
-enum ReturnStatus {
-  eReturnStatusInvalid,
+enum ReturnStatus : int {
+  eReturnStatusInvali

[Lldb-commits] [lldb] d9a7498 - [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (#123521)

2025-02-05 Thread via lldb-commits

Author: cmtice
Date: 2025-02-05T10:47:11-08:00
New Revision: d9a7498aa24a35bdd95fd20a5c63e9495b6669f6

URL: 
https://github.com/llvm/llvm-project/commit/d9a7498aa24a35bdd95fd20a5c63e9495b6669f6
DIFF: 
https://github.com/llvm/llvm-project/commit/d9a7498aa24a35bdd95fd20a5c63e9495b6669f6.diff

LOG: [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (#123521)

This adds the basic lexer, with unittests, for the Data Inspection
Language (DIL) -- see
https://discourse.llvm.org/t/rfc-data-inspection-language/69893

This version of the lexer only handles local variables and namespaces,
and is designed to work with
https://github.com/llvm/llvm-project/pull/120971.

Added: 
lldb/include/lldb/ValueObject/DILLexer.h
lldb/source/ValueObject/DILLexer.cpp
lldb/unittests/ValueObject/DILLexerTests.cpp

Modified: 
lldb/source/ValueObject/CMakeLists.txt
lldb/unittests/ValueObject/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/ValueObject/DILLexer.h 
b/lldb/include/lldb/ValueObject/DILLexer.h
new file mode 100644
index 00..e1182da5b20ab2
--- /dev/null
+++ b/lldb/include/lldb/ValueObject/DILLexer.h
@@ -0,0 +1,123 @@
+//===-- DILLexer.h --*- C++ 
-*-===//
+//
+// 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.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_VALUEOBJECT_DILLEXER_H
+#define LLDB_VALUEOBJECT_DILLEXER_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private::dil {
+
+/// Class defining the tokens generated by the DIL lexer and used by the
+/// DIL parser.
+class Token {
+public:
+  enum Kind {
+coloncolon,
+eof,
+identifier,
+l_paren,
+r_paren,
+  };
+
+  Token(Kind kind, std::string spelling, uint32_t start)
+  : m_kind(kind), m_spelling(std::move(spelling)), m_start_pos(start) {}
+
+  Kind GetKind() const { return m_kind; }
+
+  std::string GetSpelling() const { return m_spelling; }
+
+  bool Is(Kind kind) const { return m_kind == kind; }
+
+  bool IsNot(Kind kind) const { return m_kind != kind; }
+
+  bool IsOneOf(Kind kind1, Kind kind2) const { return Is(kind1) || Is(kind2); }
+
+  template  bool IsOneOf(Kind kind, Ts... Ks) const {
+return Is(kind) || IsOneOf(Ks...);
+  }
+
+  uint32_t GetLocation() const { return m_start_pos; }
+
+  static llvm::StringRef GetTokenName(Kind kind);
+
+private:
+  Kind m_kind;
+  std::string m_spelling;
+  uint32_t m_start_pos; // within entire expression string
+};
+
+/// Class for doing the simple lexing required by DIL.
+class DILLexer {
+public:
+  /// Lexes all the tokens in expr and calls the private constructor
+  /// with the lexed tokens.
+  static llvm::Expected Create(llvm::StringRef expr);
+
+  /// Return the current token to be handled by the DIL parser.
+  const Token &GetCurrentToken() { return m_lexed_tokens[m_tokens_idx]; }
+
+  /// Advance the current token position by N.
+  void Advance(uint32_t N = 1) {
+if (m_tokens_idx + N >= m_lexed_tokens.size())
+  // N is too large; advance to the end of the lexed tokens.
+  m_tokens_idx = m_lexed_tokens.size() - 1;
+else
+  m_tokens_idx += N;
+  }
+
+  /// Return the lexed token N positions ahead of the 'current' token
+  /// being handled by the DIL parser.
+  const Token &LookAhead(uint32_t N) {
+if (m_tokens_idx + N < m_lexed_tokens.size())
+  return m_lexed_tokens[m_tokens_idx + N];
+
+// Last token should be an 'eof' token.
+return m_lexed_tokens.back();
+  }
+
+  /// Return the index for the 'current' token being handled by the DIL parser.
+  uint32_t GetCurrentTokenIdx() { return m_tokens_idx; }
+
+  /// Set the index for the 'current' token (to be handled by the parser)
+  /// to a particular position. Used for either committing 'look ahead' parsing
+  /// or rolling back tentative parsing.
+  void ResetTokenIdx(uint32_t new_value) {
+assert(new_value < m_lexed_tokens.size());
+m_tokens_idx = new_value;
+  }
+
+  uint32_t NumLexedTokens() { return m_lexed_tokens.size(); }
+
+private:
+  DILLexer(llvm::StringRef dil_expr, std::vector lexed_tokens)
+  : m_expr(dil_expr), m_lexed_tokens(std::move(lexed_tokens)),
+m_tokens_idx(0) {}
+
+  static llvm::Expected Lex(llvm::StringRef expr,
+   llvm::StringRef &remainder);
+
+  // The input string we are lexing & parsing.
+  llvm::StringRef m_expr;
+
+  // Holds all of the tokens lexed so far.
+  std::vector m_lexed_tokens;
+
+  // Index into m_lexed_tokens; indicates which token the DIL parser is
+  // currently trying to parse/handle.
+  uint32_t m_tokens_idx;
+};
+
+} // namespace ll

[Lldb-commits] [lldb] [LLDB] Add Lexer (with tests) for DIL (Data Inspection Language). (PR #123521)

2025-02-05 Thread via lldb-commits

https://github.com/cmtice closed 
https://github.com/llvm/llvm-project/pull/123521
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Jonas Devlieghere 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",

JDevlieghere wrote:

Thanks for explaining!

https://github.com/llvm/llvm-project/pull/125832
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Clear cached unwind plans when adding symbols (PR #125839)

2025-02-05 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

My bad, I misread "add a flag" as "add a command". I think moving the command 
and making it an alias would be a nice-to-have (in your copious amounts of 
spare time ;-), but obviously that's outside the scope of this PR. 

https://github.com/llvm/llvm-project/pull/125839
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] s/GetAddressRange().GetBaseAddress()/GetAddress() (PR #125847)

2025-02-05 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda approved this pull request.

LGTM.

https://github.com/llvm/llvm-project/pull/125847
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [clang] NFC: rename MatchedPackOnParmToNonPackOnArg to StrictPackMatch (PR #125418)

2025-02-05 Thread Matheus Izvekov via lldb-commits

https://github.com/mizvekov updated 
https://github.com/llvm/llvm-project/pull/125418

>From 29c48b0785af13572a785f90747529ffe7a572ed Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Sun, 2 Feb 2025 13:31:20 -0300
Subject: [PATCH] [clang] NFC: rename MatchedPackOnParmToNonPackOnArg to
 StrictPackMatch

This rename follows the proposed wording in P3310R5, which introduces
the term 'strict pack match' to refer to the same thing.
---
 clang/include/clang/AST/DeclTemplate.h| 12 +++
 clang/include/clang/Sema/Overload.h   |  5 ++-
 clang/include/clang/Sema/Sema.h   | 33 +--
 clang/include/clang/Sema/TemplateDeduction.h  | 10 ++
 clang/lib/AST/ASTImporter.cpp |  8 ++---
 clang/lib/AST/DeclTemplate.cpp| 18 --
 clang/lib/AST/JSONNodeDumper.cpp  |  2 +-
 clang/lib/AST/TextNodeDumper.cpp  |  2 +-
 clang/lib/Sema/SemaOverload.cpp   | 30 +++--
 clang/lib/Sema/SemaTemplate.cpp   | 29 
 clang/lib/Sema/SemaTemplateDeduction.cpp  | 21 ++--
 clang/lib/Sema/SemaTemplateInstantiate.cpp| 16 -
 .../lib/Sema/SemaTemplateInstantiateDecl.cpp  |  2 +-
 clang/lib/Sema/SemaType.cpp   |  3 +-
 clang/lib/Serialization/ASTReaderDecl.cpp |  2 +-
 clang/lib/Serialization/ASTWriterDecl.cpp |  2 +-
 .../Clang/CxxModuleHandler.cpp|  2 +-
 17 files changed, 86 insertions(+), 111 deletions(-)

diff --git a/clang/include/clang/AST/DeclTemplate.h 
b/clang/include/clang/AST/DeclTemplate.h
index 03c43765206b18..87406b0e030df1 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -1842,11 +1842,11 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
   unsigned SpecializationKind : 3;
 
   /// Indicate that we have matched a parameter pack with a non pack
-  /// argument, when the opposite match is also allowed (strict pack match).
+  /// argument, when the opposite match is also allowed.
   /// This needs to be cached as deduction is performed during declaration,
   /// and we need the information to be preserved so that it is consistent
   /// during instantiation.
-  bool MatchedPackOnParmToNonPackOnArg : 1;
+  bool StrictPackMatch : 1;
 
 protected:
   ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK,
@@ -1854,7 +1854,7 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
   SourceLocation IdLoc,
   ClassTemplateDecl *SpecializedTemplate,
   ArrayRef Args,
-  bool MatchedPackOnParmToNonPackOnArg,
+  bool StrictPackMatch,
   ClassTemplateSpecializationDecl *PrevDecl);
 
   ClassTemplateSpecializationDecl(ASTContext &C, Kind DK);
@@ -1867,7 +1867,7 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
   Create(ASTContext &Context, TagKind TK, DeclContext *DC,
  SourceLocation StartLoc, SourceLocation IdLoc,
  ClassTemplateDecl *SpecializedTemplate,
- ArrayRef Args, bool MatchedPackOnParmToNonPackOnArg,
+ ArrayRef Args, bool StrictPackMatch,
  ClassTemplateSpecializationDecl *PrevDecl);
   static ClassTemplateSpecializationDecl *CreateDeserialized(ASTContext &C,
  GlobalDeclID ID);
@@ -1938,9 +1938,7 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
 SpecializationKind = TSK;
   }
 
-  bool hasMatchedPackOnParmToNonPackOnArg() const {
-return MatchedPackOnParmToNonPackOnArg;
-  }
+  bool hasStrictPackMatch() const { return StrictPackMatch; }
 
   /// Get the point of instantiation (if any), or null if none.
   SourceLocation getPointOfInstantiation() const {
diff --git a/clang/include/clang/Sema/Overload.h 
b/clang/include/clang/Sema/Overload.h
index c7f2422b542dd1..c03ec00d03dc50 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -933,7 +933,7 @@ class Sema;
 /// Have we matched any packs on the parameter side, versus any non-packs 
on
 /// the argument side, in a context where the opposite matching is also
 /// allowed?
-bool HasMatchedPackOnParmToNonPackOnArg : 1;
+bool StrictPackMatch : 1;
 
 /// True if the candidate was found using ADL.
 LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
@@ -1010,8 +1010,7 @@ class Sema;
 friend class OverloadCandidateSet;
 OverloadCandidate()
 : IsSurrogate(false), IgnoreObjectArgument(false),
-  TookAddressOfOverload(false),
-  HasMatchedPackOnParmToNonPackOnArg(false),
+  TookAddressOfOverload(false), StrictPackMatch(false),
   IsADLCandidate(llvm::to_underlying(CallExpr::NotADL)),
   RewriteKind(CRK_None) {}
   };
diff --git a/clang/incl

[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)

2025-02-05 Thread Matheus Izvekov via lldb-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/125791
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/119716

>From b7216d7c3edd5974d84612586fbabdef19037387 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Thu, 26 Dec 2024 20:50:40 -0500
Subject: [PATCH 1/4] Implement LLDB Telemetry (Part 1)

This contains only the concrete implementation of the framework to be used but 
no usages yet.

This is a subset of PR/98528.

I plan to send a few follow-up patches:
part2 : includes changes in the plugin-manager to set up the plugin stuff (ie., 
how to create a default vs vendor impl)
part3 (all of the following can be done in parallel):
* part 3_a: define DebuggerTelemetryInfo and related methods to collect data 
about debugger startup/exit
* part 3_b: define TargetTelemetryInfo and related methods to collect data 
about debug target(s)
* part 3_c: define CommandTelemetryInfo and related methods to collect data 
about debug-commands
* part 3_d: define ClientTelemtryInfo and related methods to collect data about 
lldb-dap/any other client
---
 lldb/include/lldb/Core/Telemetry.h| 101 ++
 lldb/include/lldb/lldb-enumerations.h |   4 +-
 lldb/source/Core/CMakeLists.txt   |   2 +
 lldb/source/Core/Telemetry.cpp|  92 +++
 lldb/test/CMakeLists.txt  |   3 +
 5 files changed, 200 insertions(+), 2 deletions(-)
 create mode 100644 lldb/include/lldb/Core/Telemetry.h
 create mode 100644 lldb/source/Core/Telemetry.cpp

diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
new file mode 100644
index 00..882511efd804d2
--- /dev/null
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -0,0 +1,101 @@
+//===-- Telemetry.h --*- C++
+//-*-===//
+//
+// 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.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_CORE_TELEMETRY_H
+#define LLDB_CORE_TELEMETRY_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
+#include "llvm/Telemetry/Telemetry.h"
+
+namespace lldb_private {
+
+using llvm::telemetry::Destination;
+using llvm::telemetry::KindType;
+using llvm::telemetry::Serializer;
+using llvm::telemetry::TelemetryInfo;
+
+struct LldbEntryKind : public ::llvm::telemetry::EntryKind {
+  static const KindType BaseInfo = 0b11000;
+};
+
+/// Defines a convenient type for timestamp of various events.
+/// This is used by the EventStats below.
+using SteadyTimePoint = std::chrono::time_point;
+
+/// Various time (and possibly memory) statistics of an event.
+struct EventStats {
+  // REQUIRED: Start time of an event
+  SteadyTimePoint start;
+  // OPTIONAL: End time of an event - may be empty if not meaningful.
+  std::optional end;
+  // TBD: could add some memory stats here too?
+
+  EventStats() = default;
+  EventStats(SteadyTimePoint start) : start(start) {}
+  EventStats(SteadyTimePoint start, SteadyTimePoint end)
+  : start(start), end(end) {}
+};
+
+/// Describes the exit signal of an event.
+struct ExitDescription {
+  int exit_code;
+  std::string description;
+};
+
+struct LldbBaseTelemetryInfo : public TelemetryInfo {
+  EventStats stats;
+
+  std::optional exit_desc;
+
+  Debugger *debugger;
+
+  // For dyn_cast, isa, etc operations.
+  KindType getKind() const override { return LldbEntryKind::BaseInfo; }
+
+  static bool classof(const TelemetryInfo *t) {
+// Subclasses of this is also acceptable.
+return (t->getKind() & LldbEntryKind::BaseInfo) == LldbEntryKind::BaseInfo;
+  }
+
+  void serialize(Serializer &serializer) const override;
+};
+
+/// The base Telemetry manager instance in LLDB
+/// This class declares additional instrumentation points
+/// applicable to LLDB.
+class TelemetryManager : public llvm::telemetry::Manager {
+public:
+  TelemetryManager(std::unique_ptr config);
+
+  llvm::Error dispatch(TelemetryInfo *entry) override;
+
+  void addDestination(std::unique_ptr destination) override;
+
+private:
+  std::unique_ptr m_config;
+  const std::string m_session_uuid;
+  std::vector> m_destinations;
+};
+
+} // namespace lldb_private
+#endif // LLDB_CORE_TELEMETRY_H
diff --git a/lldb/include/lldb/lldb-enumerations.h 
b/lldb/include/lldb/lldb-enumerations.h
index 0094fcd596fdf7..f63e446b6042f6 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -257,8 +257,8 @@ enum StopReason {
 };
 
 /// Command Return Status Types.
-enum ReturnStatus {
-  eReturnStatusInvalid,
+enum ReturnStatus : int {
+  eReturnStatusInvalid = 

[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo] Make some block-start-position methods return iterators (PR #124287)

2025-02-05 Thread Harald van Dijk via lldb-commits

hvdijk wrote:

Given that https://llvm.org/docs/RemoveDIsDebugInfo.html specifically documents 
these functions as "no plans to deprecate", even though I personally feel like 
they are a bad idea, I just updated them so they compile with no deprecation 
warnings. Does this look like a good approach? Should I create a PR, or would 
you prefer a different approach and/or would you like to make some changes to 
it?

https://github.com/llvm/llvm-project/pull/124287
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)

2025-02-05 Thread Erich Keane via lldb-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/125791
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Vy Nguyen via lldb-commits


@@ -0,0 +1,92 @@
+//===-- Telemetry.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.0 WITH LLVM-exception
+//
+//===--===//
+#include "lldb/Core/Telemetry.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Target/Statistics.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/UUID.h"
+#include "lldb/Version/Version.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/RandomNumberGenerator.h"
+#include "llvm/Telemetry/Telemetry.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private {
+
+using ::llvm::Error;
+using ::llvm::telemetry::Destination;
+using ::llvm::telemetry::TelemetryInfo;
+
+static uint64_t ToNanosec(const SteadyTimePoint Point) {
+  return nanoseconds(Point.value().time_since_epoch()).count();
+}
+
+void LldbBaseTelemetryInfo::serialize(Serializer &serializer) const {
+  serializer.write("entry_kind", getKind());
+  serializer.write("session_id", SessionId);
+  serializer.write("start_time", ToNanosec(stats.start));
+  if (stats.end.has_value())
+serializer.write("end_time", ToNanosec(stats.end.value()));
+  if (exit_desc.has_value()) {
+serializer.write("exit_code", exit_desc->exit_code);
+serializer.write("exit_msg", exit_desc->description);
+  }
+}
+
+static std::string MakeUUID(lldb_private::Debugger *debugger) {
+  std::string ret;
+  uint8_t random_bytes[16];
+  if (auto ec = llvm::getRandomBytes(random_bytes, 16)) {
+LLDB_LOG(GetLog(LLDBLog::Object),
+ "Failed to generate random bytes for UUID: {0}", ec.message());
+// fallback to using timestamp + debugger ID.
+ret = std::to_string(
+  std::chrono::steady_clock::now().time_since_epoch().count()) +
+  "_" + std::to_string(debugger->GetID());
+  } else {
+ret = lldb_private::UUID(random_bytes).GetAsString();
+  }
+
+  return ret;
+}
+
+TelemetryManager::TelemetryManager(
+std::unique_ptr config,
+lldb_private::Debugger *debugger)
+: m_config(std::move(config)), m_debugger(debugger),

oontvoo wrote:

No, sorry - this was the outdated code (as mentioned before, some changes 
didn't seem to get reflected).

I've removed this reference to the debugger* from the constructor, because (as 
you pointed out in another comment), we don't want to tie the manager to a 
specific debugger. Instead, we'd attach a pointer to the debugger to each 
TelemetryInfo. The pointer could be null in cases where there isn't a debugger.

Does that make sense?

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun via lldb-commits


@@ -9,7 +9,13 @@
 #include "FifoFiles.h"
 #include "JSONUtils.h"
 

SuibianP wrote:

Removed one empty line and preserved those around `ifdef` guarded includes, the 
same way `lldb-dap.cpp` does it.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun 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::error_code(errno, std::generic_category());
+llvm::errs() << "Failed to open fifo file " << path << ": " << EC.message()
+ << "\n";
+std::terminate();
+  }
+  if (setvbuf(m_file, NULL, _IONBF, 0))
+llvm::errs() << "Error setting unbuffered mode on C FILE\n";
+}
+FifoFile::FifoFile(StringRef path, FILE *f) : m_path(path), m_file(f) {}
+FifoFile::FifoFile(FifoFile &&other)
+: m_path(other.m_path), m_file(other.m_file) {
+  other.m_file = nullptr;

SuibianP wrote:

Called `clear` on it.

Also fixed one place where the moved `m_path` was still used.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)

2025-02-05 Thread Michael Buch via lldb-commits


@@ -280,7 +280,8 @@ std::optional 
CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
   new_class_template->getDeclContext(),
   new_class_template->getTemplatedDecl()->getLocation(),
   new_class_template->getLocation(), new_class_template, imported_args,
-  nullptr);
+  td->hasMatchedPackOnParmToNonPackOnArg(),
+  /*PrevDecl=*/nullptr);

Michael137 wrote:

yup this is correct, thanks

https://github.com/llvm/llvm-project/pull/125791
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun 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::error_code(errno, std::generic_category());
+llvm::errs() << "Failed to open fifo file " << path << ": " << EC.message()
+ << "\n";
+std::terminate();
+  }
+  if (setvbuf(m_file, NULL, _IONBF, 0))
+llvm::errs() << "Error setting unbuffered mode on C FILE\n";
+}
+FifoFile::FifoFile(StringRef path, FILE *f) : m_path(path), m_file(f) {}
+FifoFile::FifoFile(FifoFile &&other)
+: m_path(other.m_path), m_file(other.m_file) {
+  other.m_file = nullptr;
+}
 FifoFile::~FifoFile() {
+  if (m_file)
+fclose(m_file);
 #if !defined(_WIN32)
+  // Unreferenced named pipes are deleted automatically on Win32
   unlink(m_path.c_str());
 #endif
 }
 
-Expected> CreateFifoFile(StringRef path) {
-#if defined(_WIN32)
-  return createStringError(inconvertibleErrorCode(), "Unimplemented");
+// This probably belongs to llvm::sys::fs as another FSEntity type
+std::error_code createNamedPipe(const Twine &Prefix, StringRef Suffix,
+int &ResultFd,
+SmallVectorImpl &ResultPath) {
+  const char *Middle = Suffix.empty() ? "-%%" : "-%%.";
+  auto EC = sys::fs::getPotentiallyUniqueFileName(
+#ifdef _WIN32
+  ".\\pipe\\LOCAL\\"
+#else
+  "/tmp/"
+#endif
+  + Prefix + Middle + Suffix,
+  ResultPath);
+  if (EC)
+return EC;
+  ResultPath.push_back(0);
+  const char *path = ResultPath.data();
+#ifdef _WIN32
+  HANDLE h = ::CreateNamedPipeA(
+  path, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
+  PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, 0, NULL);
+  if (h == INVALID_HANDLE_VALUE)
+return std::error_code(::GetLastError(), std::system_category());
+  ResultFd = _open_osfhandle((intptr_t)h, _O_TEXT | _O_RDWR);
+  if (ResultFd == -1)
+return std::error_code(::GetLastError(), std::system_category());

SuibianP wrote:

Switched.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun 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::error_code(errno, std::generic_category());
+llvm::errs() << "Failed to open fifo file " << path << ": " << EC.message()
+ << "\n";
+std::terminate();
+  }
+  if (setvbuf(m_file, NULL, _IONBF, 0))
+llvm::errs() << "Error setting unbuffered mode on C FILE\n";
+}
+FifoFile::FifoFile(StringRef path, FILE *f) : m_path(path), m_file(f) {}
+FifoFile::FifoFile(FifoFile &&other)
+: m_path(other.m_path), m_file(other.m_file) {
+  other.m_file = nullptr;
+}
 FifoFile::~FifoFile() {
+  if (m_file)
+fclose(m_file);
 #if !defined(_WIN32)
+  // Unreferenced named pipes are deleted automatically on Win32
   unlink(m_path.c_str());
 #endif
 }
 
-Expected> CreateFifoFile(StringRef path) {
-#if defined(_WIN32)
-  return createStringError(inconvertibleErrorCode(), "Unimplemented");
+// This probably belongs to llvm::sys::fs as another FSEntity type
+std::error_code createNamedPipe(const Twine &Prefix, StringRef Suffix,
+int &ResultFd,
+SmallVectorImpl &ResultPath) {
+  const char *Middle = Suffix.empty() ? "-%%" : "-%%.";
+  auto EC = sys::fs::getPotentiallyUniqueFileName(
+#ifdef _WIN32
+  ".\\pipe\\LOCAL\\"
+#else
+  "/tmp/"
+#endif
+  + Prefix + Middle + Suffix,
+  ResultPath);
+  if (EC)
+return EC;
+  ResultPath.push_back(0);
+  const char *path = ResultPath.data();
+#ifdef _WIN32
+  HANDLE h = ::CreateNamedPipeA(
+  path, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
+  PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, 0, NULL);
+  if (h == INVALID_HANDLE_VALUE)
+return std::error_code(::GetLastError(), std::system_category());

SuibianP wrote:

Didn't know this utility function existed. Switched to it.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun 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::error_code(errno, std::generic_category());
+llvm::errs() << "Failed to open fifo file " << path << ": " << EC.message()
+ << "\n";
+std::terminate();
+  }
+  if (setvbuf(m_file, NULL, _IONBF, 0))
+llvm::errs() << "Error setting unbuffered mode on C FILE\n";
+}
+FifoFile::FifoFile(StringRef path, FILE *f) : m_path(path), m_file(f) {}
+FifoFile::FifoFile(FifoFile &&other)
+: m_path(other.m_path), m_file(other.m_file) {
+  other.m_file = nullptr;
+}
 FifoFile::~FifoFile() {
+  if (m_file)
+fclose(m_file);
 #if !defined(_WIN32)
+  // Unreferenced named pipes are deleted automatically on Win32
   unlink(m_path.c_str());
 #endif
 }
 
-Expected> CreateFifoFile(StringRef path) {
-#if defined(_WIN32)
-  return createStringError(inconvertibleErrorCode(), "Unimplemented");
+// This probably belongs to llvm::sys::fs as another FSEntity type
+std::error_code createNamedPipe(const Twine &Prefix, StringRef Suffix,

SuibianP wrote:

`llvm::sys::fs` functions seem to have a convention on returning 
`std::error_code` so I followed them. The function does not have any additional 
information to add on, so I think `error_code` should be sufficient.

Are there benefits using `llvm::Error`?

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun via lldb-commits


@@ -2249,6 +2249,11 @@ llvm::Error request_runInTerminal(DAP &dap,
}
  });
 
+  llvm::errs() << "WaitForLauncher\n";

SuibianP wrote:

Oops, debug leftover again... Removed.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun via lldb-commits


@@ -21,21 +23,22 @@ 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(llvm::StringRef path, FILE *f);

SuibianP wrote:

Removed.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun via lldb-commits


@@ -2249,6 +2249,11 @@ llvm::Error request_runInTerminal(DAP &dap,
}
  });
 
+  llvm::errs() << "WaitForLauncher\n";
+  auto err = comm_channel.WaitForLauncher();
+  llvm::errs() << "WaitForLauncher returned\n";

SuibianP wrote:

Removed.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun via lldb-commits


@@ -24,41 +30,95 @@ using namespace llvm;
 
 namespace lldb_dap {
 
-FifoFile::FifoFile(StringRef path) : m_path(path) {}
+std::error_code EC;

SuibianP wrote:

Unintended, moved into function.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun via lldb-commits


@@ -21,21 +23,22 @@ 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(llvm::StringRef path, FILE *f);
+  FifoFile(FifoFile &&other);
+
+  FifoFile(const FifoFile &) = delete;
+  FifoFile &operator=(const FifoFile &) = delete;
 
   ~FifoFile();
 
   std::string m_path;
+  FILE *m_file;
 };
 
-/// Create a fifo file in the filesystem.
-///
-/// \param[in] path
-/// The path for the fifo file.
-///
-/// \return
-/// A \a std::shared_ptr if the file could be created, or an
-/// \a llvm::Error in case of failures.
-llvm::Expected> CreateFifoFile(llvm::StringRef path);
+std::error_code createNamedPipe(const llvm::Twine &Prefix,

SuibianP wrote:

Added doxygen comments, changed to snake_case and renamed function to 
`createUniqueNamedPipe`.

https://github.com/llvm/llvm-project/pull/121269
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Hu Jialun via lldb-commits

https://github.com/SuibianP updated 
https://github.com/llvm/llvm-project/pull/121269

>From c656de0311a7ecb954b1ac1ce0eda1879efffeb6 Mon Sep 17 00:00:00 2001
From: Hu Jialun 
Date: Sat, 28 Dec 2024 22:39:33 +0800
Subject: [PATCH] [lldb-dap] Implement runInTerminal for Windows

Currently, the named pipe is passed by name and a transient ofstream is
constructed at each I/O request. This assumes,
  - Blocking semantics: FIFO I/O waits for the other side to connect.
  - Buffered semantics: Closing one side does not discard existing data.

The former can be replaced by WaitNamedPipe/ConnectNamedPipe on Win32,
but the second cannot be easily worked around. It is also impossible to
have another "keep-alive" pipe server instance, as server-client pairs
are fixed on connection on Win32 and the client may get connected to it
instead of the real one.

Refactor FifoFile[IO] to use an open file handles rather than file name.

---

Win32 provides no way to replace the process image. Under the hood exec*
actually creates a new process with a new PID. DebugActiveProcess also
cannot get notified of process creations.

Create the new process in a suspended state and resume it after attach.
---
 lldb/packages/Python/lldbsuite/test/dotest.py |   2 +-
 .../runInTerminal/TestDAP_runInTerminal.py|   3 -
 .../API/tools/lldb-dap/runInTerminal/main.c   |   6 +-
 lldb/tools/lldb-dap/FifoFiles.cpp | 122 +++---
 lldb/tools/lldb-dap/FifoFiles.h   |  29 +++--
 lldb/tools/lldb-dap/RunInTerminal.cpp |  40 +++---
 lldb/tools/lldb-dap/RunInTerminal.h   |   9 +-
 lldb/tools/lldb-dap/lldb-dap.cpp  |  53 ++--
 8 files changed, 201 insertions(+), 63 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index 681ea1638f2d6f..538cece8b4913d 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -545,7 +545,7 @@ def setupSysPath():
 
 lldbDir = os.path.dirname(lldbtest_config.lldbExec)
 
-lldbDAPExec = os.path.join(lldbDir, "lldb-dap")
+lldbDAPExec = os.path.join(lldbDir, "lldb-dap.exe" if os.name == "nt" else 
"lldb-dap")
 if is_exe(lldbDAPExec):
 os.environ["LLDBDAP_EXEC"] = lldbDAPExec
 
diff --git 
a/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py 
b/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py
index ac96bcc1364a27..18a92dd3fa3359 100644
--- a/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py
+++ b/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py
@@ -43,7 +43,6 @@ def isTestSupported(self):
 except:
 return False
 
-@skipIfWindows
 @skipIf(archs=no_match(["x86_64"]))
 def test_runInTerminal(self):
 if not self.isTestSupported():
@@ -113,7 +112,6 @@ def test_runInTerminalWithObjectEnv(self):
 self.assertIn("FOO", request_envs)
 self.assertEqual("BAR", request_envs["FOO"])
 
-@skipIfWindows
 @skipIf(archs=no_match(["x86_64"]))
 def test_runInTerminalInvalidTarget(self):
 if not self.isTestSupported():
@@ -132,7 +130,6 @@ def test_runInTerminalInvalidTarget(self):
 response["message"],
 )
 
-@skipIfWindows
 @skipIf(archs=no_match(["x86_64"]))
 def test_missingArgInRunInTerminalLauncher(self):
 if not self.isTestSupported():
diff --git a/lldb/test/API/tools/lldb-dap/runInTerminal/main.c 
b/lldb/test/API/tools/lldb-dap/runInTerminal/main.c
index 676bd830e657b4..9cc25b2e45a494 100644
--- a/lldb/test/API/tools/lldb-dap/runInTerminal/main.c
+++ b/lldb/test/API/tools/lldb-dap/runInTerminal/main.c
@@ -1,11 +1,13 @@
 #include 
 #include 
-#include 
+
+#include 
+#include 
 
 int main(int argc, char *argv[]) {
   const char *foo = getenv("FOO");
   for (int counter = 1;; counter++) {
-sleep(1); // breakpoint
+thrd_sleep(&(struct timespec){.tv_sec = 1}, NULL); // breakpoint
   }
   return 0;
 }
diff --git a/lldb/tools/lldb-dap/FifoFiles.cpp 
b/lldb/tools/lldb-dap/FifoFiles.cpp
index 1f1bba80bd3b11..dcf121739495d1 100644
--- a/lldb/tools/lldb-dap/FifoFiles.cpp
+++ b/lldb/tools/lldb-dap/FifoFiles.cpp
@@ -8,8 +8,14 @@
 
 #include "FifoFiles.h"
 #include "JSONUtils.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/WindowsError.h"
 
-#if !defined(_WIN32)
+#if defined(_WIN32)
+#include 
+#include 
+#include 
+#else
 #include 
 #include 
 #include 
@@ -24,27 +30,74 @@ 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::error_code(errno, std::generic_category());
+llvm::errs() << "Failed to open fifo file " << path << ": " << EC.message()
+ << "\n";
+std::terminate();
+  }
+  if (setvbuf(m_file, NUL

[Lldb-commits] [clang] [lldb] [clang] NFC: rename MatchedPackOnParmToNonPackOnArg to StrictPackMatch (PR #125418)

2025-02-05 Thread Matheus Izvekov via lldb-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/125418
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb/Host] Add ability to open URLs on macOS (PR #125893)

2025-02-05 Thread Alex Langford via lldb-commits

https://github.com/bulbazord approved this pull request.


https://github.com/llvm/llvm-project/pull/125893
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)

2025-02-05 Thread Vy Nguyen via lldb-commits


@@ -0,0 +1,92 @@
+//===-- Telemetry.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.0 WITH LLVM-exception
+//
+//===--===//
+#include "lldb/Core/Telemetry.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Target/Statistics.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/UUID.h"
+#include "lldb/Version/Version.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/RandomNumberGenerator.h"
+#include "llvm/Telemetry/Telemetry.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace lldb_private {
+
+using ::llvm::Error;
+using ::llvm::telemetry::Destination;
+using ::llvm::telemetry::TelemetryInfo;
+
+static uint64_t ToNanosec(const SteadyTimePoint Point) {
+  return nanoseconds(Point.value().time_since_epoch()).count();
+}
+
+void LldbBaseTelemetryInfo::serialize(Serializer &serializer) const {
+  serializer.write("entry_kind", getKind());
+  serializer.write("session_id", SessionId);
+  serializer.write("start_time", ToNanosec(stats.start));
+  if (stats.end.has_value())
+serializer.write("end_time", ToNanosec(stats.end.value()));
+  if (exit_desc.has_value()) {
+serializer.write("exit_code", exit_desc->exit_code);
+serializer.write("exit_msg", exit_desc->description);
+  }
+}
+
+static std::string MakeUUID(lldb_private::Debugger *debugger) {
+  std::string ret;
+  uint8_t random_bytes[16];
+  if (auto ec = llvm::getRandomBytes(random_bytes, 16)) {
+LLDB_LOG(GetLog(LLDBLog::Object),
+ "Failed to generate random bytes for UUID: {0}", ec.message());
+// fallback to using timestamp + debugger ID.
+ret = std::to_string(
+  std::chrono::steady_clock::now().time_since_epoch().count()) +
+  "_" + std::to_string(debugger->GetID());

oontvoo wrote:

done

https://github.com/llvm/llvm-project/pull/119716
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)

2025-02-05 Thread via lldb-commits

jimingham wrote:

If possible, yes.  It would be even more apropos if you could convince yourself 
that the dynamic type was bigger than the buffer for the static type, and you 
refused to read past the buffer...

Jim

> On Feb 4, 2025, at 3:12 PM, Augusto Noronha ***@***.***> wrote:
> 
> 
> To make sure I understand, you want me to write a unittest where I have a 
> value object, and make sure it's dynamic value object child uses the local 
> buffer to store the contents? What should I test? That it prints correctly?
> 
> —
> Reply to this email directly, view it on GitHub 
> , 
> or unsubscribe 
> .
> You are receiving this because your review was requested.
> 



https://github.com/llvm/llvm-project/pull/125143
___
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 vscode launch URLs (PR #125843)

2025-02-05 Thread Jonas Devlieghere 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') {
+const configJson = params.get("config");
+if (configJson === null) {
+throw new Error("Missing `config` URI parameter");
+}
+// Build the debug config

JDevlieghere wrote:

```suggestion
// Build the debug config.
```

https://github.com/llvm/llvm-project/pull/125843
___
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 vscode launch URLs (PR #125843)

2025-02-05 Thread Jonas Devlieghere via lldb-commits


@@ -174,6 +174,20 @@ The default hostname being used `localhost`.
 }
 ```
 
+### Launching via `vscode://` URIs
+
+Debugging sessions can also be starting using special URIs.
+
+The 
`vscode://llvm-vs-code-extensions.lldb-dap/launch/config?config={launch-config}`
+URI accepts a [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding)
+JSON launch config.
+
+This is useful, e.g., to integrate with custom scripts which start debugging
+sessions. The URIs might be printed to the terminal, potentially using

JDevlieghere wrote:

```suggestion
This is useful for integration with custom scripts to start debugging
sessions. The URI might be printed to the terminal, potentially using
```

https://github.com/llvm/llvm-project/pull/125843
___
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 vscode launch URLs (PR #125843)

2025-02-05 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.

Thanks! LGTM with small nits. 

https://github.com/llvm/llvm-project/pull/125843
___
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 vscode launch URLs (PR #125843)

2025-02-05 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere edited 
https://github.com/llvm/llvm-project/pull/125843
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang edited 
https://github.com/llvm/llvm-project/pull/125832
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang edited 
https://github.com/llvm/llvm-project/pull/125832
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2025-02-05 Thread Adrian Vogelsgesang 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",

vogelsgesang wrote:

The engine field states that we support `^1.75.0`. I.e., we also claim support 
with version 1.75. Now, if I would declare `@types/vscode` as `^1.75`, I might 
end up with `@types/vscode` version 1.80. This would allow me to use APIs which 
were only introduced in 1.80, and I would accidentally break compatibility with 
1.75, despite our `engine` property claiming that we would be compatible with 
1.75.

https://github.com/llvm/llvm-project/pull/125832
___
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 vscode launch URLs (PR #125843)

2025-02-05 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang updated 
https://github.com/llvm/llvm-project/pull/125843

>From cd525991ef676df7108e825eff35610638f8d7ea Mon Sep 17 00:00:00 2001
From: Adrian Vogelsgesang 
Date: Wed, 5 Feb 2025 10:11:38 +
Subject: [PATCH 1/2] [lldb-dap] Support vscode launch URLs

This commit adds support for starting debug sessions through special
`vscode://llvm-vs-code-extensions.lldb-dap/launch/config?config={launch-config}`
URIs. This allows tighter integration with custom scripts. One potential
use case is providing similar functionality to `xcdebug`, see #125777
for some discussion on that use case.

The functionality was inspired by @vadimcn's CodeLLDB extension, which
[provides similar 
functionality](https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#debugging-externally-launched-code).
---
 lldb/tools/lldb-dap/README.md |   16 +-
 lldb/tools/lldb-dap/package-lock.json | 1639 +++--
 lldb/tools/lldb-dap/package.json  |5 +-
 lldb/tools/lldb-dap/src-ts/extension.ts   |7 +-
 .../lldb-dap/src-ts/uri-launch-handler.ts |   37 +
 5 files changed, 1505 insertions(+), 199 deletions(-)
 create mode 100644 lldb/tools/lldb-dap/src-ts/uri-launch-handler.ts

diff --git a/lldb/tools/lldb-dap/README.md b/lldb/tools/lldb-dap/README.md
index 123869a033724f..34876c4c37cb6b 100644
--- a/lldb/tools/lldb-dap/README.md
+++ b/lldb/tools/lldb-dap/README.md
@@ -174,6 +174,20 @@ The default hostname being used `localhost`.
 }
 ```
 
+### Launching via `vscode://` URIs
+
+Debugging sessions can also be starting using special URIs.
+
+The 
`vscode://llvm-vs-code-extensions.lldb-dap/launch/config?config={launch-config}`
+URI accepts a [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding)
+JSON launch config.
+
+This is useful, e.g., to integrate with custom scripts which start debugging
+sessions. The URIs might be printed to the terminal, potentially using
+[OSC-8 
hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda),
+or passed to `vscode --open-url` or `xdg-open`, although mileage may vary
+depending on your specific debugging setup.
+
 ### Configuration Settings Reference
 
 For both launch and attach configurations, lldb-dap accepts the following 
`lldb-dap`
@@ -328,4 +342,4 @@ The source code is part of the [LLVM 
repository](https://github.com/llvm/llvm-pr
 We use Github's [issue 
tracker](https://github.com/llvm/llvm-project/issues?q=label%3Alldb-dap) and 
patches can be submitted via [pull 
requests](https://github.com/llvm/llvm-project/pulls?q=label%3Alldb-dap).
 Furthermore, there is a [LLDB 
category](https://discourse.llvm.org/c/subprojects/lldb/8) on the LLVM 
discourse forum.
 
-For instructions on how to get started with development on lldb-dap, see the 
"[Contributing to lldb-dap](https://lldb.llvm.org/resources/lldbdap.html)"
+For instructions on how to get started with development on lldb-dap, see the 
"[Contributing to lldb-dap](https://lldb.llvm.org/resources/lldbdap.html)" 
guide.
diff --git a/lldb/tools/lldb-dap/package-lock.json 
b/lldb/tools/lldb-dap/package-lock.json
index d1cb6d00ecf566..8fddc2e4bb4e26 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -1,17 +1,17 @@
 {
   "name": "lldb-dap",
-  "version": "0.2.8",
+  "version": "0.2.9",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
 "": {
   "name": "lldb-dap",
-  "version": "0.2.8",
+  "version": "0.2.9",
   "license": "Apache 2.0 License with LLVM exceptions",
   "devDependencies": {
 "@types/node": "^18.11.18",
 "@types/vscode": "~1.74.0",
-"@vscode/vsce": "^2.19.0",
+"@vscode/vsce": "^3.2.2",
 "prettier": "^3.1.1",
 "prettier-plugin-curly": "^0.1.3",
 "typescript": "^4.6.4"
@@ -20,6 +20,187 @@
 "vscode": "^1.75.0"
   }
 },
+"node_modules/@azure/abort-controller": {
+  "version": "2.1.2",
+  "resolved": 
"https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz";,
+  "integrity": 
"sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"tslib": "^2.6.2"
+  },
+  "engines": {
+"node": ">=18.0.0"
+  }
+},
+"node_modules/@azure/core-auth": {
+  "version": "1.9.0",
+  "resolved": 
"https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.9.0.tgz";,
+  "integrity": 
"sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"@azure/abort-controller": "^2.0.0",
+"@azure/core-util": "^1.11.0",
+"tslib": "^2.6.2"
+  },
+  "engines": {
+"node": ">=18.0.0"
+  }
+},
+"node_modules/@azure/core-client": {
+  "version": "1.9.2",
+  

[Lldb-commits] [clang] [lldb] [clang] NFC: rename MatchedPackOnParmToNonPackOnArg to StrictPackMatch (PR #125418)

2025-02-05 Thread Matheus Izvekov via lldb-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/125418
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] c94d930 - [clang] NFC: rename MatchedPackOnParmToNonPackOnArg to StrictPackMatch (#125418)

2025-02-05 Thread via lldb-commits

Author: Matheus Izvekov
Date: 2025-02-05T13:16:33-03:00
New Revision: c94d930a212248d7102822ca7d0e37e72fd38cb3

URL: 
https://github.com/llvm/llvm-project/commit/c94d930a212248d7102822ca7d0e37e72fd38cb3
DIFF: 
https://github.com/llvm/llvm-project/commit/c94d930a212248d7102822ca7d0e37e72fd38cb3.diff

LOG: [clang] NFC: rename MatchedPackOnParmToNonPackOnArg to StrictPackMatch 
(#125418)

This rename follows the proposed wording in P3310R5, which introduces
the term 'strict pack match' to refer to the same thing.

Added: 


Modified: 
clang/include/clang/AST/DeclTemplate.h
clang/include/clang/Sema/Overload.h
clang/include/clang/Sema/Sema.h
clang/include/clang/Sema/TemplateDeduction.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/DeclTemplate.cpp
clang/lib/AST/JSONNodeDumper.cpp
clang/lib/AST/TextNodeDumper.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp

Removed: 




diff  --git a/clang/include/clang/AST/DeclTemplate.h 
b/clang/include/clang/AST/DeclTemplate.h
index 03c43765206b18..87406b0e030df1 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -1842,11 +1842,11 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
   unsigned SpecializationKind : 3;
 
   /// Indicate that we have matched a parameter pack with a non pack
-  /// argument, when the opposite match is also allowed (strict pack match).
+  /// argument, when the opposite match is also allowed.
   /// This needs to be cached as deduction is performed during declaration,
   /// and we need the information to be preserved so that it is consistent
   /// during instantiation.
-  bool MatchedPackOnParmToNonPackOnArg : 1;
+  bool StrictPackMatch : 1;
 
 protected:
   ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK,
@@ -1854,7 +1854,7 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
   SourceLocation IdLoc,
   ClassTemplateDecl *SpecializedTemplate,
   ArrayRef Args,
-  bool MatchedPackOnParmToNonPackOnArg,
+  bool StrictPackMatch,
   ClassTemplateSpecializationDecl *PrevDecl);
 
   ClassTemplateSpecializationDecl(ASTContext &C, Kind DK);
@@ -1867,7 +1867,7 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
   Create(ASTContext &Context, TagKind TK, DeclContext *DC,
  SourceLocation StartLoc, SourceLocation IdLoc,
  ClassTemplateDecl *SpecializedTemplate,
- ArrayRef Args, bool MatchedPackOnParmToNonPackOnArg,
+ ArrayRef Args, bool StrictPackMatch,
  ClassTemplateSpecializationDecl *PrevDecl);
   static ClassTemplateSpecializationDecl *CreateDeserialized(ASTContext &C,
  GlobalDeclID ID);
@@ -1938,9 +1938,7 @@ class ClassTemplateSpecializationDecl : public 
CXXRecordDecl,
 SpecializationKind = TSK;
   }
 
-  bool hasMatchedPackOnParmToNonPackOnArg() const {
-return MatchedPackOnParmToNonPackOnArg;
-  }
+  bool hasStrictPackMatch() const { return StrictPackMatch; }
 
   /// Get the point of instantiation (if any), or null if none.
   SourceLocation getPointOfInstantiation() const {

diff  --git a/clang/include/clang/Sema/Overload.h 
b/clang/include/clang/Sema/Overload.h
index c7f2422b542dd1..c03ec00d03dc50 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -933,7 +933,7 @@ class Sema;
 /// Have we matched any packs on the parameter side, versus any non-packs 
on
 /// the argument side, in a context where the opposite matching is also
 /// allowed?
-bool HasMatchedPackOnParmToNonPackOnArg : 1;
+bool StrictPackMatch : 1;
 
 /// True if the candidate was found using ADL.
 LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
@@ -1010,8 +1010,7 @@ class Sema;
 friend class OverloadCandidateSet;
 OverloadCandidate()
 : IsSurrogate(false), IgnoreObjectArgument(false),
-  TookAddressOfOverload(false),
-  HasMatchedPackOnParmToNonPackOnArg(false),
+  TookAddressOfOverload(false), StrictPackMatch(false),
   IsADLCandidate(llvm::to_underlying(CallExpr::NotADL)),
   RewriteKind(CRK_None) {}
   };

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 4573a7ab336d4d..1870d1271c556c 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/

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

2025-02-05 Thread Adrian Vogelsgesang via lldb-commits

vogelsgesang wrote:

Thanks. I updated the PR with your suggestions. I will keep the PR open for a 
couple more days, in case other reviewers also have comments

https://github.com/llvm/llvm-project/pull/125843
___
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 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') {

ashgti wrote:

Should we shorten the path to `/launch`? We already are using the param 
`config` so having that twice feels a little redundant.

Or we could take the search params as keys into the launch config like:

```ts
const launchConfig = {...};
const url = new 
URL("vscode://llvm-vs-code-extensions.lldb-dap/launch?program=/a.out&initCommands=a&initCommands=b")

const stringKeys = ["program"];
const numberKeys = ["pid"];
const arrayKeys = ["initCommands"];

for (const key of stringKeys) {
  const value = url.searchParams.get(key);
  if (value) {
launchConfig[key] = value;
  }
}

for (const key of numberKeys) {
  const value = url.searchParams.get(key);
  if (value) {
launchConfig[key] = Number(value);
  }
}

for (const key of arrayKeys) {
  const value = url.searchParams.getAll(key); // note, getAll() returns an 
array of strings.
  if (value) {
launchConfig[key] = value;
  }
}

console.log(launchConfig); // => { "program": "/a.out", "initCommands": ["a", 
"b"] }
```

https://github.com/llvm/llvm-project/pull/125843
___
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-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 multiple connections.

This adjusts the lldb-dap listening mode to accept multiple clients.
Each client initializes a new instance of DAP and an associated 
`lldb::SBDebugger` instance.

The listening mode is configured with the `--connection` option and supports 
listening on a port or a unix socket on supported platforms.
---
 .../test/tools/lldb-dap/dap_server.py |  74 -
 .../test/tools/lldb-dap/lldbdap_testcase.py   |   6 +-
 lldb/test/API/tools/lldb-dap/server/Makefile  |   3 +
 .../tools/lldb-dap/server/TestDAP_server.py   |  77 +
 lldb/test/API/tools/lldb-dap/server/main.c|  10 +
 lldb/test/Shell/DAP/TestOptions.test  |   4 +-
 lldb/tools/lldb-dap/DAP.cpp   |  18 +-
 lldb/tools/lldb-dap/DAP.h |   6 +-
 lldb/tools/lldb-dap/DAPForward.h  |   2 +
 lldb/tools/lldb-dap/Options.td|  22 +-
 lldb/tools/lldb-dap/lldb-dap.cpp  | 283 +++---
 11 files changed, 358 insertions(+), 147 deletions(-)
 create mode 100644 lldb/test/API/tools/lldb-dap/server/Makefile
 create mode 100644 lldb/test/API/tools/lldb-dap/server/TestDAP_server.py
 create mode 100644 lldb/test/API/tools/lldb-dap/server/main.c

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index c29992ce9c7848e..6d765e10236733a 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -903,7 +903,7 @@ def request_setBreakpoints(self, file_path, line_array, 
data=None):
 "sourceModified": False,
 }
 if line_array is not None:
-args_dict["lines"] = "%s" % line_array
+args_dict["lines"] = line_array
 breakpoints = []
 for i, line in enumerate(line_array):
 breakpoint_data = None
@@ -1150,11 +1150,12 @@ def request_setInstructionBreakpoints(self, 
memory_reference=[]):
 }
 return self.send_recv(command_dict)
 
+
 class DebugAdaptorServer(DebugCommunication):
 def __init__(
 self,
 executable=None,
-port=None,
+connection=None,
 init_commands=[],
 log_file=None,
 env=None,
@@ -1167,21 +1168,62 @@ def __init__(
 
 if log_file:
 adaptor_env["LLDBDAP_LOG"] = log_file
+args = [executable]
+
+if connection is not None:
+args.append("--connection")
+args.append(connection)
+
 self.process = subprocess.Popen(
-[executable],
+args,
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
 env=adaptor_env,
 )
+
+if connection is not None:
+# If the process was also launched, parse the connection from the
+# resolved connection. For example, if the connection
+# `connection://localhost:0` was specified then the OS would pick a
+# random port for listening and lldb-dap would print the listening
+# port to stdout.
+if self.process is not None:
+# lldb-dap will print the listening address once the listener 
is
+# made to stdout. The listener is formatted like
+# `connection://host:port` or `unix-connection:///path`.
+expected_prefix = "Listening for: "
+out = self.process.stdout.readline().decode()
+if not out.startswith(expected_prefix):
+self.process.kill()
+raise ValueError(
+"lldb-dap failed to print listening address, expected 
'{}', got '{}'".format(
+expected_prefix, out
+)
+)
+
+# If the listener expanded into multiple addresses, use the 
first.
+connection = (
+
out.removeprefix(expected_prefix).rstrip("\r\n").split(",", 1)[0]
+)
+
+scheme, address = connection.split("://")
+if scheme == "unix-connect":  # unix-connect:///path
+s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+s.connect(address)
+elif scheme == "connection":  # connection://[host]:port
+host, port = address.rsplit(":", 1)
+# create_connection with try both ipv4 and ipv6.
+s = socket.create_connection((host.strip("[]"), int(port)))
+

[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda created 
https://github.com/llvm/llvm-project/pull/125969

SBFrame::GetRegisters() (and the .registers / .regs extensions in Python) 
returns an array of register-set's, not registers like you might expect from 
the API name.  Document this.

>From 7418a7074cba0ad4e28232d08b48d6d7a31c8cdb Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 5 Feb 2025 16:12:17 -0800
Subject: [PATCH] [lldb][NFC] Add documentation for SBFrame::GetRegisters

SBFrame::GetRegisters() (and the .registers / .regs extensions in
Python) returns an array of register-set's, not registers like you
might expect from the API name.  Document this.
---
 lldb/bindings/interface/SBFrameDocstrings.i | 16 
 lldb/bindings/interface/SBFrameExtensions.i |  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/lldb/bindings/interface/SBFrameDocstrings.i 
b/lldb/bindings/interface/SBFrameDocstrings.i
index 05a876a685a9127..5823d332c4cdd63 100644
--- a/lldb/bindings/interface/SBFrameDocstrings.i
+++ b/lldb/bindings/interface/SBFrameDocstrings.i
@@ -78,6 +78,22 @@ See also SBThread."
 See also GetFunctionName()."
 ) lldb::SBFrame::IsInlined;
 
+%feature("docstring", "
+Returns an SBValueList which is an array of one or more register
+sets that exist for this thread.  
+Each SBValue in the SBValueList represents one register-set. 
+The first register-set will be the general purpose registers -- 
+the registers printed by the `register read` command-line lldb, with 
+no additional arguments.  
+The register-set SBValue will have a name, e.g. 
+SBFrame::GetRegisters().GetValueAtIndex(0).GetName() 
+may be 'General Purpose Registers', but the general purpose 
+register-set may not use that exact name, it is only a convention 
+used by some stubs.
+A register-set SBValue will have children, one child per register 
+in the register-set."
+) lldb::SBFrame::GetRegisters;
+
 %feature("docstring", "
 Return true if this frame is artificial (e.g a frame synthesized to
 capture a tail call). Local variables may not be available in an artificial
diff --git a/lldb/bindings/interface/SBFrameExtensions.i 
b/lldb/bindings/interface/SBFrameExtensions.i
index e0472280666ab9c..5c7a63ac53b3ec1 100644
--- a/lldb/bindings/interface/SBFrameExtensions.i
+++ b/lldb/bindings/interface/SBFrameExtensions.i
@@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
 args = property(get_arguments, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 arguments = property(get_arguments, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 statics = property(get_statics, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the static variables in this stack frame.''')
-registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
-regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
+registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() of register sets for this thread.  See 
SBFrame::GetRegisters() for details.''')
+regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() of register sets for this thread.  See SBFrame::GetRegisters() 
for details.''')
 register = property(get_registers_access, None, doc='''A read only 
property that returns an helper object providing a flattened indexable view of 
the CPU registers for this stack frame.''')
 reg = property(get_registers_access, None, doc='''A read only property 
that returns an helper object providing a flattened indexable view of the CPU 
registers for this stack frame''')
 parent = property(get_parent_frame, None, doc='''A read only property 
that returns the parent (caller) frame of the current frame.''')

___
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-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 = nullptr;
-  if (portno != -1) {
-printf("Listening on port %i...\n", portno);
-SOCKET socket_fd = AcceptConnection(log.get(), portno);
-if (socket_fd < 0)
-  return EXIT_FAILURE;
+  std::vector pre_init_commands;
+  for (const std::string &arg :
+   input_args.getAllArgValues(OPT_pre_init_command)) {
+pre_init_commands.push_back(arg);
+  }
 
-input = StreamDescriptor::from_socket(socket_fd, true);
-output = StreamDescriptor::from_socket(socket_fd, false);
-  } else {
-#if defined(_WIN32)
-// Windows opens stdout and stdin in text mode which converts \n to 13,10
-// while the value is just 10 on Darwin/Linux. Setting the file mode to
-// binary fixes this.
-int result = _setmode(fileno(stdout), _O_BINARY);
-assert(result);
-result = _setmode(fileno(stdin), _O_BINARY);
-UNUSED_IF_ASSERT_DISABLED(result);
-assert(result);
-#endif
+  auto RunDAP = [](llvm::StringRef program_path, ReplMode repl_mode,
+   std::vector pre_init_commands,
+   std::ofstream *log, std::string name, StreamDescriptor 
input,
+   StreamDescriptor output, std::FILE *redirectOut = nullptr,
+   std::FILE *redirectErr = nullptr) -> bool {
+DAP dap = DAP(name, program_path, log, std::move(input), std::move(output),
+  repl_mode, pre_init_commands);
 
-int stdout_fd = DuplicateFileDescriptor(fileno(stdout));
-if (stdout_fd == -1) {
+// stdout/stderr redirection to the IDE's console
+if (auto Err = dap.ConfigureIO(redirectOut, redirectErr)) {
   llvm::logAllUnhandledErrors(
-  llvm::errorCodeToError(llvm::errnoAsErrorCode()), llvm::errs(),
-  "Failed to configure stdout redirect: ");
+  std::move(Err), llvm::errs(),
+  "Failed to configure lldb-dap IO operations: ");
+  return false;
+}
+
+RegisterRequestCallbacks(dap);
+
+// used only by TestVSCode_redirection_to_console.py
+if (getenv("LLDB_DAP_TEST_STDOUT_STDERR_REDIRECTION") != nullptr)
+  redirection_test();
+
+if (auto Err = dap.Loop()) {
+  std::string errorMessage = llvm::toString(std::move(Err));
+  if (log)
+*log << "Transport Error: " << errorMessage << "\n";
+  return false;
+}
+return true;
+  };
+
+  if (!connection.empty()) {
+auto maybeProtoclAndName = validateConnection(connection);
+if (auto Err = maybeProtoclAndName.takeError()) {
+  llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(),
+  "Invalid connection: ");
   return EXIT_FAILURE;
 }
 
-redirectOut = stdout;
-redirectErr = stderr;
+Socket::SocketProtocol protocol;
+std::string name;
+std::tie(protocol, name) = *maybeProtoclAndName;
 
-input = StreamDescriptor::from_file(fileno(stdin), false);
-output = StreamDescriptor::from_file(stdout_fd, false);
-  }
+Status error;
+std::unique_ptr listener = Socket::Create(protocol, error);
+if (error.Fail()) {
+  llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(),
+  "Failed to create socket listener: ");
+  return EXIT_FAILURE;
+}
 
-  DAP dap = DAP(program_path.str(), log.get(), default_repl_mode,
-std::move(input), std::move(output));
+error = listener->Listen(name, /* backlog */ 5);
+if (error.Fail()) {
+  llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(),
+  "Failed to listen for connections: ");
+  return EXIT_FAILURE;
+}
 
-  // stdout/stderr redirection to the IDE's console
-  if (auto Err = dap.ConfigureIO(redirectOut, redirectErr)) {
-llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(),
-"Failed to configure lldb-dap IO operations: 
");
-return EXIT_FAILURE;
-  }
+std::string address =
+llvm::join(listener->GetListeningConnectionURI(), ", ");
+if (log)
+  *log << "started with connection listeners " << address << "\n";
+
+llvm::outs() << "Listening for: " << address << "\n";
+// Ensure listening address are flushed for calles to retrieve the resolve
+// address.
+llvm::outs().flush();
+
+llvm::DefaultThreadPool pool(llvm::optimal_concurrency());

ashgti wrote:

I again misunderstood how the limit flag was applied to the thread pool.

I moved away from the thread pool and changed this to track the `DAP *` objects 
directly. With that change I was also able to have a clean shutdown when the 
server is interrupted by registering an interrupt handler with 
`llvm::sys::SetInterruptFunction` to trigger the shut

[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)


Changes

SBFrame::GetRegisters() (and the .registers / .regs extensions in Python) 
returns an array of register-set's, not registers like you might expect from 
the API name.  Document this.

---
Full diff: https://github.com/llvm/llvm-project/pull/125969.diff


2 Files Affected:

- (modified) lldb/bindings/interface/SBFrameDocstrings.i (+16) 
- (modified) lldb/bindings/interface/SBFrameExtensions.i (+2-2) 


``diff
diff --git a/lldb/bindings/interface/SBFrameDocstrings.i 
b/lldb/bindings/interface/SBFrameDocstrings.i
index 05a876a685a9127..5823d332c4cdd63 100644
--- a/lldb/bindings/interface/SBFrameDocstrings.i
+++ b/lldb/bindings/interface/SBFrameDocstrings.i
@@ -78,6 +78,22 @@ See also SBThread."
 See also GetFunctionName()."
 ) lldb::SBFrame::IsInlined;
 
+%feature("docstring", "
+Returns an SBValueList which is an array of one or more register
+sets that exist for this thread.  
+Each SBValue in the SBValueList represents one register-set. 
+The first register-set will be the general purpose registers -- 
+the registers printed by the `register read` command-line lldb, with 
+no additional arguments.  
+The register-set SBValue will have a name, e.g. 
+SBFrame::GetRegisters().GetValueAtIndex(0).GetName() 
+may be 'General Purpose Registers', but the general purpose 
+register-set may not use that exact name, it is only a convention 
+used by some stubs.
+A register-set SBValue will have children, one child per register 
+in the register-set."
+) lldb::SBFrame::GetRegisters;
+
 %feature("docstring", "
 Return true if this frame is artificial (e.g a frame synthesized to
 capture a tail call). Local variables may not be available in an artificial
diff --git a/lldb/bindings/interface/SBFrameExtensions.i 
b/lldb/bindings/interface/SBFrameExtensions.i
index e0472280666ab9c..5c7a63ac53b3ec1 100644
--- a/lldb/bindings/interface/SBFrameExtensions.i
+++ b/lldb/bindings/interface/SBFrameExtensions.i
@@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
 args = property(get_arguments, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 arguments = property(get_arguments, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 statics = property(get_statics, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the static variables in this stack frame.''')
-registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
-regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
+registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() of register sets for this thread.  See 
SBFrame::GetRegisters() for details.''')
+regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() of register sets for this thread.  See SBFrame::GetRegisters() 
for details.''')
 register = property(get_registers_access, None, doc='''A read only 
property that returns an helper object providing a flattened indexable view of 
the CPU registers for this stack frame.''')
 reg = property(get_registers_access, None, doc='''A read only property 
that returns an helper object providing a flattened indexable view of the CPU 
registers for this stack frame''')
 parent = property(get_parent_frame, None, doc='''A read only property 
that returns the parent (caller) frame of the current frame.''')

``




https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

not wedded to the specific words I used here, if anyone has an opinion.  just 
want to get something in there.

https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread via lldb-commits

https://github.com/jimingham approved this pull request.

LGTM with or without my nitpicking...

https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread via lldb-commits


@@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
 args = property(get_arguments, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 arguments = property(get_arguments, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 statics = property(get_statics, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the static variables in this stack frame.''')
-registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
-regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
+registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() of register sets for this thread.  See 
SBFrame::GetRegisters() for details.''')

jimingham wrote:

Being incredibly picky, I would say "returns the register sets for this thread 
as a list()".  It always returns all the register sets available, which this 
wording makes a little more clear.

But that's being really picky.

https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread via lldb-commits

https://github.com/jimingham edited 
https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda updated 
https://github.com/llvm/llvm-project/pull/125969

>From 7418a7074cba0ad4e28232d08b48d6d7a31c8cdb Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 5 Feb 2025 16:12:17 -0800
Subject: [PATCH 1/3] [lldb][NFC] Add documentation for SBFrame::GetRegisters

SBFrame::GetRegisters() (and the .registers / .regs extensions in
Python) returns an array of register-set's, not registers like you
might expect from the API name.  Document this.
---
 lldb/bindings/interface/SBFrameDocstrings.i | 16 
 lldb/bindings/interface/SBFrameExtensions.i |  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/lldb/bindings/interface/SBFrameDocstrings.i 
b/lldb/bindings/interface/SBFrameDocstrings.i
index 05a876a685a9127..5823d332c4cdd63 100644
--- a/lldb/bindings/interface/SBFrameDocstrings.i
+++ b/lldb/bindings/interface/SBFrameDocstrings.i
@@ -78,6 +78,22 @@ See also SBThread."
 See also GetFunctionName()."
 ) lldb::SBFrame::IsInlined;
 
+%feature("docstring", "
+Returns an SBValueList which is an array of one or more register
+sets that exist for this thread.  
+Each SBValue in the SBValueList represents one register-set. 
+The first register-set will be the general purpose registers -- 
+the registers printed by the `register read` command-line lldb, with 
+no additional arguments.  
+The register-set SBValue will have a name, e.g. 
+SBFrame::GetRegisters().GetValueAtIndex(0).GetName() 
+may be 'General Purpose Registers', but the general purpose 
+register-set may not use that exact name, it is only a convention 
+used by some stubs.
+A register-set SBValue will have children, one child per register 
+in the register-set."
+) lldb::SBFrame::GetRegisters;
+
 %feature("docstring", "
 Return true if this frame is artificial (e.g a frame synthesized to
 capture a tail call). Local variables may not be available in an artificial
diff --git a/lldb/bindings/interface/SBFrameExtensions.i 
b/lldb/bindings/interface/SBFrameExtensions.i
index e0472280666ab9c..5c7a63ac53b3ec1 100644
--- a/lldb/bindings/interface/SBFrameExtensions.i
+++ b/lldb/bindings/interface/SBFrameExtensions.i
@@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
 args = property(get_arguments, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 arguments = property(get_arguments, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 statics = property(get_statics, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the static variables in this stack frame.''')
-registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
-regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
+registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() of register sets for this thread.  See 
SBFrame::GetRegisters() for details.''')
+regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() of register sets for this thread.  See SBFrame::GetRegisters() 
for details.''')
 register = property(get_registers_access, None, doc='''A read only 
property that returns an helper object providing a flattened indexable view of 
the CPU registers for this stack frame.''')
 reg = property(get_registers_access, None, doc='''A read only property 
that returns an helper object providing a flattened indexable view of the CPU 
registers for this stack frame''')
 parent = property(get_parent_frame, None, doc='''A read only property 
that returns the parent (caller) frame of the current frame.''')

>From 9d3668ad77a877d32bb3eb0066143ed9a3b34b91 Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 5 Feb 2025 19:01:05 -0800
Subject: [PATCH 2/3] update the registers/regs extension text as per Jim's
 suggestion

---
 lldb/bindings/interface/SBFrameExtensions.i | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/bindings/interface/SBFrameExtensions.i 
b/lldb/bindings/interface/SBFrameExtensions.i
index 5c7a63ac53b3ec1..38d03abaee8f09e 100644
--- a/lldb/bindings/interface/SBFrameExtensions.i
+++ b/lldb/bindings/interface/SBFrameExtensions.i
@@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
 args = property(get_arguments, None, doc='''A read only property that 
returns a list() that contains a collection of ll

[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda updated 
https://github.com/llvm/llvm-project/pull/125969

>From 7418a7074cba0ad4e28232d08b48d6d7a31c8cdb Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 5 Feb 2025 16:12:17 -0800
Subject: [PATCH 1/4] [lldb][NFC] Add documentation for SBFrame::GetRegisters

SBFrame::GetRegisters() (and the .registers / .regs extensions in
Python) returns an array of register-set's, not registers like you
might expect from the API name.  Document this.
---
 lldb/bindings/interface/SBFrameDocstrings.i | 16 
 lldb/bindings/interface/SBFrameExtensions.i |  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/lldb/bindings/interface/SBFrameDocstrings.i 
b/lldb/bindings/interface/SBFrameDocstrings.i
index 05a876a685a9127..5823d332c4cdd63 100644
--- a/lldb/bindings/interface/SBFrameDocstrings.i
+++ b/lldb/bindings/interface/SBFrameDocstrings.i
@@ -78,6 +78,22 @@ See also SBThread."
 See also GetFunctionName()."
 ) lldb::SBFrame::IsInlined;
 
+%feature("docstring", "
+Returns an SBValueList which is an array of one or more register
+sets that exist for this thread.  
+Each SBValue in the SBValueList represents one register-set. 
+The first register-set will be the general purpose registers -- 
+the registers printed by the `register read` command-line lldb, with 
+no additional arguments.  
+The register-set SBValue will have a name, e.g. 
+SBFrame::GetRegisters().GetValueAtIndex(0).GetName() 
+may be 'General Purpose Registers', but the general purpose 
+register-set may not use that exact name, it is only a convention 
+used by some stubs.
+A register-set SBValue will have children, one child per register 
+in the register-set."
+) lldb::SBFrame::GetRegisters;
+
 %feature("docstring", "
 Return true if this frame is artificial (e.g a frame synthesized to
 capture a tail call). Local variables may not be available in an artificial
diff --git a/lldb/bindings/interface/SBFrameExtensions.i 
b/lldb/bindings/interface/SBFrameExtensions.i
index e0472280666ab9c..5c7a63ac53b3ec1 100644
--- a/lldb/bindings/interface/SBFrameExtensions.i
+++ b/lldb/bindings/interface/SBFrameExtensions.i
@@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
 args = property(get_arguments, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 arguments = property(get_arguments, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the argument variables in this stack frame.''')
 statics = property(get_statics, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the static variables in this stack frame.''')
-registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
-regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() that contains a collection of lldb.SBValue objects that 
represent the CPU registers for this stack frame.''')
+registers = property(GetRegisters, None, doc='''A read only property 
that returns a list() of register sets for this thread.  See 
SBFrame::GetRegisters() for details.''')
+regs = property(GetRegisters, None, doc='''A read only property that 
returns a list() of register sets for this thread.  See SBFrame::GetRegisters() 
for details.''')
 register = property(get_registers_access, None, doc='''A read only 
property that returns an helper object providing a flattened indexable view of 
the CPU registers for this stack frame.''')
 reg = property(get_registers_access, None, doc='''A read only property 
that returns an helper object providing a flattened indexable view of the CPU 
registers for this stack frame''')
 parent = property(get_parent_frame, None, doc='''A read only property 
that returns the parent (caller) frame of the current frame.''')

>From 9d3668ad77a877d32bb3eb0066143ed9a3b34b91 Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 5 Feb 2025 19:01:05 -0800
Subject: [PATCH 2/4] update the registers/regs extension text as per Jim's
 suggestion

---
 lldb/bindings/interface/SBFrameExtensions.i | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/bindings/interface/SBFrameExtensions.i 
b/lldb/bindings/interface/SBFrameExtensions.i
index 5c7a63ac53b3ec1..38d03abaee8f09e 100644
--- a/lldb/bindings/interface/SBFrameExtensions.i
+++ b/lldb/bindings/interface/SBFrameExtensions.i
@@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
 args = property(get_arguments, None, doc='''A read only property that 
returns a list() that contains a collection of ll

[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

> Hope that those little tweaks help! I appreciate the added documentation!

Great suggestions, thanks!

https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Jason Molenda via lldb-commits


@@ -78,6 +78,22 @@ See also SBThread."
 See also GetFunctionName()."
 ) lldb::SBFrame::IsInlined;
 
+%feature("docstring", "
+Returns an SBValueList which is an array of one or more register
+sets that exist for this thread.  
+Each SBValue in the SBValueList represents one register-set. 
+The first register-set will be the general purpose registers -- 
+the registers printed by the `register read` command-line lldb, with 

jasonmolenda wrote:

I think in my head this started as "the registers printed by the `register 
read` command in command-line lldb" and it got a little mangled somewhere along 
the way.  

https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)

2025-02-05 Thread Augusto Noronha via lldb-commits

https://github.com/augusto2112 updated 
https://github.com/llvm/llvm-project/pull/125143

>From 0c22a94214e97146b2592b77ac96255bdee47b0f Mon Sep 17 00:00:00 2001
From: Augusto Noronha 
Date: Thu, 30 Jan 2025 16:33:09 -0800
Subject: [PATCH 1/6] [lldb] Make ValueObjectDynamicValue::UpdateValue() point
 to  a host buffer

ValueObjectDynamicValue::UpdateValue() assumes that the dynamic type
found by GetDynamicTypeAndAddress() would return an address in the
inferior.  This commit makes it so it can deal with being passed a
host address instead.

This is needed downstream by the Swift fork.

rdar://143357274
---
 lldb/include/lldb/Target/LanguageRuntime.h|  4 +++-
 .../ValueObject/ValueObjectDynamicValue.cpp   | 24 ++-
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/lldb/include/lldb/Target/LanguageRuntime.h 
b/lldb/include/lldb/Target/LanguageRuntime.h
index 4a0214b04e235e6..08db8a17a67e69e 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -105,7 +105,9 @@ class LanguageRuntime : public Runtime, public 
PluginInterface {
 "language doesn't support getting vtable information");
   }
 
-  // this call should return true if it could set the name and/or the type
+  // This call should return true if it could set the name and/or the type.
+  // address can be either a legitimate address on the inferior, or an address
+  // in lldb, if value_type == HostAddress.
   virtual bool GetDynamicTypeAndAddress(ValueObject &in_value,
 lldb::DynamicValueType use_dynamic,
 TypeAndOrName &class_type_or_name,
diff --git a/lldb/source/ValueObject/ValueObjectDynamicValue.cpp 
b/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
index 588c644bbfd07b6..10a5a9d0b769190 100644
--- a/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
+++ b/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
@@ -239,11 +239,19 @@ bool ValueObjectDynamicValue::UpdateValue() {
 if (m_address.IsValid())
   SetValueDidChange(true);
 
-// We've moved, so we should be fine...
-m_address = dynamic_address;
-lldb::TargetSP target_sp(GetTargetSP());
-lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
-m_value.GetScalar() = load_address;
+// If we found a host address, point to the buffer in host memory.
+// Later on this function will copy the buffer over.
+if (value_type == Value::ValueType::HostAddress) {
+  m_value.GetScalar() = dynamic_address.GetOffset();
+  m_address = LLDB_INVALID_ADDRESS;
+} else {
+  // Otherwise we have a legitimate address on the target. Point to the 
load
+  // address.
+  m_address = dynamic_address;
+  lldb::TargetSP target_sp(GetTargetSP());
+  lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
+  m_value.GetScalar() = load_address;
+}
   }
 
   if (runtime)
@@ -258,7 +266,11 @@ bool ValueObjectDynamicValue::UpdateValue() {
 LLDB_LOGF(log, "[%s %p] has a new dynamic type %s", GetName().GetCString(),
   static_cast(this), GetTypeName().GetCString());
 
-  if (m_address.IsValid() && m_dynamic_type_info) {
+  // m_address could be invalid but we could still have a local buffer
+  // containing the dynamic value.
+  if ((m_address.IsValid() ||
+   m_value.GetValueType() == Value::ValueType::HostAddress) &&
+  m_dynamic_type_info) {
 // The variable value is in the Scalar value inside the m_value. We can
 // point our m_data right to it.
 m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());

>From 64eb2c0365daf780a0e372c0fcbd9e4023c6a518 Mon Sep 17 00:00:00 2001
From: Augusto Noronha 
Date: Mon, 3 Feb 2025 11:23:41 -0800
Subject: [PATCH 2/6] Added a new local_buffer parameter to
 GetDynamicTypeAndAddress

---
 lldb/include/lldb/Target/LanguageRuntime.h   | 16 
 lldb/include/lldb/ValueObject/ValueObject.h  | 12 
 .../ItaniumABI/ItaniumABILanguageRuntime.cpp |  2 +-
 .../ItaniumABI/ItaniumABILanguageRuntime.h   |  4 ++--
 .../ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp   |  2 +-
 .../ObjC/AppleObjCRuntime/AppleObjCRuntime.h |  4 ++--
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp |  2 +-
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h   |  4 ++--
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp |  2 +-
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h   |  4 ++--
 .../GNUstepObjCRuntime/GNUstepObjCRuntime.cpp|  2 +-
 .../ObjC/GNUstepObjCRuntime/GNUstepObjCRuntime.h |  4 ++--
 lldb/source/ValueObject/ValueObject.cpp  | 16 
 .../ValueObject/ValueObjectDynamicValue.cpp  | 13 +++--
 14 files changed, 58 insertions(+), 29 deletions(-)

diff --git a/lldb/include/lldb/Target/LanguageRuntime.h 
b/lldb/include/lldb/Target/LanguageRuntime.h
index 08db8a17a67e69e..da7b4801be6691a 100644
--- a/lldb/include/lld

[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)

2025-02-05 Thread Augusto Noronha via lldb-commits

https://github.com/augusto2112 updated 
https://github.com/llvm/llvm-project/pull/125143

>From a280e7bc731818143cc89f3ce1150694a44784b3 Mon Sep 17 00:00:00 2001
From: Augusto Noronha 
Date: Thu, 30 Jan 2025 16:33:09 -0800
Subject: [PATCH 1/6] [lldb] Make ValueObjectDynamicValue::UpdateValue() point
 to  a host buffer

ValueObjectDynamicValue::UpdateValue() assumes that the dynamic type
found by GetDynamicTypeAndAddress() would return an address in the
inferior.  This commit makes it so it can deal with being passed a
host address instead.

This is needed downstream by the Swift fork.

rdar://143357274
---
 lldb/include/lldb/Target/LanguageRuntime.h|  4 +++-
 .../ValueObject/ValueObjectDynamicValue.cpp   | 24 ++-
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/lldb/include/lldb/Target/LanguageRuntime.h 
b/lldb/include/lldb/Target/LanguageRuntime.h
index 4a0214b04e235e6..08db8a17a67e69e 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -105,7 +105,9 @@ class LanguageRuntime : public Runtime, public 
PluginInterface {
 "language doesn't support getting vtable information");
   }
 
-  // this call should return true if it could set the name and/or the type
+  // This call should return true if it could set the name and/or the type.
+  // address can be either a legitimate address on the inferior, or an address
+  // in lldb, if value_type == HostAddress.
   virtual bool GetDynamicTypeAndAddress(ValueObject &in_value,
 lldb::DynamicValueType use_dynamic,
 TypeAndOrName &class_type_or_name,
diff --git a/lldb/source/ValueObject/ValueObjectDynamicValue.cpp 
b/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
index 588c644bbfd07b6..10a5a9d0b769190 100644
--- a/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
+++ b/lldb/source/ValueObject/ValueObjectDynamicValue.cpp
@@ -239,11 +239,19 @@ bool ValueObjectDynamicValue::UpdateValue() {
 if (m_address.IsValid())
   SetValueDidChange(true);
 
-// We've moved, so we should be fine...
-m_address = dynamic_address;
-lldb::TargetSP target_sp(GetTargetSP());
-lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
-m_value.GetScalar() = load_address;
+// If we found a host address, point to the buffer in host memory.
+// Later on this function will copy the buffer over.
+if (value_type == Value::ValueType::HostAddress) {
+  m_value.GetScalar() = dynamic_address.GetOffset();
+  m_address = LLDB_INVALID_ADDRESS;
+} else {
+  // Otherwise we have a legitimate address on the target. Point to the 
load
+  // address.
+  m_address = dynamic_address;
+  lldb::TargetSP target_sp(GetTargetSP());
+  lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
+  m_value.GetScalar() = load_address;
+}
   }
 
   if (runtime)
@@ -258,7 +266,11 @@ bool ValueObjectDynamicValue::UpdateValue() {
 LLDB_LOGF(log, "[%s %p] has a new dynamic type %s", GetName().GetCString(),
   static_cast(this), GetTypeName().GetCString());
 
-  if (m_address.IsValid() && m_dynamic_type_info) {
+  // m_address could be invalid but we could still have a local buffer
+  // containing the dynamic value.
+  if ((m_address.IsValid() ||
+   m_value.GetValueType() == Value::ValueType::HostAddress) &&
+  m_dynamic_type_info) {
 // The variable value is in the Scalar value inside the m_value. We can
 // point our m_data right to it.
 m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());

>From f914d611f2a9c9758e75fe490cdaedcd40007207 Mon Sep 17 00:00:00 2001
From: Augusto Noronha 
Date: Mon, 3 Feb 2025 11:23:41 -0800
Subject: [PATCH 2/6] Added a new local_buffer parameter to
 GetDynamicTypeAndAddress

---
 lldb/include/lldb/Target/LanguageRuntime.h   | 16 
 lldb/include/lldb/ValueObject/ValueObject.h  | 12 
 .../ItaniumABI/ItaniumABILanguageRuntime.cpp |  2 +-
 .../ItaniumABI/ItaniumABILanguageRuntime.h   |  4 ++--
 .../ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp   |  2 +-
 .../ObjC/AppleObjCRuntime/AppleObjCRuntime.h |  4 ++--
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp |  2 +-
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h   |  4 ++--
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp |  2 +-
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h   |  4 ++--
 .../GNUstepObjCRuntime/GNUstepObjCRuntime.cpp|  2 +-
 .../ObjC/GNUstepObjCRuntime/GNUstepObjCRuntime.h |  4 ++--
 lldb/source/ValueObject/ValueObject.cpp  | 16 
 .../ValueObject/ValueObjectDynamicValue.cpp  | 13 +++--
 14 files changed, 58 insertions(+), 29 deletions(-)

diff --git a/lldb/include/lldb/Target/LanguageRuntime.h 
b/lldb/include/lldb/Target/LanguageRuntime.h
index 08db8a17a67e69e..da7b4801be6691a 100644
--- a/lldb/include/lld

[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)

2025-02-05 Thread Augusto Noronha via lldb-commits

augusto2112 wrote:

Jim I was able to write a unit test.

https://github.com/llvm/llvm-project/pull/125143
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan approved this pull request.

LGTM! Thanks for improving this, this has fooled me once before 😅 

https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][LoongArch] Complete register alias name in `AugmentRegisterInfo` (PR #124059)

2025-02-05 Thread via lldb-commits

https://github.com/wangleiat updated 
https://github.com/llvm/llvm-project/pull/124059

>From f404df6b2ac7b7ab33e3baadd3830154904a Mon Sep 17 00:00:00 2001
From: Ray Wang 
Date: Thu, 23 Jan 2025 12:13:32 +0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5-bogner
---
 .../ABI/LoongArch/ABISysV_loongarch.cpp   | 38 +++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp 
b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
index dc7e9bba000676d..272c6a6be529ff3 100644
--- a/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
+++ b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
@@ -644,32 +644,22 @@ void ABISysV_loongarch::AugmentRegisterInfo(
 std::vector ®s) {
   lldb_private::RegInfoBasedABI::AugmentRegisterInfo(regs);
 
+  static const std::unordered_map reg_aliases = {
+  {"r0", "zero"}, {"r1", "ra"},  {"r2", "tp"},  {"r3", "sp"},
+  {"r4", "a0"},   {"r5", "a1"},  {"r6", "a2"},  {"r7", "a3"},
+  {"r8", "a4"},   {"r9", "a5"},  {"r10", "a6"}, {"r11", "a7"},
+  {"r12", "t0"},  {"r13", "t1"}, {"r14", "t2"}, {"r15", "t3"},
+  {"r16", "t4"},  {"r17", "t5"}, {"r18", "t6"}, {"r19", "t7"},
+  {"r20", "t8"},  {"r22", "fp"}, {"r23", "s0"}, {"r24", "s1"},
+  {"r25", "s2"},  {"r26", "s3"}, {"r27", "s4"}, {"r28", "s5"},
+  {"r29", "s6"},  {"r30", "s7"}, {"r31", "s8"}};
+
   for (auto it : llvm::enumerate(regs)) {
 // Set alt name for certain registers for convenience
-if (it.value().name == "r0")
-  it.value().alt_name.SetCString("zero");
-else if (it.value().name == "r1")
-  it.value().alt_name.SetCString("ra");
-else if (it.value().name == "r3")
-  it.value().alt_name.SetCString("sp");
-else if (it.value().name == "r22")
-  it.value().alt_name.SetCString("fp");
-else if (it.value().name == "r4")
-  it.value().alt_name.SetCString("a0");
-else if (it.value().name == "r5")
-  it.value().alt_name.SetCString("a1");
-else if (it.value().name == "r6")
-  it.value().alt_name.SetCString("a2");
-else if (it.value().name == "r7")
-  it.value().alt_name.SetCString("a3");
-else if (it.value().name == "r8")
-  it.value().alt_name.SetCString("a4");
-else if (it.value().name == "r9")
-  it.value().alt_name.SetCString("a5");
-else if (it.value().name == "r10")
-  it.value().alt_name.SetCString("a6");
-else if (it.value().name == "r11")
-  it.value().alt_name.SetCString("a7");
+std::string reg_name = it.value().name.GetStringRef().str();
+if (auto alias = reg_aliases.find(reg_name); alias != reg_aliases.end()) {
+  it.value().alt_name.SetCString(alias->second.c_str());
+}
 
 // Set generic regnum so lldb knows what the PC, etc is
 it.value().regnum_generic = GetGenericNum(it.value().name.GetStringRef());

>From d03f4f2b191c09d6492249aa5e0d50fc62a5a434 Mon Sep 17 00:00:00 2001
From: Ray Wang 
Date: Wed, 5 Feb 2025 17:58:09 +0800
Subject: [PATCH 2/2] add test

Created using spr 1.3.5-bogner
---
 .../postmortem/elf-core/TestLinuxCore.py  | 82 ++-
 1 file changed, 44 insertions(+), 38 deletions(-)

diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py 
b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
index 376d6492d83b604..adabac106f3e375 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -642,8 +642,7 @@ def test_aarch64_sve_regs_full(self):
 )
 # RMode should have enumerator descriptions.
 self.expect(
-"register info fpcr",
-substrs=["RMode: 0 = RN, 1 = RP, 2 = RM, 3 = RZ"],
+"register info fpcr", substrs=["RMode: 0 = RN, 1 = RP, 2 = RM, 3 = 
RZ"]
 )
 
 @skipIfLLVMTargetMissing("AArch64")
@@ -852,41 +851,42 @@ def test_loongarch64_regs(self):
 self.assertTrue(target, VALID_TARGET)
 process = target.LoadCore("linux-loongarch64.core")
 
-values = {}
-values["r0"] = "0x"
-values["r1"] = "0x0001216c"
-values["r2"] = "0x"
-values["r3"] = "0x7b8249e0"
-values["r4"] = "0x"
-values["r5"] = "0x0001210c"
-values["r6"] = "0x"
-values["r7"] = "0x"
-values["r8"] = "0x"
-values["r9"] = "0x"
-values["r10"] = "0x"
-values["r11"] = "0x00dd"
-values["r12"] = "0x"
-values["r13"] = "0x002f"
-values["r14"] = "0x"
-values["r15

[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)

2025-02-05 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/125969
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add SymbolContext::GetFunctionOrSymbolAddress (PR #123340)

2025-02-05 Thread Pavel Labath via lldb-commits

labath wrote:

@jimingham, is the new version of the patch (new function name) what you had in 
mind?

https://github.com/llvm/llvm-project/pull/123340
___
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 vscode launch URLs (PR #125843)

2025-02-05 Thread Adrian Vogelsgesang via lldb-commits

vogelsgesang wrote:

Here is a screen recording


https://github.com/user-attachments/assets/2092beca-3c52-4395-93a6-cf6ad16d1178



and the [example 
script](https://gist.github.com/vogelsgesang/572b04dc1d447776964fb7e40fd8b261).

Note that I had to launch my program using `${CWD}/a.out` instead of simply 
using `./a.out`. It seems as if `target create` commands in lldb-dap do not 
respect the current working directory. But that's an issue for another day

https://github.com/llvm/llvm-project/pull/125843
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits