[Lldb-commits] [lldb] [lldb] Reland: Store SupportFile in FileEntry (NFC) (PR #85892)

2024-03-21 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] 556fe5f - [lldb] Reland: Store SupportFile in FileEntry (NFC) (#85892)

2024-03-21 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-03-21T08:40:08-07:00
New Revision: 556fe5f290ea88dcbb7ced16b0f057dcebce1fd0

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

LOG: [lldb] Reland: Store SupportFile in FileEntry (NFC) (#85892)

This is another step towards supporting DWARF5 checksums and inline
source code in LLDB. This is a reland of #85468 but without the
functional change of storing the support file from the line table (yet).

Added: 


Modified: 
lldb/include/lldb/Core/Disassembler.h
lldb/include/lldb/Symbol/LineEntry.h
lldb/include/lldb/Utility/SupportFile.h
lldb/source/API/SBLineEntry.cpp
lldb/source/API/SBThread.cpp
lldb/source/Breakpoint/BreakpointResolver.cpp
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Commands/CommandObjectBreakpoint.cpp
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Core/Address.cpp
lldb/source/Core/Disassembler.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/SourceManager.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/Function.cpp
lldb/source/Symbol/LineEntry.cpp
lldb/source/Symbol/LineTable.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Target/StackFrameList.cpp
lldb/source/Target/Thread.cpp
lldb/source/Target/TraceDumper.cpp
lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Disassembler.h 
b/lldb/include/lldb/Core/Disassembler.h
index 885ac1bb4a7ef8..e037a49f152c74 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -538,7 +538,7 @@ class Disassembler : public 
std::enable_shared_from_this,
   ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx,
  const SymbolContext &sc, LineEntry &line) 
{
 SourceLine sl;
-sl.file = line.file;
+sl.file = line.GetFile();
 sl.line = line.line;
 sl.column = line.column;
 return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);

diff  --git a/lldb/include/lldb/Symbol/LineEntry.h 
b/lldb/include/lldb/Symbol/LineEntry.h
index 31e1cd0b36f96e..8da59cf0bd24aa 100644
--- a/lldb/include/lldb/Symbol/LineEntry.h
+++ b/lldb/include/lldb/Symbol/LineEntry.h
@@ -130,11 +130,14 @@ struct LineEntry {
   /// Shared pointer to the target this LineEntry belongs to.
   void ApplyFileMappings(lldb::TargetSP target_sp);
 
+  /// Helper to access the file.
+  const FileSpec &GetFile() const { return file_sp->GetSpecOnly(); }
+
   /// The section offset address range for this line entry.
   AddressRange range;
 
   /// The source file, possibly mapped by the target.source-map setting.
-  FileSpec file;
+  lldb::SupportFileSP file_sp;
 
   /// The original source file, from debug info.
   lldb::SupportFileSP original_file_sp;

diff  --git a/lldb/include/lldb/Utility/SupportFile.h 
b/lldb/include/lldb/Utility/SupportFile.h
index 0ea0ca4e7c97a1..7505d7f345c5dd 100644
--- a/lldb/include/lldb/Utility/SupportFile.h
+++ b/lldb/include/lldb/Utility/SupportFile.h
@@ -45,6 +45,9 @@ class SupportFile {
   /// Materialize the file to disk and return the path to that temporary file.
   virtual const FileSpec &Materialize() { return m_file_spec; }
 
+  /// Change the file name.
+  void Update(const FileSpec &file_spec) { m_file_spec = file_spec; }
+
 protected:
   FileSpec m_file_spec;
   Checksum m_checksum;

diff  --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp
index 28d12e65fdaf8a..99a7b8fe644cb5 100644
--- a/lldb/source/API/SBLineEntry.cpp
+++ b/lldb/source/API/SBLineEntry.cpp
@@ -81,8 +81,8 @@ SBFileSpec SBLineEntry::GetFileSpec() const {
   LLDB_INSTRUMENT_VA(this);
 
   SBFileSpec sb_file_spec;
-  if (m_opaque_up.get() && m_opaque_up->file)
-sb_file_spec.SetFileSpec(m_opaque_up->file);
+  if (m_opaque_up.get() && m_opaque_up->GetFile())
+sb_file_spec.SetFileSpec(m_opaque_up->GetFile());
 
   return sb_file_spec;
 }
@@ -109,9 +109,9 @@ void SBLineEntry::SetFileSpec(lldb::SBFileSpec filespec) {
   LLDB_INSTRUMENT_VA(this, filespec);
 
   if (filespec.IsValid())
-ref().file = filespec.ref();
+ref().file_sp = std::make_shared(filespec.ref());
   else
-ref().file.Clear();
+ref().file_sp = std::make_shared();
 }
 void SBLineEntry::SetLine(uint32_t line) {
   LLDB_INSTRUMENT_VA(this, line);
@@ -168,7 +168,7 @@ bool SBLineEntry::GetDescription(SBStream &description) {
 
   if (m_opaque_up) {
 char file_path[PATH_MAX * 2];
- 

[Lldb-commits] [lldb] 6317c78 - [lldb][progress][NFC] Clarify Doxygen comments for `details` field (#86002)

2024-03-21 Thread via lldb-commits

Author: Chelsea Cassanova
Date: 2024-03-21T08:49:43-07:00
New Revision: 6317c780d81327bd06701a6aa374fc92aa3d73ad

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

LOG: [lldb][progress][NFC] Clarify Doxygen comments for `details` field (#86002)

The Doxygen comments for the `details` field of a progress report
currently does not specify that this field will act as the initial set
of details for a progress report that gets updated with
`Progress::Increment()`. This commit clarifies this.

Added: 


Modified: 
lldb/include/lldb/Core/Progress.h

Removed: 




diff  --git a/lldb/include/lldb/Core/Progress.h 
b/lldb/include/lldb/Core/Progress.h
index c38f6dd0a140ed..eb3af9816dc6ca 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -66,7 +66,11 @@ class Progress {
   /// @param [in] title The title of this progress activity.
   ///
   /// @param [in] details Specific information about what the progress report
-  /// is currently working on.
+  /// is currently working on. Although not required, if the progress report is
+  /// updated with Progress::Increment() then this field will be overwritten
+  /// with the new set of details passed into that function, and the details
+  /// passed initially will act as an "item 0" for the total set of
+  /// items being reported on.
   ///
   /// @param [in] total The total units of work to be done if specified, if
   /// set to std::nullopt then an indeterminate progress indicator should be



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


[Lldb-commits] [lldb] [lldb][progress][NFC] Clarify Doxygen comments for `details` field (PR #86002)

2024-03-21 Thread Chelsea Cassanova via lldb-commits

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


[Lldb-commits] [lldb] 81bd799 - [lldb] Add missing initialization in LineEntry ctor

2024-03-21 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2024-03-21T09:06:06-07:00
New Revision: 81bd799819f498a55e32599bce51fa98b2e73238

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

LOG: [lldb] Add missing initialization in LineEntry ctor

Added: 


Modified: 
lldb/source/Symbol/LineEntry.cpp

Removed: 




diff  --git a/lldb/source/Symbol/LineEntry.cpp 
b/lldb/source/Symbol/LineEntry.cpp
index 9e0c06b6ff73ec..461399e0326e91 100644
--- a/lldb/source/Symbol/LineEntry.cpp
+++ b/lldb/source/Symbol/LineEntry.cpp
@@ -14,8 +14,10 @@
 using namespace lldb_private;
 
 LineEntry::LineEntry()
-: range(), is_start_of_statement(0), is_start_of_basic_block(0),
-  is_prologue_end(0), is_epilogue_begin(0), is_terminal_entry(0) {}
+: range(), file_sp(std::make_shared()),
+  original_file_sp(std::make_shared()),
+  is_start_of_statement(0), is_start_of_basic_block(0), is_prologue_end(0),
+  is_epilogue_begin(0), is_terminal_entry(0) {}
 
 void LineEntry::Clear() {
   range.Clear();



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


[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

2024-03-21 Thread Greg Clayton via lldb-commits


@@ -210,6 +210,12 @@ else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
DSYM = $(EXE).debug
endif
+
+   ifeq "$(MERGE_DWOS)" "YES"

clayborg wrote:

Is `MERGE_DWOS` new? If so, lets rename to `MAKE_DWP`

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


[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

2024-03-21 Thread Kevin Frei via lldb-commits


@@ -210,6 +210,12 @@ else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
DSYM = $(EXE).debug
endif
+
+   ifeq "$(MERGE_DWOS)" "YES"

kevinfrei wrote:

Updated. It also turns out that MAKE_DWP implies MAKE_DWO, so I removed it from 
the test Makefile while I was at it.

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


[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

2024-03-21 Thread Kevin Frei via lldb-commits

https://github.com/kevinfrei updated 
https://github.com/llvm/llvm-project/pull/85693

>From fc0eda99c7cceeaefd33477c9b08e7221a5a6e2a Mon Sep 17 00:00:00 2001
From: Kevin Frei 
Date: Fri, 15 Mar 2024 08:54:04 -0700
Subject: [PATCH 1/6] Tests (w/fixes) for initial DebugInfoD LLDB integration

Summary:
While adding tests for DebugInfoD integration, there were a couple issues that 
came up:
DWP from /debuginfo for a stripped binary needs to return symbols from 
/executable

Test Plan: Added some API tests

Reviewers: gclayton, hyubo

Subscribers:

Tasks: T179375937

Tags: debuginfod

Differential Revision: https://phabricator.intern.facebook.com/D54953389
---
 .../Python/lldbsuite/test/make/Makefile.rules |  33 +++-
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  40 +++--
 .../Plugins/SymbolLocator/CMakeLists.txt  |   7 +-
 .../SymbolVendor/ELF/SymbolVendorELF.cpp  |  32 +++-
 lldb/test/API/debuginfod/Normal/Makefile  |  25 +++
 .../API/debuginfod/Normal/TestDebuginfod.py   | 159 +
 lldb/test/API/debuginfod/Normal/main.c|   7 +
 lldb/test/API/debuginfod/SplitDWARF/Makefile  |  29 +++
 .../SplitDWARF/TestDebuginfodDWP.py   | 167 ++
 lldb/test/API/debuginfod/SplitDWARF/main.c|   7 +
 10 files changed, 489 insertions(+), 17 deletions(-)
 create mode 100644 lldb/test/API/debuginfod/Normal/Makefile
 create mode 100644 lldb/test/API/debuginfod/Normal/TestDebuginfod.py
 create mode 100644 lldb/test/API/debuginfod/Normal/main.c
 create mode 100644 lldb/test/API/debuginfod/SplitDWARF/Makefile
 create mode 100644 lldb/test/API/debuginfod/SplitDWARF/TestDebuginfodDWP.py
 create mode 100644 lldb/test/API/debuginfod/SplitDWARF/main.c

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index bfd249ccd43f2e..b33c087357a79b 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -51,7 +51,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 #
 # GNUWin32 uname gives "windows32" or "server version windows32" while
 # some versions of MSYS uname return "MSYS_NT*", but most environments
-# standardize on "Windows_NT", so we'll make it consistent here. 
+# standardize on "Windows_NT", so we'll make it consistent here.
 # When running tests from Visual Studio, the environment variable isn't
 # inherited all the way down to the process spawned for make.
 #--
@@ -210,6 +210,12 @@ else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
DSYM = $(EXE).debug
endif
+
+   ifeq "$(MERGE_DWOS)" "YES"
+   MAKE_DWO := YES
+   DWP_NAME = $(EXE).dwp
+   DYLIB_DWP_NAME = $(DYLIB_NAME).dwp
+   endif
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
@@ -357,6 +363,7 @@ ifneq "$(OS)" "Darwin"
 
OBJCOPY ?= $(call replace_cc_with,objcopy)
ARCHIVER ?= $(call replace_cc_with,ar)
+   DWP ?= $(call replace_cc_with,dwp)
override AR = $(ARCHIVER)
 endif
 
@@ -527,6 +534,10 @@ ifneq "$(CXX)" ""
endif
 endif
 
+ifeq "$(GEN_GNU_BUILD_ID)" "YES"
+   LDFLAGS += -Wl,--build-id
+endif
+
 #--
 # DYLIB_ONLY variable can be used to skip the building of a.out.
 # See the sections below regarding dSYM file as well as the building of
@@ -565,11 +576,25 @@ else
 endif
 else
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
+   cp "$(EXE)" "$(EXE).full"
+endif
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
+ifeq "$(MERGE_DWOS)" "YES"
+   $(DWP) -o "$(DWP_NAME)" $(DWOS)
+endif
 endif
 
+
+#--
+# Support emitting the context of the GNU build-id into a file
+# This needs to be used in conjunction with GEN_GNU_BUILD_ID := YES
+#--
+$(EXE).uuid : $(EXE)
+   $(OBJCOPY) --dump-section=.note.gnu.build-id=$@ $<
+
 #--
 # Make the dylib
 #--
@@ -610,9 +635,15 @@ endif
 else
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+   ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
+   cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).full"
+   endif
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" 
"$(DYLIB_FILENAME).debug"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" 
"$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
 endif
+ifeq "$(MERGE_DWOS)" "YES"
+   $(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS)
+endif
 endif
 
 #

[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

2024-03-21 Thread Jonas Devlieghere via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb] Implement coalescing of disjoint progress events (PR #84854)

2024-03-21 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/84854

>From 65d86e85ce27fa4b127bf80fceebf98215b19f64 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 6 Mar 2024 17:22:43 -0800
Subject: [PATCH] [lldb] Implement coalescing of disjoint progress events

This implements coalescing of progress events using a timeout, as
discussed in the RFC on Discourse [1].

[1] https://discourse.llvm.org/t/rfc-improve-lldb-progress-reporting/75717/
---
 lldb/include/lldb/Core/Progress.h |  35 +-
 lldb/source/Core/Progress.cpp | 114 ++
 .../SystemInitializerCommon.cpp   |   3 +
 lldb/unittests/Core/ProgressReportTest.cpp|  39 +-
 4 files changed, 159 insertions(+), 32 deletions(-)

diff --git a/lldb/include/lldb/Core/Progress.h 
b/lldb/include/lldb/Core/Progress.h
index eb3af9816dc6ca..cd87be79c4f0e3 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_CORE_PROGRESS_H
 #define LLDB_CORE_PROGRESS_H
 
+#include "lldb/Host/Alarm.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-types.h"
 #include "llvm/ADT/StringMap.h"
@@ -150,9 +151,12 @@ class ProgressManager {
   void Increment(const Progress::ProgressData &);
   void Decrement(const Progress::ProgressData &);
 
+  static void Initialize();
+  static void Terminate();
+  static bool Enabled();
   static ProgressManager &Instance();
 
-private:
+protected:
   enum class EventType {
 Begin,
 End,
@@ -160,9 +164,32 @@ class ProgressManager {
   static void ReportProgress(const Progress::ProgressData &progress_data,
  EventType type);
 
-  llvm::StringMap>
-  m_progress_category_map;
-  std::mutex m_progress_map_mutex;
+  static std::optional &InstanceImpl();
+
+  /// Helper function for reporting progress when the alarm in the 
corresponding
+  /// entry in the map expires.
+  void Expire(llvm::StringRef key);
+
+  /// Entry used for bookkeeping.
+  struct Entry {
+/// Reference count used for overlapping events.
+uint64_t refcount = 0;
+
+/// Data used to emit progress events.
+Progress::ProgressData data;
+
+/// Alarm handle used when the refcount reaches zero.
+Alarm::Handle handle = Alarm::INVALID_HANDLE;
+  };
+
+  /// Map used for bookkeeping.
+  llvm::StringMap m_entries;
+
+  /// Mutex to provide the map.
+  std::mutex m_entries_mutex;
+
+  /// Alarm instance to coalesce progress events.
+  Alarm m_alarm;
 };
 
 } // namespace lldb_private
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index b4b5e98b7ba493..161038284e215a 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -35,7 +35,10 @@ Progress::Progress(std::string title, std::string details,
 
   std::lock_guard guard(m_mutex);
   ReportProgress();
-  ProgressManager::Instance().Increment(m_progress_data);
+
+  // Report to the ProgressManager if that subsystem is enabled.
+  if (ProgressManager::Enabled())
+ProgressManager::Instance().Increment(m_progress_data);
 }
 
 Progress::~Progress() {
@@ -45,7 +48,10 @@ Progress::~Progress() {
   if (!m_completed)
 m_completed = m_total;
   ReportProgress();
-  ProgressManager::Instance().Decrement(m_progress_data);
+
+  // Report to the ProgressManager if that subsystem is enabled.
+  if (ProgressManager::Enabled())
+ProgressManager::Instance().Decrement(m_progress_data);
 }
 
 void Progress::Increment(uint64_t amount,
@@ -75,45 +81,84 @@ void Progress::ReportProgress() {
   }
 }
 
-ProgressManager::ProgressManager() : m_progress_category_map() {}
+ProgressManager::ProgressManager()
+: m_entries(), m_alarm(std::chrono::milliseconds(100)) {}
 
 ProgressManager::~ProgressManager() {}
 
+void ProgressManager::Initialize() {
+  assert(!InstanceImpl() && "Already initialized.");
+  InstanceImpl().emplace();
+}
+
+void ProgressManager::Terminate() {
+  assert(InstanceImpl() && "Already terminated.");
+  InstanceImpl().reset();
+}
+
+bool ProgressManager::Enabled() { return InstanceImpl().operator bool(); }
+
 ProgressManager &ProgressManager::Instance() {
-  static std::once_flag g_once_flag;
-  static ProgressManager *g_progress_manager = nullptr;
-  std::call_once(g_once_flag, []() {
-// NOTE: known leak to avoid global destructor chain issues.
-g_progress_manager = new ProgressManager();
-  });
-  return *g_progress_manager;
+  assert(InstanceImpl() && "ProgressManager must be initialized");
+  return *InstanceImpl();
+}
+
+std::optional &ProgressManager::InstanceImpl() {
+  static std::optional g_progress_manager;
+  return g_progress_manager;
 }
 
 void ProgressManager::Increment(const Progress::ProgressData &progress_data) {
-  std::lock_guard lock(m_progress_map_mutex);
-  // If the current category exists in the map then it is not an initial 
report,
-  // therefore don't broadcast to the category bit. Also, store the current
-  // progress data i

[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

2024-03-21 Thread Greg Clayton via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Implement coalescing of disjoint progress events (PR #84854)

2024-03-21 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Rebased. @clayborg please take a look at my comment about the timeout setting 
and let me know if you consider this a blocker or have any other ideas. 

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/86159

This patch sets the necessary `ASTContext` flag
to ensure that the various ASTs (i.e., symbolfile-backed ASTs, scratch AST and 
the expression AST) in LLDB are dumped using syntax highlighting (i.e., 
whenever a user runs `target modules dump ast` or calls the `dump() on a 
`clang::Decl`).

Decided to not put this behind a setting because the diagnostics object 
persists on some AST and gets re-used, so the setting wouldn't consistenly turn 
off syntax highlighting (unless we made the setter fetch all live ASTs and turn 
the highlighting off).

>From fd904cccba7a9d5e295b1b53e25b844e3a8b01ce Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Thu, 21 Mar 2024 17:45:23 +
Subject: [PATCH] [lldb][TypeSystem] Enable colored AST dump

This patch sets the necessary `ASTContext` flag
to ensure that the various ASTs (i.e., symbolfile-backed
ASTs, scratch AST and the expression AST) in LLDB are dumped
using syntax highlighting (i.e., whenever a user runs
`target modules dump ast` or calls the `dump() on a `clang::Decl`).

Decided to not put this behind a setting because the diagnostics
object persists on some AST and gets re-used, so the setting wouldn't
consistenly turn off syntax highlighting (unless we made the setter
fetch all live ASTs and turn the highlighting off).
---
 .../Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp   | 3 +++
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp   | 3 +++
 2 files changed, 6 insertions(+)

diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 574d661e2a215e..0da497d74ffe86 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -465,6 +465,9 @@ ClangExpressionParser::ClangExpressionParser(
   // A value of 0 means no limit for both LLDB and Clang.
   m_compiler->getDiagnostics().setErrorLimit(target_sp->GetExprErrorLimit());
 
+  // AST nodes will be dumped with color
+  m_compiler->getDiagnostics().setShowColors(true);
+
   auto target_info = TargetInfo::CreateTargetInfo(
   m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts);
   if (log) {
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 51ab13108feb3a..146bfbe965e33e 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -752,6 +752,9 @@ void TypeSystemClang::CreateASTContext() {
   m_diagnostic_consumer_up = std::make_unique();
   m_ast_up->getDiagnostics().setClient(m_diagnostic_consumer_up.get(), false);
 
+  // AST nodes will be dumped with color
+  m_ast_up->getDiagnostics().setShowColors(true);
+
   // This can be NULL if we don't know anything about the architecture or if
   // the target for an architecture isn't enabled in the llvm/clang that we
   // built

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

This patch sets the necessary `ASTContext` flag
to ensure that the various ASTs (i.e., symbolfile-backed ASTs, scratch AST and 
the expression AST) in LLDB are dumped using syntax highlighting (i.e., 
whenever a user runs `target modules dump ast` or calls the `dump()` on a 
`clang::Decl`).

Decided to not put this behind a setting because the diagnostics object 
persists on some AST and gets re-used, so the setting wouldn't consistenly turn 
off syntax highlighting (unless we made the setter fetch all live ASTs and turn 
the highlighting off).

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


2 Files Affected:

- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (+3) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+3) 


``diff
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 574d661e2a215e..0da497d74ffe86 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -465,6 +465,9 @@ ClangExpressionParser::ClangExpressionParser(
   // A value of 0 means no limit for both LLDB and Clang.
   m_compiler->getDiagnostics().setErrorLimit(target_sp->GetExprErrorLimit());
 
+  // AST nodes will be dumped with color
+  m_compiler->getDiagnostics().setShowColors(true);
+
   auto target_info = TargetInfo::CreateTargetInfo(
   m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts);
   if (log) {
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 51ab13108feb3a..146bfbe965e33e 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -752,6 +752,9 @@ void TypeSystemClang::CreateASTContext() {
   m_diagnostic_consumer_up = std::make_unique();
   m_ast_up->getDiagnostics().setClient(m_diagnostic_consumer_up.get(), false);
 
+  // AST nodes will be dumped with color
+  m_ast_up->getDiagnostics().setShowColors(true);
+
   // This can be NULL if we don't know anything about the architecture or if
   // the target for an architecture isn't enabled in the llvm/clang that we
   // built

``




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


[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

2024-03-21 Thread Dave Lee via lldb-commits

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

>From 81a2034ff2b41e30a1f5b82c86b4d5d4c429ed52 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 8 Feb 2024 13:59:12 -0800
Subject: [PATCH 1/6] [lldb] Support custom printf formatting for variables

---
 lldb/source/Core/FormatEntity.cpp | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Core/FormatEntity.cpp 
b/lldb/source/Core/FormatEntity.cpp
index fa5eadc6ff4e9a..0e929203935304 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -883,8 +883,29 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
   }
 
   if (!is_array_range) {
-LLDB_LOGF(log,
-  "[Debugger::FormatPrompt] dumping ordinary printable output");
+if (!entry.printf_format.empty()) {
+  auto type_info = target->GetTypeInfo();
+  if (type_info & eTypeIsInteger) {
+if (type_info & eTypeIsSigned) {
+  bool success = false;
+  auto integer = target->GetValueAsSigned(0, &success);
+  if (success) {
+LLDB_LOGF(log, "dumping using printf format");
+s.Printf(entry.printf_format.c_str(), integer);
+return true;
+  }
+} else {
+  bool success = false;
+  auto integer = target->GetValueAsUnsigned(0, &success);
+  if (success) {
+LLDB_LOGF(log, "dumping using printf format");
+s.Printf(entry.printf_format.c_str(), integer);
+return true;
+  }
+}
+  }
+}
+LLDB_LOGF(log, "dumping ordinary printable output");
 return target->DumpPrintableRepresentation(s, val_obj_display,
custom_format);
   } else {

>From 335ab1de4b39257e3bbb3bd969a0dd6991747558 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Tue, 13 Feb 2024 13:26:35 -0800
Subject: [PATCH 2/6] Factor out DumpValueWithPrintf; Add test

---
 lldb/source/Core/FormatEntity.cpp | 45 +++
 .../custom-printf-summary/Makefile|  2 +
 .../TestCustomPrintfSummary.py| 11 +
 .../custom-printf-summary/main.c  | 13 ++
 4 files changed, 52 insertions(+), 19 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/data-formatter/custom-printf-summary/Makefile
 create mode 100644 
lldb/test/API/functionalities/data-formatter/custom-printf-summary/TestCustomPrintfSummary.py
 create mode 100644 
lldb/test/API/functionalities/data-formatter/custom-printf-summary/main.c

diff --git a/lldb/source/Core/FormatEntity.cpp 
b/lldb/source/Core/FormatEntity.cpp
index 0e929203935304..57a05507d844cf 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -658,6 +658,25 @@ static char ConvertValueObjectStyleToChar(
   return '\0';
 }
 
+static bool DumpValueWithPrintf(Stream &s, llvm::StringRef format,
+ValueObject &target) {
+  auto type_info = target.GetTypeInfo();
+  if (type_info & eTypeIsInteger) {
+if (type_info & eTypeIsSigned) {
+  if (auto integer = target.GetValueAsSigned()) {
+s.Printf(format.data(), *integer);
+return true;
+  }
+} else {
+  if (auto integer = target.GetValueAsUnsigned()) {
+s.Printf(format.data(), *integer);
+return true;
+  }
+}
+  }
+  return false;
+}
+
 static bool DumpValue(Stream &s, const SymbolContext *sc,
   const ExecutionContext *exe_ctx,
   const FormatEntity::Entry &entry, ValueObject *valobj) {
@@ -884,25 +903,13 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
 
   if (!is_array_range) {
 if (!entry.printf_format.empty()) {
-  auto type_info = target->GetTypeInfo();
-  if (type_info & eTypeIsInteger) {
-if (type_info & eTypeIsSigned) {
-  bool success = false;
-  auto integer = target->GetValueAsSigned(0, &success);
-  if (success) {
-LLDB_LOGF(log, "dumping using printf format");
-s.Printf(entry.printf_format.c_str(), integer);
-return true;
-  }
-} else {
-  bool success = false;
-  auto integer = target->GetValueAsUnsigned(0, &success);
-  if (success) {
-LLDB_LOGF(log, "dumping using printf format");
-s.Printf(entry.printf_format.c_str(), integer);
-return true;
-  }
-}
+  if (DumpValueWithPrintf(s, entry.printf_format, *target)) {
+LLDB_LOGF(log, "dumping using printf format");
+return true;
+  } else {
+LLDB_LOG(log,
+ "unsupported printf format '{0}' - for type info flags {1}",
+ entry.printf_format, target->GetTypeInfo());
   }
 }
 LLDB_LOGF(log, "dumping ordinary printable output");
diff --git 
a/lldb/test/API/functionalities/data-formatter/custom-p

[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

2024-03-21 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
0572dabb71147fdc156d90a3ecd036d1652c2006...16b8dfab53008c657c82b0ae35510c7050481bdb
 
lldb/test/API/functionalities/data-formatter/custom-printf-summary/TestCustomPrintfSummary.py
``





View the diff from darker here.


``diff
--- TestCustomPrintfSummary.py  2024-03-21 17:59:12.00 +
+++ TestCustomPrintfSummary.py  2024-03-21 18:04:23.541734 +
@@ -2,11 +2,10 @@
 from lldbsuite.test.lldbtest import *
 import lldbsuite.test.lldbutil as lldbutil
 
 
 class TestCase(TestBase):
-
 def test_raw_bytes(self):
 self.build()
 lldbutil.run_to_source_breakpoint(self, "break here", 
lldb.SBFileSpec("main.c"))
 self.runCmd("type summary add -s '${var.ubyte:x-2}${var.sbyte:x-2}!' 
Bytes")
 self.expect("v bytes", substrs=[" = 3001!"])

``




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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Alex Langford via lldb-commits

bulbazord wrote:

What happens if you have colors disabled in your terminal? Does this do 
nothing? Or does it start inserting ANSI escape codes in plain text?

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

> > What happens if you have colors disabled in your terminal? Does this do 
> > nothing? Or does it start inserting ANSI escape codes in plain text?
> 
> Yea good question, was about to try this out. It does whatever clang's 
> `ast-dump` would do if colors aren't turned off

That keys off of the output stream supporting colors, but LLDB also allows you 
to disable colors globally. Please also try `lldb --no-use-colors` and see if 
that behaves correctly (it might if we set the properties of the stream 
correctly). If it doesn't you'll need to read `debugger.GetUseColor()`. 

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Either way, we should add a comment explaining that (and why) this works. 

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


[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

2024-03-21 Thread Michael Buch via lldb-commits

Michael137 wrote:

> What happens if you have colors disabled in your terminal? Does this do 
> nothing? Or does it start inserting ANSI escape codes in plain text?

Yea good question, was about to try this out. It does whatever clang's 
`ast-dump` would do if colors aren't turned on

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


[Lldb-commits] [lldb] 6d939a6 - DebugInfoD tests + fixing issues exposed by tests (#85693)

2024-03-21 Thread via lldb-commits

Author: Kevin Frei
Date: 2024-03-21T13:09:04-07:00
New Revision: 6d939a6ec69adf284cdbef2034b49fd02ba503fc

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

LOG: DebugInfoD tests + fixing issues exposed by tests (#85693)

Finally getting back to Debuginfod tests:
I've migrated the tests in my [earlier
PR](https://github.com/llvm/llvm-project/pull/79181) from shell to API
(at @JDevlieghere's suggestion) and addressed a couple issues that came
about during testing.

The tests first test the "normal" situation (no DebugInfoD involvement,
just normal debug files sitting around), then the "no debug info"
situation (to make sure the test is seeing failure properly), then it
tests to validate that when Debuginfod returns the symbols, things work
properly. This is duplicated for DWP/split-dwarf scenarios.

-

Co-authored-by: Kevin Frei 

Added: 
lldb/test/API/debuginfod/Normal/Makefile
lldb/test/API/debuginfod/Normal/TestDebuginfod.py
lldb/test/API/debuginfod/Normal/main.c
lldb/test/API/debuginfod/SplitDWARF/Makefile
lldb/test/API/debuginfod/SplitDWARF/TestDebuginfodDWP.py
lldb/test/API/debuginfod/SplitDWARF/main.c

Modified: 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolLocator/CMakeLists.txt
lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index bfd249ccd43f2e..75efcde1f04023 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -51,7 +51,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 #
 # GNUWin32 uname gives "windows32" or "server version windows32" while
 # some versions of MSYS uname return "MSYS_NT*", but most environments
-# standardize on "Windows_NT", so we'll make it consistent here. 
+# standardize on "Windows_NT", so we'll make it consistent here.
 # When running tests from Visual Studio, the environment variable isn't
 # inherited all the way down to the process spawned for make.
 #--
@@ -210,6 +210,12 @@ else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
DSYM = $(EXE).debug
endif
+
+   ifeq "$(MAKE_DWP)" "YES"
+   MAKE_DWO := YES
+   DWP_NAME = $(EXE).dwp
+   DYLIB_DWP_NAME = $(DYLIB_NAME).dwp
+   endif
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
@@ -357,6 +363,7 @@ ifneq "$(OS)" "Darwin"
 
OBJCOPY ?= $(call replace_cc_with,objcopy)
ARCHIVER ?= $(call replace_cc_with,ar)
+   DWP ?= $(call replace_cc_with,dwp)
override AR = $(ARCHIVER)
 endif
 
@@ -527,6 +534,10 @@ ifneq "$(CXX)" ""
endif
 endif
 
+ifeq "$(GEN_GNU_BUILD_ID)" "YES"
+   LDFLAGS += -Wl,--build-id
+endif
+
 #--
 # DYLIB_ONLY variable can be used to skip the building of a.out.
 # See the sections below regarding dSYM file as well as the building of
@@ -565,11 +576,25 @@ else
 endif
 else
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
+   cp "$(EXE)" "$(EXE).full"
+endif
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
+ifeq "$(MAKE_DWP)" "YES"
+   $(DWP) -o "$(DWP_NAME)" $(DWOS)
+endif
 endif
 
+
+#--
+# Support emitting the content of the GNU build-id into a file
+# This needs to be used in conjunction with GEN_GNU_BUILD_ID := YES
+#--
+$(EXE).uuid : $(EXE)
+   $(OBJCOPY) --dump-section=.note.gnu.build-id=$@ $<
+
 #--
 # Make the dylib
 #--
@@ -610,9 +635,15 @@ endif
 else
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+   ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
+   cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).full"
+   endif
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" 
"$(DYLIB_FILENAME).debug"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" 
"$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
 endif
+ifeq "$(MAKE_DWP)" "YES"
+   $(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS)
+endif
 endif
 
 #--

diff  --git a/lldb/source/Plugins/SymbolFile/DWA

[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

2024-03-21 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Implement coalescing of disjoint progress events (PR #84854)

2024-03-21 Thread Greg Clayton via lldb-commits

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

LGTM. I commented on the timeout, but we can implement a setting later if 
needed. We can always have the ProgressManager class start with 100ms, and then 
have its timeout updated if/when the settings get modified later. Since there 
is one progress manager per process, we can just make the setting `global`.

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


[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

2024-03-21 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

2024-03-21 Thread Adrian Prantl via lldb-commits


@@ -0,0 +1,18 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class TestCase(TestBase):
+
+def test_raw_bytes(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self, "break here", 
lldb.SBFileSpec("main.c"))
+self.runCmd("type summary add -s '${var.ubyte:x-2}${var.sbyte:x-2}!' 
Bytes")
+self.expect("v bytes", substrs=[" = 3001!"])
+
+def test_bad_format(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self, "break here", 
lldb.SBFileSpec("main.c"))
+self.runCmd("type summary add -s '${var.ubyte:y}!' Bytes")
+self.expect("v bytes", substrs=[" = '0'!"])

adrian-prantl wrote:

should there be an error message of sorts?

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


[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

2024-03-21 Thread Adrian Prantl via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

2024-03-21 Thread Adrian Prantl via lldb-commits


@@ -659,20 +660,24 @@ static char ConvertValueObjectStyleToChar(
 }
 
 static bool DumpValueWithLLVMFormat(Stream &s, llvm::StringRef options,
-ValueObject &target) {
+ValueObject &valobj) {
   std::string formatted;
   std::string llvm_format = ("{0:" + options + "}").str();
 
-  auto type_info = target.GetTypeInfo();
-  if (type_info & eTypeIsInteger) {
+  // Options supported by format_provider for integral arithmetic types.
+  // See table in FormatProviders.h.
+  llvm::Regex int_format{"x[-+]?\\d*|n|d", llvm::Regex::IgnoreCase};

adrian-prantl wrote:

Should this be a static local, so the regex isn't compiled over and over?

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


[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

2024-03-21 Thread Dave Lee via lldb-commits


@@ -0,0 +1,18 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class TestCase(TestBase):
+
+def test_raw_bytes(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self, "break here", 
lldb.SBFileSpec("main.c"))
+self.runCmd("type summary add -s '${var.ubyte:x-2}${var.sbyte:x-2}!' 
Bytes")
+self.expect("v bytes", substrs=[" = 3001!"])
+
+def test_bad_format(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self, "break here", 
lldb.SBFileSpec("main.c"))
+self.runCmd("type summary add -s '${var.ubyte:y}!' Bytes")
+self.expect("v bytes", substrs=[" = '0'!"])

kastiglione wrote:

yep, I'm making that change now.

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


[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)

2024-03-21 Thread via lldb-commits


@@ -44,6 +44,25 @@ llvm::StringRef 
SymbolVendorELF::GetPluginDescriptionStatic() {
  "executables.";
 }
 
+// If this is needed elsewhere, it can be exported/moved.
+static bool IsDwpSymbolFile(const lldb::ModuleSP &module_sp,
+const FileSpec &file_spec) {
+  DataBufferSP dwp_file_data_sp;
+  lldb::offset_t dwp_file_data_offset = 0;
+  // Try to create an ObjectFile from the file_spec.
+  ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin(
+  module_sp, &file_spec, 0, FileSystem::Instance().GetByteSize(file_spec),
+  dwp_file_data_sp, dwp_file_data_offset);
+  if (!ObjectFileELF::classof(dwp_obj_file.get()))

GeorgeHuyubo wrote:

You probably want to do 
`if (!dwp_obj_file && !ObjectFileELF::classof(dwp_obj_file.get()))`
dwp_obj_file might be a null pointer

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


[Lldb-commits] [lldb] [lldb] Handle clang::Language::CIR (PR #86234)

2024-03-21 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/86234

  commit e66b670f3bf9312f696e66c31152ae535207d6bb
  Author: Nathan Lanza 
  Date:   Thu Mar 21 19:53:48 2024 -0400

triggers:

  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:478:16:
  error: enumeration value 'CIR' not handled in switch
  [-Werror,-Wswitch]

This patch teaches lldb to handle clang::Language::CIR the same way as
clang::Language::LLVM_IR.


>From ed689ca338eca95448077582ef53b7feb15e8caa Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Thu, 21 Mar 2024 19:11:15 -0700
Subject: [PATCH] [lldb] Handle clang::Language::CIR

  commit e66b670f3bf9312f696e66c31152ae535207d6bb
  Author: Nathan Lanza 
  Date:   Thu Mar 21 19:53:48 2024 -0400

triggers:

  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:478:16:
  error: enumeration value 'CIR' not handled in switch
  [-Werror,-Wswitch]

This patch teaches lldb to handle clang::Language::CIR the same way as
clang::Language::LLVM_IR.
---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3ac1cf91932cca..ebcc3bc99a801f 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -477,6 +477,7 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, 
const char *triple) {
 // Based on the base language, pick one.
 switch (IK.getLanguage()) {
 case clang::Language::Unknown:
+case clang::Language::CIR:
 case clang::Language::LLVM_IR:
 case clang::Language::RenderScript:
   llvm_unreachable("Invalid input kind!");

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


[Lldb-commits] [lldb] [lldb] Handle clang::Language::CIR (PR #86234)

2024-03-21 Thread Nathan Lanza via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Handle clang::Language::CIR (PR #86234)

2024-03-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes

  commit e66b670f3bf9312f696e66c31152ae535207d6bb
  Author: Nathan Lanza 
  Date:   Thu Mar 21 19:53:48 2024 -0400

triggers:

  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:478:16:
  error: enumeration value 'CIR' not handled in switch
  [-Werror,-Wswitch]

This patch teaches lldb to handle clang::Language::CIR the same way as
clang::Language::LLVM_IR.


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


1 Files Affected:

- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+1) 


``diff
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3ac1cf91932cca..ebcc3bc99a801f 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -477,6 +477,7 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, 
const char *triple) {
 // Based on the base language, pick one.
 switch (IK.getLanguage()) {
 case clang::Language::Unknown:
+case clang::Language::CIR:
 case clang::Language::LLVM_IR:
 case clang::Language::RenderScript:
   llvm_unreachable("Invalid input kind!");

``




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


[Lldb-commits] [lldb] [lldb] Handle clang::Language::CIR (PR #86234)

2024-03-21 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] 40beb9b - [lldb] Handle clang::Language::CIR (#86234)

2024-03-21 Thread via lldb-commits

Author: Kazu Hirata
Date: 2024-03-21T20:14:18-07:00
New Revision: 40beb9b001a3c67c60b98fae9e999dcaa2d88717

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

LOG: [lldb] Handle clang::Language::CIR (#86234)

commit e66b670f3bf9312f696e66c31152ae535207d6bb
  Author: Nathan Lanza 
  Date:   Thu Mar 21 19:53:48 2024 -0400

triggers:

  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:478:16:
  error: enumeration value 'CIR' not handled in switch
  [-Werror,-Wswitch]

This patch teaches lldb to handle clang::Language::CIR the same way as
clang::Language::LLVM_IR.

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3ac1cf91932cca..ebcc3bc99a801f 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -477,6 +477,7 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, 
const char *triple) {
 // Based on the base language, pick one.
 switch (IK.getLanguage()) {
 case clang::Language::Unknown:
+case clang::Language::CIR:
 case clang::Language::LLVM_IR:
 case clang::Language::RenderScript:
   llvm_unreachable("Invalid input kind!");



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