[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)

2024-10-23 Thread Stefan Gränitz via lldb-commits


@@ -0,0 +1,46 @@
+// Itanium ABI:
+// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
+// RUN: %lldb -f %t_linux.o -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 
mp8 mp9" | FileCheck %s
+//
+// CHECK: (char SI2::*) mp9 = 0x
+
+// Microsoft ABI:
+// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
+// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
+// RUN: %lldb -f %t_win.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 
mp8 mp9" | FileCheck --check-prefix=CHECK-MSVC %s
+//
+// DWARF has no representation of MSInheritanceAttr, so we cannot determine 
the size
+// of member-pointers yet. For the moment, make sure we don't crash on such 
variables.
+// CHECK-MSVC: error: Unable to determine byte size.
+
+class SI {
+  double si;
+};
+struct SI2 {
+  char si2;
+};
+class MI : SI, SI2 {
+  int mi;
+};
+class MI2 : MI {
+  int mi2;
+};
+class VI : virtual MI {
+  int vi;
+};
+class VI2 : virtual SI, virtual SI2 {
+  int vi;
+};
+class /* __unspecified_inheritance*/ UI;
+
+double SI::*mp1 = nullptr;
+int MI::*mp2 = nullptr;
+int MI2::*mp3 = nullptr;
+int VI::*mp4 = nullptr;
+int VI2::*mp5 = nullptr;
+int UI::*mp6 = nullptr;
+int MI::*mp7 = nullptr;
+int VI2::*mp8 = nullptr;

weliveindetail wrote:

Right. They exercise the various MSInheritance cases for the Microsoft ABI, but 
since there is no support in DWARF yet, we don't really need them. I reduced 
the test to the case that it checks.

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


[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)

2024-10-23 Thread Stefan Gränitz via lldb-commits

https://github.com/weliveindetail updated 
https://github.com/llvm/llvm-project/pull/112928

From bb66f56138cab9651aff4ac09096ede975c90701 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= 
Date: Fri, 18 Oct 2024 17:44:26 +0200
Subject: [PATCH 1/6] [lldb] Fix crash due to missing MSInheritanceAttr on
 CXXRecordDecl for DWARF on Windows

---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index fe0c53a7e9a3ea..a23dce97f3f299 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2771,6 +2771,9 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
 ast, llvm::cast(qual_type)->getModifiedType(),
 allow_completion);
 
+  case clang::Type::MemberPointer:
+return !qual_type.getTypePtr()->isIncompleteType();
+
   default:
 break;
   }

From 6f775566a4face29f85286295aafb16c4367a917 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= 
Date: Tue, 22 Oct 2024 11:11:53 +0200
Subject: [PATCH 2/6] Add test based on
 https://reviews.llvm.org/D130942#change-1PvUCFvQjDIO

---
 .../Shell/SymbolFile/DWARF/x86/ms-abi.cpp | 45 +++
 1 file changed, 45 insertions(+)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp

diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
new file mode 100644
index 00..0e51ec99934f4c
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
@@ -0,0 +1,45 @@
+// REQUIRES: lld
+
+// Check that we don't crash on variables without MSInheritanceAttr
+
+// RUN: %clang -c --target=x86_64-windows-msvc -gdwarf %s -o %t.obj
+// RUN: lld-link /out:%t.exe %t.obj /nodefaultlib /entry:main /debug
+// RUN: %lldb -f %t.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 mp8 
mp9"
+
+class SI {
+  int si;
+};
+struct SI2 {
+  int si2;
+};
+class MI : SI, SI2 {
+  int mi;
+};
+class MI2 : MI {
+  int mi2;
+};
+class VI : virtual MI {
+  int vi;
+};
+class VI2 : virtual SI, virtual SI2 {
+  int vi;
+};
+class /* __unspecified_inheritance*/ UI;
+
+typedef void (SI::*SITYPE)();
+typedef void (MI::*MITYPE)();
+typedef void (MI2::*MI2TYPE)();
+typedef void (VI::*VITYPE)();
+typedef void (VI2::*VI2TYPE)();
+typedef void (UI::*UITYPE)();
+SITYPE mp1 = nullptr;
+MITYPE mp2 = nullptr;
+MI2TYPE mp3 = nullptr;
+VITYPE mp4 = nullptr;
+VI2TYPE mp5 = nullptr;
+UITYPE mp6 = nullptr;
+MITYPE *mp7 = nullptr;
+VI2TYPE *mp8 = nullptr;
+int SI::*mp9 = nullptr;
+
+int main() {}

From a892f5eba8e79dbc115cffb1eb26501cdef56f80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= 
Date: Tue, 22 Oct 2024 15:27:33 +0200
Subject: [PATCH 3/6] Polish test and add coverage for Itanium

---
 .../SymbolFile/DWARF/x86/member-pointers.cpp  | 48 +++
 .../Shell/SymbolFile/DWARF/x86/ms-abi.cpp | 45 -
 2 files changed, 48 insertions(+), 45 deletions(-)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
 delete mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp

diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
new file mode 100644
index 00..93fa999416b74e
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
@@ -0,0 +1,48 @@
+// REQUIRES: lld
+
+// Microsoft ABI:
+// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
+// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
+// RUN: %lldb -f %t_win.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 
mp8 mp9"
+//
+// DWARF has no representation of MSInheritanceAttr, so we cannot determine 
the size
+// of member-pointers yet. For the moment, make sure we don't crash on such 
variables.
+
+// Itanium ABI:
+// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
+// RUN: ld.lld %t_linux.o -o %t_linux
+// RUN: %lldb -f %t_linux -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 
mp8 mp9" | FileCheck %s
+//
+// CHECK: (char SI2::*) mp9 = 0x
+
+class SI {
+  double si;
+};
+struct SI2 {
+  char si2;
+};
+class MI : SI, SI2 {
+  int mi;
+};
+class MI2 : MI {
+  int mi2;
+};
+class VI : virtual MI {
+  int vi;
+};
+class VI2 : virtual SI, virtual SI2 {
+  int vi;
+};
+class /* __unspecified_inheritance*/ UI;
+
+double SI::* mp1 = nullptr;
+int MI::* mp2 = nullptr;
+int MI2::* mp3 = nullptr;
+int VI::* mp4 = nullptr;
+int VI2::* mp5 = nullptr;
+int UI::* mp6 = nullptr;
+int MI::* mp7 = nullptr;
+int VI2::* mp8 = nullptr;
+char SI2::* mp9 = &SI2::si2;
+
+int main() { return 0; }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
deleted file mode 100644

[Lldb-commits] [lldb] [lldb][NFC] Make the target's SectionLoadList private. (PR #113278)

2024-10-23 Thread Greg Clayton via lldb-commits

https://github.com/clayborg updated 
https://github.com/llvm/llvm-project/pull/113278

>From 851ee7a3fd4f1ae294f3e0baaf0944caeadb7d05 Mon Sep 17 00:00:00 2001
From: Greg Clayton 
Date: Tue, 22 Oct 2024 01:16:40 -0700
Subject: [PATCH 1/2] Make the target's SectionLoadList private.

Lots of code around LLDB was directly accessing the target's section load list. 
This NFC patch makes the section load list private to the Target class can 
access it, but everyone else now uses accessor functions. This allows us to 
control the resolving of addresses and will allow for functionality in LLDB 
which can lazily resolve addresses in JIT plug-ins with a future patch.
---
 lldb/include/lldb/Target/Target.h  | 15 ---
 lldb/source/API/SBBreakpoint.cpp   |  4 ++--
 .../Breakpoint/BreakpointLocationList.cpp  |  3 +--
 .../Commands/CommandObjectDisassemble.cpp  |  6 +++---
 lldb/source/Commands/CommandObjectRegister.cpp |  4 ++--
 lldb/source/Commands/CommandObjectSource.cpp   |  9 -
 lldb/source/Commands/CommandObjectTarget.cpp   | 15 +++
 lldb/source/Core/Address.cpp   |  8 +++-
 lldb/source/Core/Disassembler.cpp  |  6 +-
 lldb/source/Core/DumpDataExtractor.cpp | 10 --
 lldb/source/Core/FormatEntity.cpp  |  2 +-
 lldb/source/Core/Section.cpp   |  4 ++--
 lldb/source/Core/Value.cpp |  5 ++---
 .../DataFormatters/CXXFunctionPointer.cpp  |  5 ++---
 lldb/source/Expression/ObjectFileJIT.cpp   |  4 ++--
 .../Architecture/Mips/ArchitectureMips.cpp |  3 +--
 .../Disassembler/LLVMC/DisassemblerLLVMC.cpp   |  6 +++---
 .../MacOSX-DYLD/DynamicLoaderMacOS.cpp |  2 +-
 .../Static/DynamicLoaderStatic.cpp |  4 ++--
 .../TSan/InstrumentationRuntimeTSan.cpp|  9 +++--
 .../Plugins/JITLoader/GDB/JITLoaderGDB.cpp |  2 +-
 .../CPlusPlus/CPPLanguageRuntime.cpp   | 18 --
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp   |  3 +--
 .../ObjectFile/Mach-O/ObjectFileMachO.cpp  | 10 +-
 .../ObjectFile/PECOFF/ObjectFilePECOFF.cpp |  2 +-
 .../Placeholder/ObjectFilePlaceholder.cpp  |  3 +--
 .../Process/minidump/ProcessMinidump.cpp   |  4 ++--
 .../Trace/intel-pt/TraceIntelPTBundleSaver.cpp |  2 +-
 lldb/source/Symbol/ObjectFile.cpp  |  3 +--
 lldb/source/Target/ProcessTrace.cpp|  2 +-
 lldb/source/Target/Target.cpp  | 14 ++
 lldb/source/Target/ThreadPlanStepInRange.cpp   |  3 +--
 lldb/source/Target/ThreadPlanTracer.cpp|  3 +--
 33 files changed, 96 insertions(+), 97 deletions(-)

diff --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index e4848f19e64d62..5f43b4f5060d0a 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1140,9 +1140,14 @@ class Target : public 
std::enable_shared_from_this,
  Address &pointer_addr,
  bool force_live_memory = false);
 
-  SectionLoadList &GetSectionLoadList() {
-return m_section_load_history.GetCurrentSectionLoadList();
-  }
+
+  bool SectionLoadListIsEmpty() const;
+
+  lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP §ion_sp);
+
+  void ClearSectionLoadList();
+
+  void DumpSectionLoadList(Stream &s);
 
   static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
const SymbolContext *sc_ptr);
@@ -1653,6 +1658,10 @@ class Target : public 
std::enable_shared_from_this,
 
   Target(const Target &) = delete;
   const Target &operator=(const Target &) = delete;
+
+  SectionLoadList &GetSectionLoadList() {
+return m_section_load_history.GetCurrentSectionLoadList();
+  }
 };
 
 } // namespace lldb_private
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp
index b2ed034d19983c..87fadbcec4f26b 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -137,7 +137,7 @@ SBBreakpointLocation 
SBBreakpoint::FindLocationByAddress(addr_t vm_addr) {
   bkpt_sp->GetTarget().GetAPIMutex());
   Address address;
   Target &target = bkpt_sp->GetTarget();
-  if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
+  if (!target.ResolveLoadAddress(vm_addr, address)) {
 address.SetRawAddress(vm_addr);
   }
   sb_bp_location.SetLocation(bkpt_sp->FindLocationByAddress(address));
@@ -157,7 +157,7 @@ break_id_t SBBreakpoint::FindLocationIDByAddress(addr_t 
vm_addr) {
 bkpt_sp->GetTarget().GetAPIMutex());
 Address address;
 Target &target = bkpt_sp->GetTarget();
-if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
+if (!target.ResolveLoadAddress(vm_addr, address)) {
   address.SetRawAddress(vm_addr);
 }
 break_id = bkpt_sp->FindLocationIDByAddress(address);
diff --gi

[Lldb-commits] [lldb] [lldb][NFC] Make the target's SectionLoadList private. (PR #113278)

2024-10-23 Thread Greg Clayton via lldb-commits

clayborg wrote:

Ok, all comments were addressed.

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


[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)

2024-10-23 Thread Stefan Gränitz via lldb-commits

https://github.com/weliveindetail updated 
https://github.com/llvm/llvm-project/pull/112928

From bb66f56138cab9651aff4ac09096ede975c90701 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= 
Date: Fri, 18 Oct 2024 17:44:26 +0200
Subject: [PATCH 1/7] [lldb] Fix crash due to missing MSInheritanceAttr on
 CXXRecordDecl for DWARF on Windows

---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index fe0c53a7e9a3ea..a23dce97f3f299 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2771,6 +2771,9 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
 ast, llvm::cast(qual_type)->getModifiedType(),
 allow_completion);
 
+  case clang::Type::MemberPointer:
+return !qual_type.getTypePtr()->isIncompleteType();
+
   default:
 break;
   }

From 6f775566a4face29f85286295aafb16c4367a917 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= 
Date: Tue, 22 Oct 2024 11:11:53 +0200
Subject: [PATCH 2/7] Add test based on
 https://reviews.llvm.org/D130942#change-1PvUCFvQjDIO

---
 .../Shell/SymbolFile/DWARF/x86/ms-abi.cpp | 45 +++
 1 file changed, 45 insertions(+)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp

diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
new file mode 100644
index 00..0e51ec99934f4c
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
@@ -0,0 +1,45 @@
+// REQUIRES: lld
+
+// Check that we don't crash on variables without MSInheritanceAttr
+
+// RUN: %clang -c --target=x86_64-windows-msvc -gdwarf %s -o %t.obj
+// RUN: lld-link /out:%t.exe %t.obj /nodefaultlib /entry:main /debug
+// RUN: %lldb -f %t.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 mp8 
mp9"
+
+class SI {
+  int si;
+};
+struct SI2 {
+  int si2;
+};
+class MI : SI, SI2 {
+  int mi;
+};
+class MI2 : MI {
+  int mi2;
+};
+class VI : virtual MI {
+  int vi;
+};
+class VI2 : virtual SI, virtual SI2 {
+  int vi;
+};
+class /* __unspecified_inheritance*/ UI;
+
+typedef void (SI::*SITYPE)();
+typedef void (MI::*MITYPE)();
+typedef void (MI2::*MI2TYPE)();
+typedef void (VI::*VITYPE)();
+typedef void (VI2::*VI2TYPE)();
+typedef void (UI::*UITYPE)();
+SITYPE mp1 = nullptr;
+MITYPE mp2 = nullptr;
+MI2TYPE mp3 = nullptr;
+VITYPE mp4 = nullptr;
+VI2TYPE mp5 = nullptr;
+UITYPE mp6 = nullptr;
+MITYPE *mp7 = nullptr;
+VI2TYPE *mp8 = nullptr;
+int SI::*mp9 = nullptr;
+
+int main() {}

From a892f5eba8e79dbc115cffb1eb26501cdef56f80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= 
Date: Tue, 22 Oct 2024 15:27:33 +0200
Subject: [PATCH 3/7] Polish test and add coverage for Itanium

---
 .../SymbolFile/DWARF/x86/member-pointers.cpp  | 48 +++
 .../Shell/SymbolFile/DWARF/x86/ms-abi.cpp | 45 -
 2 files changed, 48 insertions(+), 45 deletions(-)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
 delete mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp

diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
new file mode 100644
index 00..93fa999416b74e
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
@@ -0,0 +1,48 @@
+// REQUIRES: lld
+
+// Microsoft ABI:
+// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
+// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
+// RUN: %lldb -f %t_win.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 
mp8 mp9"
+//
+// DWARF has no representation of MSInheritanceAttr, so we cannot determine 
the size
+// of member-pointers yet. For the moment, make sure we don't crash on such 
variables.
+
+// Itanium ABI:
+// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
+// RUN: ld.lld %t_linux.o -o %t_linux
+// RUN: %lldb -f %t_linux -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 
mp8 mp9" | FileCheck %s
+//
+// CHECK: (char SI2::*) mp9 = 0x
+
+class SI {
+  double si;
+};
+struct SI2 {
+  char si2;
+};
+class MI : SI, SI2 {
+  int mi;
+};
+class MI2 : MI {
+  int mi2;
+};
+class VI : virtual MI {
+  int vi;
+};
+class VI2 : virtual SI, virtual SI2 {
+  int vi;
+};
+class /* __unspecified_inheritance*/ UI;
+
+double SI::* mp1 = nullptr;
+int MI::* mp2 = nullptr;
+int MI2::* mp3 = nullptr;
+int VI::* mp4 = nullptr;
+int VI2::* mp5 = nullptr;
+int UI::* mp6 = nullptr;
+int MI::* mp7 = nullptr;
+int VI2::* mp8 = nullptr;
+char SI2::* mp9 = &SI2::si2;
+
+int main() { return 0; }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
deleted file mode 100644

[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)

2024-10-23 Thread Stefan Gränitz via lldb-commits

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


[Lldb-commits] [lldb] 699ce16 - [lldb] Fix crash missing MSInheritanceAttr with DWARF on Windows (#112928)

2024-10-23 Thread via lldb-commits

Author: Stefan Gränitz
Date: 2024-10-23T13:21:22+02:00
New Revision: 699ce16b6284377e0cd9969b9f95e7367632a622

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

LOG: [lldb] Fix crash missing MSInheritanceAttr with DWARF on Windows (#112928)

Member pointers refer to data or function members of a `CXXRecordDecl` and
require a `MSInheritanceAttr` in order to be complete. Without that we
cannot calculate their size in memory. The attempt has been causing a crash
further down in the clang AST context. In order to implement the feature,
DWARF will need a new attribtue to convey the information. For the moment,
this patch teaches LLDB to handle to situation and avoid the crash.

Added: 
lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp

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 e710f976ccc4c1..436797abb1d7e1 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2771,6 +2771,9 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
 ast, llvm::cast(qual_type)->getModifiedType(),
 allow_completion);
 
+  case clang::Type::MemberPointer:
+return !qual_type.getTypePtr()->isIncompleteType();
+
   default:
 break;
   }

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
new file mode 100644
index 00..817833d4fa7515
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
@@ -0,0 +1,24 @@
+// REQUIRES: lld
+
+// Itanium ABI:
+// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
+// RUN: %lldb -f %t_linux.o -b -o "target variable mp" | FileCheck %s
+//
+// CHECK: (char SI::*) mp = 0x
+
+// Microsoft ABI:
+// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
+// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
+// RUN: %lldb -f %t_win.exe -b -o "target variable mp" | FileCheck 
--check-prefix=CHECK-MSVC %s
+//
+// DWARF has no representation of MSInheritanceAttr, so we cannot determine 
the size
+// of member-pointers yet. For the moment, make sure we don't crash on such 
variables.
+// CHECK-MSVC: error: Unable to determine byte size.
+
+struct SI {
+  char si;
+};
+
+char SI::*mp = &SI::si;
+
+int main() { return 0; }



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


[Lldb-commits] [lldb] ba19e98 - [lldb][CMake] If make isn't found, print a warning but don't error out (#111531)

2024-10-23 Thread Stefan Gränitz via lldb-commits

Author: Stefan Gränitz
Date: 2024-10-23T14:32:58+02:00
New Revision: ba19e98ca5e4fbc05429edd96e09b5c75df57e3c

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

LOG: [lldb][CMake] If make isn't found, print a warning but don't error out 
(#111531)

Bot maintainers should be aware and it became too much of a burden
for developers. In particular on Windows, where make.exe won't be
found in Path typically.

Added: 


Modified: 
lldb/test/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 2548cab5cfb5b8..36f4973ad9a452 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -57,9 +57,9 @@ else()
 message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
   else()
 message(STATUS "Not found: make")
-message(SEND_ERROR
-  "LLDB tests require 'make' tool. Please pass via `LLDB_TEST_MAKE` "
-  "(or otherwise disable tests with `LLDB_INCLUDE_TESTS=OFF`)")
+message(WARNING
+  "Many LLDB API tests require 'make' tool. Please provide it in Path "
+  "or pass via LLDB_TEST_MAKE.")
   endif()
 endif()
 



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


[Lldb-commits] [lldb] [LLDB] Finish implementing support for DW_FORM_data16 (PR #106799)

2024-10-23 Thread Walter Erquinigo via lldb-commits


@@ -578,6 +583,7 @@ bool DWARFFormValue::IsBlockForm(const dw_form_t form) {
   case DW_FORM_block1:
   case DW_FORM_block2:
   case DW_FORM_block4:
+  case DW_FORM_data16:

walter-erquinigo wrote:

I think that the block form will be the most convenient way to access this just 
because not all systems have uint128_t.

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


[Lldb-commits] [lldb] [lldb] Move ValueObject into its own library (NFC) (PR #113393)

2024-10-23 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Move ValueObject into its own library (NFC) (PR #113393)

2024-10-23 Thread Pavel Labath via lldb-commits

https://github.com/labath commented:

It looks like the CMakeLists.txt for Breakpoint and Command libraries is 
missing a dependency on the ValueObject lib (and the do appear to depend on it).

I can run this on linux to see if we need to increase our cirular dep counter. 
:P

My main question is: given that this is motivated by making room for the DIL 
implementation, isn't the name a bit overly specific? Like would you (all) be 
fine with putting something called DILParser into a directory called 
"ValueObject"?

(Note that I personally never had a problem with keeping the DIL in the Core 
library, and with the eviction of ValueObject, the core library gets noticably 
smaller, so for me, a completely acceptable colution would be to put/keep the 
DIL in the Core library, and leave the ValueObject library strictly for the 
ValueObject classes.)

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


[Lldb-commits] [lldb] [lldb] Add early CMake check for 'make' tool (PR #111531)

2024-10-23 Thread Stefan Gränitz via lldb-commits

weliveindetail wrote:

Yes, for devs it might be too much of a burden and eventually bot maintainers 
should be aware. If we want the error behavior back, we could make it 
conditional on `LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS`. For now I didn't want 
to make it more complicated than necessary.

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


[Lldb-commits] [lldb] 3309061 - [lldb] Cover all of SVE_TYPE in encoding switch

2024-10-23 Thread Spencer Abson via lldb-commits

Author: Spencer Abson
Date: 2024-10-23T17:05:28Z
New Revision: 3309061b2dd8a5cacacf05d956a872617808a974

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

LOG: [lldb] Cover all of SVE_TYPE in encoding switch

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 436797abb1d7e1..f5063175d6e070 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5032,62 +5032,8 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
   break;
 
 // ARM -- Scalable Vector Extension
-case clang::BuiltinType::SveBool:
-case clang::BuiltinType::SveBoolx2:
-case clang::BuiltinType::SveBoolx4:
-case clang::BuiltinType::SveCount:
-case clang::BuiltinType::SveInt8:
-case clang::BuiltinType::SveInt8x2:
-case clang::BuiltinType::SveInt8x3:
-case clang::BuiltinType::SveInt8x4:
-case clang::BuiltinType::SveInt16:
-case clang::BuiltinType::SveInt16x2:
-case clang::BuiltinType::SveInt16x3:
-case clang::BuiltinType::SveInt16x4:
-case clang::BuiltinType::SveInt32:
-case clang::BuiltinType::SveInt32x2:
-case clang::BuiltinType::SveInt32x3:
-case clang::BuiltinType::SveInt32x4:
-case clang::BuiltinType::SveInt64:
-case clang::BuiltinType::SveInt64x2:
-case clang::BuiltinType::SveInt64x3:
-case clang::BuiltinType::SveInt64x4:
-case clang::BuiltinType::SveUint8:
-case clang::BuiltinType::SveUint8x2:
-case clang::BuiltinType::SveUint8x3:
-case clang::BuiltinType::SveUint8x4:
-case clang::BuiltinType::SveUint16:
-case clang::BuiltinType::SveUint16x2:
-case clang::BuiltinType::SveUint16x3:
-case clang::BuiltinType::SveUint16x4:
-case clang::BuiltinType::SveUint32:
-case clang::BuiltinType::SveUint32x2:
-case clang::BuiltinType::SveUint32x3:
-case clang::BuiltinType::SveUint32x4:
-case clang::BuiltinType::SveUint64:
-case clang::BuiltinType::SveUint64x2:
-case clang::BuiltinType::SveUint64x3:
-case clang::BuiltinType::SveUint64x4:
-case clang::BuiltinType::SveMFloat8:
-case clang::BuiltinType::SveMFloat8x2:
-case clang::BuiltinType::SveMFloat8x3:
-case clang::BuiltinType::SveMFloat8x4:
-case clang::BuiltinType::SveFloat16:
-case clang::BuiltinType::SveBFloat16:
-case clang::BuiltinType::SveBFloat16x2:
-case clang::BuiltinType::SveBFloat16x3:
-case clang::BuiltinType::SveBFloat16x4:
-case clang::BuiltinType::SveFloat16x2:
-case clang::BuiltinType::SveFloat16x3:
-case clang::BuiltinType::SveFloat16x4:
-case clang::BuiltinType::SveFloat32:
-case clang::BuiltinType::SveFloat32x2:
-case clang::BuiltinType::SveFloat32x3:
-case clang::BuiltinType::SveFloat32x4:
-case clang::BuiltinType::SveFloat64:
-case clang::BuiltinType::SveFloat64x2:
-case clang::BuiltinType::SveFloat64x3:
-case clang::BuiltinType::SveFloat64x4:
+#define SVE_TYPE(Name, Id, SingletonId) case clang::BuiltinType::Id:
+#include "clang/Basic/AArch64SVEACLETypes.def"
   break;
 
 // RISC-V V builtin types.



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


[Lldb-commits] [lldb] [LLDB] Finish implementing support for DW_FORM_data16 (PR #113508)

2024-10-23 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/113508

This FORM already has support within LLDB to be parsed as a 16-byte BLOCK, and 
all that is left to properly support it in the DWARFParser is to add it to some 
enums.

With this, I can debug programs that use libstdc++.so.6.0.33 built with GCC.

>From e1986e8c9ec7071f5256bc648586cd848712a4e9 Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Wed, 23 Oct 2024 19:49:24 -0400
Subject: [PATCH] [LLDB] Finish implementing support for DW_FORM_data16

This FORM already has support within LLDB to be parsed as a 16-byte
BLOCK, and all that is left to properly support it in the DWARFParser is
to add it to some enums.

With this, I can debug programs that use libstdc++.so.6.0.33 built with
GCC.
---
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.cpp|  7 +++
 .../Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s | 14 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index f58c6262349c6f..404e50d57a9251 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -306,6 +306,11 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
   *offset_ptr += 8;
   return true;
 
+// 16 byte values
+case DW_FORM_data16:
+  *offset_ptr += 16;
+  return true;
+
 // signed or unsigned LEB 128 values
 case DW_FORM_addrx:
 case DW_FORM_loclistx:
@@ -578,6 +583,7 @@ bool DWARFFormValue::IsBlockForm(const dw_form_t form) {
   case DW_FORM_block1:
   case DW_FORM_block2:
   case DW_FORM_block4:
+  case DW_FORM_data16:
 return true;
   default:
 return false;
@@ -611,6 +617,7 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) {
 case DW_FORM_data2:
 case DW_FORM_data4:
 case DW_FORM_data8:
+case DW_FORM_data16:
 case DW_FORM_string:
 case DW_FORM_block:
 case DW_FORM_block1:
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s 
b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s
index 720684c19beebc..731a558f3e572d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s
@@ -3,7 +3,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t
 # RUN: %lldb %t \
-# RUN:   -o "target variable udata data1 data2 data4 data8 string strp ref4 
udata_ptr" \
+# RUN:   -o "target variable udata data1 data2 data4 data8 data16 string strp 
ref4 udata_ptr" \
 # RUN:   -o exit | FileCheck %s
 
 # CHECK-LABEL: target variable
@@ -14,6 +14,7 @@
 # CHECK: (unsigned long) data2 = 4742
 # CHECK: (unsigned long) data4 = 47424742
 # CHECK: (unsigned long) data8 = 4742474247424742
+# CHECK: (unsigned __int128) data16 = 129440743495415807670381713415221633377
 ## Variables specified using string forms. This behavior purely speculative -- 
I
 ## don't know of any compiler that would represent character strings this way.
 # CHECK: (char[7]) string = "string"
@@ -88,6 +89,7 @@
 var 15, 0x8 # DW_FORM_string
 var 16, 0xe # DW_FORM_strp
 var 17, 0x13# DW_FORM_ref4
+var 18, 0x1e# DW_FORM_data16
 .byte   0   # EOM(3)
 .section.debug_info,"",@progbits
 .Lcu_begin0:
@@ -119,6 +121,11 @@
 .Lulong_ptr:
 .byte   2   # Abbrev DW_TAG_pointer_type
 .long   .Lulong-.Lcu_begin0 # DW_AT_type
+.Lu128:
+.byte   6   # Abbrev DW_TAG_base_type
+.asciz  "Lu128" # DW_AT_name
+.byte   16  # DW_AT_byte_size
+.byte   7   # DW_AT_encoding
 
 .byte   10  # Abbrev DW_TAG_variable
 .asciz  "udata" # DW_AT_name
@@ -165,6 +172,11 @@
 .long   .Lulong_ptr-.Lcu_begin0 # DW_AT_type
 .uleb128 0xdeadbeefbaadf00d # DW_AT_const_value
 
+.byte   18  # Abbrev DW_TAG_variable
+.asciz  "data16"# DW_AT_name
+.long   .Lu128-.Lcu_begin0  # DW_AT_type
+.asciz 
""
 # DW_AT_const_value
+
 .byte   0   # End Of Children Mark
 .Ldebug_info_end0:
 

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


[Lldb-commits] [lldb] [LLDB] Finish implementing support for DW_FORM_data16 (PR #106799)

2024-10-23 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

Cancelled in favor of https://github.com/llvm/llvm-project/pull/113508 which 
adds tests


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


[Lldb-commits] [lldb] [LLDB] Finish implementing support for DW_FORM_data16 (PR #106799)

2024-10-23 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Finish implementing support for DW_FORM_data16 (PR #113508)

2024-10-23 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Walter Erquinigo (walter-erquinigo)


Changes

This FORM already has support within LLDB to be parsed as a 16-byte BLOCK, and 
all that is left to properly support it in the DWARFParser is to add it to some 
enums.

With this, I can debug programs that use libstdc++.so.6.0.33 built with GCC.

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


2 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (+7) 
- (modified) lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s (+13-1) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index f58c6262349c6f..404e50d57a9251 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -306,6 +306,11 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
   *offset_ptr += 8;
   return true;
 
+// 16 byte values
+case DW_FORM_data16:
+  *offset_ptr += 16;
+  return true;
+
 // signed or unsigned LEB 128 values
 case DW_FORM_addrx:
 case DW_FORM_loclistx:
@@ -578,6 +583,7 @@ bool DWARFFormValue::IsBlockForm(const dw_form_t form) {
   case DW_FORM_block1:
   case DW_FORM_block2:
   case DW_FORM_block4:
+  case DW_FORM_data16:
 return true;
   default:
 return false;
@@ -611,6 +617,7 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) {
 case DW_FORM_data2:
 case DW_FORM_data4:
 case DW_FORM_data8:
+case DW_FORM_data16:
 case DW_FORM_string:
 case DW_FORM_block:
 case DW_FORM_block1:
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s 
b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s
index 720684c19beebc..731a558f3e572d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s
@@ -3,7 +3,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t
 # RUN: %lldb %t \
-# RUN:   -o "target variable udata data1 data2 data4 data8 string strp ref4 
udata_ptr" \
+# RUN:   -o "target variable udata data1 data2 data4 data8 data16 string strp 
ref4 udata_ptr" \
 # RUN:   -o exit | FileCheck %s
 
 # CHECK-LABEL: target variable
@@ -14,6 +14,7 @@
 # CHECK: (unsigned long) data2 = 4742
 # CHECK: (unsigned long) data4 = 47424742
 # CHECK: (unsigned long) data8 = 4742474247424742
+# CHECK: (unsigned __int128) data16 = 129440743495415807670381713415221633377
 ## Variables specified using string forms. This behavior purely speculative -- 
I
 ## don't know of any compiler that would represent character strings this way.
 # CHECK: (char[7]) string = "string"
@@ -88,6 +89,7 @@
 var 15, 0x8 # DW_FORM_string
 var 16, 0xe # DW_FORM_strp
 var 17, 0x13# DW_FORM_ref4
+var 18, 0x1e# DW_FORM_data16
 .byte   0   # EOM(3)
 .section.debug_info,"",@progbits
 .Lcu_begin0:
@@ -119,6 +121,11 @@
 .Lulong_ptr:
 .byte   2   # Abbrev DW_TAG_pointer_type
 .long   .Lulong-.Lcu_begin0 # DW_AT_type
+.Lu128:
+.byte   6   # Abbrev DW_TAG_base_type
+.asciz  "Lu128" # DW_AT_name
+.byte   16  # DW_AT_byte_size
+.byte   7   # DW_AT_encoding
 
 .byte   10  # Abbrev DW_TAG_variable
 .asciz  "udata" # DW_AT_name
@@ -165,6 +172,11 @@
 .long   .Lulong_ptr-.Lcu_begin0 # DW_AT_type
 .uleb128 0xdeadbeefbaadf00d # DW_AT_const_value
 
+.byte   18  # Abbrev DW_TAG_variable
+.asciz  "data16"# DW_AT_name
+.long   .Lu128-.Lcu_begin0  # DW_AT_type
+.asciz 
""
 # DW_AT_const_value
+
 .byte   0   # End Of Children Mark
 .Ldebug_info_end0:
 

``




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


[Lldb-commits] [lldb] [lldb] Extend FindTypes to optionally search by mangled type name (PR #113007)

2024-10-23 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

Typenames don't often get put into the acclerator tables as mangled names for 
C/C++/ObjC. Functions do, but not typenames. Is there a case where the debug 
info contains a mangled name for a type? 

I know swift does use mangled names for types though as that is how these types 
are extracted from the Swift AST data blob by the Swift compiler. 

So I see no problem with this patch. If this is for Swift then we need to make 
sure there is a test for this in the Swift.org LLDB. Not sure if we can write a 
test using C/C++/ObjC or and language that comes from Clang ASTs.

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


[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)

2024-10-23 Thread Shubham Sandeep Rastogi via lldb-commits
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= 
Message-ID:
In-Reply-To: 


rastogishubham wrote:

I reverted this change with https://github.com/llvm/llvm-project/pull/113498

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


[Lldb-commits] [lldb] Revert "[lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows" (PR #113498)

2024-10-23 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Shubham Sandeep Rastogi (rastogishubham)


Changes

Reverts llvm/llvm-project#112928

This is because it broke greendragon: SymbolFile/DWARF/x86/member-pointers.cpp

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


2 Files Affected:

- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (-3) 
- (removed) lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp (-24) 


``diff
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f5063175d6e070..a57cd8efce8a11 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2771,9 +2771,6 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
 ast, llvm::cast(qual_type)->getModifiedType(),
 allow_completion);
 
-  case clang::Type::MemberPointer:
-return !qual_type.getTypePtr()->isIncompleteType();
-
   default:
 break;
   }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
deleted file mode 100644
index 817833d4fa7515..00
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// REQUIRES: lld
-
-// Itanium ABI:
-// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
-// RUN: %lldb -f %t_linux.o -b -o "target variable mp" | FileCheck %s
-//
-// CHECK: (char SI::*) mp = 0x
-
-// Microsoft ABI:
-// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
-// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
-// RUN: %lldb -f %t_win.exe -b -o "target variable mp" | FileCheck 
--check-prefix=CHECK-MSVC %s
-//
-// DWARF has no representation of MSInheritanceAttr, so we cannot determine 
the size
-// of member-pointers yet. For the moment, make sure we don't crash on such 
variables.
-// CHECK-MSVC: error: Unable to determine byte size.
-
-struct SI {
-  char si;
-};
-
-char SI::*mp = &SI::si;
-
-int main() { return 0; }

``




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


[Lldb-commits] [lldb] Revert "[lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows" (PR #113498)

2024-10-23 Thread Shubham Sandeep Rastogi via lldb-commits

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


[Lldb-commits] [lldb] c919970 - Revert "[lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows" (#113498)

2024-10-23 Thread via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2024-10-23T14:31:15-07:00
New Revision: c9199700b8fdde50a920857207e4387cfe69da45

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

LOG: Revert "[lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with 
DWARF on Windows" (#113498)

Reverts llvm/llvm-project#112928

This is because it broke greendragon:
SymbolFile/DWARF/x86/member-pointers.cpp

Added: 


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

Removed: 
lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp



diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f5063175d6e070..a57cd8efce8a11 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2771,9 +2771,6 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
 ast, llvm::cast(qual_type)->getModifiedType(),
 allow_completion);
 
-  case clang::Type::MemberPointer:
-return !qual_type.getTypePtr()->isIncompleteType();
-
   default:
 break;
   }

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
deleted file mode 100644
index 817833d4fa7515..00
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// REQUIRES: lld
-
-// Itanium ABI:
-// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
-// RUN: %lldb -f %t_linux.o -b -o "target variable mp" | FileCheck %s
-//
-// CHECK: (char SI::*) mp = 0x
-
-// Microsoft ABI:
-// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
-// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
-// RUN: %lldb -f %t_win.exe -b -o "target variable mp" | FileCheck 
--check-prefix=CHECK-MSVC %s
-//
-// DWARF has no representation of MSInheritanceAttr, so we cannot determine 
the size
-// of member-pointers yet. For the moment, make sure we don't crash on such 
variables.
-// CHECK-MSVC: error: Unable to determine byte size.
-
-struct SI {
-  char si;
-};
-
-char SI::*mp = &SI::si;
-
-int main() { return 0; }



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


[Lldb-commits] [lldb] Revert "[lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows" (PR #113498)

2024-10-23 Thread Shubham Sandeep Rastogi via lldb-commits

https://github.com/rastogishubham created 
https://github.com/llvm/llvm-project/pull/113498

Reverts llvm/llvm-project#112928

This is because it broke greendragon: SymbolFile/DWARF/x86/member-pointers.cpp

>From 565b370162888c91e82bd5c9a8787bbc4942219c Mon Sep 17 00:00:00 2001
From: Shubham Sandeep Rastogi 
Date: Wed, 23 Oct 2024 14:30:35 -0700
Subject: [PATCH] =?UTF-8?q?Revert=20"[lldb]=20Fix=20crash=20missing=20MSIn?=
 =?UTF-8?q?heritanceAttr=20with=20DWARF=20on=20Windows=20(#11=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 699ce16b6284377e0cd9969b9f95e7367632a622.
---
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  3 ---
 .../SymbolFile/DWARF/x86/member-pointers.cpp  | 24 ---
 2 files changed, 27 deletions(-)
 delete mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f5063175d6e070..a57cd8efce8a11 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2771,9 +2771,6 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
 ast, llvm::cast(qual_type)->getModifiedType(),
 allow_completion);
 
-  case clang::Type::MemberPointer:
-return !qual_type.getTypePtr()->isIncompleteType();
-
   default:
 break;
   }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
deleted file mode 100644
index 817833d4fa7515..00
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// REQUIRES: lld
-
-// Itanium ABI:
-// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
-// RUN: %lldb -f %t_linux.o -b -o "target variable mp" | FileCheck %s
-//
-// CHECK: (char SI::*) mp = 0x
-
-// Microsoft ABI:
-// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
-// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
-// RUN: %lldb -f %t_win.exe -b -o "target variable mp" | FileCheck 
--check-prefix=CHECK-MSVC %s
-//
-// DWARF has no representation of MSInheritanceAttr, so we cannot determine 
the size
-// of member-pointers yet. For the moment, make sure we don't crash on such 
variables.
-// CHECK-MSVC: error: Unable to determine byte size.
-
-struct SI {
-  char si;
-};
-
-char SI::*mp = &SI::si;
-
-int main() { return 0; }

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


[Lldb-commits] [lldb] Push down cpython module to the submodule (PR #113066)

2024-10-23 Thread via lldb-commits


@@ -145,7 +145,7 @@ add_lldb_library(liblldb SHARED ${option_framework}
   ${option_install_prefix}
 )
 
-# lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,
+# lib/pythonX.Y/site-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,

dingxiangfei2009 wrote:

No it is not. I will revert it.

I looked it up and it turns out that the `dist-` qualification is a Debian 
rule. I will leave this alone for discussion on another day.

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


[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)

2024-10-23 Thread Shubham Sandeep Rastogi via lldb-commits
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= ,
Stefan =?utf-8?q?Gr=C3=A4nitz?= 
Message-ID:
In-Reply-To: 


rastogishubham wrote:

Hi, this patch broke green dragon:
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/13936/



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


[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

2024-10-23 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/113521

Internally we use bazel in a way in which it can drop you in a LLDB session 
with the target launched in a particular cwd, which is needed for things to 
work. We've been making this automation work via `process launch -w`. However, 
if later the user wants to restart the process with `r`, then they end up using 
a different cwd for relaunching the process. As a way to fix this, I'm adding a 
target-level setting that allows overriding the cwd used for launching the 
process without needing the user to specify it manually.

>From be5c3c3adcc148e8e89d743b05d2b22f4be8e6c6 Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Thu, 24 Oct 2024 00:17:48 -0400
Subject: [PATCH] [LLDB] Add a target.launch-working-dir setting

Internally we use bazel in a way in which it can drop you in a LLDB session 
with the target launched in a particular cwd, which is needed for things to 
work. We've been making this automation work via `process launch -w`. However, 
if later the user wants to restart the process with `r`, then they end up using 
a different cwd for relaunching the process.
As a way to fix this, I'm adding a target-level setting that allows overriding 
the cwd used for launching the process without needing the user to specify it 
manually.
---
 lldb/include/lldb/Target/Target.h |  3 ++
 lldb/source/Commands/CommandObjectProcess.cpp |  5 +++
 lldb/source/Target/Target.cpp |  9 
 lldb/source/Target/TargetProperties.td|  4 ++
 .../process/launch/TestProcessLaunch.py   | 45 +++
 5 files changed, 66 insertions(+)

diff --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index e4848f19e64d62..0e8bbb41f29941 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -37,6 +37,7 @@
 #include "lldb/Utility/RealpathPrefixes.h"
 #include "lldb/Utility/Timeout.h"
 #include "lldb/lldb-public.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace lldb_private {
 
@@ -114,6 +115,8 @@ class TargetProperties : public Properties {
 
   void SetDisableSTDIO(bool b);
 
+  std::optional GetLaunchWorkingDirectory() const;
+
   const char *GetDisassemblyFlavor() const;
 
   InlineStrategy GetInlineStrategy() const;
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp 
b/lldb/source/Commands/CommandObjectProcess.cpp
index e7c7d07ad47722..297c94c1f0a055 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -201,6 +201,11 @@ class CommandObjectProcessLaunch : public 
CommandObjectProcessLaunchOrAttach {
 if (target->GetDisableSTDIO())
   m_options.launch_info.GetFlags().Set(eLaunchFlagDisableSTDIO);
 
+if (std::optional wd =
+target->GetLaunchWorkingDirectory()) {
+  m_options.launch_info.SetWorkingDirectory(FileSpec(*wd));
+}
+
 // Merge the launch info environment with the target environment.
 Environment target_env = target->GetEnvironment();
 m_options.launch_info.GetEnvironment().insert(target_env.begin(),
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 04395e37f0425d..ef4dabf00c1a9e 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -4428,6 +4428,15 @@ void TargetProperties::SetDisableSTDIO(bool b) {
   const uint32_t idx = ePropertyDisableSTDIO;
   SetPropertyAtIndex(idx, b);
 }
+std::optional
+TargetProperties::GetLaunchWorkingDirectory() const {
+  const uint32_t idx = ePropertyLaunchWorkingDir;
+  llvm::StringRef value = GetPropertyAtIndexAs(
+  idx, g_target_properties[idx].default_cstr_value);
+  if (value.empty())
+return {};
+  return value;
+}
 
 const char *TargetProperties::GetDisassemblyFlavor() const {
   const uint32_t idx = ePropertyDisassemblyFlavor;
diff --git a/lldb/source/Target/TargetProperties.td 
b/lldb/source/Target/TargetProperties.td
index fb61478fb752dc..613442501d6b6d 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -201,6 +201,10 @@ let Definition = "target" in {
   def DebugUtilityExpression: Property<"debug-utility-expression", "Boolean">,
 DefaultFalse,
 Desc<"Enable debugging of LLDB-internal utility expressions.">;
+  def LaunchWorkingDir: Property<"launch-working-dir", "String">,
+DefaultStringValue<"">,
+Desc<"An override for the working directory to use when launching 
processes. "
+ "It's not used when empty.">;
 }
 
 let Definition = "process_experimental" in {
diff --git a/lldb/test/API/commands/process/launch/TestProcessLaunch.py 
b/lldb/test/API/commands/process/launch/TestProcessLaunch.py
index 45f9f494ab8f5c..f3afc385a56086 100644
--- a/lldb/test/API/commands/process/launch/TestProcessLaunch.py
+++ b/lldb/test/API/commands/process/launch/TestProcessLaunch.py
@@ -8,6 +8,7 @@
 from lldbsuite.test.decorators import *
 from lldbsuite

[Lldb-commits] [lldb] [lldb] Move ValueObject into its own library (NFC) (PR #113393)

2024-10-23 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Given that most of these files start with 1st ValueObject` I felt like that was 
the better name for the library, rather than DIL which doesn't exist yet. I'm 
fine with putting the DIL implementation in the new ValueObject library 
(potentially in a DIL subdirectory) or keep it in Core like you suggested. 

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