[Lldb-commits] [lld] [libunwind] [compiler-rt] [libcxxabi] [flang] [lldb] [clang] [llvm] [clang-tools-extra] [libc] [libcxx] [mlir] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-19 Thread Shahid Iqbal via lldb-commits


@@ -83,10 +85,29 @@ struct DOTGraphTraitsViewer
   StringRef Name;
 };
 
+static void shortenFileName(std::string &FN, unsigned char len = 250) {
+
+  FN = FN.substr(0, len);
+  if (nameObj.empty())
+nameObj.push_back(FN);
+
+  else {
+for (auto it = nameObj.begin(); it != nameObj.end(); it++) {
+  if (*it == FN) {
+FN = FN.substr(0, --len);

shahidiqbal13 wrote:

@DrTodd13 ,
Yes I do agree with the 3 filenames example but the chances would be highly 
rare that's what y I didn't go for keep searching mechanism

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


[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

2023-11-19 Thread via lldb-commits
=?utf-8?q?José?= L. Junior ,taalhaataahir0102
 <23100...@lums.edu.pk>,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior ,taalhaataahir0102
 <23100...@lums.edu.pk>
Message-ID:
In-Reply-To: 


https://github.com/taalhaataahir0102 updated 
https://github.com/llvm/llvm-project/pull/69422

>From 2c23aaf231beef11d3e0db6506fe82323a0be6a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Tue, 7 Nov 2023 16:57:18 -0300
Subject: [PATCH 1/7] [lldb] colorize symbols in image lookup

---
 lldb/include/lldb/Core/Address.h  |  7 ++-
 lldb/include/lldb/Symbol/Symbol.h |  4 +-
 lldb/include/lldb/Symbol/SymbolContext.h  |  8 +--
 lldb/source/Commands/CommandObjectTarget.cpp  | 15 --
 lldb/source/Core/Address.cpp  | 53 ---
 lldb/source/Symbol/Symbol.cpp | 18 ---
 lldb/source/Symbol/SymbolContext.cpp  | 16 --
 .../Commands/command-image-lookup-color.test  | 25 +
 8 files changed, 114 insertions(+), 32 deletions(-)
 create mode 100644 lldb/test/Shell/Commands/command-image-lookup-color.test

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index b19e694427546f8..fac0ced910a11d4 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -246,8 +246,11 @@ class Address {
   /// \see Address::DumpStyle
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
-uint32_t addr_byte_size = UINT32_MAX,
-bool all_ranges = false) const;
+uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
+const char *pattern = nullptr) const;
+
+  static void DumpName(Stream *strm, llvm::StringRef text,
+   const char *pattern = nullptr);
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index 44a2d560010fe40..0e41cd95e0ef17d 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -174,8 +174,8 @@ class Symbol : public SymbolContextScope {
 
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
-  void GetDescription(Stream *s, lldb::DescriptionLevel level,
-  Target *target) const;
+  void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+  const char *pattern = nullptr) const;
 
   bool IsSynthetic() const { return m_is_synthetic; }
 
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h 
b/lldb/include/lldb/Symbol/SymbolContext.h
index b0f5ffead2a1656..9567c3f4384c175 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -150,8 +150,8 @@ class SymbolContext {
   bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
-   bool show_function_arguments,
-   bool show_function_name) const;
+   bool show_function_arguments, bool show_function_name,
+   const char *pattern = nullptr) const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -217,8 +217,8 @@ class SymbolContext {
   /// The symbol that was found, or \b nullptr if none was found.
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
-  void GetDescription(Stream *s, lldb::DescriptionLevel level,
-  Target *target) const;
+  void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+  const char *pattern = nullptr) const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 8f052d0a7b837e2..a83575ad82d6909 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -8,6 +8,7 @@
 
 #include "CommandObjectTarget.h"
 
+#include "lldb/Core/Address.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/Module.h"
@@ -1534,7 +1535,7 @@ static void DumpOsoFilesTable(Stream &strm,
 
 static void DumpAddress(ExecutionContextScope *exe_scope,
 const Address &so_addr, bool verbose, bool all_ranges,
-Stream &strm) {
+Stream &strm, const char *pattern = nullptr) {
   strm.IndentMore();
   strm.Indent("Address: ");
   so_addr.Dump(&strm, exe_scope, Address::DumpStyleModuleWithFileAddress);
@@ -1544,13 +1545,14 @@ static void DumpAddress(ExecutionContextScope 
*exe_scope,
   strm.Indent("Summary: ");
   const uint32_t save_indent = strm.GetIndentLevel();
   strm.SetIndentLevel(save_indent + 13);
-  so_addr.Dump(&strm, exe_scope, Address::DumpS

[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

2023-11-19 Thread via lldb-commits
=?utf-8?q?José?= L. Junior ,taalhaataahir0102
 <23100...@lums.edu.pk>,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


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


[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

2023-11-19 Thread via lldb-commits
=?utf-8?q?José?= L. Junior ,taalhaataahir0102
 <23100...@lums.edu.pk>,
=?utf-8?q?José?= L. Junior ,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


https://github.com/taalhaataahir0102 updated 
https://github.com/llvm/llvm-project/pull/69422

>From 2c23aaf231beef11d3e0db6506fe82323a0be6a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Tue, 7 Nov 2023 16:57:18 -0300
Subject: [PATCH 1/6] [lldb] colorize symbols in image lookup

---
 lldb/include/lldb/Core/Address.h  |  7 ++-
 lldb/include/lldb/Symbol/Symbol.h |  4 +-
 lldb/include/lldb/Symbol/SymbolContext.h  |  8 +--
 lldb/source/Commands/CommandObjectTarget.cpp  | 15 --
 lldb/source/Core/Address.cpp  | 53 ---
 lldb/source/Symbol/Symbol.cpp | 18 ---
 lldb/source/Symbol/SymbolContext.cpp  | 16 --
 .../Commands/command-image-lookup-color.test  | 25 +
 8 files changed, 114 insertions(+), 32 deletions(-)
 create mode 100644 lldb/test/Shell/Commands/command-image-lookup-color.test

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index b19e694427546f8..fac0ced910a11d4 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -246,8 +246,11 @@ class Address {
   /// \see Address::DumpStyle
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
-uint32_t addr_byte_size = UINT32_MAX,
-bool all_ranges = false) const;
+uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
+const char *pattern = nullptr) const;
+
+  static void DumpName(Stream *strm, llvm::StringRef text,
+   const char *pattern = nullptr);
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index 44a2d560010fe40..0e41cd95e0ef17d 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -174,8 +174,8 @@ class Symbol : public SymbolContextScope {
 
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
-  void GetDescription(Stream *s, lldb::DescriptionLevel level,
-  Target *target) const;
+  void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+  const char *pattern = nullptr) const;
 
   bool IsSynthetic() const { return m_is_synthetic; }
 
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h 
b/lldb/include/lldb/Symbol/SymbolContext.h
index b0f5ffead2a1656..9567c3f4384c175 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -150,8 +150,8 @@ class SymbolContext {
   bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
-   bool show_function_arguments,
-   bool show_function_name) const;
+   bool show_function_arguments, bool show_function_name,
+   const char *pattern = nullptr) const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -217,8 +217,8 @@ class SymbolContext {
   /// The symbol that was found, or \b nullptr if none was found.
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
-  void GetDescription(Stream *s, lldb::DescriptionLevel level,
-  Target *target) const;
+  void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
+  const char *pattern = nullptr) const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 8f052d0a7b837e2..a83575ad82d6909 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -8,6 +8,7 @@
 
 #include "CommandObjectTarget.h"
 
+#include "lldb/Core/Address.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/Module.h"
@@ -1534,7 +1535,7 @@ static void DumpOsoFilesTable(Stream &strm,
 
 static void DumpAddress(ExecutionContextScope *exe_scope,
 const Address &so_addr, bool verbose, bool all_ranges,
-Stream &strm) {
+Stream &strm, const char *pattern = nullptr) {
   strm.IndentMore();
   strm.Indent("Address: ");
   so_addr.Dump(&strm, exe_scope, Address::DumpStyleModuleWithFileAddress);
@@ -1544,13 +1545,14 @@ static void DumpAddress(ExecutionContextScope 
*exe_scope,
   strm.Indent("Summary: ");
   const uint32_t save_indent = strm.GetIndentLevel();
   strm.SetIndentLevel(save_indent + 13);
-  so_addr.Dump(&strm, exe_scope, Address::DumpStyleResolvedDescription);
+  so_addr.Dump(

[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

2023-11-19 Thread via lldb-commits
=?utf-8?q?José?= L. Junior ,taalhaataahir0102
 <23100...@lums.edu.pk>,
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


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


[Lldb-commits] [lldb] Add new API in SBTarget for loading core from SBFile (PR #71769)

2023-11-19 Thread Omair Javaid via lldb-commits

omjavaid wrote:

I have reverted this temporarily as it broke  TestLinuxCore.py on 
lldb-*-windows. Kindly have a look at
https://lab.llvm.org/buildbot/#/builders/219/builds/7014

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


[Lldb-commits] [lldb] c1fe190 - Revert "Add new API in SBTarget for loading core from SBFile (#71769)"

2023-11-19 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2023-11-20T11:12:34+05:00
New Revision: c1fe1900491ae773e45e41604af25312e5fc6559

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

LOG: Revert "Add new API in SBTarget for loading core from SBFile (#71769)"

This reverts commit e2fb816c4f0286ddf8b1030148a343d5efc14e01.
It breaks TestLinuxCore.py on lldb-*-windows. See buildbot below:
https://lab.llvm.org/buildbot/#/builders/219/builds/7014

Added: 


Modified: 
lldb/include/lldb/API/SBTarget.h
lldb/source/API/SBTarget.cpp
lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py

Removed: 




diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index 8e44cd5513c5b20..83087623088c5b4 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -184,7 +184,6 @@ class LLDB_API SBTarget {
 
   SBProcess LoadCore(const char *core_file);
   SBProcess LoadCore(const char *core_file, lldb::SBError &error);
-  SBProcess LoadCore(const SBFile &file, lldb::SBError &error);
 
   /// Launch a new process with sensible defaults.
   ///

diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 9632627e3cefc42..2d029554492a05c 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -16,7 +16,6 @@
 #include "lldb/API/SBEnvironment.h"
 #include "lldb/API/SBEvent.h"
 #include "lldb/API/SBExpressionOptions.h"
-#include "lldb/API/SBFile.h"
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBListener.h"
 #include "lldb/API/SBModule.h"
@@ -261,31 +260,6 @@ SBProcess SBTarget::LoadCore(const char *core_file, 
lldb::SBError &error) {
   return sb_process;
 }
 
-SBProcess SBTarget::LoadCore(const SBFile &file, lldb::SBError &error) {
-  LLDB_INSTRUMENT_VA(this, file, error);
-
-  SBProcess sb_process;
-  TargetSP target_sp(GetSP());
-  if (target_sp) {
-FileSP file_sp = file.GetFile();
-FileSpec filespec;
-file_sp->GetFileSpec(filespec);
-FileSystem::Instance().Resolve(filespec);
-ProcessSP process_sp(target_sp->CreateProcess(
-target_sp->GetDebugger().GetListener(), "", &filespec, false));
-if (process_sp) {
-  error.SetError(process_sp->LoadCore());
-  if (error.Success())
-sb_process.SetSP(process_sp);
-} else {
-  error.SetErrorString("Failed to create the process");
-}
-  } else {
-error.SetErrorString("SBTarget is invalid");
-  }
-  return sb_process;
-}
-
 SBProcess SBTarget::LaunchSimple(char const **argv, char const **envp,
  const char *working_directory) {
   LLDB_INSTRUMENT_VA(this, argv, envp, working_directory);

diff  --git 
a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py 
b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
index a6a8518f9397da3..58f104eb49de245 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -53,11 +53,6 @@ def test_x86_64(self):
 """Test that lldb can read the process information from an x86_64 
linux core file."""
 self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions, 
"a.out")
 
-@skipIfLLVMTargetMissing("X86")
-def test_x86_64_fd(self):
-"""Test that lldb can read the process information from an x86_64 
linux core file."""
-self.do_test_fd("linux-x86_64", self._x86_64_pid, 
self._x86_64_regions, "a.out")
-
 @skipIfLLVMTargetMissing("SystemZ")
 def test_s390x(self):
 """Test that lldb can read the process information from an s390x linux 
core file."""
@@ -762,19 +757,6 @@ def do_test(self, filename, pid, region_count, 
thread_name):
 
 self.dbg.DeleteTarget(target)
 
-def do_test_fd(self, filename, pid, region_count, thread_name):
-file_object = open(filename + ".core", "r")
-fd = file_object.fileno()
-file = lldb.SBFile(fd, "r", True)
-target = self.dbg.CreateTarget(filename + ".out")
-error = lldb.SBError()
-process = target.LoadCore(file, error)
-
-self.check_all(process, pid, region_count, thread_name)
-
-self.dbg.DeleteTarget(target)
-
-
 
 def replace_path(binary, replace_from, replace_to):
 src = replace_from.encode()



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


[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)

2023-11-19 Thread Tom Yang via lldb-commits

zhyty wrote:

@bulbazord @clayborg I updated the DWO tests so that we try to compile for 
`x86_64-pc-linux-elf` on all platforms, and if we fail the tests are skipped. 
I've verified that the tests pass on my Linux machine and that they're skipped 
on my Mac, though it would be nice if I could make sure the build bots will 
pass.

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


[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)

2023-11-19 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)

2023-11-19 Thread Tom Yang via lldb-commits

https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230

>From 68c8884696efab8991e71dfd892463b9873b5e46 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Fri, 3 Nov 2023 13:45:37 -0700
Subject: [PATCH 1/5] [lldb][split-dwarf] implement GetSeparateDebugInfo for
 SymbolFileOnDemand

---
 lldb/include/lldb/Symbol/SymbolFileOnDemand.h |  5 
 lldb/source/Commands/CommandObjectTarget.cpp  |  1 +
 .../dwo/TestDumpDwo.py| 26 +++
 3 files changed, 32 insertions(+)

diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h 
b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
index adf1017ce73c11b..9cbcef2a111d320 100644
--- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile 
{
 return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors();
   }
 
+  bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
+bool errors_only) override {
+return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only);
+  }
+
   lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name,
 std::optional byte_size,
 SymbolContextScope *context,
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 8f052d0a7b837e2..31ad485ac236878 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
 "Found unsupported debug info type '%s'.\n",
 type.str().c_str());
   }
+  strm.EOL();
   return true;
 });
   }
diff --git 
a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py 
b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
index 163f5a112367693..881ee7b1dc71adf 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
@@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self):
 "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo",
 ],
 )
+
+@skipIfRemote
+@skipIfDarwin
+@skipIfWindows
+def test_dwos_loaded_symbols_on_demand(self):
+self.build()
+exe = self.getBuildArtifact("a.out")
+main_dwo = self.getBuildArtifact("main.dwo")
+foo_dwo = self.getBuildArtifact("foo.dwo")
+
+# Make sure dwo files exist
+self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" 
file exists')
+self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file 
exists')
+
+# Load symbols on-demand
+self.runCmd("settings set symbols.load-on-demand true")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, lldbtest.VALID_TARGET)
+
+self.runCmd("target modules dump separate-debug-info --json")
+
+# Check the output
+output = self.get_dwos_from_json_output()
+self.assertTrue(output[exe]["main.dwo"]["loaded"])
+self.assertTrue(output[exe]["foo.dwo"]["loaded"])

>From f2e2b100144dad2bfeb2d71efd8559a0a003bd27 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Sun, 5 Nov 2023 10:06:12 -0800
Subject: [PATCH 2/5] add symbol on demand Darwin OSO tests

---
 .../oso/TestDumpOso.py| 30 +++
 1 file changed, 30 insertions(+)

diff --git 
a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py 
b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
index b69938454659bda..06dc8234591844b 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
@@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self):
 "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o",
 ],
 )
+
+@skipIfRemote
+@skipUnlessDarwin
+def test_osos_loaded_symbols_on_demand(self):
+self.build(debug_info="dwarf")
+exe = self.getBuildArtifact("a.out")
+main_o = self.getBuildArtifact("main.o")
+foo_o = self.getBuildArtifact("foo.o")
+
+# Make sure o files exist
+self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file 
exists')
+self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file 
exists')
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, lldbtest.VALID_TARGET)
+
+self.runCmd("target modules dump separate-debug-info --json")
+
+# Load symbols on-demand
+self.runCmd("settings set symbols.load-on-demand true")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue

[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)

2023-11-19 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 
edad025d1e1f8043637c65fed91060b327e85313..2efa56974ee171b5f34f19607eefa652ef1b344a
 lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py 
lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
``





View the diff from darker here.


``diff
--- dwo/TestDumpDwo.py  2023-11-19 23:59:34.00 +
+++ dwo/TestDumpDwo.py  2023-11-20 00:02:31.354747 +
@@ -24,11 +24,11 @@
 result[symfile_entry["symfile"]] = dwo_dict
 return result
 
 def build_and_skip_if_error(self):
 try:
-self.build() 
+self.build()
 except BuildError as e:
 self.skipTest(f"Skipping test due to build exception: {e}")
 
 def test_dwos_loaded_json_output(self):
 self.build_and_skip_if_error()

``




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


[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)

2023-11-19 Thread Tom Yang via lldb-commits

https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230

>From 68c8884696efab8991e71dfd892463b9873b5e46 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Fri, 3 Nov 2023 13:45:37 -0700
Subject: [PATCH 1/4] [lldb][split-dwarf] implement GetSeparateDebugInfo for
 SymbolFileOnDemand

---
 lldb/include/lldb/Symbol/SymbolFileOnDemand.h |  5 
 lldb/source/Commands/CommandObjectTarget.cpp  |  1 +
 .../dwo/TestDumpDwo.py| 26 +++
 3 files changed, 32 insertions(+)

diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h 
b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
index adf1017ce73c11b0..9cbcef2a111d3200 100644
--- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile 
{
 return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors();
   }
 
+  bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
+bool errors_only) override {
+return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only);
+  }
+
   lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name,
 std::optional byte_size,
 SymbolContextScope *context,
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 8f052d0a7b837e24..31ad485ac2368780 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
 "Found unsupported debug info type '%s'.\n",
 type.str().c_str());
   }
+  strm.EOL();
   return true;
 });
   }
diff --git 
a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py 
b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
index 163f5a1123676936..881ee7b1dc71adf3 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
@@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self):
 "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo",
 ],
 )
+
+@skipIfRemote
+@skipIfDarwin
+@skipIfWindows
+def test_dwos_loaded_symbols_on_demand(self):
+self.build()
+exe = self.getBuildArtifact("a.out")
+main_dwo = self.getBuildArtifact("main.dwo")
+foo_dwo = self.getBuildArtifact("foo.dwo")
+
+# Make sure dwo files exist
+self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" 
file exists')
+self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file 
exists')
+
+# Load symbols on-demand
+self.runCmd("settings set symbols.load-on-demand true")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, lldbtest.VALID_TARGET)
+
+self.runCmd("target modules dump separate-debug-info --json")
+
+# Check the output
+output = self.get_dwos_from_json_output()
+self.assertTrue(output[exe]["main.dwo"]["loaded"])
+self.assertTrue(output[exe]["foo.dwo"]["loaded"])

>From f2e2b100144dad2bfeb2d71efd8559a0a003bd27 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Sun, 5 Nov 2023 10:06:12 -0800
Subject: [PATCH 2/4] add symbol on demand Darwin OSO tests

---
 .../oso/TestDumpOso.py| 30 +++
 1 file changed, 30 insertions(+)

diff --git 
a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py 
b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
index b69938454659bda5..06dc8234591844b1 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
@@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self):
 "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o",
 ],
 )
+
+@skipIfRemote
+@skipUnlessDarwin
+def test_osos_loaded_symbols_on_demand(self):
+self.build(debug_info="dwarf")
+exe = self.getBuildArtifact("a.out")
+main_o = self.getBuildArtifact("main.o")
+foo_o = self.getBuildArtifact("foo.o")
+
+# Make sure o files exist
+self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file 
exists')
+self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file 
exists')
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, lldbtest.VALID_TARGET)
+
+self.runCmd("target modules dump separate-debug-info --json")
+
+# Load symbols on-demand
+self.runCmd("settings set symbols.load-on-demand true")
+
+target = self.dbg.CreateTarget(exe)
+self.as

[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)

2023-11-19 Thread Tom Yang via lldb-commits

https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230

>From 68c8884696efab8991e71dfd892463b9873b5e46 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Fri, 3 Nov 2023 13:45:37 -0700
Subject: [PATCH 1/3] [lldb][split-dwarf] implement GetSeparateDebugInfo for
 SymbolFileOnDemand

---
 lldb/include/lldb/Symbol/SymbolFileOnDemand.h |  5 
 lldb/source/Commands/CommandObjectTarget.cpp  |  1 +
 .../dwo/TestDumpDwo.py| 26 +++
 3 files changed, 32 insertions(+)

diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h 
b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
index adf1017ce73c11b0..9cbcef2a111d3200 100644
--- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile 
{
 return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors();
   }
 
+  bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
+bool errors_only) override {
+return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only);
+  }
+
   lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name,
 std::optional byte_size,
 SymbolContextScope *context,
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 8f052d0a7b837e24..31ad485ac2368780 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
 "Found unsupported debug info type '%s'.\n",
 type.str().c_str());
   }
+  strm.EOL();
   return true;
 });
   }
diff --git 
a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py 
b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
index 163f5a1123676936..881ee7b1dc71adf3 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
@@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self):
 "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo",
 ],
 )
+
+@skipIfRemote
+@skipIfDarwin
+@skipIfWindows
+def test_dwos_loaded_symbols_on_demand(self):
+self.build()
+exe = self.getBuildArtifact("a.out")
+main_dwo = self.getBuildArtifact("main.dwo")
+foo_dwo = self.getBuildArtifact("foo.dwo")
+
+# Make sure dwo files exist
+self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" 
file exists')
+self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file 
exists')
+
+# Load symbols on-demand
+self.runCmd("settings set symbols.load-on-demand true")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, lldbtest.VALID_TARGET)
+
+self.runCmd("target modules dump separate-debug-info --json")
+
+# Check the output
+output = self.get_dwos_from_json_output()
+self.assertTrue(output[exe]["main.dwo"]["loaded"])
+self.assertTrue(output[exe]["foo.dwo"]["loaded"])

>From f2e2b100144dad2bfeb2d71efd8559a0a003bd27 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Sun, 5 Nov 2023 10:06:12 -0800
Subject: [PATCH 2/3] add symbol on demand Darwin OSO tests

---
 .../oso/TestDumpOso.py| 30 +++
 1 file changed, 30 insertions(+)

diff --git 
a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py 
b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
index b69938454659bda5..06dc8234591844b1 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
@@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self):
 "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o",
 ],
 )
+
+@skipIfRemote
+@skipUnlessDarwin
+def test_osos_loaded_symbols_on_demand(self):
+self.build(debug_info="dwarf")
+exe = self.getBuildArtifact("a.out")
+main_o = self.getBuildArtifact("main.o")
+foo_o = self.getBuildArtifact("foo.o")
+
+# Make sure o files exist
+self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file 
exists')
+self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file 
exists')
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, lldbtest.VALID_TARGET)
+
+self.runCmd("target modules dump separate-debug-info --json")
+
+# Load symbols on-demand
+self.runCmd("settings set symbols.load-on-demand true")
+
+target = self.dbg.CreateTarget(exe)
+self.as