[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)

2025-04-23 Thread Yuval Deutscher via lldb-commits

yuvald-sweet-security wrote:

> FYI, I reverted this because of problems test failures on mac: 
> https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/24395/testReport/junit/lldb-api/commands_target_auto-install-main-executable/TestAutoInstallMainExecutable_py/
> 
> I'm not quite sure what's happening, but it seems pretty clear that lldb is 
> failing to find the debugserver binary (on mac, the gdbserver is in a 
> different binary). If you have access to a mac, you should be able to 
> reproduce it yourself (it worked for me, even though I often get different 
> results from the green dragon). If not, maybe we can ask one of the apple 
> folks to take a look.
> 
> That said, inspired by your last PR (which, unsurprisingly, broke some of our 
> symlink configurations), I'm going to be refactoring the code which launches 
> debug servers soon(ish), and I think I can make it work with your setup as 
> well. So, if you're not in particular hurry, you may not need to do anything.

Don't have a mac at hand here but I do have one in another place (tagging 
myself - @hadeutscher). I might get to fixing this next week.


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


[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [mlir] [openmp] [polly] [Documentation] Always use SVG for dot-generated doxygen images. (PR #136843)

2025-04-23 Thread John Ericson via lldb-commits


@@ -48,14 +48,6 @@ if (LLVM_ENABLE_DOXYGEN)
 set(bolt_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG

Ericson2314 wrote:

(Not to us in Nixpkgs at least!) Though I doubt downstream distros are the 
people who want to build the API docs in general.

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


[Lldb-commits] [lldb] Add symbol locator time for each module in statistics (PR #134563)

2025-04-23 Thread via lldb-commits

https://github.com/GeorgeHuyubo updated 
https://github.com/llvm/llvm-project/pull/134563

>From f7e2bf51c51de0f38a59c741dd7f75b806cbbe9e Mon Sep 17 00:00:00 2001
From: George Hu 
Date: Tue, 22 Apr 2025 19:37:05 -0700
Subject: [PATCH] Add symbol locator time for each module in statistics

---
 lldb/include/lldb/Core/Module.h   |  6 +
 lldb/include/lldb/Core/PluginManager.h|  7 --
 lldb/include/lldb/Target/Statistics.h | 21 
 lldb/source/Core/DynamicLoader.cpp| 11 ++--
 lldb/source/Core/ModuleList.cpp   |  8 +++---
 lldb/source/Core/PluginManager.cpp| 25 ++-
 .../Platform/MacOSX/PlatformDarwinKernel.cpp  |  4 +--
 .../Process/MacOSX-Kernel/ProcessKDP.cpp  | 11 +---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 10 +---
 .../SymbolVendor/ELF/SymbolVendorELF.cpp  |  9 +++
 .../MacOSX/SymbolVendorMacOSX.cpp |  5 ++--
 .../PECOFF/SymbolVendorPECOFF.cpp |  4 +--
 .../SymbolVendor/wasm/SymbolVendorWasm.cpp|  4 +--
 lldb/source/Target/Statistics.cpp | 18 +
 .../Commands/command-statistics-dump.test |  1 -
 .../unittests/Symbol/LocateSymbolFileTest.cpp |  6 +++--
 16 files changed, 114 insertions(+), 36 deletions(-)

diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 1ad67d6747850..8bb55c95773bc 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -885,6 +885,10 @@ class Module : public std::enable_shared_from_this,
   /// ElapsedTime RAII object.
   StatsDuration &GetSymtabIndexTime() { return m_symtab_index_time; }
 
+  StatisticsMap &GetSymbolLocatorStatistics() {
+return m_symbol_locator_duration_map;
+  }
+
   void ResetStatistics();
 
   /// \class LookupInfo Module.h "lldb/Core/Module.h"
@@ -1064,6 +1068,8 @@ class Module : public 
std::enable_shared_from_this,
   /// time for the symbol tables can be aggregated here.
   StatsDuration m_symtab_index_time;
 
+  StatisticsMap m_symbol_locator_duration_map;
+
   /// A set of hashes of all warnings and errors, to avoid reporting them
   /// multiple times to the same Debugger.
   llvm::DenseMap>
diff --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index a6dab045adf27..4f856b0d01a55 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -12,6 +12,7 @@
 #include "lldb/Core/Architecture.h"
 #include "lldb/Interpreter/Interfaces/ScriptedInterfaceUsages.h"
 #include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Target/Statistics.h"
 #include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
@@ -377,11 +378,13 @@ class PluginManager {
   static SymbolLocatorCreateInstance
   GetSymbolLocatorCreateCallbackAtIndex(uint32_t idx);
 
-  static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec);
+  static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec,
+   StatisticsMap &map);
 
   static FileSpec
   LocateExecutableSymbolFile(const ModuleSpec &module_spec,
- const FileSpecList &default_search_paths);
+ const FileSpecList &default_search_paths,
+ StatisticsMap &map);
 
   static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
   Status &error,
diff --git a/lldb/include/lldb/Target/Statistics.h 
b/lldb/include/lldb/Target/Statistics.h
index b87a12a8ab9cd..63595c090efed 100644
--- a/lldb/include/lldb/Target/Statistics.h
+++ b/lldb/include/lldb/Target/Statistics.h
@@ -90,6 +90,26 @@ class ElapsedTime {
   }
 };
 
+/// A class to count time for plugins
+class StatisticsMap {
+public:
+  void add(llvm::StringRef key, double value) {
+if (key.empty())
+  return;
+auto it = map.find(key);
+if (it == map.end())
+  map.try_emplace(key, value);
+else
+  it->second += value;
+  }
+  void merge(StatisticsMap map_to_merge) {
+for (const auto &entry : map_to_merge.map) {
+  add(entry.first(), entry.second);
+}
+  }
+  llvm::StringMap map;
+};
+
 /// A class to count success/fail statistics.
 struct StatsSuccessFail {
   StatsSuccessFail(llvm::StringRef n) : name(n.str()) {}
@@ -118,6 +138,7 @@ struct ModuleStats {
   // track down all of the stats that contribute to this module.
   std::vector symfile_modules;
   llvm::StringMap type_system_stats;
+  StatisticsMap symbol_locator_time;
   double symtab_parse_time = 0.0;
   double symtab_index_time = 0.0;
   uint32_t num_symbols_loaded = 0;
diff --git a/lldb/source/Core/DynamicLoader.cpp 
b/lldb/source/Core/DynamicLoader.cpp
index 76c71d2a49a48..291e6b73a2c39 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -243,15 +243,22 @@ ModuleSP DynamicLoader::LoadBin

[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-23 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/131836

>From c86c50e6914b017a25a1ba29bbc47ea46f5dfaf2 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Mon, 7 Apr 2025 13:22:27 +0100
Subject: [PATCH 1/5] [lldb] Implement TrackingOutputBuffer to track demangled
 name information
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch implements a new `TrackingOutputBuffer` which tracks where the 
scope/basename/arguments begin and end in the demangled string.

The idea that a function name can be decomposed into . 
The assumption is that given the ranges of those three elements and the 
demangled name, LLDB will be able to to reconstruct the full demangled name. 
The tracking of those ranges is pretty simple. We don’t ever deal with nesting, 
so whenever we recurse into a template argument list or another function type, 
we just stop tracking any positions. Once we recursed out of those, and are 
back to printing the top-level function name, we continue tracking the 
positions.

We introduce a new structure `FunctionNameInfo` that holds all this information 
and is stored in the new `TrackingOutputBuffer` class.

Tests are in `ItaniumDemangleTest.cpp`.
---
 lldb/include/lldb/Core/DemangledNameInfo.h | 153 +++
 lldb/source/Core/CMakeLists.txt|   1 +
 lldb/source/Core/DemangledNameInfo.cpp | 213 +
 lldb/unittests/Core/MangledTest.cpp| 143 ++
 4 files changed, 510 insertions(+)
 create mode 100644 lldb/include/lldb/Core/DemangledNameInfo.h
 create mode 100644 lldb/source/Core/DemangledNameInfo.cpp

diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h 
b/lldb/include/lldb/Core/DemangledNameInfo.h
new file mode 100644
index 0..7c584872196ab
--- /dev/null
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -0,0 +1,153 @@
+//===-- DemangledNameInfo.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_DEMANGLEDNAMEINFO_H
+#define LLDB_CORE_DEMANGLEDNAMEINFO_H
+
+#include "llvm/Demangle/ItaniumDemangle.h"
+#include "llvm/Demangle/Utility.h"
+
+#include 
+#include 
+
+namespace lldb_private {
+
+/// Stores information about where certain portions of a demangled
+/// function name begin and end.
+struct DemangledNameInfo {
+  /// A [start, end) pair for the function basename.
+  /// The basename is the name without scope qualifiers
+  /// and without template parameters. E.g.,
+  /// \code{.cpp}
+  ///void foo::bar::someFunc(int) const &&
+  ///^   ^
+  ///  startend
+  /// \endcode
+  std::pair BasenameRange;
+
+  /// A [start, end) pair for the function scope qualifiers.
+  /// E.g., for
+  /// \code{.cpp}
+  ///void foo::bar::qux(int) const &&
+  /// ^  ^
+  ///   start   end
+  /// \endcode
+  std::pair ScopeRange;
+
+  /// Indicates the [start, end) of the function argument lits.
+  /// E.g.,
+  /// \code{.cpp}
+  ///int (*getFunc(float, double))(int, int)
+  ///^  ^
+  ///  start   end
+  /// \endcode
+  std::pair ArgumentsRange;
+
+  /// Returns \c true if this object holds a valid basename range.
+  bool hasBasename() const {
+return BasenameRange.first != BasenameRange.second &&
+   BasenameRange.second > 0;
+  }
+
+  friend bool operator==(const DemangledNameInfo &lhs,
+ const DemangledNameInfo &rhs) {
+return std::tie(lhs.BasenameRange, lhs.ArgumentsRange, lhs.ScopeRange,
+lhs.QualifiersRange) ==
+   std::tie(rhs.BasenameRange, rhs.ArgumentsRange, rhs.ScopeRange,
+lhs.QualifiersRange);
+  }
+
+  friend bool operator!=(const DemangledNameInfo &lhs,
+ const DemangledNameInfo &rhs) {
+return !(lhs == rhs);
+  }
+};
+
+/// An OutputBuffer which keeps a record of where certain parts of a
+/// demangled name begin/end (e.g., basename, scope, argument list, etc.).
+/// The tracking occurs during printing of the Itanium demangle tree.
+///
+/// Usage:
+/// \code{.cpp}
+///
+/// Node *N = mangling_parser.parseType();
+///
+/// TrackingOutputBuffer buffer;
+/// N->printLeft(OB);
+///
+/// assert (buffer.NameInfo.hasBasename());
+///
+/// \endcode
+struct TrackingOutputBuffer : public llvm::itanium_demangle::OutputBuffer {
+  using OutputBuffer::OutputBuffer;
+
+  /// Holds information about the demangled name that is
+  /// being printed into this buffer.
+  DemangledNameInfo NameInfo;
+
+  void printLeft(const llvm::itanium_demangle::Node &N) override;
+  void printRight

[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-23 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)

2025-04-23 Thread Matheus Izvekov via lldb-commits

mizvekov wrote:

@emaxx-google thanks for the reproducer.

I will be off to C++Now soon, so it's unlikely I will have time to take a look 
at
that in the next two weeks, sorry about that.

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


[Lldb-commits] [lldb] [llvm] [lldb] Implement CLI support for reverse-continue (PR #132783)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] 2397180 - [lldb] Implement CLI support for reverse-continue (#132783)

2025-04-23 Thread via lldb-commits

Author: Robert O'Callahan
Date: 2025-04-23T16:16:30-07:00
New Revision: 239718055d7260caa3e6631e82d68ac27e01c1f4

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

LOG: [lldb] Implement CLI support for reverse-continue (#132783)

This introduces the options "-F/--forward" and "-R/--reverse" to
`process continue`.

These only work if you're running with a gdbserver backend that supports
reverse execution, such as rr. For testing we rely on the fake
reverse-execution functionality in `lldbreverse.py`.

Added: 
lldb/test/API/commands/process/reverse-continue/Makefile
lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py

lldb/test/API/commands/process/reverse-continue/TestReverseContinueNotSupported.py
lldb/test/API/commands/process/reverse-continue/main.c

Modified: 
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/Options.td
llvm/docs/ReleaseNotes.md

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectProcess.cpp 
b/lldb/source/Commands/CommandObjectProcess.cpp
index 654dfa83ea444..ed80c854ed66e 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -468,7 +468,13 @@ class CommandObjectProcessContinue : public 
CommandObjectParsed {
   case 'b':
 m_run_to_bkpt_args.AppendArgument(option_arg);
 m_any_bkpts_specified = true;
-  break;
+break;
+  case 'F':
+m_base_direction = lldb::RunDirection::eRunForward;
+break;
+  case 'R':
+m_base_direction = lldb::RunDirection::eRunReverse;
+break;
   default:
 llvm_unreachable("Unimplemented option");
   }
@@ -479,6 +485,7 @@ class CommandObjectProcessContinue : public 
CommandObjectParsed {
   m_ignore = 0;
   m_run_to_bkpt_args.Clear();
   m_any_bkpts_specified = false;
+  m_base_direction = std::nullopt;
 }
 
 llvm::ArrayRef GetDefinitions() override {
@@ -488,6 +495,7 @@ class CommandObjectProcessContinue : public 
CommandObjectParsed {
 uint32_t m_ignore = 0;
 Args m_run_to_bkpt_args;
 bool m_any_bkpts_specified = false;
+std::optional m_base_direction;
   };
 
   void DoExecute(Args &command, CommandReturnObject &result) override {
@@ -654,6 +662,9 @@ class CommandObjectProcessContinue : public 
CommandObjectParsed {
 }
   }
 
+  if (m_options.m_base_direction.has_value())
+process->SetBaseDirection(*m_options.m_base_direction);
+
   const uint32_t iohandler_id = process->GetIOHandlerID();
 
   StreamString stream;

diff  --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index cc579d767eb06..53864ff29327d 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -737,13 +737,17 @@ let Command = "process attach" in {
 }
 
 let Command = "process continue" in {
-  def process_continue_ignore_count : Option<"ignore-count", "i">, Group<1>,
+  def process_continue_ignore_count : Option<"ignore-count", "i">, 
Groups<[1,2]>,
 Arg<"UnsignedInteger">, Desc<"Ignore  crossings of the breakpoint (if 
it"
 " exists) for the currently selected thread.">;
-  def process_continue_run_to_bkpt : Option<"continue-to-bkpt", "b">, Group<2>,
+  def process_continue_run_to_bkpt : Option<"continue-to-bkpt", "b">, 
Groups<[3,4]>,
 Arg<"BreakpointIDRange">, Desc<"Specify a breakpoint to continue to, 
temporarily "
 "ignoring other breakpoints.  Can be specified more than once.  "
 "The continue action will be done synchronously if this option is 
specified.">;
+  def thread_continue_forward : Option<"forward", "F">, Groups<[1,3]>,
+Desc<"Set the direction to forward before continuing.">;
+  def thread_continue_reverse : Option<"reverse", "R">, Groups<[2,4]>,
+Desc<"Set the direction to reverse before continuing.">;
 }
 
 let Command = "process detach" in {

diff  --git a/lldb/test/API/commands/process/reverse-continue/Makefile 
b/lldb/test/API/commands/process/reverse-continue/Makefile
new file mode 100644
index 0..10495940055b6
--- /dev/null
+++ b/lldb/test/API/commands/process/reverse-continue/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py 
b/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py
new file mode 100644
index 0..c04d2b9d4b5a5
--- /dev/null
+++ b/lldb/test/API/commands/process/reverse-continue/TestReverseContinue.py
@@ -0,0 +1,66 @@
+"""
+Test the "process continue --reverse" and "--forward" options.
+"""
+
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils imp

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

2025-04-23 Thread John Harrison via lldb-commits

https://github.com/ashgti created 
https://github.com/llvm/llvm-project/pull/137071

Migrates the 'stepIn' request handler to have well structured types instead of 
raw json values.

I also noticed in the 'next' request handler we were not passing the 'RunMode' 
flag. Updated the 'next' request handler as well.

>From f4f2fea5cebbce550de0e0c3facaac894b9f40b8 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Wed, 23 Apr 2025 15:01:53 -0700
Subject: [PATCH] [lldb-dap] Migrate 'stepIn' request to well structured types.

Migrates the 'stepIn' request handler to have well structured types instead of 
raw json values.

I also noticed in the 'next' request handler we were not passing the 'RunMode' 
flag. Updated the 'next' request handler as well.
---
 .../lldb-dap/Handler/NextRequestHandler.cpp   |   3 +-
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   7 +-
 .../lldb-dap/Handler/StepInRequestHandler.cpp | 107 ++
 .../lldb-dap/Protocol/ProtocolRequests.cpp|   9 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  22 
 5 files changed, 69 insertions(+), 79 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp
index 1603563841005..3fa167686d2f9 100644
--- a/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp
@@ -13,6 +13,7 @@
 #include "llvm/Support/Error.h"
 
 using namespace llvm;
+using namespace lldb;
 using namespace lldb_dap::protocol;
 
 namespace lldb_dap {
@@ -35,7 +36,7 @@ Error NextRequestHandler::Run(const NextArguments &args) 
const {
   if (args.granularity == eSteppingGranularityInstruction) {
 thread.StepInstruction(/*step_over=*/true);
   } else {
-thread.StepOver();
+thread.StepOver(args.singleThread ? eOnlyThisThread : eOnlyDuringStepping);
   }
 
   return Error::success();
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index edb9de7d0dc20..e13f7a3749e00 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -298,11 +298,12 @@ class NextRequestHandler
   llvm::Error Run(const protocol::NextArguments &args) const override;
 };
 
-class StepInRequestHandler : public LegacyRequestHandler {
+class StepInRequestHandler : public RequestHandler {
 public:
-  using LegacyRequestHandler::LegacyRequestHandler;
+  using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "stepIn"; }
-  void operator()(const llvm::json::Object &request) const override;
+  llvm::Error Run(const protocol::StepInArguments &args) const override;
 };
 
 class StepInTargetsRequestHandler : public LegacyRequestHandler {
diff --git a/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp
index 9d8d75b359447..00b68abb48677 100644
--- a/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp
@@ -8,91 +8,48 @@
 
 #include "DAP.h"
 #include "EventHelper.h"
-#include "JSONUtils.h"
+#include "Protocol/ProtocolRequests.h"
+#include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 
-namespace lldb_dap {
+using namespace llvm;
+using namespace lldb;
+using namespace lldb_dap::protocol;
 
-// "StepInRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "StepIn request; value of command field is 'stepIn'. The
-// request starts the debuggee to step into a function/method if possible.
-// If it cannot step into a target, 'stepIn' behaves like 'next'. The debug
-// adapter first sends the StepInResponse and then a StoppedEvent (event
-// type 'step') after the step has completed. If there are multiple
-// function/method calls (or other targets) on the source line, the 
optional
-// argument 'targetId' can be used to control into which target the 
'stepIn'
-// should occur. The list of possible targets for a given source line can 
be
-// retrieved via the 'stepInTargets' request.", "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "stepIn" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/StepInArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "StepInArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'stepIn' request.",
-//   "properties": {
-// "threadId": {
-//   "type": "integer",
-//   "description": "Execute 'stepIn' for this thread."
-// },
-// "targetId": {
-//   "type": "integer",
-//   "description": "Optional id of the target to step into."
-// },
-// "granularity": {
-//   "$ref": "#/definitions/SteppingGranularity",
-//   "description": "Stepping granularity. If no granularity is specified, 
a
-//   granu

[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Redirect LLDB's messages to the right output category. (PR #137002)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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

I didn't realize lldb-dap was handing the process output separately. In that 
case, this LGTM. Apologies for the confusion! 

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


[Lldb-commits] [lldb] [llvm] Add RISC-V CPU type and CPU subtype to llvm & lldb (PR #136785)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] 213424b - Add MachO RISC-V CPU type and CPU subtype to llvm & lldb (#136785)

2025-04-23 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-04-23T11:03:40-07:00
New Revision: 213424b94792d730510a12046abfc05e0262c985

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

LOG: Add MachO RISC-V CPU type and CPU subtype to llvm & lldb (#136785)

Add the enum values for MachO RISC-V CPU type and CPU subtype to
llvm and use in LLDB's ArchSpec.

Added: 


Modified: 
lldb/source/Utility/ArchSpec.cpp
lldb/unittests/Utility/ArchSpecTest.cpp
llvm/include/llvm/BinaryFormat/MachO.h

Removed: 




diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index 495215459336a..2e6c6a6ffcbe4 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -353,6 +353,8 @@ static const ArchDefinitionEntry g_macho_arch_entries[] = {
 {ArchSpec::eCore_x86_64_x86_64,   llvm::MachO::CPU_TYPE_X86_64, 
llvm::MachO::CPU_SUBTYPE_X86_ARCH1, UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_x86_64_x86_64h,  llvm::MachO::CPU_TYPE_X86_64, 
llvm::MachO::CPU_SUBTYPE_X86_64_H,  UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_x86_64_x86_64,   llvm::MachO::CPU_TYPE_X86_64, 
CPU_ANY, UINT32_MAX, UINT32_MAX},
+{ArchSpec::eCore_riscv32, llvm::MachO::CPU_TYPE_RISCV,  
llvm::MachO::CPU_SUBTYPE_RISCV_ALL, UINT32_MAX, SUBTYPE_MASK},
+{ArchSpec::eCore_riscv32, llvm::MachO::CPU_TYPE_RISCV,  
CPU_ANY,UINT32_MAX, SUBTYPE_MASK},
 // Catch any unknown mach architectures so we can always use the object 
and symbol mach-o files
 {ArchSpec::eCore_uknownMach32,0,0, 
 0xFF00u, 0xu},
 {ArchSpec::eCore_uknownMach64,llvm::MachO::CPU_ARCH_ABI64,  0, 
 0xFF00u, 0xu}};

diff  --git a/lldb/unittests/Utility/ArchSpecTest.cpp 
b/lldb/unittests/Utility/ArchSpecTest.cpp
index 2c78629849c64..3bf1c3f81876f 100644
--- a/lldb/unittests/Utility/ArchSpecTest.cpp
+++ b/lldb/unittests/Utility/ArchSpecTest.cpp
@@ -113,6 +113,14 @@ TEST(ArchSpecTest, TestSetTriple) {
   .consume_front("powerpc-apple-darwin"));
   EXPECT_EQ(ArchSpec::eCore_ppc_ppc970, AS.GetCore());
 
+  AS = ArchSpec();
+  EXPECT_TRUE(AS.SetTriple("24-0-apple-unknown"));
+  EXPECT_EQ(uint32_t(llvm::MachO::CPU_TYPE_RISCV), AS.GetMachOCPUType());
+  EXPECT_EQ(0u, AS.GetMachOCPUSubType());
+  EXPECT_TRUE(llvm::StringRef(AS.GetTriple().str())
+  .consume_front("riscv32-apple-unknown"));
+  EXPECT_EQ(ArchSpec::eCore_riscv32, AS.GetCore());
+
   AS = ArchSpec();
   EXPECT_TRUE(AS.SetTriple("i686-pc-windows"));
   EXPECT_EQ(llvm::Triple::x86, AS.GetTriple().getArch());

diff  --git a/llvm/include/llvm/BinaryFormat/MachO.h 
b/llvm/include/llvm/BinaryFormat/MachO.h
index 83aaf19c71e50..5afe70bffc24b 100644
--- a/llvm/include/llvm/BinaryFormat/MachO.h
+++ b/llvm/include/llvm/BinaryFormat/MachO.h
@@ -1571,7 +1571,9 @@ enum CPUType {
   CPU_TYPE_ARM64_32 = CPU_TYPE_ARM | CPU_ARCH_ABI64_32,
   CPU_TYPE_SPARC = 14,
   CPU_TYPE_POWERPC = 18,
-  CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64
+  CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64,
+
+  CPU_TYPE_RISCV = 24,
 };
 
 enum : uint32_t {
@@ -1698,6 +1700,10 @@ enum CPUSubTypePowerPC {
   CPU_SUBTYPE_MC98601 = CPU_SUBTYPE_POWERPC_601
 };
 
+enum CPUSubTypeRISCV {
+  CPU_SUBTYPE_RISCV_ALL = 0,
+};
+
 Expected getCPUType(const Triple &T);
 Expected getCPUSubType(const Triple &T);
 Expected getCPUSubType(const Triple &T, unsigned PtrAuthABIVersion,



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


[Lldb-commits] [lldb] Add symbol locator time for each module in statistics (PR #134563)

2025-04-23 Thread via lldb-commits

https://github.com/GeorgeHuyubo updated 
https://github.com/llvm/llvm-project/pull/134563

>From d40024584089f5342407c3b5e5d78ff1bde0f765 Mon Sep 17 00:00:00 2001
From: George Hu 
Date: Tue, 22 Apr 2025 19:37:05 -0700
Subject: [PATCH] Add symbol locator time for each module in statistics

---
 lldb/include/lldb/Core/Module.h   |  6 +
 lldb/include/lldb/Core/PluginManager.h|  7 --
 lldb/include/lldb/Target/Statistics.h | 21 
 lldb/source/Core/DynamicLoader.cpp| 11 ++--
 lldb/source/Core/ModuleList.cpp   |  8 +++---
 lldb/source/Core/PluginManager.cpp| 25 ++-
 .../Platform/MacOSX/PlatformDarwinKernel.cpp  |  4 +--
 .../Process/MacOSX-Kernel/ProcessKDP.cpp  | 11 +---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 10 +---
 .../SymbolVendor/ELF/SymbolVendorELF.cpp  |  9 +++
 .../MacOSX/SymbolVendorMacOSX.cpp |  5 ++--
 .../PECOFF/SymbolVendorPECOFF.cpp |  4 +--
 .../SymbolVendor/wasm/SymbolVendorWasm.cpp|  4 +--
 lldb/source/Target/Statistics.cpp | 18 +
 .../unittests/Symbol/LocateSymbolFileTest.cpp |  6 +++--
 15 files changed, 114 insertions(+), 35 deletions(-)

diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 1ad67d6747850..8bb55c95773bc 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -885,6 +885,10 @@ class Module : public std::enable_shared_from_this,
   /// ElapsedTime RAII object.
   StatsDuration &GetSymtabIndexTime() { return m_symtab_index_time; }
 
+  StatisticsMap &GetSymbolLocatorStatistics() {
+return m_symbol_locator_duration_map;
+  }
+
   void ResetStatistics();
 
   /// \class LookupInfo Module.h "lldb/Core/Module.h"
@@ -1064,6 +1068,8 @@ class Module : public 
std::enable_shared_from_this,
   /// time for the symbol tables can be aggregated here.
   StatsDuration m_symtab_index_time;
 
+  StatisticsMap m_symbol_locator_duration_map;
+
   /// A set of hashes of all warnings and errors, to avoid reporting them
   /// multiple times to the same Debugger.
   llvm::DenseMap>
diff --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index a6dab045adf27..4f856b0d01a55 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -12,6 +12,7 @@
 #include "lldb/Core/Architecture.h"
 #include "lldb/Interpreter/Interfaces/ScriptedInterfaceUsages.h"
 #include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Target/Statistics.h"
 #include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
@@ -377,11 +378,13 @@ class PluginManager {
   static SymbolLocatorCreateInstance
   GetSymbolLocatorCreateCallbackAtIndex(uint32_t idx);
 
-  static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec);
+  static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec,
+   StatisticsMap &map);
 
   static FileSpec
   LocateExecutableSymbolFile(const ModuleSpec &module_spec,
- const FileSpecList &default_search_paths);
+ const FileSpecList &default_search_paths,
+ StatisticsMap &map);
 
   static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
   Status &error,
diff --git a/lldb/include/lldb/Target/Statistics.h 
b/lldb/include/lldb/Target/Statistics.h
index b87a12a8ab9cd..63595c090efed 100644
--- a/lldb/include/lldb/Target/Statistics.h
+++ b/lldb/include/lldb/Target/Statistics.h
@@ -90,6 +90,26 @@ class ElapsedTime {
   }
 };
 
+/// A class to count time for plugins
+class StatisticsMap {
+public:
+  void add(llvm::StringRef key, double value) {
+if (key.empty())
+  return;
+auto it = map.find(key);
+if (it == map.end())
+  map.try_emplace(key, value);
+else
+  it->second += value;
+  }
+  void merge(StatisticsMap map_to_merge) {
+for (const auto &entry : map_to_merge.map) {
+  add(entry.first(), entry.second);
+}
+  }
+  llvm::StringMap map;
+};
+
 /// A class to count success/fail statistics.
 struct StatsSuccessFail {
   StatsSuccessFail(llvm::StringRef n) : name(n.str()) {}
@@ -118,6 +138,7 @@ struct ModuleStats {
   // track down all of the stats that contribute to this module.
   std::vector symfile_modules;
   llvm::StringMap type_system_stats;
+  StatisticsMap symbol_locator_time;
   double symtab_parse_time = 0.0;
   double symtab_index_time = 0.0;
   uint32_t num_symbols_loaded = 0;
diff --git a/lldb/source/Core/DynamicLoader.cpp 
b/lldb/source/Core/DynamicLoader.cpp
index 76c71d2a49a48..291e6b73a2c39 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -243,15 +243,22 @@ ModuleSP DynamicLoader::LoadBinaryWithUUIDAndAddress(
 // find an executable and 

[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-23 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


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


[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-23 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/131836

>From b3e1aa9ff4817af23d99a8b0b668c62149524181 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Mon, 7 Apr 2025 13:22:27 +0100
Subject: [PATCH 1/5] [lldb] Implement TrackingOutputBuffer to track demangled
 name information (#131836)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch implements a new `TrackingOutputBuffer` which tracks where the 
scope/basename/arguments begin and end in the demangled string.

The idea that a function name can be decomposed into . 
The assumption is that given the ranges of those three elements and the 
demangled name, LLDB will be able to to reconstruct the full demangled name. 
The tracking of those ranges is pretty simple. We don’t ever deal with nesting, 
so whenever we recurse into a template argument list or another function type, 
we just stop tracking any positions. Once we recursed out of those, and are 
back to printing the top-level function name, we continue tracking the 
positions.

We introduce a new structure `FunctionNameInfo` that holds all this information 
and is stored in the new `TrackingOutputBuffer` class.

Tests are in `ItaniumDemangleTest.cpp`.

https://github.com/llvm/llvm-project/pull/131836
---
 lldb/include/lldb/Core/DemangledNameInfo.h | 153 +++
 lldb/source/Core/CMakeLists.txt|   1 +
 lldb/source/Core/DemangledNameInfo.cpp | 213 +
 lldb/unittests/Core/MangledTest.cpp| 143 ++
 4 files changed, 510 insertions(+)
 create mode 100644 lldb/include/lldb/Core/DemangledNameInfo.h
 create mode 100644 lldb/source/Core/DemangledNameInfo.cpp

diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h 
b/lldb/include/lldb/Core/DemangledNameInfo.h
new file mode 100644
index 0..51cd152bf79d8
--- /dev/null
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -0,0 +1,153 @@
+//===-- DemangledNameInfo.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_DEMANGLEDNAMEINFO_H
+#define LLDB_CORE_DEMANGLEDNAMEINFO_H
+
+#include "llvm/Demangle/ItaniumDemangle.h"
+#include "llvm/Demangle/Utility.h"
+
+#include 
+#include 
+
+namespace lldb_private {
+
+/// Stores information about where certain portions of a demangled
+/// function name begin and end.
+struct DemangledNameInfo {
+  /// A [start, end) pair for the function basename.
+  /// The basename is the name without scope qualifiers
+  /// and without template parameters. E.g.,
+  /// \code{.cpp}
+  ///void foo::bar::someFunc(int) const &&
+  ///^   ^
+  ///  startend
+  /// \endcode
+  std::pair BasenameRange;
+
+  /// A [start, end) pair for the function scope qualifiers.
+  /// E.g., for
+  /// \code{.cpp}
+  ///void foo::bar::qux(int) const &&
+  /// ^  ^
+  ///   start   end
+  /// \endcode
+  std::pair ScopeRange;
+
+  /// Indicates the [start, end) of the function argument lits.
+  /// E.g.,
+  /// \code{.cpp}
+  ///int (*getFunc(float, double))(int, int)
+  ///^  ^
+  ///  start   end
+  /// \endcode
+  std::pair ArgumentsRange;
+
+  /// Returns \c true if this object holds a valid basename range.
+  bool hasBasename() const {
+return BasenameRange.first != BasenameRange.second &&
+   BasenameRange.second > 0;
+  }
+
+  friend bool operator==(const DemangledNameInfo &lhs,
+ const DemangledNameInfo &rhs) {
+return std::tie(lhs.BasenameRange, lhs.ArgumentsRange, lhs.ScopeRange,
+lhs.QualifiersRange) ==
+   std::tie(rhs.BasenameRange, rhs.ArgumentsRange, rhs.ScopeRange,
+lhs.QualifiersRange);
+  }
+
+  friend bool operator!=(const DemangledNameInfo &lhs,
+ const DemangledNameInfo &rhs) {
+return !(lhs == rhs);
+  }
+};
+
+/// An OutputBuffer which keeps a record of where certain parts of a
+/// demangled name begin/end (e.g., basename, scope, argument list, etc.).
+/// The tracking occurs during printing of the Itanium demangle tree.
+///
+/// Usage:
+/// \code{.cpp}
+///
+/// Node *N = mangling_parser.parseType();
+///
+/// TrackingOutputBuffer buffer;
+/// N->printLeft(OB);
+///
+/// assert (buffer.NameInfo.hasBasename());
+///
+/// \endcode
+struct TrackingOutputBuffer : public llvm::itanium_demangle::OutputBuffer {
+  using OutputBuffer::OutputBuffer;
+
+  /// Holds information about the demangled name that is
+  /// being printed into this buffer.
+  DemangledNameInfo NameInfo;
+
+  void printLeft(const l

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

2025-04-23 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/137113

The debug adapter protocol supports an option to provide formatting information 
for a stack frames as part of the StackTrace request. lldb-dap incorrectly 
advertises it supports this, but until this PR that support wasn't actually 
implemented.

Fixes #137057

>From 21681616560eceb9b46ef4c370817099fe149701 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 23 Apr 2025 20:05:19 -0700
Subject: [PATCH] [lldb-dap] Support StackFrameFormat

The debug adapter protocol supports an option to provide formatting
information for a stack frames as part of the StackTrace request.
lldb-dap incorrectly advertises it supports this, but until this PR that
support wasn't actually implemented.

Fixes #137057
---
 .../test/tools/lldb-dap/dap_server.py |  4 +-
 .../test/tools/lldb-dap/lldbdap_testcase.py   | 18 ++--
 .../lldb-dap/stackTrace/TestDAP_stackTrace.py | 30 +
 .../Handler/StackTraceRequestHandler.cpp  | 42 ---
 4 files changed, 84 insertions(+), 10 deletions(-)

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 a9915ba2f6de6..dadf6b1f8774c 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
@@ -1046,7 +1046,7 @@ def request_modules(self):
 return self.send_recv({"command": "modules", "type": "request"})
 
 def request_stackTrace(
-self, threadId=None, startFrame=None, levels=None, dump=False
+self, threadId=None, startFrame=None, levels=None, format=None, 
dump=False
 ):
 if threadId is None:
 threadId = self.get_thread_id()
@@ -1055,6 +1055,8 @@ def request_stackTrace(
 args_dict["startFrame"] = startFrame
 if levels is not None:
 args_dict["levels"] = levels
+if format is not None:
+args_dict["format"] = format
 command_dict = {
 "command": "stackTrace",
 "type": "request",
diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 70b04b051e0ec..b5b55b336d535 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -161,10 +161,14 @@ def get_dict_value(self, d, key_path):
 return value
 
 def get_stackFrames_and_totalFramesCount(
-self, threadId=None, startFrame=None, levels=None, dump=False
+self, threadId=None, startFrame=None, levels=None, format=None, 
dump=False
 ):
 response = self.dap_server.request_stackTrace(
-threadId=threadId, startFrame=startFrame, levels=levels, dump=dump
+threadId=threadId,
+startFrame=startFrame,
+levels=levels,
+format=format,
+dump=dump,
 )
 if response:
 stackFrames = self.get_dict_value(response, ["body", 
"stackFrames"])
@@ -177,9 +181,15 @@ def get_stackFrames_and_totalFramesCount(
 return (stackFrames, totalFrames)
 return (None, 0)
 
-def get_stackFrames(self, threadId=None, startFrame=None, levels=None, 
dump=False):
+def get_stackFrames(
+self, threadId=None, startFrame=None, levels=None, format=None, 
dump=False
+):
 (stackFrames, totalFrames) = self.get_stackFrames_and_totalFramesCount(
-threadId=threadId, startFrame=startFrame, levels=levels, dump=dump
+threadId=threadId,
+startFrame=startFrame,
+levels=levels,
+format=format,
+dump=dump,
 )
 return stackFrames
 
diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py 
b/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py
index 56ed1ebdf7ab4..713b5d841cfcd 100644
--- a/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py
+++ b/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py
@@ -217,3 +217,33 @@ def test_functionNameWithArgs(self):
 self.continue_to_next_stop()
 frame = self.get_stackFrames()[0]
 self.assertEqual(frame["name"], "recurse(x=1)")
+
+@skipIfWindows
+def test_StackFrameFormat(self):
+"""
+Test the StackFrameFormat.
+"""
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program)
+source = "main.c"
+
+self.set_source_breakpoints(source, [line_number(source, "recurse 
end")])
+
+self.continue_to_next_stop()
+frame = self.get_stackFrames(format={"includeAll": True})[0]
+self.assertEqual(frame["name"], "a.out main.c:6:5 recurse(x=1)")
+
+frame = self.get_stackFrames(format={"pa

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

2025-04-23 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

The debug adapter protocol supports an option to provide formatting information 
for a stack frames as part of the StackTrace request. lldb-dap incorrectly 
advertises it supports this, but until this PR that support wasn't actually 
implemented.

Fixes #137057

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


4 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
(+3-1) 
- (modified) 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (+14-4) 
- (modified) lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py 
(+30) 
- (modified) lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp (+37-5) 


``diff
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 a9915ba2f6de6..dadf6b1f8774c 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
@@ -1046,7 +1046,7 @@ def request_modules(self):
 return self.send_recv({"command": "modules", "type": "request"})
 
 def request_stackTrace(
-self, threadId=None, startFrame=None, levels=None, dump=False
+self, threadId=None, startFrame=None, levels=None, format=None, 
dump=False
 ):
 if threadId is None:
 threadId = self.get_thread_id()
@@ -1055,6 +1055,8 @@ def request_stackTrace(
 args_dict["startFrame"] = startFrame
 if levels is not None:
 args_dict["levels"] = levels
+if format is not None:
+args_dict["format"] = format
 command_dict = {
 "command": "stackTrace",
 "type": "request",
diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 70b04b051e0ec..b5b55b336d535 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -161,10 +161,14 @@ def get_dict_value(self, d, key_path):
 return value
 
 def get_stackFrames_and_totalFramesCount(
-self, threadId=None, startFrame=None, levels=None, dump=False
+self, threadId=None, startFrame=None, levels=None, format=None, 
dump=False
 ):
 response = self.dap_server.request_stackTrace(
-threadId=threadId, startFrame=startFrame, levels=levels, dump=dump
+threadId=threadId,
+startFrame=startFrame,
+levels=levels,
+format=format,
+dump=dump,
 )
 if response:
 stackFrames = self.get_dict_value(response, ["body", 
"stackFrames"])
@@ -177,9 +181,15 @@ def get_stackFrames_and_totalFramesCount(
 return (stackFrames, totalFrames)
 return (None, 0)
 
-def get_stackFrames(self, threadId=None, startFrame=None, levels=None, 
dump=False):
+def get_stackFrames(
+self, threadId=None, startFrame=None, levels=None, format=None, 
dump=False
+):
 (stackFrames, totalFrames) = self.get_stackFrames_and_totalFramesCount(
-threadId=threadId, startFrame=startFrame, levels=levels, dump=dump
+threadId=threadId,
+startFrame=startFrame,
+levels=levels,
+format=format,
+dump=dump,
 )
 return stackFrames
 
diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py 
b/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py
index 56ed1ebdf7ab4..713b5d841cfcd 100644
--- a/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py
+++ b/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py
@@ -217,3 +217,33 @@ def test_functionNameWithArgs(self):
 self.continue_to_next_stop()
 frame = self.get_stackFrames()[0]
 self.assertEqual(frame["name"], "recurse(x=1)")
+
+@skipIfWindows
+def test_StackFrameFormat(self):
+"""
+Test the StackFrameFormat.
+"""
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program)
+source = "main.c"
+
+self.set_source_breakpoints(source, [line_number(source, "recurse 
end")])
+
+self.continue_to_next_stop()
+frame = self.get_stackFrames(format={"includeAll": True})[0]
+self.assertEqual(frame["name"], "a.out main.c:6:5 recurse(x=1)")
+
+frame = self.get_stackFrames(format={"parameters": True})[0]
+self.assertEqual(frame["name"], "recurse(x=1)")
+
+frame = self.get_stackFrames(format={"parameterNames": True})[0]
+self.assertEqual(frame["name"], "recurse(x=1)")
+
+frame = self.get_stackFrames(format={"parameterValues": True})[0]
+self.

[Lldb-commits] [lldb] [lldb][MachO] MachO corefile support for riscv32 binaries (PR #137092)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb][MachO] MachO corefile support for riscv32 binaries (PR #137092)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -0,0 +1,81 @@
+"""Test that all of the GPR registers are read correctly from a riscv32 
corefile."""
+
+import os
+import re
+import subprocess
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestRV32MachOCorefile(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_riscv32_gpr_corefile_registers(self):

JDevlieghere wrote:

```suggestion
@skipUnlessDarwin
def test_riscv32_gpr_corefile_registers(self):
```

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


[Lldb-commits] [lldb] [lldb][MachO] MachO corefile support for riscv32 binaries (PR #137092)

2025-04-23 Thread Jason Molenda via lldb-commits

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

>From 0a1b1c19bfd4102fe58a04736efed22c6de4fd0d Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 23 Apr 2025 17:05:43 -0700
Subject: [PATCH 1/2] [lldb][MachO] MachO corefile support for riscv32 binaries

Add support for reading a macho corefile with CPU_TYPE_RISCV and
the riscv32 general purpose register file.  I added code for the
floating point and exception registers too, but haven't exercised
this.  If we start putting the full CSR register bank in a riscv
corefile, it'll be in separate 4k byte chunks, but I don't have a
corefile to test against that so I haven't written the code to read
it.

rdar://145014653
---
 .../ObjectFile/Mach-O/ObjectFileMachO.cpp |  152 ++
 .../Plugins/Process/Utility/CMakeLists.txt|1 +
 .../Utility/RegisterContextDarwin_riscv32.cpp | 1313 +
 .../Utility/RegisterContextDarwin_riscv32.h   |  260 
 .../test/API/macosx/riscv32-corefile/Makefile |7 +
 .../riscv32-corefile/TestRV32MachOCorefile.py |   81 +
 .../create-empty-riscv-corefile.cpp   |  116 ++
 7 files changed, 1930 insertions(+)
 create mode 100644 
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_riscv32.cpp
 create mode 100644 
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_riscv32.h
 create mode 100644 lldb/test/API/macosx/riscv32-corefile/Makefile
 create mode 100644 
lldb/test/API/macosx/riscv32-corefile/TestRV32MachOCorefile.py
 create mode 100644 
lldb/test/API/macosx/riscv32-corefile/create-empty-riscv-corefile.cpp

diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index f31b56b9f81e6..9d5e0f886a4a5 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -12,6 +12,7 @@
 #include "Plugins/Process/Utility/RegisterContextDarwin_arm.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_arm64.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_i386.h"
+#include "Plugins/Process/Utility/RegisterContextDarwin_riscv32.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_x86_64.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
@@ -769,6 +770,147 @@ class RegisterContextDarwin_arm64_Mach : public 
RegisterContextDarwin_arm64 {
   }
 };
 
+class RegisterContextDarwin_riscv32_Mach
+: public RegisterContextDarwin_riscv32 {
+public:
+  RegisterContextDarwin_riscv32_Mach(lldb_private::Thread &thread,
+ const DataExtractor &data)
+  : RegisterContextDarwin_riscv32(thread, 0) {
+SetRegisterDataFrom_LC_THREAD(data);
+  }
+
+  void InvalidateAllRegisters() override {
+// Do nothing... registers are always valid...
+  }
+
+  void SetRegisterDataFrom_LC_THREAD(const DataExtractor &data) {
+lldb::offset_t offset = 0;
+SetError(GPRRegSet, Read, -1);
+SetError(FPURegSet, Read, -1);
+SetError(EXCRegSet, Read, -1);
+SetError(CSRRegSet, Read, -1);
+bool done = false;
+while (!done) {
+  int flavor = data.GetU32(&offset);
+  uint32_t count = data.GetU32(&offset);
+  lldb::offset_t next_thread_state = offset + (count * 4);
+  switch (flavor) {
+  case GPRRegSet:
+// x0-x31 + pc
+if (count >= 32) {
+  for (uint32_t i = 0; i < 32; ++i)
+((uint32_t *)&gpr.x0)[i] = data.GetU32(&offset);
+  gpr.pc = data.GetU32(&offset);
+  SetError(GPRRegSet, Read, 0);
+}
+offset = next_thread_state;
+break;
+  case FPURegSet: {
+// f0-f31 + fcsr
+if (count >= 32) {
+  for (uint32_t i = 0; i < 32; ++i)
+((uint32_t *)&fpr.f0)[i] = data.GetU32(&offset);
+  fpr.fcsr = data.GetU32(&offset);
+  SetError(FPURegSet, Read, 0);
+}
+  }
+offset = next_thread_state;
+break;
+  case EXCRegSet:
+if (count == 3) {
+  exc.exception = data.GetU32(&offset);
+  exc.fsr = data.GetU32(&offset);
+  exc.far = data.GetU32(&offset);
+  SetError(EXCRegSet, Read, 0);
+}
+offset = next_thread_state;
+break;
+  default:
+done = true;
+break;
+  }
+}
+  }
+
+  static bool Create_LC_THREAD(Thread *thread, Stream &data) {
+RegisterContextSP reg_ctx_sp(thread->GetRegisterContext());
+if (reg_ctx_sp) {
+  RegisterContext *reg_ctx = reg_ctx_sp.get();
+
+  data.PutHex32(GPRRegSet); // Flavor
+  data.PutHex32(GPRWordCount);
+  PrintRegisterValue(reg_ctx, "x0", nullptr, 4, data);
+  PrintRegisterValue(reg_ctx, "x1", nullptr, 4, data);
+  PrintRegisterValue(reg_ctx, "x2", nullptr, 4, data);
+  PrintRegisterValue(reg_ctx, "x3", nullptr, 4, data);
+  PrintRegisterValue(reg_ctx, "x4", nullptr, 4, data);
+  PrintRegisterValue(reg_ctx, "x5", nullptr, 4,

[Lldb-commits] [lldb] [lldb][MachO] MachO corefile support for riscv32 binaries (PR #137092)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -42,10 +43,19 @@ SourceRequestHandler::Run(const protocol::SourceArguments 
&args) const {
   if (!frame.IsValid())
 return llvm::make_error("source not found");
 
-  lldb::SBInstructionList insts = 
frame.GetSymbol().GetInstructions(dap.target);
   lldb::SBStream stream;
   lldb::SBExecutionContext exe_ctx(frame);
-  insts.GetDescription(stream, exe_ctx);
+  lldb::SBSymbol symbol = frame.GetSymbol();
+
+  if (symbol.IsValid()) {
+lldb::SBInstructionList insts = symbol.GetInstructions(dap.target);
+insts.GetDescription(stream, exe_ctx);
+  } else {
+// No valid symbol, just return the disassembly

JDevlieghere wrote:

```suggestion
// No valid symbol, just return the disassembly.
```
[When writing comments, write them as English prose, using proper 
capitalization, punctuation, 
etc.](https://llvm.org/docs/CodingStandards.html#commenting)

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


[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -783,6 +783,16 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
 // Line numbers are 1-based.
 object.try_emplace("line", inst_line + 1);
 object.try_emplace("column", 1);
+  } else {
+// No valid line entry or symbol

JDevlieghere wrote:

```suggestion
// No valid line entry or symbol.
```

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


[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -783,6 +783,16 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
 // Line numbers are 1-based.
 object.try_emplace("line", inst_line + 1);
 object.try_emplace("column", 1);
+  } else {
+// No valid line entry or symbol
+llvm::json::Object source;
+EmplaceSafeString(source, "name", frame_name);
+source.try_emplace("sourceReference", MakeDAPFrameID(frame));
+EmplaceSafeString(source, "presentationHint", "deemphasize");
+object.try_emplace("source", std::move(source));
+
+object.try_emplace("line", 1);
+object.try_emplace("column", 1);

JDevlieghere wrote:

```suggestion
object.try_emplace("line", LLDB_INVALID_LINE_NUMBER);
object.try_emplace("column", LLDB_INVALID_LINE_NUMBER);
```

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


[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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

Nice test. LGTM! 

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


[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb][MachO] MachO corefile support for riscv32 binaries (PR #137092)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -0,0 +1,81 @@
+"""Test that all of the GPR registers are read correctly from a riscv32 
corefile."""
+
+import os
+import re
+import subprocess
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestRV32MachOCorefile(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_riscv32_gpr_corefile_registers(self):

JDevlieghere wrote:

It's the `mach` headers you're using I think.

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


[Lldb-commits] [lldb] [lldb][MachO] MachO corefile support for riscv32 binaries (PR #137092)

2025-04-23 Thread Jason Molenda via lldb-commits


@@ -0,0 +1,81 @@
+"""Test that all of the GPR registers are read correctly from a riscv32 
corefile."""
+
+import os
+import re
+import subprocess
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestRV32MachOCorefile(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_riscv32_gpr_corefile_registers(self):

jasonmolenda wrote:

I didn't think there was anything very Darwin specific here, figured 
ObjectFileMachO was built on Linux etc but PR linux testing says I'm wrong.

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-23 Thread Michael Buch via lldb-commits

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


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

2025-04-23 Thread John Harrison via lldb-commits

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


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

2025-04-23 Thread via lldb-commits

Author: John Harrison
Date: 2025-04-23T11:02:33-07:00
New Revision: 3b48e2a7508ab090b1b7c6a68f87e3eddad5473d

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

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

Acquiring the lock for the target should help ensure consistency with
other background operations, like the thread monitoring events that can
trigger run commands from a different thread.

Added: 


Modified: 
lldb/tools/lldb-dap/Handler/RequestHandler.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
index 3520dc2c71a55..be9273963654a 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
@@ -14,6 +14,7 @@
 #include "Protocol/ProtocolBase.h"
 #include "RunInTerminal.h"
 #include "llvm/Support/Error.h"
+#include 
 
 #if !defined(_WIN32)
 #include 
@@ -180,6 +181,9 @@ void BaseRequestHandler::Run(const Request &request) {
 return;
   }
 
+  lldb::SBMutex lock = dap.GetAPIMutex();
+  std::lock_guard guard(lock);
+
   // FIXME: After all the requests have migrated from LegacyRequestHandler >
   // RequestHandler<> we should be able to move this into
   // RequestHandler<>::operator().



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


[Lldb-commits] [lldb] [lldb][lldb-dap] Redirect LLDB's messages to the right output category. (PR #137002)

2025-04-23 Thread Ebuka Ezike via lldb-commits

da-viper wrote:

I think that may not apply to LLDB-dap.

Since dap uses the SBAPI it sends the debugee output to the client here. 
https://github.com/llvm/llvm-project/blob/1b6cbaa7b64f54b127d139d653468e213bae007e/lldb/tools/lldb-dap/EventHelper.cpp#L205-L215




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


[Lldb-commits] [lldb] [lldb] Support riscv32 corefiles (PR #115408)

2025-04-23 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes



---

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


10 Files Affected:

- (modified) lldb/source/Plugins/Process/Utility/CMakeLists.txt (+2) 
- (added) lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp 
(+81) 
- (added) lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.h 
(+63) 
- (added) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv32.cpp 
(+142) 
- (added) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv32.h (+76) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.cpp 
(+4-5) 
- (added) lldb/source/Plugins/Process/Utility/RegisterInfos_riscv32.h (+185) 
- (modified) lldb/source/Plugins/Process/elf-core/CMakeLists.txt (+1) 
- (added) 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.cpp (+81) 
- (added) 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.h (+56) 


``diff
diff --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt 
b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index 308ea29e31ad7..5ffd2d7114cc9 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -39,6 +39,7 @@ add_lldb_library(lldbPluginProcessUtility
   RegisterContextPOSIX_arm64.cpp
   RegisterContextPOSIX_loongarch64.cpp
   RegisterContextPOSIX_mips64.cpp
+  RegisterContextPOSIX_riscv32.cpp
   RegisterContextPOSIX_powerpc.cpp
   RegisterContextPOSIX_ppc64le.cpp
   RegisterContextPOSIX_riscv64.cpp
@@ -53,6 +54,7 @@ add_lldb_library(lldbPluginProcessUtility
   RegisterInfoPOSIX_arm64.cpp
   RegisterInfoPOSIX_loongarch64.cpp
   RegisterInfoPOSIX_ppc64le.cpp
+  RegisterInfoPOSIX_riscv32.cpp
   RegisterInfoPOSIX_riscv64.cpp
   StopInfoMachException.cpp
   ThreadMemory.cpp
diff --git 
a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp
new file mode 100644
index 0..64064f86cea04
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp
@@ -0,0 +1,81 @@
+//===-- RegisterContextPOSIX_riscv32.cpp *- 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
+//
+//===--===//
+
+#include "RegisterContextPOSIX_riscv32.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/Utility/Scalar.h"
+#include "llvm/Support/Compiler.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+RegisterContextPOSIX_riscv32::RegisterContextPOSIX_riscv32(
+lldb_private::Thread &thread,
+std::unique_ptr register_info)
+: lldb_private::RegisterContext(thread, 0),
+  m_register_info_up(std::move(register_info)) {}
+
+RegisterContextPOSIX_riscv32::~RegisterContextPOSIX_riscv32() = default;
+
+void RegisterContextPOSIX_riscv32::invalidate() {}
+
+void RegisterContextPOSIX_riscv32::InvalidateAllRegisters() {}
+
+size_t RegisterContextPOSIX_riscv32::GetRegisterCount() {
+  return m_register_info_up->GetRegisterCount();
+}
+
+size_t RegisterContextPOSIX_riscv32::GetGPRSize() {
+  return m_register_info_up->GetGPRSize();
+}
+
+unsigned RegisterContextPOSIX_riscv32::GetRegisterSize(unsigned int reg) {
+  return m_register_info_up->GetRegisterInfo()[reg].byte_size;
+}
+
+unsigned RegisterContextPOSIX_riscv32::GetRegisterOffset(unsigned int reg) {
+  return m_register_info_up->GetRegisterInfo()[reg].byte_offset;
+}
+
+const lldb_private::RegisterInfo *
+RegisterContextPOSIX_riscv32::GetRegisterInfoAtIndex(size_t reg) {
+  if (reg < GetRegisterCount())
+return &GetRegisterInfo()[reg];
+
+  return nullptr;
+}
+
+size_t RegisterContextPOSIX_riscv32::GetRegisterSetCount() {
+  return m_register_info_up->GetRegisterCount();
+}
+
+const lldb_private::RegisterSet *
+RegisterContextPOSIX_riscv32::GetRegisterSet(size_t set) {
+  return m_register_info_up->GetRegisterSet(set);
+}
+
+const lldb_private::RegisterInfo *
+RegisterContextPOSIX_riscv32::GetRegisterInfo() {
+  return m_register_info_up->GetRegisterInfo();
+}
+
+bool RegisterContextPOSIX_riscv32::IsGPR(unsigned int reg) {
+  return m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
+ RegisterInfoPOSIX_riscv32::eRegsetMaskDefault;
+}
+
+bool RegisterContextPOSIX_riscv32::IsFPR(unsigned int reg) {
+  return m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
+ RegisterInfoPOSIX_riscv32::eRe

[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-23 Thread Michael Buch via lldb-commits


@@ -395,8 +395,8 @@ 
lldb_private::formatters::NSSetISyntheticFrontEnd::GetIndexOfChildWithName(
   (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors()))
 return llvm::createStringError(
 "'SyntheticChildrenFrontEnd::NSSetISyntheticFrontEnd' cannot find "
-"index of child '%s'",
-name.AsCString());
+"index of child '%s'. (idx='%d')",

Michael137 wrote:

```suggestion
"index of child '%s'. (idx='%" PRu32 "')",
```
(same goes for the other `idx` logs)

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


[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-23 Thread Michael Buch via lldb-commits


@@ -2074,6 +2076,64 @@ static const Definition *FindEntry(const llvm::StringRef 
&format_str,
   return parent;
 }
 
+/// Parses a single highlighting format specifier.
+///
+/// Example syntax for such specifier:
+/// \code
+/// ${function.name-with-args:%highlight_basename(ansi.fg.green)}

Michael137 wrote:

This got lost in the noise a bit but @jimingham , do you still have an issue 
with the setting name after my explanation above? Maybe we can find an 
alternative to `language` for the `` part

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


[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-23 Thread Michael Buch via lldb-commits

Michael137 wrote:

Will give others some time to look over

Any preference on how to land this? Would be nice to keep the commits separate 
and not get them squashed. Perhaps push them to HEAD without the github UI but 
mention the PR in each commit message?

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (PR #137007)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -37,6 +37,16 @@ void OptionValueEnumeration::DumpValue(const 
ExecutionContext *exe_ctx,
   }
 }
 
+llvm::json::Value
+OptionValueEnumeration::ToJSON(const ExecutionContext *exe_ctx) {
+  for (const auto &enums : m_enumerations) {
+if (enums.value.value == m_current_value)
+  return enums.cstring.GetStringRef();
+  }
+
+  return llvm::formatv("%", PRIu64, static_cast(m_current_value));

JDevlieghere wrote:

Could this use `to_string`? 
```suggestion
  return std::to_string(m_current_value);
```

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (PR #137007)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (PR #137007)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] dd17cf4 - [lldb] Minor improvements to AddNamesMatchingPartialString (NFC) (#136760)

2025-04-23 Thread via lldb-commits

Author: Dave Lee
Date: 2025-04-23T15:21:34-07:00
New Revision: dd17cf4480fc55c38813769a46fb2807397d8f72

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

LOG: [lldb] Minor improvements to AddNamesMatchingPartialString (NFC) (#136760)

The primary changes are:

1. Avoid allocating a temporary `std::string` each time in the loop
2. Use `starts_with` instead of `find(...) == 0`

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandObject.h

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandObject.h 
b/lldb/include/lldb/Interpreter/CommandObject.h
index e6fea9e022c43..8e33edbc4c794 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -40,14 +40,13 @@ int AddNamesMatchingPartialString(
 StringList *descriptions = nullptr) {
   int number_added = 0;
 
-  const bool add_all = cmd_str.empty();
-
-  for (auto iter = in_map.begin(), end = in_map.end(); iter != end; iter++) {
-if (add_all || (iter->first.find(std::string(cmd_str), 0) == 0)) {
+  for (const auto &[name, cmd] : in_map) {
+llvm::StringRef cmd_name = name;
+if (cmd_name.starts_with(cmd_str)) {
   ++number_added;
-  matches.AppendString(iter->first.c_str());
+  matches.AppendString(name);
   if (descriptions)
-descriptions->AppendString(iter->second->GetHelp());
+descriptions->AppendString(cmd->GetHelp());
 }
   }
 



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


[Lldb-commits] [lldb] [lldb] Support riscv32 corefiles (PR #115408)

2025-04-23 Thread Jason Molenda via lldb-commits


@@ -0,0 +1,185 @@
+//===-- RegisterInfos_riscv32.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
+//
+//===--===//
+
+#ifdef DECLARE_REGISTER_INFOS_RISCV32_STRUCT
+
+#include "Utility/RISCV_DWARF_Registers.h"
+#include "lldb-riscv-register-enums.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private.h"
+
+#include 
+
+#ifndef GPR_OFFSET
+#error GPR_OFFSET must be defined before including this header file
+#endif
+
+#ifndef FPR_OFFSET
+#error FPR_OFFSET must be defined before including this header file
+#endif
+
+using namespace riscv_dwarf;
+
+// clang-format off
+
+// I suppose EHFrame and DWARF are the same.
+#define KIND_HELPER(reg, generic_kind) 
\
+  {
\
+riscv_dwarf::dwarf_##reg, riscv_dwarf::dwarf_##reg, generic_kind,  
\
+LLDB_INVALID_REGNUM, reg##_riscv   
\
+  }
+
+// Generates register kinds array for vector registers
+#define GPR32_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind)
+
+// FPR register kinds array for vector registers
+#define FPR32_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind)
+
+// VPR register kinds array for vector registers
+#define VPR_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind)
+
+// Defines a 32-bit general purpose register
+#define DEFINE_GPR32(reg, generic_kind) DEFINE_GPR32_ALT(reg, reg, 
generic_kind)
+
+// Defines a 32-bit general purpose register
+#define DEFINE_GPR32_ALT(reg, alt, generic_kind)   
\
+  {
\
+#reg, #alt, 4, GPR_OFFSET(gpr_##reg##_riscv - gpr_first_riscv),
\
+lldb::eEncodingUint, lldb::eFormatHex, 
\
+GPR32_KIND(gpr_##reg, generic_kind), nullptr, nullptr, nullptr,
\
+  }
+
+#define DEFINE_FPR32(reg, generic_kind) DEFINE_FPR32_ALT(reg, reg, 
generic_kind)
+
+#define DEFINE_FPR32_ALT(reg, alt, generic_kind) DEFINE_FPR_ALT(reg, alt, 4, 
generic_kind)
+
+#define DEFINE_FPR_ALT(reg, alt, size, generic_kind)   
\
+  {
\
+#reg, #alt, size, FPR_OFFSET(fpr_##reg##_riscv - fpr_first_riscv), 
\
+lldb::eEncodingUint, lldb::eFormatHex, 
\
+FPR32_KIND(fpr_##reg, generic_kind), nullptr, nullptr, nullptr,   \
+  }
+
+#define DEFINE_VPR(reg, generic_kind) DEFINE_VPR_ALT(reg, reg, generic_kind)
+
+// Defines a scalable vector register, with default size 128 bits
+// The byte offset 0 is a placeholder, which should be corrected at runtime.
+#define DEFINE_VPR_ALT(reg, alt, generic_kind) 
\
+  {
\
+#reg, #alt, 16, 0, lldb::eEncodingVector, lldb::eFormatVectorOfUInt8,  
\
+VPR_KIND(vpr_##reg, generic_kind), nullptr, nullptr, nullptr   
\
+  }
+
+// clang-format on
+
+static lldb_private::RegisterInfo g_register_infos_riscv32_le[] = {
+// DEFINE_GPR32(name, GENERIC KIND)
+DEFINE_GPR32(pc, LLDB_REGNUM_GENERIC_PC),
+DEFINE_GPR32_ALT(ra, x1, LLDB_REGNUM_GENERIC_RA),
+DEFINE_GPR32_ALT(sp, x2, LLDB_REGNUM_GENERIC_SP),
+DEFINE_GPR32_ALT(gp, x3, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(tp, x4, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(t0, x5, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(t1, x6, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(t2, x7, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(fp, x8, LLDB_REGNUM_GENERIC_FP),
+DEFINE_GPR32_ALT(s1, x9, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(a0, x10, LLDB_REGNUM_GENERIC_ARG1),
+DEFINE_GPR32_ALT(a1, x11, LLDB_REGNUM_GENERIC_ARG2),
+DEFINE_GPR32_ALT(a2, x12, LLDB_REGNUM_GENERIC_ARG3),
+DEFINE_GPR32_ALT(a3, x13, LLDB_REGNUM_GENERIC_ARG4),
+DEFINE_GPR32_ALT(a4, x14, LLDB_REGNUM_GENERIC_ARG5),
+DEFINE_GPR32_ALT(a5, x15, LLDB_REGNUM_GENERIC_ARG6),
+DEFINE_GPR32_ALT(a6, x16, LLDB_REGNUM_GENERIC_ARG7),
+DEFINE_GPR32_ALT(a7, x17, LLDB_REGNUM_GENERIC_ARG8),
+DEFINE_GPR32_ALT(s2, x18, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(s3, x19, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(s4, x20, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(s5, x21, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(s6, x22, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(s7, x23, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(s8, x24, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_ALT(s9, x25, LLDB_INVALID_REGNUM),
+DEFINE_GPR32_AL

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

2025-04-23 Thread John Harrison via lldb-commits


@@ -8,72 +8,37 @@
 
 #include "DAP.h"
 #include "EventHelper.h"
-#include "JSONUtils.h"
+#include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
+#include "llvm/Support/Error.h"
+
+using namespace llvm;
+using namespace lldb_dap::protocol;
 
 namespace lldb_dap {
 
-// "NextRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Next request; value of command field is 'next'. The
-// request starts the debuggee to run again for one step.
-// The debug adapter first sends the NextResponse and then
-// a StoppedEvent (event type 'step') after the step has
-// completed.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "next" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/NextArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "NextArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'next' request.",
-//   "properties": {
-// "threadId": {
-//   "type": "integer",
-//   "description": "Execute 'next' for this thread."
-// },
-// "granularity": {
-//   "$ref": "#/definitions/SteppingGranularity",
-//   "description": "Stepping granularity. If no granularity is specified, 
a
-//   granularity of `statement` is assumed."
-// }
-//   },
-//   "required": [ "threadId" ]
-// },
-// "NextResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'next' request. This is just an
-// acknowledgement, so no body field is required."
-//   }]
-// }
-void NextRequestHandler::operator()(const llvm::json::Object &request) const {
-  llvm::json::Object response;
-  FillResponse(request, response);
-  const auto *arguments = request.getObject("arguments");
-  lldb::SBThread thread = dap.GetLLDBThread(*arguments);
-  if (thread.IsValid()) {
-// Remember the thread ID that caused the resume so we can set the
-// "threadCausedFocus" boolean value in the "stopped" events.
-dap.focus_tid = thread.GetThreadID();
-if (HasInstructionGranularity(*arguments)) {
-  thread.StepInstruction(/*step_over=*/true);
-} else {
-  thread.StepOver();
-}
+/// The request executes one step (in the given granularity) for the specified
+/// thread and allows all other threads to run freely by resuming them. If the
+/// debug adapter supports single thread execution (see capability
+/// `supportsSingleThreadExecutionRequests`), setting the `singleThread`
+/// argument to true prevents other suspended threads from resuming. The debug
+/// adapter first sends the response and then a `stopped` event (with reason
+/// `step`) after the step has completed.
+Error NextRequestHandler::Run(const NextArguments &args) const {
+  lldb::SBThread thread = dap.GetLLDBThread(args.threadId);

ashgti wrote:

Sent this as PR #137026

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -37,6 +37,18 @@ void OptionValueEnumeration::DumpValue(const 
ExecutionContext *exe_ctx,
   }
 }
 
+llvm::json::Value
+OptionValueEnumeration::ToJSON(const ExecutionContext *exe_ctx) {
+  const size_t count = m_enumerations.GetSize();
+  for (size_t i = 0; i < count; ++i) {
+if (m_enumerations.GetValueAtIndexUnchecked(i).value == m_current_value) {
+  return m_enumerations.GetCStringAtIndex(i).GetStringRef();
+}

JDevlieghere wrote:

```suggestion
if (m_enumerations.GetValueAtIndexUnchecked(i).value == m_current_value) 
  return m_enumerations.GetCStringAtIndex(i).GetStringRef();
```

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -163,6 +163,19 @@ GetEnvironmentFromArguments(const llvm::json::Object 
&arguments) {
   return envs;
 }
 
+std::string GetStopDisassemblyDisplay(lldb::SBDebugger &debugger) {
+  lldb::SBStructuredData result =
+  debugger.GetSetting("stop-disassembly-display");
+  const size_t result_length = result.GetStringValue(nullptr, 0);
+  if (result_length > 0) {
+std::string result_string(result_length, '\0');
+result.GetStringValue(result_string.data(), result_length + 1);
+return result_string;
+  }
+
+  return "no-debuginfo";

JDevlieghere wrote:

I don't like hard-coding a default value here. If for whatever reason this ever 
were to change, that person needs to remember to do the same thing here. 
Instead, could we make this return a `std::optional`.

Even better, instead of having this return a string, I would create a new enum 
for this setting in lldb-dap and have this return an enum value instead of a 
string.  If we move the enum from `Debugger.h` into `lldb-enumerations.h` we 
can parse it with an llvm::StringSwitch and reuse it across lldb-dap. 

```
  enum StopDisassemblyType {
eStopDisassemblyTypeNever = 0,
eStopDisassemblyTypeNoDebugInfo,
eStopDisassemblyTypeNoSource,
eStopDisassemblyTypeAlways
  };
```

I guess that would still require a default value, but at least it's easier to 
grep for the enum value than for the corresponding string. 

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Jonas Devlieghere via lldb-commits


@@ -202,6 +202,10 @@ struct DAP {
 
   lldb::SBFormat frame_format;
   lldb::SBFormat thread_format;
+
+  /// The value of stop-disassembly-display setting in LLDB.
+  std::string stop_disassembly_display;

JDevlieghere wrote:

I'm wondering if we should be caching this. Querying the debugger for a setting 
should be cheap enough that we could do it whenever we need to know. The added 
benefit is that you'll be able to change the setting and have it take immediate 
effect, while with the current approach you'd have to create new debug session. 

Personally I'm leaning toward computing this once per request. 

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


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

2025-04-23 Thread John Harrison via lldb-commits

ashgti wrote:

I updated my branch with main and updated the launch handler to return an 
`llvm::Error` to simplify the body.

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


[Lldb-commits] [lldb] [llvm] [lldb] Implement CLI support for reverse-continue (PR #132783)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb] Support riscv32 corefiles (PR #115408)

2025-04-23 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] Bug fix in FindModuleUUID (PR #137075)

2025-04-23 Thread via lldb-commits

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


[Lldb-commits] [lldb] Bug fix in FindModuleUUID (PR #137075)

2025-04-23 Thread via lldb-commits

https://github.com/GeorgeHuyubo created 
https://github.com/llvm/llvm-project/pull/137075

In some core file, we are seeing that it's not always the case that the ELF 
header would exist in the first region in NT_FILES section. Therefore the 
FindModuleUUID is not able to find the module UUID by just returning the first 
entry with path matching. 

This fix change the behavior to continue search the NT_FILE entries until 
finding a valid UUID with path matching.

>From 2542d34b2259f2540ca319f9b46e4f898427146e Mon Sep 17 00:00:00 2001
From: George Hu 
Date: Wed, 23 Apr 2025 15:24:55 -0700
Subject: [PATCH] Bug fix in FindModuleUUID

---
 lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp 
b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 5f85f99ce7bdd..6635b15b669f1 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -289,7 +289,7 @@ void ProcessElfCore::UpdateBuildIdForNTFileEntries() {
 UUID ProcessElfCore::FindModuleUUID(const llvm::StringRef path) {
   // Returns the gnu uuid from matched NT_FILE entry
   for (NT_FILE_Entry &entry : m_nt_file_entries)
-if (path == entry.path)
+if (path == entry.path && entry.uuid.IsValid())
   return entry.uuid;
   return UUID();
 }

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits


@@ -163,6 +163,19 @@ GetEnvironmentFromArguments(const llvm::json::Object 
&arguments) {
   return envs;
 }
 
+std::string GetStopDisassemblyDisplay(lldb::SBDebugger &debugger) {
+  lldb::SBStructuredData result =
+  debugger.GetSetting("stop-disassembly-display");
+  const size_t result_length = result.GetStringValue(nullptr, 0);
+  if (result_length > 0) {
+std::string result_string(result_length, '\0');
+result.GetStringValue(result_string.data(), result_length + 1);
+return result_string;
+  }
+
+  return "no-debuginfo";

eronnen wrote:

not sure I understand the suggestion, do you mean having an alternative setting 
in the lldb-dap launch configuration and use it instead of 
`debugger.GetSetting`, or just export the existing `StopDisassemblyType` enum 
and convert the current `GetSetting` to use it?

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/136494

>From 9bb3be7a7fe315cda2e63dd10d90b161e6677263 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 17:07:09 +0200
Subject: [PATCH 1/5] fallback to assembly when source code is not available

---
 lldb/tools/lldb-dap/JSONUtils.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp 
b/lldb/tools/lldb-dap/JSONUtils.cpp
index 33f10c93d2ada..1a44df7740639 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -750,9 +750,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
   EmplaceSafeString(object, "name", frame_name);
 
   auto line_entry = frame.GetLineEntry();
+  auto file_spec = line_entry.GetFileSpec();
   // A line entry of 0 indicates the line is compiler generated i.e. no source
   // file is associated with the frame.
-  if (line_entry.GetFileSpec().IsValid() &&
+  if (file_spec.IsValid() && file_spec.Exists() &&
   (line_entry.GetLine() != 0 ||
line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) {
 object.try_emplace("source", CreateSource(line_entry));

>From 87426fea3817fb4b54cf2a25560edfed763fe999 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:03:02 +0200
Subject: [PATCH 2/5] fix TestDAP_coreFile.py with source maps

---
 .../API/tools/lldb-dap/coreFile/TestDAP_coreFile.py| 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 1896acea15a99..ce54133a61f3e 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -19,7 +19,9 @@ def test_core_file(self):
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 
 self.create_debug_adapter()
-self.attach(exe_file, coreFile=core_file)
+
+source_map = [["/home/labath/test", current_dir]]
+self.attach(exe_file, coreFile=core_file, sourceMap=source_map)
 
 expected_frames = [
 {
@@ -27,7 +29,7 @@ def test_core_file(self):
 "id": 524288,
 "line": 4,
 "name": "bar",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40011C",
 },
 {
@@ -35,7 +37,7 @@ def test_core_file(self):
 "id": 524289,
 "line": 10,
 "name": "foo",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x400142",
 },
 {
@@ -43,7 +45,7 @@ def test_core_file(self):
 "id": 524290,
 "line": 16,
 "name": "_start",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40015F",
 },
 ]

>From e9043dc00010c603553ae067d5ff1e30aba0985e Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:04:46 +0200
Subject: [PATCH 3/5] use stop-disassembly-display setting to determine when to
 show disassembly

---
 .../lldb-dap/coreFile/TestDAP_coreFile.py |  10 +-
 .../stackTraceDisassemblyDisplay/Makefile |   3 +
 .../TestDAP_stackTraceDisassemblyDisplay.py   | 195 ++
 .../stackTraceDisassemblyDisplay/main.c   |  10 +
 lldb/tools/lldb-dap/DAP.h |   4 +
 .../lldb-dap/Handler/AttachRequestHandler.cpp |   1 +
 .../lldb-dap/Handler/LaunchRequestHandler.cpp |   1 +
 .../tools/lldb-dap/Handler/RequestHandler.cpp |   4 +
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   3 +
 .../Handler/StackTraceRequestHandler.cpp  |   3 +-
 lldb/tools/lldb-dap/JSONUtils.cpp |  34 ++-
 lldb/tools/lldb-dap/JSONUtils.h   |  21 +-
 lldb/tools/lldb-dap/LLDBUtils.cpp |  19 ++
 lldb/tools/lldb-dap/LLDBUtils.h   |   9 +
 14 files changed, 300 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/Makefile
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/main.c

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index ce54133a61f3e..1896acea15a99 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP

[Lldb-commits] [lldb] Fix connecting via abstract socket (PR #136466)

2025-04-23 Thread Dmitry Vasilyev via lldb-commits


@@ -455,35 +455,29 @@ int main_platform(int argc, char *argv[]) {
   lldb_private::Args inferior_arguments;
   inferior_arguments.SetArguments(argc, const_cast(argv));
 
-  Socket::SocketProtocol protocol = Socket::ProtocolUnixDomain;
-
+  Log *log = GetLog(LLDBLog::Platform);
   if (fd != SharedSocket::kInvalidFD) {
 // Child process will handle the connection and exit.
-if (gdbserver_port)
-  protocol = Socket::ProtocolTcp;
-
-Log *log = GetLog(LLDBLog::Platform);
-
 NativeSocket sockfd;
 error = SharedSocket::GetNativeSocket(fd, sockfd);
 if (error.Fail()) {
   LLDB_LOGF(log, "lldb-platform child: %s", error.AsCString());
   return socket_error;
 }
 
-GDBRemoteCommunicationServerPlatform platform(protocol, gdbserver_port);
 Socket *socket;
-if (protocol == Socket::ProtocolTcp)
+if (gdbserver_port) {
   socket = new TCPSocket(sockfd, /*should_close=*/true);
-else {
-#if LLDB_ENABLE_POSIX
-  socket = new DomainSocket(sockfd, /*should_close=*/true);
-#else
-  WithColor::error() << "lldb-platform child: Unix domain sockets are not "
-"supported on this platform.";
-  return socket_error;
-#endif
+} else {
+  socket = DomainSocket::Create(sockfd, /*should_close=*/true, error);
+  if (error.Fail()) {
+LLDB_LOGF(log, "Failed to create socket: %s\n", error.AsCString());
+return socket_error;
+  }
 }
+
+Socket::SocketProtocol protocol = socket->GetSocketProtocol();
+GDBRemoteCommunicationServerPlatform platform(protocol, gdbserver_port);

slydiman wrote:

```suggestion
GDBRemoteCommunicationServerPlatform platform(socket->GetSocketProtocol(), 
gdbserver_port);
```

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


[Lldb-commits] [lldb] [lldb][CPlusPlus] Always use CPlusPlusNameParser for parsing C++ function names (PR #137072)

2025-04-23 Thread Pavel Labath via lldb-commits


@@ -174,6 +175,9 @@ int main(int argc, char **argv) {
   //% self.expect("expr (new struct C[1]); side_effect", endstr=" = 4\n")
   //% self.expect("expr delete c2; side_effect", endstr=" = 1\n")
   //% self.expect("expr delete[] c3; side_effect", endstr=" = 2\n")
+  //% self.expect("image lookup -n operator()", substrs=["C::operator()(int)"])

labath wrote:

I take it this means that the "simplified" parser got `operator()` wrong 
somehow? Could you also add this to the unit tests in 
unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (PR #137007)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] Fix connecting via abstract socket (PR #136466)

2025-04-23 Thread Dmitry Vasilyev via lldb-commits


@@ -455,35 +455,29 @@ int main_platform(int argc, char *argv[]) {
   lldb_private::Args inferior_arguments;
   inferior_arguments.SetArguments(argc, const_cast(argv));
 
-  Socket::SocketProtocol protocol = Socket::ProtocolUnixDomain;

slydiman wrote:

There is a path when protocol remains undefined inside parse_listen_host_port().

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


[Lldb-commits] [lldb] Fix connecting via abstract socket (PR #136466)

2025-04-23 Thread Dmitry Vasilyev via lldb-commits


@@ -182,3 +191,22 @@ std::vector 
DomainSocket::GetListeningConnectionURI() const {
 
   return {llvm::formatv("unix-connect://{0}", addr.sun_path)};
 }
+
+Socket *DomainSocket::Create(NativeSocket sockfd, bool should_close,
+ Status &error) {
+#ifdef __linux__
+  // Check if fd represents domain socket or abstract socket.
+  struct sockaddr_un addr;
+  socklen_t addr_len = sizeof(addr);
+  if (getsockname(sockfd, (struct sockaddr *)&addr, &addr_len) == -1) {
+error = Status::FromErrorString(

slydiman wrote:

Please remove the `lldb-platform` reference from DomainSocket implementation.

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (PR #137007)

2025-04-23 Thread Ebuka Ezike via lldb-commits

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


[Lldb-commits] [lldb] fb0000b - [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (#137007)

2025-04-23 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-04-24T07:38:35+01:00
New Revision: fbb6624a5f2df25d10e3667111e96dd1abd5

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

LOG: [lldb][lldb-dap] Add ToJSON for OptionValueEnumeration (#137007)

This automatically enables reading enum settings in the SB API

Added: 


Modified: 
lldb/include/lldb/Interpreter/OptionValueEnumeration.h
lldb/source/Interpreter/OptionValueEnumeration.cpp
lldb/test/API/commands/settings/TestSettings.py

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h 
b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h
index 7dc6eea4e69de..924fcc10cbb00 100644
--- a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h
+++ b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h
@@ -41,6 +41,8 @@ class OptionValueEnumeration
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
+
   Status
   SetValueFromString(llvm::StringRef value,
  VarSetOperationType op = eVarSetOperationAssign) override;

diff  --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp 
b/lldb/source/Interpreter/OptionValueEnumeration.cpp
index 8088695243545..dd231f43e0d96 100644
--- a/lldb/source/Interpreter/OptionValueEnumeration.cpp
+++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp
@@ -37,6 +37,16 @@ void OptionValueEnumeration::DumpValue(const 
ExecutionContext *exe_ctx,
   }
 }
 
+llvm::json::Value
+OptionValueEnumeration::ToJSON(const ExecutionContext *exe_ctx) {
+  for (const auto &enums : m_enumerations) {
+if (enums.value.value == m_current_value)
+  return enums.cstring.GetStringRef();
+  }
+
+  return std::to_string(static_cast(m_current_value));
+}
+
 Status OptionValueEnumeration::SetValueFromString(llvm::StringRef value,
   VarSetOperationType op) {
   Status error;
@@ -105,6 +115,6 @@ void 
OptionValueEnumeration::AutoComplete(CommandInterpreter &interpreter,
 }
 return;
   }
-for (size_t i = 0; i < num_enumerators; ++i)
-  
request.AddCompletion(m_enumerations.GetCStringAtIndex(i).GetStringRef());
+  for (size_t i = 0; i < num_enumerators; ++i)
+request.AddCompletion(m_enumerations.GetCStringAtIndex(i).GetStringRef());
 }

diff  --git a/lldb/test/API/commands/settings/TestSettings.py 
b/lldb/test/API/commands/settings/TestSettings.py
index b9b66ea953971..f05a285b47d16 100644
--- a/lldb/test/API/commands/settings/TestSettings.py
+++ b/lldb/test/API/commands/settings/TestSettings.py
@@ -1041,6 +1041,9 @@ def test_settings_api(self):
 # Test OptionValueLanguage
 self.verify_setting_value_json("repl-lang", "c++")
 
+# Test OptionValueEnumeration
+self.verify_setting_value_json("target.x86-disassembly-flavor", 
"intel")
+
 def test_global_option(self):
 # This command used to crash the settings because -g was signaled by a
 # NULL execution context (not one with an empty Target...) and in the



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


[Lldb-commits] [lldb] [llvm] [lldb] Prefer `DW_AT_bit_size` over `DW_AT_byte_size` in `GetDIEBitSizeAndSign` (PR #137123)

2025-04-23 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-transforms

Author: Yingwei Zheng (dtcxzyw)


Changes

`DW_AT_bit_size` will be ignored by lldb if `DW_AT_byte_size` is available and 
non-zero. Unfortunately, gdb crashes when `DW_AT_byte_size` does not exist or 
is set to zero. So I decided to change lldb to match gdb's behavior :(

Stacked on https://github.com/llvm/llvm-project/pull/137118 and 
https://github.com/llvm/llvm-project/pull/137013.
Closes https://github.com/llvm/llvm-project/issues/71065


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


6 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+2-2) 
- (added) lldb/test/Shell/SymbolFile/DWARF/print-boolean.c (+19) 
- (modified) llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (+4) 
- (modified) llvm/lib/Transforms/InstCombine/InstructionCombining.cpp (+18) 
- (added) llvm/test/DebugInfo/X86/convert-bool.ll (+43) 
- (added) llvm/test/Transforms/InstCombine/debuginfo-invert.ll (+70) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 7d0afc04ac3b6..c6aab01fb4a59 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -707,9 +707,9 @@ DWARFUnit::GetDIEBitSizeAndSign(uint64_t 
relative_die_offset) const {
 return llvm::createStringError("cannot resolve DW_OP_convert type DIE");
   uint64_t encoding =
   die.GetAttributeValueAsUnsigned(DW_AT_encoding, DW_ATE_hi_user);
-  uint64_t bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+  uint64_t bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0);
   if (!bit_size)
-bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0);
+bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
   if (!bit_size)
 return llvm::createStringError("unsupported type size");
   bool sign;
diff --git a/lldb/test/Shell/SymbolFile/DWARF/print-boolean.c 
b/lldb/test/Shell/SymbolFile/DWARF/print-boolean.c
new file mode 100644
index 0..27778d89140ac
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/print-boolean.c
@@ -0,0 +1,19 @@
+// RUN: %clang_host -O3 -ggdb -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b 17" \
+// RUN:   -o r \
+// RUN:   -o "p t" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK: (lldb) p t
+// CHECK-NEXT: (int) 1
+
+int a, b, c;
+int d(int e) { return e; }
+int main() {
+  int t;
+  c = d(1);
+  t = 1 && c;
+  b = t & a;
+  return 0;
+}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp 
b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 3939dae81841f..e73028d2e28d9 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1749,6 +1749,10 @@ void DwarfCompileUnit::createBaseTypeDIEs() {
 // Round up to smallest number of bytes that contains this number of bits.
 addUInt(Die, dwarf::DW_AT_byte_size, std::nullopt,
 divideCeil(Btr.BitSize, 8));
+// If the size is not a multiple of 8 (e.g., boolean), add the bit size
+// field.
+if (Btr.BitSize % 8 != 0)
+  addUInt(Die, dwarf::DW_AT_bit_size, std::nullopt, Btr.BitSize);
 
 Btr.Die = &Die;
   }
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp 
b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index f807f5f4519fc..c47d32dc01cd3 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1396,6 +1396,24 @@ void InstCombinerImpl::freelyInvertAllUsersOf(Value *I, 
Value *IgnoredUser) {
"canFreelyInvertAllUsersOf() ?");
 }
   }
+
+  // Update pre-existing debug value uses.
+  SmallVector DbgValues;
+  SmallVector DbgVariableRecords;
+  llvm::findDbgValues(DbgValues, I, &DbgVariableRecords);
+  auto ApplyNot = [](DIExpression *Src) {
+SmallVector Elements;
+Elements.reserve(Src->getElements().size() + 1);
+Elements.push_back(dwarf::DW_OP_not);
+Elements.append(Src->getElements().begin(), Src->getElements().end());
+return DIExpression::get(Src->getContext(), Elements);
+  };
+
+  for (auto *DVI : DbgValues)
+DVI->setExpression(ApplyNot(DVI->getExpression()));
+
+  for (DbgVariableRecord *DVR : DbgVariableRecords)
+DVR->setExpression(ApplyNot(DVR->getExpression()));
 }
 
 /// Given a 'sub' instruction, return the RHS of the instruction if the LHS is 
a
diff --git a/llvm/test/DebugInfo/X86/convert-bool.ll 
b/llvm/test/DebugInfo/X86/convert-bool.ll
new file mode 100644
index 0..3b131579dfe74
--- /dev/null
+++ b/llvm/test/DebugInfo/X86/convert-bool.ll
@@ -0,0 +1,43 @@
+; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s | 
llvm-dwarfdump - | FileCheck %s
+
+; CHECK: DW_TAG_base_type
+; CHECK-NEXT: DW_AT_name  ("DW_ATE_unsigned_1")
+; CHECK-NEXT: DW_AT_encoding  (DW_ATE_unsigned)
+; CHECK-N

[Lldb-commits] [lldb] [llvm] [lldb] Prefer `DW_AT_bit_size` over `DW_AT_byte_size` in `GetDIEBitSizeAndSign` (PR #137123)

2025-04-23 Thread Yingwei Zheng via lldb-commits

https://github.com/dtcxzyw created 
https://github.com/llvm/llvm-project/pull/137123

`DW_AT_bit_size` will be ignored by lldb if `DW_AT_byte_size` is available and 
non-zero. Unfortunately, gdb crashes when `DW_AT_byte_size` does not exist or 
is set to zero. So I decided to change lldb to match gdb's behavior :(

Stacked on https://github.com/llvm/llvm-project/pull/137118 and 
https://github.com/llvm/llvm-project/pull/137013.
Closes https://github.com/llvm/llvm-project/issues/71065


>From 8d37b691c5ebb2e4e85a16b4df02453533869d93 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng 
Date: Thu, 24 Apr 2025 00:08:29 +0800
Subject: [PATCH 1/5] [InstCombine] Add pre-commit tests. NFC.

---
 .../InstCombine/debuginfo-invert.ll   | 70 +++
 1 file changed, 70 insertions(+)
 create mode 100644 llvm/test/Transforms/InstCombine/debuginfo-invert.ll

diff --git a/llvm/test/Transforms/InstCombine/debuginfo-invert.ll 
b/llvm/test/Transforms/InstCombine/debuginfo-invert.ll
new file mode 100644
index 0..2c82c788197a7
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/debuginfo-invert.ll
@@ -0,0 +1,70 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 5
+; RUN: opt -passes=instcombine -S %s -o - | FileCheck %s
+
+target datalayout = 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @test(i32 noundef %x, i32 noundef %y) !dbg !10 {
+; CHECK-LABEL: define i32 @test(
+; CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) !dbg 
[[DBG10:![0-9]+]] {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:  #dbg_value(i32 [[X]], [[META15:![0-9]+]], !DIExpression(), 
[[META18:![0-9]+]])
+; CHECK-NEXT:  #dbg_value(i32 [[Y]], [[META16:![0-9]+]], !DIExpression(), 
[[META18]])
+; CHECK-NEXT:[[CMP_NOT:%.*]] = icmp eq i32 [[X]], 0, !dbg [[DBG19:![0-9]+]]
+; CHECK-NEXT:  #dbg_value(i1 [[CMP_NOT]], [[META17:![0-9]+]], 
!DIExpression(DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, 
DW_ATE_unsigned, DW_OP_stack_value), [[META18]])
+; CHECK-NEXT:[[TMP0:%.*]] = and i32 [[Y]], 1, !dbg [[DBG20:![0-9]+]]
+; CHECK-NEXT:[[AND:%.*]] = select i1 [[CMP_NOT]], i32 0, i32 [[TMP0]], 
!dbg [[DBG20]]
+; CHECK-NEXT:ret i32 [[AND]], !dbg [[DBG21:![0-9]+]]
+;
+entry:
+  #dbg_value(i32 %x, !15, !DIExpression(), !18)
+  #dbg_value(i32 %y, !16, !DIExpression(), !18)
+  %cmp = icmp ne i32 %x, 0, !dbg !19
+  %conv = zext i1 %cmp to i32, !dbg !19
+  #dbg_value(i32 %conv, !17, !DIExpression(), !18)
+  %and = and i32 %conv, %y, !dbg !20
+  ret i32 %and, !dbg !21
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
+!llvm.ident = !{!9}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang 
version 21.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: 
FullDebug, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "test.c", directory: "/", checksumkind: CSK_MD5, 
checksum: "b2d9ffc7905684d8b7c3b52a3136e57c")
+!2 = !{i32 7, !"Dwarf Version", i32 5}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = !{i32 1, !"wchar_size", i32 4}
+!5 = !{i32 8, !"PIC Level", i32 2}
+!6 = !{i32 7, !"PIE Level", i32 2}
+!7 = !{i32 7, !"uwtable", i32 2}
+!8 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
+!9 = !{!"clang version 21.0.0git"}
+!10 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: 
!11, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: 
DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
+!11 = !DISubroutineType(types: !12)
+!12 = !{!13, !13, !13}
+!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!14 = !{!15, !16, !17}
+!15 = !DILocalVariable(name: "x", arg: 1, scope: !10, file: !1, line: 1, type: 
!13)
+!16 = !DILocalVariable(name: "y", arg: 2, scope: !10, file: !1, line: 1, type: 
!13)
+!17 = !DILocalVariable(name: "z", scope: !10, file: !1, line: 2, type: !13)
+!18 = !DILocation(line: 0, scope: !10)
+!19 = !DILocation(line: 2, column: 13, scope: !10)
+!20 = !DILocation(line: 3, column: 12, scope: !10)
+!21 = !DILocation(line: 3, column: 3, scope: !10)
+;.
+; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, 
file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: 
true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, 
nameTableKind: None)
+; CHECK: [[META1]] = !DIFile(filename: "test.c", directory: {{.*}})
+; CHECK: [[DBG10]] = distinct !DISubprogram(name: "test", scope: [[META1]], 
file: [[META1]], line: 1, type: [[META11:![0-9]+]], scopeLine: 1, flags: 
DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | 
DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META14:![0-9]+]])
+; CHECK: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
+; CHECK: [[META12]] = !{[[META13:![0-9]+]], [[META13]], [[META

[Lldb-commits] [lldb] [llvm] [lldb] Prefer `DW_AT_bit_size` over `DW_AT_byte_size` in `GetDIEBitSizeAndSign` (PR #137123)

2025-04-23 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-debuginfo

@llvm/pr-subscribers-lldb

Author: Yingwei Zheng (dtcxzyw)


Changes

`DW_AT_bit_size` will be ignored by lldb if `DW_AT_byte_size` is available and 
non-zero. Unfortunately, gdb crashes when `DW_AT_byte_size` does not exist or 
is set to zero. So I decided to change lldb to match gdb's behavior :(

Stacked on https://github.com/llvm/llvm-project/pull/137118 and 
https://github.com/llvm/llvm-project/pull/137013.
Closes https://github.com/llvm/llvm-project/issues/71065


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


6 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+2-2) 
- (added) lldb/test/Shell/SymbolFile/DWARF/print-boolean.c (+19) 
- (modified) llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (+4) 
- (modified) llvm/lib/Transforms/InstCombine/InstructionCombining.cpp (+18) 
- (added) llvm/test/DebugInfo/X86/convert-bool.ll (+43) 
- (added) llvm/test/Transforms/InstCombine/debuginfo-invert.ll (+70) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 7d0afc04ac3b6..c6aab01fb4a59 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -707,9 +707,9 @@ DWARFUnit::GetDIEBitSizeAndSign(uint64_t 
relative_die_offset) const {
 return llvm::createStringError("cannot resolve DW_OP_convert type DIE");
   uint64_t encoding =
   die.GetAttributeValueAsUnsigned(DW_AT_encoding, DW_ATE_hi_user);
-  uint64_t bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+  uint64_t bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0);
   if (!bit_size)
-bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0);
+bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
   if (!bit_size)
 return llvm::createStringError("unsupported type size");
   bool sign;
diff --git a/lldb/test/Shell/SymbolFile/DWARF/print-boolean.c 
b/lldb/test/Shell/SymbolFile/DWARF/print-boolean.c
new file mode 100644
index 0..27778d89140ac
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/print-boolean.c
@@ -0,0 +1,19 @@
+// RUN: %clang_host -O3 -ggdb -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b 17" \
+// RUN:   -o r \
+// RUN:   -o "p t" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK: (lldb) p t
+// CHECK-NEXT: (int) 1
+
+int a, b, c;
+int d(int e) { return e; }
+int main() {
+  int t;
+  c = d(1);
+  t = 1 && c;
+  b = t & a;
+  return 0;
+}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp 
b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 3939dae81841f..e73028d2e28d9 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1749,6 +1749,10 @@ void DwarfCompileUnit::createBaseTypeDIEs() {
 // Round up to smallest number of bytes that contains this number of bits.
 addUInt(Die, dwarf::DW_AT_byte_size, std::nullopt,
 divideCeil(Btr.BitSize, 8));
+// If the size is not a multiple of 8 (e.g., boolean), add the bit size
+// field.
+if (Btr.BitSize % 8 != 0)
+  addUInt(Die, dwarf::DW_AT_bit_size, std::nullopt, Btr.BitSize);
 
 Btr.Die = &Die;
   }
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp 
b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index f807f5f4519fc..c47d32dc01cd3 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1396,6 +1396,24 @@ void InstCombinerImpl::freelyInvertAllUsersOf(Value *I, 
Value *IgnoredUser) {
"canFreelyInvertAllUsersOf() ?");
 }
   }
+
+  // Update pre-existing debug value uses.
+  SmallVector DbgValues;
+  SmallVector DbgVariableRecords;
+  llvm::findDbgValues(DbgValues, I, &DbgVariableRecords);
+  auto ApplyNot = [](DIExpression *Src) {
+SmallVector Elements;
+Elements.reserve(Src->getElements().size() + 1);
+Elements.push_back(dwarf::DW_OP_not);
+Elements.append(Src->getElements().begin(), Src->getElements().end());
+return DIExpression::get(Src->getContext(), Elements);
+  };
+
+  for (auto *DVI : DbgValues)
+DVI->setExpression(ApplyNot(DVI->getExpression()));
+
+  for (DbgVariableRecord *DVR : DbgVariableRecords)
+DVR->setExpression(ApplyNot(DVR->getExpression()));
 }
 
 /// Given a 'sub' instruction, return the RHS of the instruction if the LHS is 
a
diff --git a/llvm/test/DebugInfo/X86/convert-bool.ll 
b/llvm/test/DebugInfo/X86/convert-bool.ll
new file mode 100644
index 0..3b131579dfe74
--- /dev/null
+++ b/llvm/test/DebugInfo/X86/convert-bool.ll
@@ -0,0 +1,43 @@
+; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s | 
llvm-dwarfdump - | FileCheck %s
+
+; CHECK: DW_TAG_base_type
+; CHECK-NEXT: DW_AT_name  ("DW_ATE_unsigned_1")
+; CHECK-NEXT: DW_AT_encoding  (DW_ATE_

[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/136494

>From 9bb3be7a7fe315cda2e63dd10d90b161e6677263 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 17:07:09 +0200
Subject: [PATCH 1/6] fallback to assembly when source code is not available

---
 lldb/tools/lldb-dap/JSONUtils.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp 
b/lldb/tools/lldb-dap/JSONUtils.cpp
index 33f10c93d2ada..1a44df7740639 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -750,9 +750,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
   EmplaceSafeString(object, "name", frame_name);
 
   auto line_entry = frame.GetLineEntry();
+  auto file_spec = line_entry.GetFileSpec();
   // A line entry of 0 indicates the line is compiler generated i.e. no source
   // file is associated with the frame.
-  if (line_entry.GetFileSpec().IsValid() &&
+  if (file_spec.IsValid() && file_spec.Exists() &&
   (line_entry.GetLine() != 0 ||
line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) {
 object.try_emplace("source", CreateSource(line_entry));

>From 87426fea3817fb4b54cf2a25560edfed763fe999 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:03:02 +0200
Subject: [PATCH 2/6] fix TestDAP_coreFile.py with source maps

---
 .../API/tools/lldb-dap/coreFile/TestDAP_coreFile.py| 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 1896acea15a99..ce54133a61f3e 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -19,7 +19,9 @@ def test_core_file(self):
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 
 self.create_debug_adapter()
-self.attach(exe_file, coreFile=core_file)
+
+source_map = [["/home/labath/test", current_dir]]
+self.attach(exe_file, coreFile=core_file, sourceMap=source_map)
 
 expected_frames = [
 {
@@ -27,7 +29,7 @@ def test_core_file(self):
 "id": 524288,
 "line": 4,
 "name": "bar",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40011C",
 },
 {
@@ -35,7 +37,7 @@ def test_core_file(self):
 "id": 524289,
 "line": 10,
 "name": "foo",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x400142",
 },
 {
@@ -43,7 +45,7 @@ def test_core_file(self):
 "id": 524290,
 "line": 16,
 "name": "_start",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40015F",
 },
 ]

>From e9043dc00010c603553ae067d5ff1e30aba0985e Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:04:46 +0200
Subject: [PATCH 3/6] use stop-disassembly-display setting to determine when to
 show disassembly

---
 .../lldb-dap/coreFile/TestDAP_coreFile.py |  10 +-
 .../stackTraceDisassemblyDisplay/Makefile |   3 +
 .../TestDAP_stackTraceDisassemblyDisplay.py   | 195 ++
 .../stackTraceDisassemblyDisplay/main.c   |  10 +
 lldb/tools/lldb-dap/DAP.h |   4 +
 .../lldb-dap/Handler/AttachRequestHandler.cpp |   1 +
 .../lldb-dap/Handler/LaunchRequestHandler.cpp |   1 +
 .../tools/lldb-dap/Handler/RequestHandler.cpp |   4 +
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   3 +
 .../Handler/StackTraceRequestHandler.cpp  |   3 +-
 lldb/tools/lldb-dap/JSONUtils.cpp |  34 ++-
 lldb/tools/lldb-dap/JSONUtils.h   |  21 +-
 lldb/tools/lldb-dap/LLDBUtils.cpp |  19 ++
 lldb/tools/lldb-dap/LLDBUtils.h   |   9 +
 14 files changed, 300 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/Makefile
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/main.c

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index ce54133a61f3e..1896acea15a99 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP

[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/136777

>From e513345b74d5dac5b80fcddebcd52ff1aa2ea4dd Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Wed, 23 Apr 2025 00:06:28 +0200
Subject: [PATCH 1/2] [lldb-dap] handle stack frames without a module

---
 .../lldb-dap/stackTraceMissingModule/Makefile |  2 +
 .../TestDAP_stackTraceMissingModule.py| 54 +++
 .../lldb-dap/stackTraceMissingModule/main.c   | 37 +
 .../lldb-dap/Handler/SourceRequestHandler.cpp | 14 -
 lldb/tools/lldb-dap/JSONUtils.cpp | 10 
 5 files changed, 115 insertions(+), 2 deletions(-)
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceMissingModule/Makefile
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceMissingModule/TestDAP_stackTraceMissingModule.py
 create mode 100644 lldb/test/API/tools/lldb-dap/stackTraceMissingModule/main.c

diff --git a/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/Makefile 
b/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/Makefile
new file mode 100644
index 0..c9319d6e6888a
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/Makefile
@@ -0,0 +1,2 @@
+C_SOURCES := main.c
+include Makefile.rules
diff --git 
a/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/TestDAP_stackTraceMissingModule.py
 
b/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/TestDAP_stackTraceMissingModule.py
new file mode 100644
index 0..1eb00f9935a22
--- /dev/null
+++ 
b/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/TestDAP_stackTraceMissingModule.py
@@ -0,0 +1,54 @@
+"""
+Test lldb-dap stack trace when module is missing
+"""
+
+from lldbsuite.test.decorators import skipUnlessPlatform
+from lldbsuite.test.lldbtest import line_number
+import lldbdap_testcase
+import re
+
+
+class TestDAP_stackTraceMissingModule(lldbdap_testcase.DAPTestCaseBase):
+@skipUnlessPlatform(["linux"])
+def test_missingModule(self):
+"""
+Test that the stack frame without a module still has assembly source.
+"""
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+
+source = "main.c"
+self.set_source_breakpoints(
+source,
+[line_number(source, "// Break here")],
+)
+self.continue_to_next_stop()
+
+# Evaluate expr -- func
+expr_result = self.dap_server.request_evaluate(
+expression="expr -f pointer -- func",
+context="repl",
+)
+
+expr_result_address = re.search(
+r"0x[0-9a-fA-F]+", expr_result["body"]["result"]
+)
+self.assertIsNotNone(
+expr_result_address, "Failed to get address of dynamic allocated 
func"
+)
+func_address = expr_result_address.group(0)
+
+self.dap_server.request_evaluate(
+expression=f"breakpoint set --address {func_address}",
+context="repl",
+)
+
+self.continue_to_next_stop()
+
+frame_without_module = self.get_stackFrames()[0]
+
+self.assertIn("line", frame_without_module, "Line number missing.")
+self.assertIn("column", frame_without_module, "Column number missing.")
+self.assertIn("source", frame_without_module, "Source location 
missing.")
+source = frame_without_module["source"]
+self.assertIn("sourceReference", source, "Source reference missing.")
diff --git a/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/main.c 
b/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/main.c
new file mode 100644
index 0..d706231fbd5c2
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/stackTraceMissingModule/main.c
@@ -0,0 +1,37 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+extern uint8_t __start_target_section[];
+extern uint8_t __stop_target_section[];
+
+__attribute__((used, section("target_section"))) int target_function(void) {
+  return 42;
+}
+
+typedef int (*target_function_t)(void);
+
+int main(void) {
+  size_t target_function_size = __stop_target_section - __start_target_section;
+  size_t page_size = sysconf(_SC_PAGESIZE);
+  size_t page_aligned_size =
+  (target_function_size + page_size - 1) & ~(page_size - 1);
+
+  void *executable_memory =
+  mmap(NULL, page_aligned_size, PROT_READ | PROT_WRITE | PROT_EXEC,
+   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  if (executable_memory == MAP_FAILED) {
+perror("mmap");
+return 1;
+  }
+
+  memcpy(executable_memory, __start_target_section, target_function_size);
+
+  target_function_t func = (target_function_t)executable_memory;
+  int result = func(); // Break here
+  printf("Result from target function: %d\n", result);
+
+  return 0;
+}
diff --git a/lldb/tools/lldb-dap/Handler/SourceRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/SourceRequestHandler.cpp
index 327198bab0395..fa80eb10877bf 100644
--- a/lldb/tools/lldb-dap/

[Lldb-commits] [lldb] [lldb][CPlusPlus] Always use CPlusPlusNameParser for parsing C++ function names (PR #137072)

2025-04-23 Thread Pavel Labath via lldb-commits

labath wrote:

Yeah, getting some numbers would be nice. Maybe just repeating the benchmark in 
that diff. It might be a good idea to do it with and without the accelerator 
tables, just to rule out any effect from those.

FWIW, I expect this to not matter these days. It looks like this change 
(https://reviews.llvm.org/D31451) predates our use of the 
ItaniumPartialDemangler (https://reviews.llvm.org/D50071), which means that we 
were getting the name information by demangling the name and then parsing the 
result. Now, we should get this straight from the demangler, so the parsing 
code should be less hot.

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


[Lldb-commits] [lldb] [lldb-dap] Handle stack frames without a module (PR #136777)

2025-04-23 Thread Ely Ronnen via lldb-commits


@@ -783,6 +783,16 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
 // Line numbers are 1-based.
 object.try_emplace("line", inst_line + 1);
 object.try_emplace("column", 1);
+  } else {
+// No valid line entry or symbol
+llvm::json::Object source;
+EmplaceSafeString(source, "name", frame_name);
+source.try_emplace("sourceReference", MakeDAPFrameID(frame));
+EmplaceSafeString(source, "presentationHint", "deemphasize");
+object.try_emplace("source", std::move(source));
+
+object.try_emplace("line", 1);
+object.try_emplace("column", 1);

eronnen wrote:

it still needs to be 1, this way it will be possible to debug the code in the 
IDE:

[Screencast From 2025-04-24 
08-48-53.webm](https://github.com/user-attachments/assets/c05692c6-a966-4db2-874b-0815a6563427)

The only annoying thing is that each step removes the previous assembly lines, 
but I couldn't think of a straightforward way to tackle it because the frame 
changes too in every step

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/136494

>From 9bb3be7a7fe315cda2e63dd10d90b161e6677263 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 17:07:09 +0200
Subject: [PATCH 1/6] fallback to assembly when source code is not available

---
 lldb/tools/lldb-dap/JSONUtils.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp 
b/lldb/tools/lldb-dap/JSONUtils.cpp
index 33f10c93d2ada..1a44df7740639 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -750,9 +750,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
   EmplaceSafeString(object, "name", frame_name);
 
   auto line_entry = frame.GetLineEntry();
+  auto file_spec = line_entry.GetFileSpec();
   // A line entry of 0 indicates the line is compiler generated i.e. no source
   // file is associated with the frame.
-  if (line_entry.GetFileSpec().IsValid() &&
+  if (file_spec.IsValid() && file_spec.Exists() &&
   (line_entry.GetLine() != 0 ||
line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) {
 object.try_emplace("source", CreateSource(line_entry));

>From 87426fea3817fb4b54cf2a25560edfed763fe999 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:03:02 +0200
Subject: [PATCH 2/6] fix TestDAP_coreFile.py with source maps

---
 .../API/tools/lldb-dap/coreFile/TestDAP_coreFile.py| 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 1896acea15a99..ce54133a61f3e 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -19,7 +19,9 @@ def test_core_file(self):
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 
 self.create_debug_adapter()
-self.attach(exe_file, coreFile=core_file)
+
+source_map = [["/home/labath/test", current_dir]]
+self.attach(exe_file, coreFile=core_file, sourceMap=source_map)
 
 expected_frames = [
 {
@@ -27,7 +29,7 @@ def test_core_file(self):
 "id": 524288,
 "line": 4,
 "name": "bar",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40011C",
 },
 {
@@ -35,7 +37,7 @@ def test_core_file(self):
 "id": 524289,
 "line": 10,
 "name": "foo",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x400142",
 },
 {
@@ -43,7 +45,7 @@ def test_core_file(self):
 "id": 524290,
 "line": 16,
 "name": "_start",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40015F",
 },
 ]

>From e9043dc00010c603553ae067d5ff1e30aba0985e Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:04:46 +0200
Subject: [PATCH 3/6] use stop-disassembly-display setting to determine when to
 show disassembly

---
 .../lldb-dap/coreFile/TestDAP_coreFile.py |  10 +-
 .../stackTraceDisassemblyDisplay/Makefile |   3 +
 .../TestDAP_stackTraceDisassemblyDisplay.py   | 195 ++
 .../stackTraceDisassemblyDisplay/main.c   |  10 +
 lldb/tools/lldb-dap/DAP.h |   4 +
 .../lldb-dap/Handler/AttachRequestHandler.cpp |   1 +
 .../lldb-dap/Handler/LaunchRequestHandler.cpp |   1 +
 .../tools/lldb-dap/Handler/RequestHandler.cpp |   4 +
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   3 +
 .../Handler/StackTraceRequestHandler.cpp  |   3 +-
 lldb/tools/lldb-dap/JSONUtils.cpp |  34 ++-
 lldb/tools/lldb-dap/JSONUtils.h   |  21 +-
 lldb/tools/lldb-dap/LLDBUtils.cpp |  19 ++
 lldb/tools/lldb-dap/LLDBUtils.h   |   9 +
 14 files changed, 300 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/Makefile
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/main.c

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index ce54133a61f3e..1896acea15a99 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP

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

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] Ptrace seize dead process (PR #137041)

2025-04-23 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond created 
https://github.com/llvm/llvm-project/pull/137041

This the actual PR to my [SEIZE 
RFC](https://discourse.llvm.org/t/rfc-ptrace-seize-when-attaching-to-dead-processes/85825/8).
 This is currently the bare bones on seizing a dead process, and being able to 
attach and introspect with LLDB.

Some caveats that I need to address before we publish this PR is how to prevent 
LLDB from running any expressions or really anything that trys to SIGCONT, 
because that will immediately terminate the process, I would like this behavior 
to mimic how we inform the user post mortem processes can't run expressions.

Additionally, right now I only check proc status before seize, and we should 
double check after seize that the process has not changed. Worth noting is once 
you seize a coredumping process (and it hits trace stop), Coredumping in status 
will now report 0.

This is pretty complicated to test because it requires integration with the 
Kernel, thankfully the setup only involves some very simple toy programs, which 
I have outlined with instructions [in this 
gist](https://gist.github.com/Jlalond/a81a995dd14ff5d88b7f21f00879ce83)

>From 87e133063341f6058c0a3d5bcc5e988824c2c762 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Tue, 22 Apr 2025 16:35:00 -0700
Subject: [PATCH 1/2] Create proc status reader

---
 .../Plugins/Process/Utility/CMakeLists.txt|  1 +
 .../Process/Utility/LinuxProcStatus.cpp   | 42 +++
 .../Plugins/Process/Utility/LinuxProcStatus.h | 22 ++
 3 files changed, 65 insertions(+)
 create mode 100644 lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp
 create mode 100644 lldb/source/Plugins/Process/Utility/LinuxProcStatus.h

diff --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt 
b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index f269f5d7d4d74..e9be9634b9876 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -6,6 +6,7 @@ add_lldb_library(lldbPluginProcessUtility
   HistoryUnwind.cpp
   InferiorCallPOSIX.cpp
   LinuxProcMaps.cpp
+  LinuxProcStatus.cpp
   LinuxSignals.cpp
   MemoryTagManagerAArch64MTE.cpp
   NativeProcessSoftwareSingleStep.cpp
diff --git a/lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp 
b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp
new file mode 100644
index 0..75575d62210f0
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp
@@ -0,0 +1,42 @@
+//===-- LinuxProcMaps.cpp ---*- 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
+//
+//===--===//
+
+#include "LinuxProcStatus.h"
+#include 
+#include 
+#include 
+
+static std::vector SplitLines(llvm::StringRef proc_status) {
+  std::istringstream inputstream(proc_status.str());
+  std::vector lines;
+  std::string line;
+  while (std::getline(inputstream, line)) {
+lines.push_back(line);
+  }
+  return lines;
+}
+
+lldb_private::StructuredData::Dictionary
+ParseProcStatus(llvm::StringRef proc_status) {
+  std::vector lines = SplitLines(proc_status);
+  lldb_private::StructuredData::Dictionary proc_status_data;
+  for (auto &str : lines) {
+// proc/pid/status is a delineated by a colon, so we split all the lines
+// and then return a structureddata of each name : value. We keep these
+// all as text, and let the caller sort the type they want them as.
+size_t colonPos = str.find(':');
+if (colonPos == std::string::npos) {
+  continue;
+}
+std::string name = str.substr(0, colonPos);
+std::string value = str.substr(colonPos + 1);
+proc_status_data.AddStringItem(name, value);
+  }
+
+  return proc_status_data;
+}
diff --git a/lldb/source/Plugins/Process/Utility/LinuxProcStatus.h 
b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.h
new file mode 100644
index 0..28e01ac9ff74e
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.h
@@ -0,0 +1,22 @@
+//===-- LinuxProcStatus.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_SOURCE_PLUGINS_PROCESS_UTILITY_LINUXPROCSTATUS_H
+#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_LINUXPROCSTATUS_H
+
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+StructuredData::Dictionary ParseProcStatus(llvm::StringRef proc_status);
+
+} // namespace lldb_priv

[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-23 Thread Adrian Prantl via lldb-commits


@@ -0,0 +1,166 @@
+//===-- DemangledNameInfo.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_DEMANGLEDNAMEINFO_H
+#define LLDB_CORE_DEMANGLEDNAMEINFO_H
+
+#include "llvm/Demangle/ItaniumDemangle.h"
+#include "llvm/Demangle/Utility.h"
+
+#include 
+#include 
+
+namespace lldb_private {
+
+/// Stores information about where certain portions of a demangled
+/// function name begin and end.
+struct DemangledNameInfo {
+  /// A [start, end) pair for the function basename.
+  /// The basename is the name without scope qualifiers
+  /// and without template parameters. E.g.,
+  /// \code{.cpp}
+  ///void foo::bar::someFunc(int) const &&
+  ///^   ^
+  ///  startend
+  /// \endcode
+  std::pair BasenameRange;
+
+  /// A [start, end) pair for the function scope qualifiers.
+  /// E.g., for
+  /// \code{.cpp}
+  ///void foo::bar::qux(int) const &&
+  /// ^  ^
+  ///   start   end
+  /// \endcode
+  std::pair ScopeRange;
+
+  /// Indicates the [start, end) of the function argument lits.
+  /// E.g.,
+  /// \code{.cpp}
+  ///int (*getFunc(float, double))(int, int)
+  ///^  ^
+  ///  start   end
+  /// \endcode
+  std::pair ArgumentsRange;
+
+  /// Indicates the [start, end) of the function qualifiers
+  /// (e.g., CV-qualifiers, reference qualifiers, requires clauses).
+  ///
+  /// E.g.,
+  /// \code{.cpp}
+  ///void foo::bar::qux(int) const &&
+  ///   ^^
+  /// start end
+  /// \endcode
+  std::pair QualifiersRange;
+
+  /// Returns \c true if this object holds a valid basename range.
+  bool hasBasename() const {
+return BasenameRange.second > BasenameRange.first &&
+   BasenameRange.second > 0;
+  }
+
+  friend bool operator==(const DemangledNameInfo &lhs,
+ const DemangledNameInfo &rhs) {
+return std::tie(lhs.BasenameRange, lhs.ArgumentsRange, lhs.ScopeRange,
+lhs.QualifiersRange) ==
+   std::tie(rhs.BasenameRange, rhs.ArgumentsRange, rhs.ScopeRange,
+lhs.QualifiersRange);
+  }
+
+  friend bool operator!=(const DemangledNameInfo &lhs,
+ const DemangledNameInfo &rhs) {
+return !(lhs == rhs);
+  }
+};
+
+/// An OutputBuffer which keeps a record of where certain parts of a
+/// demangled name begin/end (e.g., basename, scope, argument list, etc.).
+/// The tracking occurs during printing of the Itanium demangle tree.
+///
+/// Usage:
+/// \code{.cpp}
+///
+/// Node *N = mangling_parser.parseType();
+///
+/// TrackingOutputBuffer buffer;
+/// N->printLeft(OB);
+///
+/// assert (buffer.NameInfo.hasBasename());
+///
+/// \endcode
+struct TrackingOutputBuffer : public llvm::itanium_demangle::OutputBuffer {
+  using OutputBuffer::OutputBuffer;
+
+  /// Holds information about the demangled name that is
+  /// being printed into this buffer.
+  DemangledNameInfo NameInfo;
+
+  void printLeft(const llvm::itanium_demangle::Node &N) override;
+  void printRight(const llvm::itanium_demangle::Node &N) override;
+
+private:
+  void printLeftImpl(const llvm::itanium_demangle::FunctionType &N);
+  void printRightImpl(const llvm::itanium_demangle::FunctionType &N);
+
+  void printLeftImpl(const llvm::itanium_demangle::FunctionEncoding &N);
+  void printRightImpl(const llvm::itanium_demangle::FunctionEncoding &N);
+
+  void printLeftImpl(const llvm::itanium_demangle::NestedName &N);
+  void printLeftImpl(const llvm::itanium_demangle::NameWithTemplateArgs &N);
+
+  /// Called whenever we start printing a function type in the Itanium
+  /// mangling scheme. Examples include \ref FunctionEncoding, \ref
+  /// FunctionType, etc.
+  ///
+  /// \returns A ScopedOverride which will update the nesting depth of
+  /// currently printed function types on destruction.
+  [[nodiscard]] llvm::itanium_demangle::ScopedOverride
+  enterFunctionTypePrinting();
+
+  /// Returns \c true if we're not printing any nested function types,
+  /// just a \ref FunctionEncoding in the Itanium mangling scheme.
+  bool isPrintingTopLevelFunctionType() const;
+
+  /// If this object \ref shouldTrack, then update the end of
+  /// the basename range to the current \c OB position.
+  void updateBasenameEnd();
+
+  /// If this object \ref shouldTrack, then update the beginning
+  /// of the scope range to the current \c OB position.
+  void updateScopeStart();
+
+  /// If this object \ref shouldTrack, then update the end of
+  /// the scope range to the current \c OB pos

[Lldb-commits] [lldb] [lldb] Remerge #136236 (PR #136795)

2025-04-23 Thread Greg Clayton via lldb-commits


@@ -209,6 +209,26 @@ def test_default_no_run(self):
 )
 self.assertGreater(module_stats["symbolsLoaded"], 0)

clayborg wrote:

Same here, renamed  "symbolTableSymbolCount"

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


[Lldb-commits] [lldb] [lldb-dap] Show load addresses in disassembly (PR #136755)

2025-04-23 Thread Ely Ronnen via lldb-commits

eronnen wrote:

@JDevlieghere I don't have write access, fee free to merge this PR if possible 
(I don't know how the procedures of LLVM work in order to merge)

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


[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

https://github.com/kastiglione updated 
https://github.com/llvm/llvm-project/pull/136766

>From daf394bf76b5fd627f77aee6e451e7d706d26916 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Tue, 22 Apr 2025 13:58:25 -0700
Subject: [PATCH 1/2] [lldb] Expose language plugin commands based based on
 language of current frame

---
 .../lldb/Interpreter/CommandInterpreter.h |  6 ++
 .../source/Interpreter/CommandInterpreter.cpp | 55 ++-
 2 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 724d88d65f6ac..26e0767951e7f 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -730,6 +730,12 @@ class CommandInterpreter : public Broadcaster,
   bool EchoCommandNonInteractive(llvm::StringRef line,
  const Flags &io_handler_flags) const;
 
+  /// Return the language specific command object for the current frame.
+  ///
+  /// For example, when stopped on a C++ frame, this returns the command object
+  /// for "language cplusplus" (`CommandObjectMultiwordItaniumABI`).
+  lldb::CommandObjectSP GetFrameLanguageCommand() const;
+
   // A very simple state machine which models the command handling transitions
   enum class CommandHandlingState {
 eIdle,
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index eb4741feb0aa5..2ff02ae5086b4 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1018,6 +1018,26 @@ CommandInterpreter::VerifyUserMultiwordCmdPath(Args 
&path, bool leaf_is_command,
   return cur_as_multi;
 }
 
+CommandObjectSP CommandInterpreter::GetFrameLanguageCommand() const {
+  if (auto frame_sp = GetExecutionContext().GetFrameSP()) {
+auto frame_language = Language::GetPrimaryLanguage(
+frame_sp->GuessLanguage().AsLanguageType());
+
+auto it = m_command_dict.find("language");
+if (it != m_command_dict.end()) {
+  // The root "language" command.
+  CommandObjectSP language_cmd_sp = it->second;
+
+  if (auto *plugin = Language::FindPlugin(frame_language)) {
+// "cplusplus", "objc", etc.
+auto lang_name = plugin->GetPluginName();
+return language_cmd_sp->GetSubcommandSPExact(lang_name);
+  }
+}
+  }
+  return {};
+}
+
 CommandObjectSP
 CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str, bool include_aliases,
  bool exact, StringList *matches,
@@ -1050,11 +1070,20 @@ CommandInterpreter::GetCommandSP(llvm::StringRef 
cmd_str, bool include_aliases,
   command_sp = pos->second;
   }
 
+  // The `language` subcommand ("language objc", "language cplusplus", etc).
+  CommandObjectMultiword *lang_subcmd = nullptr;
+  if (!command_sp) {
+if (auto subcmd_sp = GetFrameLanguageCommand()) {
+  lang_subcmd = subcmd_sp->GetAsMultiwordCommand();
+  command_sp = subcmd_sp->GetSubcommandSPExact(cmd_str);
+}
+  }
+
   if (!exact && !command_sp) {
 // We will only get into here if we didn't find any exact matches.
 
 CommandObjectSP user_match_sp, user_mw_match_sp, alias_match_sp,
-real_match_sp;
+real_match_sp, lang_match_sp;
 
 StringList local_matches;
 if (matches == nullptr)
@@ -1064,6 +1093,7 @@ CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str, 
bool include_aliases,
 unsigned int num_alias_matches = 0;
 unsigned int num_user_matches = 0;
 unsigned int num_user_mw_matches = 0;
+unsigned int num_lang_matches = 0;
 
 // Look through the command dictionaries one by one, and if we get only one
 // match from any of them in toto, then return that, otherwise return an
@@ -1121,11 +1151,28 @@ CommandInterpreter::GetCommandSP(llvm::StringRef 
cmd_str, bool include_aliases,
 user_mw_match_sp = pos->second;
 }
 
+if (lang_subcmd) {
+  num_lang_matches =
+  AddNamesMatchingPartialString(lang_subcmd->GetSubcommandDictionary(),
+cmd_str, *matches, descriptions);
+}
+
+if (num_lang_matches == 1) {
+  cmd.assign(matches->GetStringAtIndex(num_cmd_matches + num_alias_matches 
+
+   num_user_matches +
+   num_user_mw_matches));
+
+  auto &lang_dict = lang_subcmd->GetSubcommandDictionary();
+  auto pos = lang_dict.find(cmd);
+  if (pos != lang_dict.end())
+lang_match_sp = pos->second;
+}
+
 // If we got exactly one match, return that, otherwise return the match
 // list.
 
 if (num_user_matches + num_user_mw_matches + num_cmd_matches +
-num_alias_matches ==
+num_alias_matches + num_lang_matches ==
 1) {
   if (num_cmd_matches)
 return real_match_sp;
@@ -1133,8 +1180,10 @

[Lldb-commits] [lldb] [lldb-dap] Show load addresses in disassembly (PR #136755)

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] 1da856a - [lldb] Fix typo in ManualDWARFIndexSet.h

2025-04-23 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2025-04-23T18:22:26+02:00
New Revision: 1da856a685cf427ab1f5b810125c41e7859ed362

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

LOG: [lldb] Fix typo in ManualDWARFIndexSet.h

operator== wasn't used in production code, but the bad definition made
the tests vacuosly pass.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.h 
b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.h
index 3a0fd84dc36b6..7fb57421c57dd 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.h
@@ -40,7 +40,7 @@ template  struct IndexSet {
 
   friend bool operator==(const IndexSet &lhs, const IndexSet &rhs) {
 return llvm::all_of(Indices(), [&lhs, &rhs](T(IndexSet::*index)) {
-  return lhs.*index == lhs.*index;
+  return lhs.*index == rhs.*index;
 });
   }
 };



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


[Lldb-commits] [lldb] Add commands to list/enable/disable plugins (PR #134418)

2025-04-23 Thread David Peixotto via lldb-commits

dmpots wrote:


> > 1. Are we ok to start with a static table of plugin namespaces or do we 
> > want dynamic registration from the beginning?
> >[Add commands to list/enable/disable plugins #134418 
> > (comment)](https://github.com/llvm/llvm-project/pull/134418#discussion_r2029164327)
> 
> If you're committed to supporting the dynamic registration, I don't mind 
> doing it incrementally.

Sounds good. I think it should be easy to add later and would be good to have a 
few instances to use as an example.


> > 2. Are we ok adding the disabled plug-in info to the "statistics dump" 
> > output, or do we want it as part of the version dump?
> >[Add commands to list/enable/disable plugins #134418 
> > (comment)](https://github.com/llvm/llvm-project/pull/134418#issuecomment-2784151621)
> 
> That sounds like a good idea. Jim made a similar point that if LLDB behaves 
> oddly when you have a plugin disabled, that should be as obvious as possible. 
> We don't currently collect this information automatically, but they seem like 
> a natural place to note this.

I agree adding to stats makes sense. Will update the PR to do it.

> > 3. Do we want a separate command for this, or should we do this with 
> > "settings set"?
> >[Add commands to list/enable/disable plugins #134418 
> > (review)](https://github.com/llvm/llvm-project/pull/134418#pullrequestreview-2747662941)
> 
> I'm on the fence on this one. I like Greg's suggestion of reusing something 
> existing. If everything you care about can be done with the existing setting 
> infrastructure, i.e. enabling/disabling and showing whether they're on or 
> off, then I think we should reuse them. If you need more information and a 
> dedicated dump command, then I'd make this its own command so that everything 
> related to the plugins lives together. The latter has the advantage of being 
> slightly more future proof, at the cost of not following the existing 
> settings paradigm.

I think we do want a separate dump command at least to be able to show the 
plugin order which is useful in understanding how the debugger works and makes 
the plugin discovery easier. @clayborg what do you think?


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


[Lldb-commits] [lldb] [lldb] Fix logic error in AppleObjCTypeEncodingParser (PR #137067)

2025-04-23 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] Fix connecting via abstract socket (PR #136466)

2025-04-23 Thread Emre Kultursay via lldb-commits

https://github.com/emrekultursay updated 
https://github.com/llvm/llvm-project/pull/136466

>From b6c46b7a28a807b507f06d748ed93f20d26fdfcc Mon Sep 17 00:00:00 2001
From: Emre Kultursay 
Date: Sun, 20 Apr 2025 01:11:31 +
Subject: [PATCH 1/4] Fix connecting via abstract socket

Commit 82ee31f and Commit 2e893124 added socket sharing, but only for
unix domain sockets. That broke Android, which uses unix-abstract
sockets.
---
 lldb/include/lldb/Host/linux/AbstractSocket.h |  1 +
 lldb/include/lldb/Host/posix/DomainSocket.h   |  1 +
 lldb/source/Host/linux/AbstractSocket.cpp |  3 ++
 lldb/source/Host/posix/DomainSocket.cpp   |  6 +++
 lldb/tools/lldb-server/lldb-platform.cpp  | 40 +--
 5 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/lldb/include/lldb/Host/linux/AbstractSocket.h 
b/lldb/include/lldb/Host/linux/AbstractSocket.h
index accfd01457a5e..c6a0e2f8af63b 100644
--- a/lldb/include/lldb/Host/linux/AbstractSocket.h
+++ b/lldb/include/lldb/Host/linux/AbstractSocket.h
@@ -15,6 +15,7 @@ namespace lldb_private {
 class AbstractSocket : public DomainSocket {
 public:
   AbstractSocket();
+  AbstractSocket(NativeSocket socket, bool should_close);
 
 protected:
   size_t GetNameOffset() const override;
diff --git a/lldb/include/lldb/Host/posix/DomainSocket.h 
b/lldb/include/lldb/Host/posix/DomainSocket.h
index 3dbe6206da2c5..562c011ee73e6 100644
--- a/lldb/include/lldb/Host/posix/DomainSocket.h
+++ b/lldb/include/lldb/Host/posix/DomainSocket.h
@@ -33,6 +33,7 @@ class DomainSocket : public Socket {
 
 protected:
   DomainSocket(SocketProtocol protocol);
+  DomainSocket(SocketProtocol protocol, NativeSocket socket, bool 
should_close);
 
   virtual size_t GetNameOffset() const;
   virtual void DeleteSocketFile(llvm::StringRef name);
diff --git a/lldb/source/Host/linux/AbstractSocket.cpp 
b/lldb/source/Host/linux/AbstractSocket.cpp
index 8393a80e86e72..681aa2d1ebc72 100644
--- a/lldb/source/Host/linux/AbstractSocket.cpp
+++ b/lldb/source/Host/linux/AbstractSocket.cpp
@@ -15,6 +15,9 @@ using namespace lldb_private;
 
 AbstractSocket::AbstractSocket() : DomainSocket(ProtocolUnixAbstract) {}
 
+AbstractSocket::AbstractSocket(NativeSocket socket, bool should_close)
+: DomainSocket(ProtocolUnixAbstract, socket, should_close) {}
+
 size_t AbstractSocket::GetNameOffset() const { return 1; }
 
 void AbstractSocket::DeleteSocketFile(llvm::StringRef name) {}
diff --git a/lldb/source/Host/posix/DomainSocket.cpp 
b/lldb/source/Host/posix/DomainSocket.cpp
index 6c490cdda47ed..9b1e4f71bba2a 100644
--- a/lldb/source/Host/posix/DomainSocket.cpp
+++ b/lldb/source/Host/posix/DomainSocket.cpp
@@ -67,6 +67,12 @@ DomainSocket::DomainSocket(NativeSocket socket,
   m_socket = socket;
 }
 
+DomainSocket::DomainSocket(SocketProtocol protocol, NativeSocket socket,
+   bool should_close)
+: Socket(protocol, should_close) {
+  m_socket = socket;
+}
+
 Status DomainSocket::Connect(llvm::StringRef name) {
   sockaddr_un saddr_un;
   socklen_t saddr_un_len;
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp 
b/lldb/tools/lldb-server/lldb-platform.cpp
index 23d36ffb4cb66..59a83c28b0212 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -39,11 +39,19 @@
 #if LLDB_ENABLE_POSIX
 #include "lldb/Host/posix/DomainSocket.h"
 #endif
+#ifdef __linux__
+#include "lldb/Host/linux/AbstractSocket.h"
+#endif
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/UriParser.h"
 
+#if LLDB_ENABLE_POSIX
+#include 
+#include 
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::lldb_server;
@@ -455,14 +463,28 @@ int main_platform(int argc, char *argv[]) {
   lldb_private::Args inferior_arguments;
   inferior_arguments.SetArguments(argc, const_cast(argv));
 
+  Log *log = GetLog(LLDBLog::Platform);
   Socket::SocketProtocol protocol = Socket::ProtocolUnixDomain;
 
   if (fd != SharedSocket::kInvalidFD) {
 // Child process will handle the connection and exit.
-if (gdbserver_port)
+if (gdbserver_port) {
   protocol = Socket::ProtocolTcp;
+} else {
+#ifdef LLDB_ENABLE_POSIX
+  // Check if fd represents domain socket or abstract socket.
+  struct sockaddr_un addr;
+  socklen_t addr_len = sizeof(addr);
+  if (getsockname(fd, (struct sockaddr *)&addr, &addr_len) == -1) {
+LLDB_LOGF(log, "lldb-platform child: not a socket or error occurred");
+return socket_error;
+  }
 
-Log *log = GetLog(LLDBLog::Platform);
+  if (addr.sun_family == AF_UNIX && addr.sun_path[0] == '\0') {
+protocol = Socket::ProtocolUnixAbstract;
+  }
+#endif
+}
 
 NativeSocket sockfd;
 error = SharedSocket::GetNativeSocket(fd, sockfd);
@@ -473,17 +495,27 @@ int main_platform(int argc, char *argv[]) {
 
 GDBRemoteCommunicationServerPlatform platform(protocol, gdbserver_

[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

kastiglione wrote:

> What if a language plugin adds a command that conflicts with a top-level 
> command?

@bulbazord the top-level command will be used. This is a fallback, for when no 
such top-level command exists. If a language plugin adds a subcommand that 
conflicts with a top-level command, then the only way to run it will be by 
explicitly running `language  `.

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/136494

>From 9bb3be7a7fe315cda2e63dd10d90b161e6677263 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 17:07:09 +0200
Subject: [PATCH 1/5] fallback to assembly when source code is not available

---
 lldb/tools/lldb-dap/JSONUtils.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp 
b/lldb/tools/lldb-dap/JSONUtils.cpp
index 33f10c93d2ada..1a44df7740639 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -750,9 +750,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
   EmplaceSafeString(object, "name", frame_name);
 
   auto line_entry = frame.GetLineEntry();
+  auto file_spec = line_entry.GetFileSpec();
   // A line entry of 0 indicates the line is compiler generated i.e. no source
   // file is associated with the frame.
-  if (line_entry.GetFileSpec().IsValid() &&
+  if (file_spec.IsValid() && file_spec.Exists() &&
   (line_entry.GetLine() != 0 ||
line_entry.GetLine() != LLDB_INVALID_LINE_NUMBER)) {
 object.try_emplace("source", CreateSource(line_entry));

>From 87426fea3817fb4b54cf2a25560edfed763fe999 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:03:02 +0200
Subject: [PATCH 2/5] fix TestDAP_coreFile.py with source maps

---
 .../API/tools/lldb-dap/coreFile/TestDAP_coreFile.py| 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 1896acea15a99..ce54133a61f3e 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -19,7 +19,9 @@ def test_core_file(self):
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 
 self.create_debug_adapter()
-self.attach(exe_file, coreFile=core_file)
+
+source_map = [["/home/labath/test", current_dir]]
+self.attach(exe_file, coreFile=core_file, sourceMap=source_map)
 
 expected_frames = [
 {
@@ -27,7 +29,7 @@ def test_core_file(self):
 "id": 524288,
 "line": 4,
 "name": "bar",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40011C",
 },
 {
@@ -35,7 +37,7 @@ def test_core_file(self):
 "id": 524289,
 "line": 10,
 "name": "foo",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x400142",
 },
 {
@@ -43,7 +45,7 @@ def test_core_file(self):
 "id": 524290,
 "line": 16,
 "name": "_start",
-"source": {"name": "main.c", "path": 
"/home/labath/test/main.c"},
+"source": {"name": "main.c", "path": os.path.join(current_dir, 
"main.c")},
 "instructionPointerReference": "0x40015F",
 },
 ]

>From e9043dc00010c603553ae067d5ff1e30aba0985e Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 21:04:46 +0200
Subject: [PATCH 3/5] use stop-disassembly-display setting to determine when to
 show disassembly

---
 .../lldb-dap/coreFile/TestDAP_coreFile.py |  10 +-
 .../stackTraceDisassemblyDisplay/Makefile |   3 +
 .../TestDAP_stackTraceDisassemblyDisplay.py   | 195 ++
 .../stackTraceDisassemblyDisplay/main.c   |  10 +
 lldb/tools/lldb-dap/DAP.h |   4 +
 .../lldb-dap/Handler/AttachRequestHandler.cpp |   1 +
 .../lldb-dap/Handler/LaunchRequestHandler.cpp |   1 +
 .../tools/lldb-dap/Handler/RequestHandler.cpp |   4 +
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   3 +
 .../Handler/StackTraceRequestHandler.cpp  |   3 +-
 lldb/tools/lldb-dap/JSONUtils.cpp |  34 ++-
 lldb/tools/lldb-dap/JSONUtils.h   |  21 +-
 lldb/tools/lldb-dap/LLDBUtils.cpp |  19 ++
 lldb/tools/lldb-dap/LLDBUtils.h   |   9 +
 14 files changed, 300 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/Makefile
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTraceDisassemblyDisplay/main.c

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index ce54133a61f3e..1896acea15a99 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP

[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits


@@ -37,6 +37,18 @@ void OptionValueEnumeration::DumpValue(const 
ExecutionContext *exe_ctx,
   }
 }
 
+llvm::json::Value
+OptionValueEnumeration::ToJSON(const ExecutionContext *exe_ctx) {
+  const size_t count = m_enumerations.GetSize();
+  for (size_t i = 0; i < count; ++i) {
+if (m_enumerations.GetValueAtIndexUnchecked(i).value == m_current_value) {
+  return m_enumerations.GetCStringAtIndex(i).GetStringRef();
+}

eronnen wrote:

:100: 

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits


@@ -202,6 +202,10 @@ struct DAP {
 
   lldb::SBFormat frame_format;
   lldb::SBFormat thread_format;
+
+  /// The value of stop-disassembly-display setting in LLDB.
+  std::string stop_disassembly_display;

eronnen wrote:

Agree, changed it

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


[Lldb-commits] [lldb] [lldb-dap] Show assembly depending on `stop-disassembly-display` settings (PR #136494)

2025-04-23 Thread Ely Ronnen via lldb-commits


@@ -163,6 +163,19 @@ GetEnvironmentFromArguments(const llvm::json::Object 
&arguments) {
   return envs;
 }
 
+std::string GetStopDisassemblyDisplay(lldb::SBDebugger &debugger) {
+  lldb::SBStructuredData result =
+  debugger.GetSetting("stop-disassembly-display");
+  const size_t result_length = result.GetStringValue(nullptr, 0);
+  if (result_length > 0) {
+std::string result_string(result_length, '\0');
+result.GetStringValue(result_string.data(), result_length + 1);
+return result_string;
+  }
+
+  return "no-debuginfo";

eronnen wrote:

anyway I moved the enum to `lldb-enumerations.h`

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


[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

kastiglione wrote:

> maybe you step into a frame you don't have debug info or symbols for

@bulbazord one potential solution to this is to use the top-most stack frame 
for which a language is known.

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


[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)

2025-04-23 Thread Maksim Ivanov via lldb-commits

emaxx-google wrote:

Hello, the minimized reproducer for the determinism issue is there: 
https://pastebin.com/6aL6rmBe . To build it, unpack it into separate files (via 
`split-file`), then run `CLANG=path/to/clang make`. The nondeterminism can be 
checked by looping `make clean` + `make` + `md5sum problem.pcm` - typically a 
different hash pops up after a few dozens of iterations.

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


[Lldb-commits] [lldb] [lldb] Remerge #136236 (PR #136795)

2025-04-23 Thread Greg Clayton via lldb-commits


@@ -209,6 +209,26 @@ def test_default_no_run(self):
 )
 self.assertGreater(module_stats["symbolsLoaded"], 0)
 
+def test_default_no_run_no_preload_symbols(self):
+"""Test "statistics dump" without running the target and without
+preloading symbols.
+
+Checks that symbol count are zero.
+"""
+# Make sure symbols will not be preloaded.
+self.runCmd("settings set target.preload-symbols false")
+
+# Build and load the target
+self.build()
+self.createTestTarget()
+
+# Get statistics
+debug_stats = self.get_stats()
+
+# No symbols should be loaded in the main module.
+main_module_stats = debug_stats["modules"][0]
+self.assertEqual(main_module_stats["symbolsLoaded"], 0)

clayborg wrote:

rename to "symbolTableSymbolCount" per request in previous PR to keep naming 
consistent.

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


[Lldb-commits] [lldb] [lldb] Remerge #136236 (PR #136795)

2025-04-23 Thread Greg Clayton via lldb-commits

https://github.com/clayborg requested changes to this pull request.


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


[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Expose language plugin commands based based on language of current frame (PR #136766)

2025-04-23 Thread Dave Lee via lldb-commits

kastiglione wrote:

> Many of our users are opinionated about how commands should work ("This 
> breaks my python scripts!"

@bulbazord I agree. I don't think this should break anything.

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


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

2025-04-23 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/136486

>From 5cb1442b1df0befbc55806aee6c9dea4edd68816 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 20 Apr 2025 14:27:53 +0200
Subject: [PATCH 1/2] fix wrong assembly line number when debugging assembly
 with different sized instructions

---
 lldb/tools/lldb-dap/JSONUtils.cpp | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp 
b/lldb/tools/lldb-dap/JSONUtils.cpp
index 33f10c93d2ada..8447b3f87fb80 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -19,6 +19,7 @@
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBFrame.h"
 #include "lldb/API/SBFunction.h"
+#include "lldb/API/SBInstructionList.h"
 #include "lldb/API/SBLineEntry.h"
 #include "lldb/API/SBModule.h"
 #include "lldb/API/SBQueue.h"
@@ -776,10 +777,11 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
 
 // Calculate the line of the current PC from the start of the current
 // symbol.
-lldb::addr_t inst_offset = frame.GetPCAddress().GetOffset() -
-   frame.GetSymbol().GetStartAddress().GetOffset();
-lldb::addr_t inst_line =
-inst_offset / (frame.GetThread().GetProcess().GetAddressByteSize() / 
2);
+lldb::SBTarget target = frame.GetThread().GetProcess().GetTarget();
+lldb::SBInstructionList inst_list = target.ReadInstructions(
+frame.GetSymbol().GetStartAddress(), frame.GetPCAddress(), nullptr);
+size_t inst_line = inst_list.GetSize();
+
 // Line numbers are 1-based.
 object.try_emplace("line", inst_line + 1);
 object.try_emplace("column", 1);

>From 9f285f8a43dbc025f884f71da177c002dc05e1c1 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Thu, 24 Apr 2025 01:24:21 +0200
Subject: [PATCH 2/2] add x86 tests that verifies lldb-dap steps correctly
 through assembly

---
 .../tools/lldb-dap/stackTrace-x86/Makefile|  3 +
 .../stackTrace-x86/TestDAP_source_x86.py  | 64 +++
 .../API/tools/lldb-dap/stackTrace-x86/main.c  | 29 +
 3 files changed, 96 insertions(+)
 create mode 100644 lldb/test/API/tools/lldb-dap/stackTrace-x86/Makefile
 create mode 100644 
lldb/test/API/tools/lldb-dap/stackTrace-x86/TestDAP_source_x86.py
 create mode 100644 lldb/test/API/tools/lldb-dap/stackTrace-x86/main.c

diff --git a/lldb/test/API/tools/lldb-dap/stackTrace-x86/Makefile 
b/lldb/test/API/tools/lldb-dap/stackTrace-x86/Makefile
new file mode 100644
index 0..10495940055b6
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/stackTrace-x86/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
diff --git a/lldb/test/API/tools/lldb-dap/stackTrace-x86/TestDAP_source_x86.py 
b/lldb/test/API/tools/lldb-dap/stackTrace-x86/TestDAP_source_x86.py
new file mode 100644
index 0..5594a1977915e
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/stackTrace-x86/TestDAP_source_x86.py
@@ -0,0 +1,64 @@
+"""
+Test lldb-dap stack trace containing x86 assembly
+"""
+
+import lldbdap_testcase
+from lldbsuite.test.decorators import skipUnlessArch, skipUnlessPlatform
+from lldbsuite.test.lldbtest import line_number
+
+
+class TestDAP_stacktrace_x86(lldbdap_testcase.DAPTestCaseBase):
+@skipUnlessArch("x86_64")
+@skipUnlessPlatform(["linux"])
+def test_stacktrace_x86(self):
+"""
+Tests that lldb-dap steps through correctly and the source lines are 
correct in x86 assembly.
+"""
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(
+program,
+initCommands=[
+"settings set target.process.thread.step-in-avoid-nodebug 
false"
+],
+)
+
+source = "main.c"
+breakpoint_ids = self.set_source_breakpoints(
+source,
+[line_number(source, "// Break here")],
+)
+self.continue_to_breakpoints(breakpoint_ids)
+self.stepIn()
+
+frame = self.get_stackFrames()[0]
+self.assertEqual(
+frame["name"],
+"no_branch_func",
+"verify we are in the no_branch_func function",
+)
+
+self.assertEqual(frame["line"], 1, "verify we are at the start of the 
function")
+minimum_assembly_lines = (
+line_number(source, "Assembly end")
+- line_number(source, "Assembly start")
++ 1
+)
+self.assertLessEqual(
+10,
+minimum_assembly_lines,
+"verify we have a reasonable number of assembly lines",
+)
+
+for i in range(2, minimum_assembly_lines):
+self.stepIn()
+frame = self.get_stackFrames()[0]
+self.assertEqual(
+frame["name"],
+"no_branch_func",
+"verify we are still in the no_branch_func function",
+)
+self.assertEqual(
+  

[Lldb-commits] [lldb] [lldb] Minor improvements to AddNamesMatchingPartialString (NFC) (PR #136760)

2025-04-23 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] Ptrace seize dead process (PR #137041)

2025-04-23 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond updated 
https://github.com/llvm/llvm-project/pull/137041

>From a33b865302e0d489cc4426c038128d8dde47500e Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Tue, 22 Apr 2025 16:35:00 -0700
Subject: [PATCH 1/2] Create proc status reader

---
 .../Plugins/Process/Utility/CMakeLists.txt|  1 +
 .../Process/Utility/LinuxProcStatus.cpp   | 42 +++
 .../Plugins/Process/Utility/LinuxProcStatus.h | 22 ++
 3 files changed, 65 insertions(+)
 create mode 100644 lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp
 create mode 100644 lldb/source/Plugins/Process/Utility/LinuxProcStatus.h

diff --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt 
b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index f269f5d7d4d74..e9be9634b9876 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -6,6 +6,7 @@ add_lldb_library(lldbPluginProcessUtility
   HistoryUnwind.cpp
   InferiorCallPOSIX.cpp
   LinuxProcMaps.cpp
+  LinuxProcStatus.cpp
   LinuxSignals.cpp
   MemoryTagManagerAArch64MTE.cpp
   NativeProcessSoftwareSingleStep.cpp
diff --git a/lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp 
b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp
new file mode 100644
index 0..75575d62210f0
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.cpp
@@ -0,0 +1,42 @@
+//===-- LinuxProcMaps.cpp ---*- 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
+//
+//===--===//
+
+#include "LinuxProcStatus.h"
+#include 
+#include 
+#include 
+
+static std::vector SplitLines(llvm::StringRef proc_status) {
+  std::istringstream inputstream(proc_status.str());
+  std::vector lines;
+  std::string line;
+  while (std::getline(inputstream, line)) {
+lines.push_back(line);
+  }
+  return lines;
+}
+
+lldb_private::StructuredData::Dictionary
+ParseProcStatus(llvm::StringRef proc_status) {
+  std::vector lines = SplitLines(proc_status);
+  lldb_private::StructuredData::Dictionary proc_status_data;
+  for (auto &str : lines) {
+// proc/pid/status is a delineated by a colon, so we split all the lines
+// and then return a structureddata of each name : value. We keep these
+// all as text, and let the caller sort the type they want them as.
+size_t colonPos = str.find(':');
+if (colonPos == std::string::npos) {
+  continue;
+}
+std::string name = str.substr(0, colonPos);
+std::string value = str.substr(colonPos + 1);
+proc_status_data.AddStringItem(name, value);
+  }
+
+  return proc_status_data;
+}
diff --git a/lldb/source/Plugins/Process/Utility/LinuxProcStatus.h 
b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.h
new file mode 100644
index 0..28e01ac9ff74e
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/LinuxProcStatus.h
@@ -0,0 +1,22 @@
+//===-- LinuxProcStatus.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_SOURCE_PLUGINS_PROCESS_UTILITY_LINUXPROCSTATUS_H
+#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_LINUXPROCSTATUS_H
+
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+StructuredData::Dictionary ParseProcStatus(llvm::StringRef proc_status);
+
+} // namespace lldb_private
+
+#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_LINUXPROCSTATUS_H

>From 8de35b8a25cd42aa20784bff83840dbe80cdab54 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Wed, 23 Apr 2025 11:31:01 -0700
Subject: [PATCH 2/2] Fix tabs, newlines, and spaces getting in the structured
 data

---
 .../Process/Linux/NativeProcessLinux.cpp  | 80 ---
 .../Process/Utility/LinuxProcStatus.cpp   | 15 +++-
 2 files changed, 81 insertions(+), 14 deletions(-)

diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp 
b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 7f2aba0e4eb2c..f052931e1d377 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -23,6 +23,7 @@
 #include "NativeThreadLinux.h"
 #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
 #include "Plugins/Process/Utility/LinuxProcMaps.h"
+#include "Plugins/Process/Utility/LinuxProcStatus.h"
 #include "Procfs.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Host/Host.h"
@@ -443,10 +444,29 @@ Nativ

[Lldb-commits] [lldb] d72f1f9 - Bug fix in FindModuleUUID (#137075)

2025-04-23 Thread via lldb-commits

Author: GeorgeHuyubo
Date: 2025-04-23T15:46:12-07:00
New Revision: d72f1f92f469a5d0ee28dc89f72977634d90d111

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

LOG: Bug fix in FindModuleUUID (#137075)

In some core file, we are seeing that it's not always the case that the
ELF header would exist in the first region in NT_FILES section.
Therefore the FindModuleUUID is not able to find the module UUID by just
returning the first entry with path matching.

This fix change the behavior to continue search the NT_FILE entries
until finding a valid UUID with path matching.

Co-authored-by: George Hu 

Added: 


Modified: 
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp 
b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 5f85f99ce7bdd..6635b15b669f1 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -289,7 +289,7 @@ void ProcessElfCore::UpdateBuildIdForNTFileEntries() {
 UUID ProcessElfCore::FindModuleUUID(const llvm::StringRef path) {
   // Returns the gnu uuid from matched NT_FILE entry
   for (NT_FILE_Entry &entry : m_nt_file_entries)
-if (path == entry.path)
+if (path == entry.path && entry.uuid.IsValid())
   return entry.uuid;
   return UUID();
 }



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


[Lldb-commits] [lldb] Bug fix in FindModuleUUID (PR #137075)

2025-04-23 Thread via lldb-commits

GeorgeHuyubo wrote:

> LGTM. Any chance you could artifically craft such a core file for a test?

I think this file historically lack a good way of testing changes due to 
difficulties in hand craft a ELF core file using YAML.

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


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

2025-04-23 Thread Jonas Devlieghere via lldb-commits

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


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


  1   2   3   >