[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-25 Thread Paul Robinson via Phabricator via lldb-commits
probinson added a comment.

In D131919#3749850 , @Meinersbur 
wrote:

> Semi-OT: `polly\lib\External` has 3 more third-party libraries. Two of them 
> have been heavily modified in-tree, the third has just a custom 
> CMakeLists.txt.
> Should these eventually also be moved?

I don't know that there's a formal policy.  Our copy of googletest is used by 
several projects, so unhooking it from the llvm tree has value in that regard.
Heavy modification might not be a blocker; googletest is somewhat 
stripped-down, although otherwise I think only lightly modified.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131919/new/

https://reviews.llvm.org/D131919

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


[Lldb-commits] [lldb] 6f88388 - [lldb][test] Fix nullptr test expctation for 32-bit system

2022-08-25 Thread Adrian Vogelsgesang via lldb-commits

Author: Adrian Vogelsgesang
Date: 2022-08-25T17:11:57-07:00
New Revision: 6f88388f61327b375112e76ff4b80741a1b349cb

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

LOG: [lldb][test] Fix nullptr test expctation for 32-bit system

Follow-up to https://reviews.llvm.org/D132415

Fixes https://lab.llvm.org/buildbot/#/builders/17/builds/26630

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 1c090395e6c4c..0d449737cfd0b 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -286,8 +286,12 @@ def check_value(self, test_base, val, error_msg=None):
 test_base.assertEqual(self.expect_name, val.GetName(),
   this_error_msg)
 if self.expect_value:
-test_base.assertEqual(self.expect_value, val.GetValue(),
-  this_error_msg)
+if isinstance(self.expect_value, re.Pattern):
+test_base.assertRegex(val.GetValue(), self.expect_value,
+  this_error_msg)
+else:
+test_base.assertEqual(self.expect_value, val.GetValue(),
+  this_error_msg)
 if self.expect_type:
 test_base.assertEqual(self.expect_type, val.GetDisplayTypeName(),
   this_error_msg)

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
index 33d580d98df61..50cac6ebff7fd 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
@@ -63,7 +63,7 @@ def do_test(self, stdlib_type):
 # Check that we still show the remaining data correctly.
 self.expect_expr("gen.hdl",
 result_children=[
-ValueCheck(name="resume", value = "0x"),
+ValueCheck(name="resume", value = re.compile("^0x0+$")),
 ValueCheck(name="destroy", summary = 
test_generator_func_ptr_re),
 ValueCheck(name="promise", children=[
 ValueCheck(name="current_value", value = "42"),



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


[Lldb-commits] [PATCH] D132148: [lldb][docs] Add documentation for LLDB fuzzers

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM modulo inline comment.




Comment at: lldb/docs/resources/fuzzing.rst:15-17
+   $ -DLLVM_USE_SANITIZER='Address'
+   $ -DLLVM_USE_SANITIZE_COVERAGE=On
+   $ -DCLANG_ENABLE_PROTO_FUZZER=ON

Remove the `$` because these are not shell commands.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132148/new/

https://reviews.llvm.org/D132148

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


[Lldb-commits] [PATCH] D132642: [lldb] Fix dotest argument order

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: lldb/test/API/CMakeLists.txt:166
 
+set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS_VAR} CACHE INTERNAL STRING)
+

fdeazeve wrote:
> JDevlieghere wrote:
> > Instead of having two variables, why not move this to line 40 and make 
> > `LLDB_TEST_COMMON_ARGS` a cached variable and operate directly on that? 
> I actually address this in the commit message:
> 
> > The variable LLDB_TEST_COMMON_ARGS needs to be a CACHE property, but it
> is modified throughout the CMake file with set or list or string
> commands, which don't work with properties. As such, a temporary
> variable LLDB_TEST_COMMON_ARGS_VAR is created.
> 
> Does this make sense?
Gotcha, I didn't know about that limitation. I'm 99% sure you can still use the 
same variable and then cache it:

```
set(LLDB_TEST_COMMON_ARGS "")
list(APPEND LLDB_TEST_COMMON_ARGS "FOO")
list(APPEND LLDB_TEST_COMMON_ARGS "BAR")
set(LLDB_TEST_COMMON_ARGS "${LLDB_TEST_COMMON_ARGS}" CACHE INTERNAL STRING)
```

But maybe that's needless opaque. 




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132642/new/

https://reviews.llvm.org/D132642

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


[Lldb-commits] [lldb] e360281 - [lldb] Computer the slide when and apply it to each fileset's vm addr

2022-08-25 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-08-25T16:38:01-07:00
New Revision: e360281fa710a6e637667e6d70aa9e3919214b0f

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

LOG: [lldb] Computer the slide when and apply it to each fileset's vm addr

Computer the slide when and apply it to each entry's vm addr when
reading from memory.

Differential revision: https://reviews.llvm.org/D132710

Added: 


Modified: 

lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp

lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h

Removed: 




diff  --git 
a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
 
b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
index 681d3421b2d56..c4247512cfca6 100644
--- 
a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ 
b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -133,21 +133,35 @@ static llvm::Optional 
ParseMachOHeader(DataExtractor ) {
 
 static bool
 ParseFileset(DataExtractor , mach_header header,
- std::vector ) {
+ std::vector ,
+ llvm::Optional load_addr = llvm::None) {
   lldb::offset_t offset = MachHeaderSizeFromMagic(header.magic);
+  lldb::offset_t slide = 0;
   for (uint32_t i = 0; i < header.ncmds; ++i) {
 const lldb::offset_t load_cmd_offset = offset;
 load_command lc = {};
 if (data.GetU32(, , 2) == nullptr)
   break;
 
+// If we know the load address we can compute the slide.
+if (load_addr) {
+  if (lc.cmd == llvm::MachO::LC_SEGMENT_64) {
+segment_command_64 segment;
+data.CopyData(load_cmd_offset, sizeof(segment_command_64), );
+if (llvm::StringRef(segment.segname) == "__TEXT")
+  slide = *load_addr - segment.vmaddr;
+  }
+}
+
 if (lc.cmd == LC_FILESET_ENTRY) {
   fileset_entry_command entry;
   data.CopyData(load_cmd_offset, sizeof(fileset_entry_command), );
   lldb::offset_t entry_id_offset = load_cmd_offset + entry.entry_id;
   const char *id = data.GetCStr(_id_offset);
-  entries.emplace_back(entry.vmaddr, entry.fileoff, std::string(id));
+  entries.emplace_back(entry.vmaddr + slide, entry.fileoff,
+   std::string(id));
 }
+
 offset = load_cmd_offset + lc.cmdsize;
   }
 
@@ -198,7 +212,7 @@ bool ObjectContainerMachOFileset::ParseHeader() {
 m_data.SetData(data_sp);
   }
 
-  return ParseFileset(m_data, *header, m_entries);
+  return ParseFileset(m_data, *header, m_entries, m_memory_addr);
 }
 
 size_t ObjectContainerMachOFileset::GetModuleSpecifications(

diff  --git 
a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
 
b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
index 0619833143ad4..134c503aac919 100644
--- 
a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
+++ 
b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -73,7 +73,6 @@ class ObjectContainerMachOFileset : public 
lldb_private::ObjectContainer {
 : vmaddr(vmaddr), fileoff(fileoff), id(id) {}
 uint64_t vmaddr;
 uint64_t fileoff;
-uint64_t slide;
 std::string id;
   };
 



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


[Lldb-commits] [PATCH] D132710: [lldb] Computer and apply the slide to the fileset entry's vmaddr

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe360281fa710: [lldb] Computer the slide when and apply it to 
each filesets vm addr (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D132710?vs=455749=455756#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132710/new/

https://reviews.llvm.org/D132710

Files:
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h


Index: 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
===
--- 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
+++ 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -73,7 +73,6 @@
 : vmaddr(vmaddr), fileoff(fileoff), id(id) {}
 uint64_t vmaddr;
 uint64_t fileoff;
-uint64_t slide;
 std::string id;
   };
 
Index: 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
===
--- 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -133,21 +133,35 @@
 
 static bool
 ParseFileset(DataExtractor , mach_header header,
- std::vector ) {
+ std::vector ,
+ llvm::Optional load_addr = llvm::None) {
   lldb::offset_t offset = MachHeaderSizeFromMagic(header.magic);
+  lldb::offset_t slide = 0;
   for (uint32_t i = 0; i < header.ncmds; ++i) {
 const lldb::offset_t load_cmd_offset = offset;
 load_command lc = {};
 if (data.GetU32(, , 2) == nullptr)
   break;
 
+// If we know the load address we can compute the slide.
+if (load_addr) {
+  if (lc.cmd == llvm::MachO::LC_SEGMENT_64) {
+segment_command_64 segment;
+data.CopyData(load_cmd_offset, sizeof(segment_command_64), );
+if (llvm::StringRef(segment.segname) == "__TEXT")
+  slide = *load_addr - segment.vmaddr;
+  }
+}
+
 if (lc.cmd == LC_FILESET_ENTRY) {
   fileset_entry_command entry;
   data.CopyData(load_cmd_offset, sizeof(fileset_entry_command), );
   lldb::offset_t entry_id_offset = load_cmd_offset + entry.entry_id;
   const char *id = data.GetCStr(_id_offset);
-  entries.emplace_back(entry.vmaddr, entry.fileoff, std::string(id));
+  entries.emplace_back(entry.vmaddr + slide, entry.fileoff,
+   std::string(id));
 }
+
 offset = load_cmd_offset + lc.cmdsize;
   }
 
@@ -198,7 +212,7 @@
 m_data.SetData(data_sp);
   }
 
-  return ParseFileset(m_data, *header, m_entries);
+  return ParseFileset(m_data, *header, m_entries, m_memory_addr);
 }
 
 size_t ObjectContainerMachOFileset::GetModuleSpecifications(


Index: lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
===
--- lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
+++ lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -73,7 +73,6 @@
 : vmaddr(vmaddr), fileoff(fileoff), id(id) {}
 uint64_t vmaddr;
 uint64_t fileoff;
-uint64_t slide;
 std::string id;
   };
 
Index: lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
===
--- lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -133,21 +133,35 @@
 
 static bool
 ParseFileset(DataExtractor , mach_header header,
- std::vector ) {
+ std::vector ,
+ llvm::Optional load_addr = llvm::None) {
   lldb::offset_t offset = MachHeaderSizeFromMagic(header.magic);
+  lldb::offset_t slide = 0;
   for (uint32_t i = 0; i < header.ncmds; ++i) {
 const lldb::offset_t load_cmd_offset = offset;
 load_command lc = {};
 if (data.GetU32(, , 2) == nullptr)
   break;
 
+// If we know the load address we can compute the slide.
+if (load_addr) {
+  if (lc.cmd == llvm::MachO::LC_SEGMENT_64) {
+segment_command_64 segment;
+data.CopyData(load_cmd_offset, sizeof(segment_command_64), );
+if (llvm::StringRef(segment.segname) == "__TEXT")
+  slide = *load_addr - segment.vmaddr;
+  }
+}
+
 if (lc.cmd == LC_FILESET_ENTRY) {
   fileset_entry_command entry;
   data.CopyData(load_cmd_offset, sizeof(fileset_entry_command), );
   lldb::offset_t entry_id_offset = load_cmd_offset + entry.entry_id;
   const char *id = 

[Lldb-commits] [PATCH] D132710: [lldb] Computer and apply the slide to the fileset entry's vmaddr

2022-08-25 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

LGTM.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132710/new/

https://reviews.llvm.org/D132710

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


[Lldb-commits] [PATCH] D132709: [lldb][ClangExpression] Fix LLDB_LOG incorrect format specifier

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132709/new/

https://reviews.llvm.org/D132709

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


[Lldb-commits] [PATCH] D132710: [lldb] Computer and apply the slide to the fileset entry's vmaddr

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: jasonmolenda.
Herald added a project: All.
JDevlieghere requested review of this revision.

Computer and apply the slide to the fileset entry's vmaddr when reading a 
fileset from memory.


https://reviews.llvm.org/D132710

Files:
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h


Index: 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
===
--- 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
+++ 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -73,7 +73,6 @@
 : vmaddr(vmaddr), fileoff(fileoff), id(id) {}
 uint64_t vmaddr;
 uint64_t fileoff;
-uint64_t slide;
 std::string id;
   };
 
Index: 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
===
--- 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -133,21 +133,34 @@
 
 static bool
 ParseFileset(DataExtractor , mach_header header,
- std::vector ) {
+ std::vector ,
+ llvm::Optional load_addr = llvm::None) {
   lldb::offset_t offset = MachHeaderSizeFromMagic(header.magic);
+  lldb::offset_t slide = 0;
   for (uint32_t i = 0; i < header.ncmds; ++i) {
 const lldb::offset_t load_cmd_offset = offset;
 load_command lc = {};
 if (data.GetU32(, , 2) == nullptr)
   break;
 
+// If we know the load address we can compute the slide.
+if (load_addr) {
+  if (lc.cmd == llvm::MachO::LC_SEGMENT_64) {
+segment_command_64 segment;
+data.CopyData(load_cmd_offset, sizeof(segment_command_64), );
+if (llvm::StringRef(segment.segname) == "__TEXT")
+  slide = *load_addr - segment.vmaddr;
+  }
+}
+
 if (lc.cmd == LC_FILESET_ENTRY) {
   fileset_entry_command entry;
   data.CopyData(load_cmd_offset, sizeof(fileset_entry_command), );
   lldb::offset_t entry_id_offset = load_cmd_offset + entry.entry_id;
   const char *id = data.GetCStr(_id_offset);
-  entries.emplace_back(entry.vmaddr, entry.fileoff, std::string(id));
+  entries.emplace_back(entry.vmaddr + slide, entry.fileoff, 
std::string(id));
 }
+
 offset = load_cmd_offset + lc.cmdsize;
   }
 
@@ -198,7 +211,7 @@
 m_data.SetData(data_sp);
   }
 
-  return ParseFileset(m_data, *header, m_entries);
+  return ParseFileset(m_data, *header, m_entries, m_memory_addr);
 }
 
 size_t ObjectContainerMachOFileset::GetModuleSpecifications(


Index: lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
===
--- lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
+++ lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -73,7 +73,6 @@
 : vmaddr(vmaddr), fileoff(fileoff), id(id) {}
 uint64_t vmaddr;
 uint64_t fileoff;
-uint64_t slide;
 std::string id;
   };
 
Index: lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
===
--- lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -133,21 +133,34 @@
 
 static bool
 ParseFileset(DataExtractor , mach_header header,
- std::vector ) {
+ std::vector ,
+ llvm::Optional load_addr = llvm::None) {
   lldb::offset_t offset = MachHeaderSizeFromMagic(header.magic);
+  lldb::offset_t slide = 0;
   for (uint32_t i = 0; i < header.ncmds; ++i) {
 const lldb::offset_t load_cmd_offset = offset;
 load_command lc = {};
 if (data.GetU32(, , 2) == nullptr)
   break;
 
+// If we know the load address we can compute the slide.
+if (load_addr) {
+  if (lc.cmd == llvm::MachO::LC_SEGMENT_64) {
+segment_command_64 segment;
+data.CopyData(load_cmd_offset, sizeof(segment_command_64), );
+if (llvm::StringRef(segment.segname) == "__TEXT")
+  slide = *load_addr - segment.vmaddr;
+  }
+}
+
 if (lc.cmd == LC_FILESET_ENTRY) {
   fileset_entry_command entry;
   data.CopyData(load_cmd_offset, sizeof(fileset_entry_command), );
   lldb::offset_t entry_id_offset = load_cmd_offset + entry.entry_id;
   const char *id = data.GetCStr(_id_offset);
-  entries.emplace_back(entry.vmaddr, entry.fileoff, std::string(id));
+  entries.emplace_back(entry.vmaddr + slide, entry.fileoff, std::string(id));
 }
+

[Lldb-commits] [PATCH] D132709: [lldb][ClangExpression] Fix LLDB_LOG incorrect format specifier

2022-08-25 Thread Michael Buch via Phabricator via lldb-commits
Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Previously this would log:

   FindExternalLexicalDecls on (ASTContext*)0x0005CE825200 'Expression
  ASTContext for ''' in 'weak_ptr'
  (%sDecl*)ClassTemplateSpecialization
   FindExternalLexicalDecls on (ASTContext*)0x0005CE825200 'Expression
  ASTContext for ''' in '__shared_count'
  (%sDecl*)CXXRecord

Note that the `%s` isn't actually respected. This patch fixes this
by providing the format specifiers that `lldb::formatv` supports.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132709

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -405,7 +405,7 @@
 if (const NamedDecl *context_named_decl = 
dyn_cast(context_decl))
   LLDB_LOG(log,
"FindExternalLexicalDecls on (ASTContext*){0} '{1}' in "
-   "'{2}' (%sDecl*){3}",
+   "'{2}' ({3}Decl*){4}",
m_ast_context, m_clang_ast_context->getDisplayName(),
context_named_decl->getNameAsString().c_str(),
context_decl->getDeclKindName(),


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -405,7 +405,7 @@
 if (const NamedDecl *context_named_decl = dyn_cast(context_decl))
   LLDB_LOG(log,
"FindExternalLexicalDecls on (ASTContext*){0} '{1}' in "
-   "'{2}' (%sDecl*){3}",
+   "'{2}' ({3}Decl*){4}",
m_ast_context, m_clang_ast_context->getDisplayName(),
context_named_decl->getNameAsString().c_str(),
context_decl->getDeclKindName(),
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 48506fb - [lldb] Teach LLDB about Mach-O filesets

2022-08-25 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-08-25T15:24:51-07:00
New Revision: 48506fbbbf2732d9fc1fa75970a132450a1c1e20

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

LOG: [lldb] Teach LLDB about Mach-O filesets

This patch teaches LLDB about Mach-O filesets. Filsets are Mach-O files
that contain a bunch of other Mach-O files. Unlike universal binaries,
which have a different header, Filesets use load commands to describe
the different entries it contains.

Differential revision: https://reviews.llvm.org/D132433

Added: 
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/CMakeLists.txt

lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp

lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
lldb/source/Symbol/ObjectContainer.cpp

Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/Symbol/ObjectContainer.h
lldb/include/lldb/Symbol/ObjectFile.h
lldb/include/lldb/lldb-forward.h
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/ObjectContainer/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Symbol/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 58be1d2b18dcc..ed8917f059cd4 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -197,16 +197,20 @@ class PluginManager {
  llvm::StringRef plugin_name);
 
   // ObjectContainer
-  static bool
-  RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
- ObjectContainerCreateInstance create_callback,
- ObjectFileGetModuleSpecifications get_module_specifications);
+  static bool RegisterPlugin(
+  llvm::StringRef name, llvm::StringRef description,
+  ObjectContainerCreateInstance create_callback,
+  ObjectFileGetModuleSpecifications get_module_specifications,
+  ObjectContainerCreateMemoryInstance create_memory_callback = nullptr);
 
   static bool UnregisterPlugin(ObjectContainerCreateInstance create_callback);
 
   static ObjectContainerCreateInstance
   GetObjectContainerCreateCallbackAtIndex(uint32_t idx);
 
+  static ObjectContainerCreateMemoryInstance
+  GetObjectContainerCreateMemoryCallbackAtIndex(uint32_t idx);
+
   static ObjectFileGetModuleSpecifications
   GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
 

diff  --git a/lldb/include/lldb/Symbol/ObjectContainer.h 
b/lldb/include/lldb/Symbol/ObjectContainer.h
index 41cae692f2e57..cd4713b271c8d 100644
--- a/lldb/include/lldb/Symbol/ObjectContainer.h
+++ b/lldb/include/lldb/Symbol/ObjectContainer.h
@@ -36,15 +36,7 @@ class ObjectContainer : public PluginInterface, public 
ModuleChild {
   /// more than one architecture or object.
   ObjectContainer(const lldb::ModuleSP _sp, const FileSpec *file,
   lldb::offset_t file_offset, lldb::offset_t length,
-  lldb::DataBufferSP _sp, lldb::offset_t data_offset)
-  : ModuleChild(module_sp),
-m_file(), // This file can be 
diff erent than the module's file spec
-m_offset(file_offset), m_length(length) {
-if (file)
-  m_file = *file;
-if (data_sp)
-  m_data.SetData(data_sp, data_offset, length);
-  }
+  lldb::DataBufferSP data_sp, lldb::offset_t data_offset);
 
   /// Destructor.
   ///
@@ -132,15 +124,23 @@ class ObjectContainer : public PluginInterface, public 
ModuleChild {
   /// file exists in the container.
   virtual lldb::ObjectFileSP GetObjectFile(const FileSpec *file) = 0;
 
+  static lldb::ObjectContainerSP
+  FindPlugin(const lldb::ModuleSP _sp, const lldb::ProcessSP 
_sp,
+ lldb::addr_t header_addr, lldb::WritableDataBufferSP 
file_data_sp);
+
 protected:
-  // Member variables.
-  FileSpec m_file; ///< The file that represents this container objects (which
-   ///can be 
diff erent from the module's file).
-  lldb::addr_t
-  m_offset; ///< The offset in bytes into the file, or the address in 
memory
-  lldb::addr_t m_length; ///< The size in bytes if known (can be zero).
-  DataExtractor
-  m_data; ///< The data for this object file so things can be parsed 
lazily.
+  /// The file that represents this container objects (which can be 
diff erent
+  /// from the module's file).
+  FileSpec m_file;
+
+  /// The offset in bytes into the file, or the address in memory
+  lldb::addr_t m_offset;
+
+  /// The size in bytes if known (can be zero).
+  lldb::addr_t m_length;
+
+  /// The data for this object file so things can be parsed lazily.
+  DataExtractor m_data;
 
 private:
   

[Lldb-commits] [PATCH] D132433: [lldb] Teach LLDB about filesets

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG48506fbbbf27: [lldb] Teach LLDB about Mach-O filesets 
(authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D132433?vs=455725=455737#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132433/new/

https://reviews.llvm.org/D132433

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Symbol/ObjectContainer.h
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/lldb-forward.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/source/Core/PluginManager.cpp
  lldb/source/Plugins/ObjectContainer/CMakeLists.txt
  lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/CMakeLists.txt
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Symbol/CMakeLists.txt
  lldb/source/Symbol/ObjectContainer.cpp

Index: lldb/source/Symbol/ObjectContainer.cpp
===
--- /dev/null
+++ lldb/source/Symbol/ObjectContainer.cpp
@@ -0,0 +1,59 @@
+//===-- ObjectContainer.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Symbol/ObjectContainer.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/Timer.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+ObjectContainer::ObjectContainer(const lldb::ModuleSP _sp,
+ const FileSpec *file,
+ lldb::offset_t file_offset,
+ lldb::offset_t length,
+ lldb::DataBufferSP data_sp,
+ lldb::offset_t data_offset)
+: ModuleChild(module_sp),
+  m_file(), // This file can be different than the module's file spec
+  m_offset(file_offset), m_length(length) {
+  if (file)
+m_file = *file;
+  if (data_sp)
+m_data.SetData(data_sp, data_offset, length);
+}
+
+ObjectContainerSP ObjectContainer::FindPlugin(const lldb::ModuleSP _sp,
+  const ProcessSP _sp,
+  lldb::addr_t header_addr,
+  WritableDataBufferSP data_sp) {
+  if (!module_sp)
+return {};
+
+  LLDB_SCOPED_TIMERF("ObjectContainer::FindPlugin (module = "
+ "%s, process = %p, header_addr = "
+ "0x%" PRIx64 ")",
+ module_sp->GetFileSpec().GetPath().c_str(),
+ static_cast(process_sp.get()), header_addr);
+
+  ObjectContainerCreateMemoryInstance create_callback;
+  for (size_t idx = 0;
+   (create_callback =
+PluginManager::GetObjectContainerCreateMemoryCallbackAtIndex(
+idx)) != nullptr;
+   ++idx) {
+ObjectContainerSP object_container_sp(
+create_callback(module_sp, data_sp, process_sp, header_addr));
+if (object_container_sp)
+  return object_container_sp;
+  }
+
+  return {};
+}
Index: lldb/source/Symbol/CMakeLists.txt
===
--- lldb/source/Symbol/CMakeLists.txt
+++ lldb/source/Symbol/CMakeLists.txt
@@ -22,6 +22,7 @@
   LineEntry.cpp
   LineTable.cpp
   LocateSymbolFile.cpp
+  ObjectContainer.cpp
   ObjectFile.cpp
   PostfixExpression.cpp
   Symbol.cpp
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -941,6 +941,17 @@
   data.SetData(data_sp, data_offset, data_length);
   lldb::offset_t offset = 0;
   uint32_t magic = data.GetU32();
+
+  offset += 4; // cputype
+  offset += 4; // cpusubtype
+  uint32_t filetype = data.GetU32();
+
+  // A fileset has a Mach-O header but is not an
+  // individual file and must be handled via an
+  // ObjectContainer plugin.
+  if (filetype == llvm::MachO::MH_FILESET)
+return false;
+
   return MachHeaderSizeFromMagic(magic) != 0;
 }
 
Index: lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
===
--- /dev/null
+++ lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -0,0 

[Lldb-commits] [PATCH] D132433: [lldb] Teach LLDB about filesets

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 455725.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

I added the ability to call `ObjectContainer::FindPlugin` which allows you to 
create a Mach-O fileset from memory without actually having to know it's a 
fileset. I think that should cover Jason's use-case without needing to thread 
it through process.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132433/new/

https://reviews.llvm.org/D132433

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Symbol/ObjectContainer.h
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/lldb-forward.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/source/Core/PluginManager.cpp
  lldb/source/Plugins/ObjectContainer/CMakeLists.txt
  lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/CMakeLists.txt
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
  
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Symbol/CMakeLists.txt
  lldb/source/Symbol/ObjectContainer.cpp

Index: lldb/source/Symbol/ObjectContainer.cpp
===
--- /dev/null
+++ lldb/source/Symbol/ObjectContainer.cpp
@@ -0,0 +1,59 @@
+//===-- ObjectContainer.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Symbol/ObjectContainer.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/Timer.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+ObjectContainer::ObjectContainer(const lldb::ModuleSP _sp,
+ const FileSpec *file,
+ lldb::offset_t file_offset,
+ lldb::offset_t length,
+ lldb::DataBufferSP data_sp,
+ lldb::offset_t data_offset)
+: ModuleChild(module_sp),
+  m_file(), // This file can be different than the module's file spec
+  m_offset(file_offset), m_length(length) {
+  if (file)
+m_file = *file;
+  if (data_sp)
+m_data.SetData(data_sp, data_offset, length);
+}
+
+ObjectContainerSP ObjectContainer::FindPlugin(const lldb::ModuleSP _sp,
+  const ProcessSP _sp,
+  lldb::addr_t header_addr,
+  WritableDataBufferSP data_sp) {
+  if (!module_sp)
+return {};
+
+  LLDB_SCOPED_TIMERF("ObjectContainer::FindPlugin (module = "
+ "%s, process = %p, header_addr = "
+ "0x%" PRIx64 ")",
+ module_sp->GetFileSpec().GetPath().c_str(),
+ static_cast(process_sp.get()), header_addr);
+
+  ObjectContainerCreateMemoryInstance create_callback;
+  for (size_t idx = 0;
+   (create_callback =
+PluginManager::GetObjectContainerCreateMemoryCallbackAtIndex(
+idx)) != nullptr;
+   ++idx) {
+ObjectContainerSP object_container_sp(
+create_callback(module_sp, data_sp, process_sp, header_addr));
+if (object_container_sp)
+  return object_container_sp;
+  }
+
+  return {};
+}
Index: lldb/source/Symbol/CMakeLists.txt
===
--- lldb/source/Symbol/CMakeLists.txt
+++ lldb/source/Symbol/CMakeLists.txt
@@ -22,6 +22,7 @@
   LineEntry.cpp
   LineTable.cpp
   LocateSymbolFile.cpp
+  ObjectContainer.cpp
   ObjectFile.cpp
   PostfixExpression.cpp
   Symbol.cpp
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -941,6 +941,17 @@
   data.SetData(data_sp, data_offset, data_length);
   lldb::offset_t offset = 0;
   uint32_t magic = data.GetU32();
+
+  offset += 4; // cputype
+  offset += 4; // cpusubtype
+  uint32_t filetype = data.GetU32();
+
+  // A fileset has a Mach-O header but is not an
+  // individual file and must be handled via an
+  // ObjectContainer plugin.
+  if (filetype == llvm::MachO::MH_FILESET)
+return false;
+
   return MachHeaderSizeFromMagic(magic) != 0;
 }
 
Index: lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
===
--- /dev/null
+++ lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -0,0 

[Lldb-commits] [lldb] 613336d - Don't index the skeleton CU when we have a fission compile unit.

2022-08-25 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2022-08-25T14:48:04-07:00
New Revision: 613336da8ce16bd2e998e77e02eaf5866ad7e311

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

LOG: Don't index the skeleton CU when we have a fission compile unit.

When fission is enabled, we were indexing the skeleton CU _and_ the .dwo CU. 
Issues arise when users enable compiler options that add extra data to the 
skeleton CU (like -fsplit-dwarf-inlining) and there can end up being types in 
the skeleton CU due to template parameters. We never want to index this 
information since the .dwo file has the real definition, and we really don't 
want function prototypes from this info since all parameters are removed. The 
index doesn't work correctly if it does index the skeleton CU as the DIE offset 
will assume it is from the .dwo file, so even if we do index the skeleton CU, 
the index entries will try and grab information from the .dwo file using the 
wrong DIE offset which can cause errors to be displayed or even worse, if the 
DIE offsets is valid in the .dwo CU, the wrong DIE will be used.

We also fix DWO ID detection to use llvm::Optional to make sure we 
can load a .dwo file with a DWO ID of zero.

Differential Revision: https://reviews.llvm.org/D131437

Added: 
lldb/test/API/functionalities/dwo/TestZeroDwoId.py
lldb/test/API/functionalities/dwo/main.dwo.yaml
lldb/test/API/functionalities/dwo/main.o.yaml

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
index fcb424029f5a0..e5cf598719001 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
@@ -53,6 +53,13 @@ uint64_t DWARFBaseDIE::GetAttributeValueAsUnsigned(const 
dw_attr_t attr,
 return fail_value;
 }
 
+llvm::Optional
+DWARFBaseDIE::GetAttributeValueAsOptionalUnsigned(const dw_attr_t attr) const {
+  if (IsValid())
+return m_die->GetAttributeValueAsOptionalUnsigned(GetCU(), attr);
+  return llvm::None;
+}
+
 uint64_t DWARFBaseDIE::GetAttributeValueAsAddress(const dw_attr_t attr,
   uint64_t fail_value) const {
   if (IsValid())

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
index 36df980f6ef0f..6ee887d4bef21 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
@@ -107,6 +107,9 @@ class DWARFBaseDIE {
   uint64_t GetAttributeValueAsUnsigned(const dw_attr_t attr,
uint64_t fail_value) const;
 
+  llvm::Optional
+  GetAttributeValueAsOptionalUnsigned(const dw_attr_t attr) const;
+
   uint64_t GetAttributeValueAsAddress(const dw_attr_t attr,
   uint64_t fail_value) const;
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index b9a018c034fb2..5a584e15c397d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -547,6 +547,17 @@ uint64_t DWARFDebugInfoEntry::GetAttributeValueAsUnsigned(
   return fail_value;
 }
 
+llvm::Optional
+DWARFDebugInfoEntry::GetAttributeValueAsOptionalUnsigned(
+const DWARFUnit *cu, const dw_attr_t attr,
+bool check_specification_or_abstract_origin) const {
+  DWARFFormValue form_value;
+  if (GetAttributeValue(cu, attr, form_value, nullptr,
+check_specification_or_abstract_origin))
+return form_value.Unsigned();
+  return llvm::None;
+}
+
 // GetAttributeValueAsReference
 //
 // Get the value of an attribute as reference and fix up and compile unit

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index 32f653e99a705..63d6aa79240b3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -67,6 +67,10 @@ class DWARFDebugInfoEntry {
   const DWARFUnit *cu, const dw_attr_t attr, 

[Lldb-commits] [PATCH] D131437: Don't index the skeleton CU when we have a fission compile unit.

2022-08-25 Thread Greg Clayton via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG613336da8ce1: Dont index the skeleton CU when we have 
a fission compile unit. (authored by clayborg).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131437/new/

https://reviews.llvm.org/D131437

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/test/API/functionalities/dwo/TestZeroDwoId.py
  lldb/test/API/functionalities/dwo/main.dwo.yaml
  lldb/test/API/functionalities/dwo/main.o.yaml

Index: lldb/test/API/functionalities/dwo/main.o.yaml
===
--- /dev/null
+++ lldb/test/API/functionalities/dwo/main.o.yaml
@@ -0,0 +1,212 @@
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_X86_64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+AddressAlign:0x10
+Content: 554889E531C05DC30F1F8400554889E54883EC10C745FC897DF8488975F0E84883C4105DC3
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 01110010171B0EB44219B0420EB1420711011206B3421700
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 2C00040008013100
+  - Name:.debug_addr
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: ''
+  - Name:.debug_gnu_pubnames
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 210002003000190030666F6F002900306D61696E00
+  - Name:.debug_gnu_pubtypes
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 2100020030004F0090696E74006200906368617200
+  - Name:.comment
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 00636C616E672076657273696F6E2031362E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A65637420613836613537613033663831623362323561323839313737373235646662333733303164383836382900
+  - Name:.note.GNU-stack
+Type:SHT_PROGBITS
+AddressAlign:0x1
+  - Name:.eh_frame
+Type:SHT_X86_64_UNWIND
+Flags:   [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 1400017A5200017810011B0C070890011C001C0008410E108602430D06430C0708001C003C0021410E108602430D065C0C070800
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 47000400210101FB0E0D0001010101000101006D61696E2E63707009020105030A4B0500BD050A0A0859050306580206000101
+  - Name:.rela.text
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.text
+Relocations:
+  - Offset:  0x27
+Symbol:  _Z3foov
+Type:R_X86_64_PLT32
+Addend:  -4
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.debug_info
+Relocations:
+  - Offset:  0x6
+Symbol:  .debug_abbrev
+Type:R_X86_64_32
+  - Offset:  0xC
+Symbol:  .debug_line
+Type:R_X86_64_32
+  - Offset:  0x10
+Symbol:  .debug_str
+Type:R_X86_64_32
+  - Offset:  0x14
+Symbol:  .debug_str
+Type:R_X86_64_32
+Addend:  58
+  - Offset:  0x20
+Symbol:  .text
+Type:R_X86_64_64
+  - Offset:  0x2C
+Symbol:  .debug_addr
+Type:R_X86_64_32
+  - Name:.rela.debug_addr
+Type:SHT_RELA
+   

[Lldb-commits] [PATCH] D132642: [lldb] Fix dotest argument order

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve added inline comments.



Comment at: lldb/test/API/CMakeLists.txt:166
 
+set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS_VAR} CACHE INTERNAL STRING)
+

JDevlieghere wrote:
> Instead of having two variables, why not move this to line 40 and make 
> `LLDB_TEST_COMMON_ARGS` a cached variable and operate directly on that? 
I actually address this in the commit message:

> The variable LLDB_TEST_COMMON_ARGS needs to be a CACHE property, but it
is modified throughout the CMake file with set or list or string
commands, which don't work with properties. As such, a temporary
variable LLDB_TEST_COMMON_ARGS_VAR is created.

Does this make sense?



Comment at: lldb/test/API/lit.site.cfg.py.in:26
+config.dotest_common_args_str = 
lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
+config.dotest_user_cmake_args_str = 
lit_config.substitute("@LLDB_TEST_USER_ARGS@")
 config.lldb_enable_python = @LLDB_ENABLE_PYTHON@

JDevlieghere wrote:
> Let's omit the `cmake` part, it doesn't really matter where these args come 
> from. 
Agreed!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132642/new/

https://reviews.llvm.org/D132642

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


[Lldb-commits] [PATCH] D132642: [lldb] Fix dotest argument order

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/test/API/CMakeLists.txt:166
 
+set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS_VAR} CACHE INTERNAL STRING)
+

Instead of having two variables, why not move this to line 40 and make 
`LLDB_TEST_COMMON_ARGS` a cached variable and operate directly on that? 



Comment at: lldb/test/API/lit.site.cfg.py.in:26
+config.dotest_common_args_str = 
lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
+config.dotest_user_cmake_args_str = 
lit_config.substitute("@LLDB_TEST_USER_ARGS@")
 config.lldb_enable_python = @LLDB_ENABLE_PYTHON@

Let's omit the `cmake` part, it doesn't really matter where these args come 
from. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132642/new/

https://reviews.llvm.org/D132642

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


[Lldb-commits] [PATCH] D132694: [lldb] Quietly source lit-lldb-init

2022-08-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132694/new/

https://reviews.llvm.org/D132694

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


[Lldb-commits] [PATCH] D132694: [lldb] Quietly source lit-lldb-init

2022-08-25 Thread Dave Lee via Phabricator via lldb-commits
kastiglione created this revision.
kastiglione added a reviewer: JDevlieghere.
Herald added a subscriber: mgorny.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Improve utility of `FileCheck` output when a shell test fails.

The conflict is from:

1. On failure, `FileCheck` prints 5 lines of context
2. Shell tests first source `lit-lldb-init`, having the effect of printing its 
contents

If a `FileCheck` failure happens at the beginning of the input, then the
context shown is the `lit-lldb-init`, as it's over 5 lines and is the first
thing printed. As the init contents are fairly static, and presumably
uninteresting to most test failures, it seems reasonable to not print it.

Unfortunately it's not possible to use the `--source-quietly` flag in the lldb
invocation, because it will quiet all other `--source` flags on the command
line, making many tests fail.

This fix is a level of indirection, where a new sibling file named
`lit-lldb-init-quiet` is created, and its static contents are:

  command source -C --silent-run true lit-lldb-init

This achieves the result of loading `lit-lldb-init` quietly. The `-C` flag
loads the path relatively.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132694

Files:
  lldb/test/Shell/CMakeLists.txt
  lldb/test/Shell/helper/toolchain.py


Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -11,7 +11,7 @@
 
 
 def _get_lldb_init_path(config):
-return os.path.join(config.test_exec_root, 'lit-lldb-init')
+return os.path.join(config.test_exec_root, 'lit-lldb-init-quiet')
 
 
 def _disallow(config, execName):
Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -14,6 +14,9 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/lit-lldb-init.in
   ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init)
 
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init-quiet
+  "command source -C --silent-run true lit-lldb-init\n")
+
 add_lit_testsuite(check-lldb-shell "Running lldb shell test suite"
   ${CMAKE_CURRENT_BINARY_DIR}
   EXCLUDE_FROM_CHECK_ALL


Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -11,7 +11,7 @@
 
 
 def _get_lldb_init_path(config):
-return os.path.join(config.test_exec_root, 'lit-lldb-init')
+return os.path.join(config.test_exec_root, 'lit-lldb-init-quiet')
 
 
 def _disallow(config, execName):
Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -14,6 +14,9 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/lit-lldb-init.in
   ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init)
 
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init-quiet
+  "command source -C --silent-run true lit-lldb-init\n")
+
 add_lit_testsuite(check-lldb-shell "Running lldb shell test suite"
   ${CMAKE_CURRENT_BINARY_DIR}
   EXCLUDE_FROM_CHECK_ALL
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-25 Thread Michael Kruse via Phabricator via lldb-commits
Meinersbur added a comment.

Semi-OT: `polly\lib\External` has 3 more third-party libraries. Two of them 
have been heavily modified in-tree, the third has just a custom CMakeLists.txt.
Should these eventually also be moved?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131919/new/

https://reviews.llvm.org/D131919

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


[Lldb-commits] [PATCH] D132433: [lldb] Teach LLDB about filesets

2022-08-25 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.

In D132433#3747948 , @jasonmolenda 
wrote:

> `Process::ReadModuleFromMemory()` takes a FileSpec and header address in 
> memory (and a size to read, default 512 bytes).  It calls through 
> `Module::GetMemoryObjectFile`.  That reads the 512 bytes of memory into a 
> buffer and calls `ObjectFile::FindPlugin` class method for finding the 
> correct plugin (via PluginManager's ObjectFileCreateMemoryInstance methods), 
> finally hitting something like `ObjectFileMachO::CreateMemoryInstance`.

Reviewed this a little too close to bed time ;) - Jonas asked me if I really 
needed this up at the generic Process level, and I remembered that the one use 
case I am writing currently for this will be down in Darwin-specific code, so I 
can create the memory instance of the macho fileset explicitly.  This patch 
looks good to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132433/new/

https://reviews.llvm.org/D132433

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


[Lldb-commits] [PATCH] D131919: Move googletest to the third-party directory

2022-08-25 Thread Paul Robinson via Phabricator via lldb-commits
probinson added inline comments.



Comment at: clang/CMakeLists.txt:106
   AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
 add_subdirectory(${UNITTEST_DIR} utils/unittest)
   endif()

Should this be `third-party/unittest` ? Looking at how the lldb cmake files 
were modified.



Comment at: lld/CMakeLists.txt:69
   AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
 add_subdirectory(${UNITTEST_DIR} utils/unittest)
   endif()

See comment for clang/CMakeLists.txt



Comment at: mlir/CMakeLists.txt:25
   if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
 add_subdirectory(${UNITTEST_DIR} utils/unittest)
   endif()

See comment for clang/CMakeLists.txt



Comment at: polly/CMakeLists.txt:37
 if (NOT TARGET gtest)
   add_subdirectory(${UNITTEST_DIR} utils/unittest)
 endif()

See comment for clang/CMakeLists.txt


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131919/new/

https://reviews.llvm.org/D131919

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


Re: [Lldb-commits] [PATCH] D132624: [LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`

2022-08-25 Thread Jim Ingham via lldb-commits


> On Aug 25, 2022, at 8:11 AM, Pavel Labath via Phabricator via lldb-commits 
>  wrote:
> 
> labath added a comment.
> 
> In D132624#3748434 , @avogelsgesang 
> wrote:
> 
>>> The only concern is that if it would be not so easy to read if there are 
>>> too many levels? (Consider the 30levels example in D132451 
>>> ). If it would be better to print ... at 
>>> certain level? Or this is already handled by lldb?
>> 
>> Agree, it would be better to limit the printing at some point. However, 
>> afaict, limiting the depth to which children are expanded cannot be done 
>> from inside the data formatter/synthetic children frontend. I am not sure if 
>> lldb already has a separate mechanism in place to limit printing in this 
>> case. If it does not, I think it makes sense to add it, but that would be a 
>> separate commit
> 
> The best (I think) mechanism we have is the "pointer depth" limit (defaulting 
> to 1). It works fine on regular objects, but requires some care with 
> synthetic children. The fact that it does not kick in here leads me to 
> believe that the data formatter is creating the synthetic children as non 
> pointer objects (e.g. by automatically dereferencing any nested pointers), 
> even though the structures clearly contain some pointers inside. That is a 
> problem. Not only it creates excessively large outputs, it can even cause 
> lldb to hang (looping endlessly while trying to print "all" children) if the 
> data structures it is trying to print are circular (e.g. due to corruption).

There are actually two separate controls for the depth of child traversal:

(lldb) help v
...
   -D  ( --depth  )
Set the max recurse depth when dumping aggregate types (default is 
infinity).
...
   -P  ( --ptr-depth  )
The number of pointers to be traversed when dumping values (default 
is zero).

There have to be two, because aggregate types can't have cycles, so it's safe 
to set those to a high value, but pointer following can lead to cycles and we 
don't currently do cycle detection so you have to be more careful with this 
setting.

Jim


> 
> 
> Repository:
>  rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D132624/new/
> 
> https://reviews.llvm.org/D132624
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [PATCH] D132624: [LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`

2022-08-25 Thread Adrian Vogelsgesang via Phabricator via lldb-commits
avogelsgesang added a comment.

> leads me to believe that the data formatter is creating the synthetic 
> children as non pointer objects (e.g. by automatically dereferencing any 
> nested pointers), even though the structures clearly contain some pointers 
> inside

Yes, that is correct. The formatter (introduced recently in 
https://reviews.llvm.org/D132415) does dereference the pointer internally. It 
replaces the

  (std::coroutine_handle<>) hdl = {
__handle_ = 0xb2a0
  }

by

  (std::coroutine_handle<>) hdl = {
  resume = 0x5a10 (a.out`coro_task(int, int) at 
llvm-example.cpp:36)
  destroy = 0x6090 (a.out`coro_task(int, int) at 
llvm-example.cpp:36)
  }

by dereferencing the pointer and directly exposing its children.

I could not find a good way to not dereference the pointer internally. Maybe 
you can help me find a better way?

I tried to just adjust the pointer type of the `__handle_` member, but then I 
got multiple problems:

1. Unnecessary clutter:

  (std::coroutine_handle<>) hdl = {
  __handle_ = {
  resume = 0x5a10 (a.out`coro_task(int, int) at 
llvm-example.cpp:36)
  destroy = 0x6090 (a.out`coro_task(int, int) at 
llvm-example.cpp:36)
  }
  }

The additional `__handle_` in it is just visual clutter.

Not expanded by default:

By default, if I write `p hdl`, LLDB did not expand its children and just 
displayed

  (std::coroutine_handle<>) hdl = {
__handle_ = 0xb2a0
  }

without an indication that there was more to see inside the pointer.

Also, when I write `p hdl.__handle_`, LLDB did not expand the pointer. Because 
now the `hdl.__handle_` access is done with C++ semantics, returning a `void*` 
and hence the data formatter for `std::exception_handle` did not kick in


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132624/new/

https://reviews.llvm.org/D132624

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


[Lldb-commits] [PATCH] D132624: [LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`

2022-08-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D132624#3748434 , @avogelsgesang 
wrote:

>> The only concern is that if it would be not so easy to read if there are too 
>> many levels? (Consider the 30levels example in D132451 
>> ). If it would be better to print ... at 
>> certain level? Or this is already handled by lldb?
>
> Agree, it would be better to limit the printing at some point. However, 
> afaict, limiting the depth to which children are expanded cannot be done from 
> inside the data formatter/synthetic children frontend. I am not sure if lldb 
> already has a separate mechanism in place to limit printing in this case. If 
> it does not, I think it makes sense to add it, but that would be a separate 
> commit

The best (I think) mechanism we have is the "pointer depth" limit (defaulting 
to 1). It works fine on regular objects, but requires some care with synthetic 
children. The fact that it does not kick in here leads me to believe that the 
data formatter is creating the synthetic children as non pointer objects (e.g. 
by automatically dereferencing any nested pointers), even though the structures 
clearly contain some pointers inside. That is a problem. Not only it creates 
excessively large outputs, it can even cause lldb to hang (looping endlessly 
while trying to print "all" children) if the data structures it is trying to 
print are circular (e.g. due to corruption).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132624/new/

https://reviews.llvm.org/D132624

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


[Lldb-commits] [PATCH] D132642: [lldb] Fix dotest argument order

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve updated this revision to Diff 455588.
fdeazeve edited the summary of this revision.
fdeazeve added a comment.

Updated review message with the latest edits to the commit message.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132642/new/

https://reviews.llvm.org/D132642

Files:
  lldb/test/API/CMakeLists.txt
  lldb/test/API/lit.cfg.py
  lldb/test/API/lit.site.cfg.py.in
  lldb/utils/lldb-dotest/CMakeLists.txt

Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -3,7 +3,8 @@
 add_dependencies(lldb-dotest lldb-test-depends)
 set_target_properties(lldb-dotest PROPERTIES FOLDER "lldb utils")
 
-get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
+get_property(LLDB_TEST_USER_ARGS GLOBAL PROPERTY LLDB_TEST_USER_ARGS_PROPERTY)
+get_property(LLDB_TEST_COMMON_ARGS GLOBAL PROPERTY LLDB_TEST_COMMON_ARGS_PROPERTY)
 set(LLDB_LIBS_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}")
 
 llvm_canonicalize_cmake_booleans(
@@ -12,7 +13,8 @@
 
 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
 set(vars
-  LLDB_DOTEST_ARGS
+  LLDB_TEST_COMMON_ARGS
+  LLDB_TEST_USER_ARGS
   LLDB_SOURCE_DIR
   LLDB_FRAMEWORK_DIR
   LLDB_TEST_BUILD_DIRECTORY
Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -22,7 +22,8 @@
 config.python_executable = "@Python3_EXECUTABLE@"
 config.lua_executable = "@Lua_EXECUTABLE@"
 config.lua_test_entry = "TestLuaAPI.py"
-config.dotest_args_str = lit_config.substitute("@LLDB_DOTEST_ARGS@")
+config.dotest_common_args_str = lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
+config.dotest_user_cmake_args_str = lit_config.substitute("@LLDB_TEST_USER_ARGS@")
 config.lldb_enable_python = @LLDB_ENABLE_PYTHON@
 config.dotest_lit_args_str = None
 config.enabled_plugins = []
Index: lldb/test/API/lit.cfg.py
===
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -155,8 +155,8 @@
 # Build dotest command.
 dotest_cmd = [os.path.join(config.lldb_src_root, 'test', 'API', 'dotest.py')]
 
-if is_configured('dotest_args_str'):
-  dotest_cmd.extend(config.dotest_args_str.split(';'))
+if is_configured('dotest_common_args_str'):
+  dotest_cmd.extend(config.dotest_common_args_str.split(';'))
 
 # Library path may be needed to locate just-built clang and libcxx.
 if is_configured('llvm_libs_dir'):
@@ -235,6 +235,20 @@
   for plugin in config.enabled_plugins:
 dotest_cmd += ['--enable-plugin', plugin]
 
+# `dotest` args come from three different sources:
+# 1. Derived by CMake based on its configs (LLDB_TEST_COMMON_ARGS), which end
+# up in `dotest_common_args_str`.
+# 2. CMake user parameters (LLDB_TEST_USER_ARGS), which end up in
+# `dotest_user_cmake_args_str`.
+# 3. With `llvm-lit "--param=dotest-args=..."`, which end up in
+# `dotest_lit_args_str`.
+# Check them in this order, so that more specific overrides are visited last.
+# In particular, (1) is visited at the top of the file, since the script
+# derives other information from it.
+
+if is_configured('dotest_user_cmake_args_str'):
+  dotest_cmd.extend(config.dotest_user_cmake_args_str.split(';'))
+
 if is_configured('dotest_lit_args_str'):
   # We don't want to force users passing arguments to lit to use `;` as a
   # separator. We use Python's simple lexical analyzer to turn the args into a
Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -37,7 +37,7 @@
   ""
   CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'")
 
-set(LLDB_TEST_COMMON_ARGS
+set(LLDB_TEST_COMMON_ARGS_VAR
   -u CXXFLAGS
   -u CFLAGS
   )
@@ -71,16 +71,16 @@
 CACHE BOOL "(Windows only) Hides the console window for an inferior when it is launched through the test suite")
 
   if (LLDB_TEST_DEBUG_TEST_CRASHES)
-set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --enable-crash-dialog)
+set(LLDB_TEST_COMMON_ARGS_VAR ${LLDB_TEST_COMMON_ARGS_VAR} --enable-crash-dialog)
   endif()
 
   if (NOT LLDB_TEST_HIDE_CONSOLE_WINDOWS)
-set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --show-inferior-console)
+set(LLDB_TEST_COMMON_ARGS_VAR ${LLDB_TEST_COMMON_ARGS_VAR} --show-inferior-console)
   endif()
 endif()
 
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
-  list(APPEND LLDB_TEST_COMMON_ARGS
+  list(APPEND LLDB_TEST_COMMON_ARGS_VAR
 --env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
 endif()
 
@@ -98,7 +98,7 @@
   # Use the same identity for testing
   get_property(code_sign_identity_used GLOBAL PROPERTY LLDB_DEBUGSERVER_CODESIGN_IDENTITY)
   if(code_sign_identity_used)
-

[Lldb-commits] [PATCH] D132642: [lldb] Fix dotest argument order

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve updated this revision to Diff 455585.
fdeazeve added a comment.

Added missing files


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132642/new/

https://reviews.llvm.org/D132642

Files:
  lldb/test/API/CMakeLists.txt
  lldb/test/API/lit.cfg.py
  lldb/test/API/lit.site.cfg.py.in
  lldb/utils/lldb-dotest/CMakeLists.txt

Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -3,7 +3,8 @@
 add_dependencies(lldb-dotest lldb-test-depends)
 set_target_properties(lldb-dotest PROPERTIES FOLDER "lldb utils")
 
-get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
+get_property(LLDB_TEST_USER_ARGS GLOBAL PROPERTY LLDB_TEST_USER_ARGS_PROPERTY)
+get_property(LLDB_TEST_COMMON_ARGS GLOBAL PROPERTY LLDB_TEST_COMMON_ARGS_PROPERTY)
 set(LLDB_LIBS_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}")
 
 llvm_canonicalize_cmake_booleans(
@@ -12,7 +13,8 @@
 
 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
 set(vars
-  LLDB_DOTEST_ARGS
+  LLDB_TEST_COMMON_ARGS
+  LLDB_TEST_USER_ARGS
   LLDB_SOURCE_DIR
   LLDB_FRAMEWORK_DIR
   LLDB_TEST_BUILD_DIRECTORY
Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -22,7 +22,8 @@
 config.python_executable = "@Python3_EXECUTABLE@"
 config.lua_executable = "@Lua_EXECUTABLE@"
 config.lua_test_entry = "TestLuaAPI.py"
-config.dotest_args_str = lit_config.substitute("@LLDB_DOTEST_ARGS@")
+config.dotest_common_args_str = lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
+config.dotest_user_cmake_args_str = lit_config.substitute("@LLDB_TEST_USER_ARGS@")
 config.lldb_enable_python = @LLDB_ENABLE_PYTHON@
 config.dotest_lit_args_str = None
 config.enabled_plugins = []
Index: lldb/test/API/lit.cfg.py
===
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -155,8 +155,8 @@
 # Build dotest command.
 dotest_cmd = [os.path.join(config.lldb_src_root, 'test', 'API', 'dotest.py')]
 
-if is_configured('dotest_args_str'):
-  dotest_cmd.extend(config.dotest_args_str.split(';'))
+if is_configured('dotest_common_args_str'):
+  dotest_cmd.extend(config.dotest_common_args_str.split(';'))
 
 # Library path may be needed to locate just-built clang and libcxx.
 if is_configured('llvm_libs_dir'):
@@ -235,6 +235,20 @@
   for plugin in config.enabled_plugins:
 dotest_cmd += ['--enable-plugin', plugin]
 
+# `dotest` args come from three different sources:
+# 1. Derived by CMake based on its configs (LLDB_TEST_COMMON_ARGS), which end
+# up in `dotest_common_args_str`.
+# 2. CMake user parameters (LLDB_TEST_USER_ARGS), which end up in
+# `dotest_user_cmake_args_str`.
+# 3. With `llvm-lit "--param=dotest-args=..."`, which end up in
+# `dotest_lit_args_str`.
+# Check them in this order, so that more specific overrides are visited last.
+# In particular, (1) is visited at the top of the file, since the script
+# derives other information from it.
+
+if is_configured('dotest_user_cmake_args_str'):
+  dotest_cmd.extend(config.dotest_user_cmake_args_str.split(';'))
+
 if is_configured('dotest_lit_args_str'):
   # We don't want to force users passing arguments to lit to use `;` as a
   # separator. We use Python's simple lexical analyzer to turn the args into a
Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -37,7 +37,7 @@
   ""
   CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'")
 
-set(LLDB_TEST_COMMON_ARGS
+set(LLDB_TEST_COMMON_ARGS_VAR
   -u CXXFLAGS
   -u CFLAGS
   )
@@ -71,16 +71,16 @@
 CACHE BOOL "(Windows only) Hides the console window for an inferior when it is launched through the test suite")
 
   if (LLDB_TEST_DEBUG_TEST_CRASHES)
-set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --enable-crash-dialog)
+set(LLDB_TEST_COMMON_ARGS_VAR ${LLDB_TEST_COMMON_ARGS_VAR} --enable-crash-dialog)
   endif()
 
   if (NOT LLDB_TEST_HIDE_CONSOLE_WINDOWS)
-set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --show-inferior-console)
+set(LLDB_TEST_COMMON_ARGS_VAR ${LLDB_TEST_COMMON_ARGS_VAR} --show-inferior-console)
   endif()
 endif()
 
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
-  list(APPEND LLDB_TEST_COMMON_ARGS
+  list(APPEND LLDB_TEST_COMMON_ARGS_VAR
 --env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
 endif()
 
@@ -98,7 +98,7 @@
   # Use the same identity for testing
   get_property(code_sign_identity_used GLOBAL PROPERTY LLDB_DEBUGSERVER_CODESIGN_IDENTITY)
   if(code_sign_identity_used)
-list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${code_sign_identity_used}")
+

[Lldb-commits] [PATCH] D132642: [lldb] Fix dotest argument order

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve updated this revision to Diff 455531.
fdeazeve added a comment.
Herald added a subscriber: JDevlieghere.

Fix commit message typo


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132642/new/

https://reviews.llvm.org/D132642

Files:
  lldb/test/API/CMakeLists.txt
  lldb/test/API/lit.cfg.py
  lldb/test/API/lit.site.cfg.py.in


Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -22,7 +22,8 @@
 config.python_executable = "@Python3_EXECUTABLE@"
 config.lua_executable = "@Lua_EXECUTABLE@"
 config.lua_test_entry = "TestLuaAPI.py"
-config.dotest_args_str = lit_config.substitute("@LLDB_DOTEST_ARGS@")
+config.dotest_common_args_str = 
lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
+config.dotest_user_cmake_args_str = 
lit_config.substitute("@LLDB_TEST_USER_ARGS@")
 config.lldb_enable_python = @LLDB_ENABLE_PYTHON@
 config.dotest_lit_args_str = None
 config.enabled_plugins = []
Index: lldb/test/API/lit.cfg.py
===
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -155,8 +155,8 @@
 # Build dotest command.
 dotest_cmd = [os.path.join(config.lldb_src_root, 'test', 'API', 'dotest.py')]
 
-if is_configured('dotest_args_str'):
-  dotest_cmd.extend(config.dotest_args_str.split(';'))
+if is_configured('dotest_common_args_str'):
+  dotest_cmd.extend(config.dotest_common_args_str.split(';'))
 
 # Library path may be needed to locate just-built clang and libcxx.
 if is_configured('llvm_libs_dir'):
@@ -235,6 +235,20 @@
   for plugin in config.enabled_plugins:
 dotest_cmd += ['--enable-plugin', plugin]
 
+# `dotest` args come from three different sources:
+# 1. Derived by CMake based on its configs (LLDB_TEST_COMMON_ARGS), which end
+# up in `dotest_common_args_str`.
+# 2. CMake user parameters (LLDB_TEST_USER_ARGS), which end up in
+# `dotest_user_cmake_args_str`.
+# 3. With `llvm-lit "--param=dotest-args=..."`, which end up in
+# `dotest_lit_args_str`.
+# Check them in this order, so that more specific overrides are visited last.
+# In particular, (1) is visited at the top of the file, since the script
+# derives other information from it.
+
+if is_configured('dotest_user_cmake_args_str'):
+  dotest_cmd.extend(config.dotest_user_cmake_args_str.split(';'))
+
 if is_configured('dotest_lit_args_str'):
   # We don't want to force users passing arguments to lit to use `;` as a
   # separator. We use Python's simple lexical analyzer to turn the args into a
Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -122,13 +122,13 @@
   endif()
 endif()
 
-set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS} CACHE 
INTERNAL STRING)
 set(dotest_args_replacement ${LLVM_BUILD_MODE})
 
 if(LLDB_BUILT_STANDALONE)
   # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our 
configuration name placeholder.
   string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
-  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_COMMON_ARGS "${LLDB_TEST_COMMON_ARGS}")
+  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_USER_ARGS "${LLDB_TEST_USER_ARGS}")
   string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
   string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_FRAMEWORK_DIR "${LLDB_FRAMEWORK_DIR}")
   string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
@@ -155,7 +155,8 @@
   endif()
 endif()
 
-string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_DOTEST_ARGS 
"${LLDB_DOTEST_ARGS}")
+string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} 
LLDB_TEST_COMMON_ARGS "${LLDB_TEST_COMMON_ARGS}")
+string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} 
LLDB_TEST_USER_ARGS "${LLDB_TEST_USER_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} LLDB_SOURCE_DIR 
"${LLDB_SOURCE_DIR}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} 
LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${dotest_args_replacement} 
LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")


Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -22,7 +22,8 @@
 config.python_executable = "@Python3_EXECUTABLE@"
 config.lua_executable = "@Lua_EXECUTABLE@"
 

[Lldb-commits] [PATCH] D132642: [lldb] Fix dotest argument order

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

When running LLDB API tests, a user can override test arguments with the
LLDB_TEST_USER_ARGS. However, these flags used to be concatenated with a
CMake-derived variable LLDB_TEST_COMMON_ARGS, as below:

  set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}

This is problematic, because LLDB_TEST_COMMON_ARGS must be processed
first, while LLDB_TEST_USER_ARGS args must be processed last, so that
user overrides are respected. Currently, if a user attempts to override
one of the "inferred" flags, the user's request is ignored. This is the
case, for example, with `--libcxx-include-dir` and
`--libcxx-library-dir`. Both flags are needed by the greendragon bots.

This commit removes the concatenation above, keeping the two original
variables throughout the entire flow, processing the user's flag last.

This was tested locally by invoking CMake with:
-DLLDB_TEST_USER_ARGS="--libcxx-include-dir=blah --libcxx-library-dir=blah2"
and checking that tests failed appropriately.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132642

Files:
  lldb/test/API/CMakeLists.txt
  lldb/test/API/lit.cfg.py
  lldb/test/API/lit.site.cfg.py.in


Index: lldb/test/API/lit.site.cfg.py.in
===
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -22,7 +22,8 @@
 config.python_executable = "@Python3_EXECUTABLE@"
 config.lua_executable = "@Lua_EXECUTABLE@"
 config.lua_test_entry = "TestLuaAPI.py"
-config.dotest_args_str = lit_config.substitute("@LLDB_DOTEST_ARGS@")
+config.dotest_common_args_str = 
lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
+config.dotest_user_cmake_args_str = 
lit_config.substitute("@LLDB_TEST_USER_ARGS@")
 config.lldb_enable_python = @LLDB_ENABLE_PYTHON@
 config.dotest_lit_args_str = None
 config.enabled_plugins = []
Index: lldb/test/API/lit.cfg.py
===
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -155,8 +155,8 @@
 # Build dotest command.
 dotest_cmd = [os.path.join(config.lldb_src_root, 'test', 'API', 'dotest.py')]
 
-if is_configured('dotest_args_str'):
-  dotest_cmd.extend(config.dotest_args_str.split(';'))
+if is_configured('dotest_common_args_str'):
+  dotest_cmd.extend(config.dotest_common_args_str.split(';'))
 
 # Library path may be needed to locate just-built clang and libcxx.
 if is_configured('llvm_libs_dir'):
@@ -235,6 +235,20 @@
   for plugin in config.enabled_plugins:
 dotest_cmd += ['--enable-plugin', plugin]
 
+# `dotest` args come from three different sources:
+# 1. Derived by CMake based on its configs (LLDB_TEST_COMMON_ARGS), which end
+# up in `dotest_common_args_str`.
+# 2. CMake user parameters (LLDB_TEST_USER_ARGS), which end up in
+# `dotest_user_cmake_args_str`.
+# 3. With `llvm-lit "--param=dotest-args=..."`, which end up in
+# `dotest_lit_args_str`.
+# Check them in this order, so that more specific overrides are visited last.
+# In particular, (1) is visited at the top of the file, since the script
+# derives other information from it.
+
+if is_configured('dotest_user_cmake_args_str'):
+  dotest_cmd.extend(config.dotest_user_cmake_args_str.split(';'))
+
 if is_configured('dotest_lit_args_str'):
   # We don't want to force users passing arguments to lit to use `;` as a
   # separator. We use Python's simple lexical analyzer to turn the args into a
Index: lldb/test/API/CMakeLists.txt
===
--- lldb/test/API/CMakeLists.txt
+++ lldb/test/API/CMakeLists.txt
@@ -122,13 +122,13 @@
   endif()
 endif()
 
-set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS} CACHE 
INTERNAL STRING)
 set(dotest_args_replacement ${LLVM_BUILD_MODE})
 
 if(LLDB_BUILT_STANDALONE)
   # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our 
configuration name placeholder.
   string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
-  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
+  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_COMMON_ARGS "${LLDB_TEST_COMMON_ARGS}")
+  string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_USER_ARGS "${LLDB_TEST_USER_ARGS}")
   string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
   string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_FRAMEWORK_DIR "${LLDB_FRAMEWORK_DIR}")
   string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
@@ -155,7 

[Lldb-commits] [PATCH] D132598: [lldb] Add more dylib paths for exception breakpoints

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbaeb17cdfa4b: [lldb] Add more dylib paths for exception 
breakpoints (authored by fdeazeve).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132598/new/

https://reviews.llvm.org/D132598

Files:
  
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp


Index: 
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
===
--- 
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ 
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -453,6 +453,8 @@
 // Apple binaries.
 filter_modules.EmplaceBack("libc++abi.dylib");
 filter_modules.EmplaceBack("libSystem.B.dylib");
+filter_modules.EmplaceBack("libc++abi.1.0.dylib");
+filter_modules.EmplaceBack("libc++abi.1.dylib");
   }
   return target.GetSearchFilterForModuleList(_modules);
 }


Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -453,6 +453,8 @@
 // Apple binaries.
 filter_modules.EmplaceBack("libc++abi.dylib");
 filter_modules.EmplaceBack("libSystem.B.dylib");
+filter_modules.EmplaceBack("libc++abi.1.0.dylib");
+filter_modules.EmplaceBack("libc++abi.1.dylib");
   }
   return target.GetSearchFilterForModuleList(_modules);
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] baeb17c - [lldb] Add more dylib paths for exception breakpoints

2022-08-25 Thread Felipe de Azevedo Piovezan via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2022-08-25T06:46:04-04:00
New Revision: baeb17cdfa4bba8985ebb9809edf7eb82c636bc4

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

LOG: [lldb] Add more dylib paths for exception breakpoints

When setting a breakpoint upon throwing exceptions, LLDB only
searches for the libc++abi code inside dylibs named:
  1. libc++abi.dylib
  2. libSystem.B.dylib

However, this fails to account for libs with a version number. For
example, when building the libcxx and libcxxabi runtimes, the following
dylibs are generated:

build/lib/libc++abi.1.0.dylib
build/lib/libc++abi.1.dylib -> libc++abi.1.0.dylib
build/lib/libc++abi.dylib -> libc++abi.1.dylib

If we are debugging a program linked against any of the "versioned"
libs, the breakpoint doesn't work. This commit adds these names to the
search list.

Differential Revision: https://reviews.llvm.org/D132598

Added: 


Modified: 

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 1595335cfe330..563f2de8f190d 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -453,6 +453,8 @@ lldb::SearchFilterSP 
ItaniumABILanguageRuntime::CreateExceptionSearchFilter() {
 // Apple binaries.
 filter_modules.EmplaceBack("libc++abi.dylib");
 filter_modules.EmplaceBack("libSystem.B.dylib");
+filter_modules.EmplaceBack("libc++abi.1.0.dylib");
+filter_modules.EmplaceBack("libc++abi.1.dylib");
   }
   return target.GetSearchFilterForModuleList(_modules);
 }



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


[Lldb-commits] [PATCH] D132598: [lldb] Add more dylib paths for exception breakpoints

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve added inline comments.



Comment at: 
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp:457
+filter_modules.EmplaceBack("libc++abi.1.0.dylib");
+filter_modules.EmplaceBack("libc++abi.1.dylib");
   }

aprantl wrote:
> fdeazeve wrote:
> > aprantl wrote:
> > > Should these be ordered such that the most likely matches on the most 
> > > modern systems come first?
> > According to @jasonmolenda, the order is not relevant from a practical 
> > point of view, as breakpoints will be set in _all_ of the above (if they 
> > exist). Unless your intent here is for readers to know which files are more 
> > common?
> I also just realized that the ones you added here are the less common ones. 
> So this LGTM
For the reference of future readers, my previous comment was incorrect, as I 
had misinterpreted something. The order matters in that, whenever a new dylib 
is loaded, its name is checked against this list. The earlier the match, the 
earlier we stop the search.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132598/new/

https://reviews.llvm.org/D132598

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


[Lldb-commits] [lldb] 14d5ae2 - [lldb][nfc] Remove unused makefile test variables

2022-08-25 Thread Felipe de Azevedo Piovezan via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2022-08-25T06:39:01-04:00
New Revision: 14d5ae2038b58830f0565980e20fe0bfd683fb54

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

LOG: [lldb][nfc] Remove unused makefile test variables

The variables LLDB_USING_LIBCPP and LLDB_USING_LIBSTDCPP are no longer
used anywhere.

Differential Revision: https://reviews.llvm.org/D132596

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 6336ef2a523c0..36ef028101522 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -381,13 +381,12 @@ endif
 ifeq (1,$(USE_LIBSTDCPP))
# Clang requires an extra flag: -stdlib=libstdc++
ifneq (,$(findstring clang,$(CC)))
-   CXXFLAGS += -stdlib=libstdc++ -DLLDB_USING_LIBSTDCPP
+   CXXFLAGS += -stdlib=libstdc++
LDFLAGS += -stdlib=libstdc++
endif
 endif
 
 ifeq (1,$(USE_LIBCPP))
-   CXXFLAGS += -DLLDB_USING_LIBCPP
ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem 
$(LIBCPP_INCLUDE_DIR)
LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) 
-lc++



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


[Lldb-commits] [PATCH] D132596: [lldb][nfc] Remove unused makefile test variables

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG14d5ae2038b5: [lldb][nfc] Remove unused makefile test 
variables (authored by fdeazeve).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132596/new/

https://reviews.llvm.org/D132596

Files:
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -381,13 +381,12 @@
 ifeq (1,$(USE_LIBSTDCPP))
# Clang requires an extra flag: -stdlib=libstdc++
ifneq (,$(findstring clang,$(CC)))
-   CXXFLAGS += -stdlib=libstdc++ -DLLDB_USING_LIBSTDCPP
+   CXXFLAGS += -stdlib=libstdc++
LDFLAGS += -stdlib=libstdc++
endif
 endif
 
 ifeq (1,$(USE_LIBCPP))
-   CXXFLAGS += -DLLDB_USING_LIBCPP
ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem 
$(LIBCPP_INCLUDE_DIR)
LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) 
-lc++


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -381,13 +381,12 @@
 ifeq (1,$(USE_LIBSTDCPP))
 	# Clang requires an extra flag: -stdlib=libstdc++
 	ifneq (,$(findstring clang,$(CC)))
-		CXXFLAGS += -stdlib=libstdc++ -DLLDB_USING_LIBSTDCPP
+		CXXFLAGS += -stdlib=libstdc++
 		LDFLAGS += -stdlib=libstdc++
 	endif
 endif
 
 ifeq (1,$(USE_LIBCPP))
-	CXXFLAGS += -DLLDB_USING_LIBCPP
 	ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
 		CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(LIBCPP_INCLUDE_DIR)
 		LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D132596: [lldb][nfc] Remove unused makefile test variables

2022-08-25 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve updated this revision to Diff 455523.
fdeazeve added a comment.

Fixed typo in commit message


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132596/new/

https://reviews.llvm.org/D132596

Files:
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -381,13 +381,12 @@
 ifeq (1,$(USE_LIBSTDCPP))
# Clang requires an extra flag: -stdlib=libstdc++
ifneq (,$(findstring clang,$(CC)))
-   CXXFLAGS += -stdlib=libstdc++ -DLLDB_USING_LIBSTDCPP
+   CXXFLAGS += -stdlib=libstdc++
LDFLAGS += -stdlib=libstdc++
endif
 endif
 
 ifeq (1,$(USE_LIBCPP))
-   CXXFLAGS += -DLLDB_USING_LIBCPP
ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem 
$(LIBCPP_INCLUDE_DIR)
LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) 
-lc++


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -381,13 +381,12 @@
 ifeq (1,$(USE_LIBSTDCPP))
 	# Clang requires an extra flag: -stdlib=libstdc++
 	ifneq (,$(findstring clang,$(CC)))
-		CXXFLAGS += -stdlib=libstdc++ -DLLDB_USING_LIBSTDCPP
+		CXXFLAGS += -stdlib=libstdc++
 		LDFLAGS += -stdlib=libstdc++
 	endif
 endif
 
 ifeq (1,$(USE_LIBCPP))
-	CXXFLAGS += -DLLDB_USING_LIBCPP
 	ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
 		CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(LIBCPP_INCLUDE_DIR)
 		LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D132624: [LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`

2022-08-25 Thread Chuanqi Xu via Phabricator via lldb-commits
ChuanqiXu added a comment.

In D132624#3748434 , @avogelsgesang 
wrote:

>> The only concern is that if it would be not so easy to read if there are too 
>> many levels? (Consider the 30levels example in D132451 
>> ). If it would be better to print ... at 
>> certain level? Or this is already handled by lldb?
>
> Agree, it would be better to limit the printing at some point. However, 
> afaict, limiting the depth to which children are expanded cannot be done from 
> inside the data formatter/synthetic children frontend. I am not sure if lldb 
> already has a separate mechanism in place to limit printing in this case. If 
> it does not, I think it makes sense to add it, but that would be a separate 
> commit

Yeah, I am not objecting this. I understand it is bad to make perfect the enemy 
of better.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132624/new/

https://reviews.llvm.org/D132624

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


[Lldb-commits] [PATCH] D132624: [LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`

2022-08-25 Thread Adrian Vogelsgesang via Phabricator via lldb-commits
avogelsgesang added a comment.

> The only concern is that if it would be not so easy to read if there are too 
> many levels? (Consider the 30levels example in D132451 
> ). If it would be better to print ... at 
> certain level? Or this is already handled by lldb?

Agree, it would be better to limit the printing at some point. However, afaict, 
limiting the depth to which children are expanded cannot be done from inside 
the data formatter/synthetic children frontend. I am not sure if lldb already 
has a separate mechanism in place to limit printing in this case. If it does 
not, I think it makes sense to add it, but that would be a separate commit


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132624/new/

https://reviews.llvm.org/D132624

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


[Lldb-commits] [lldb] 9427487 - [lldb][Test] Prevent generating DW_AT_location for unused argument

2022-08-25 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2022-08-25T08:49:13+01:00
New Revision: 9427487fdbb24df148caba7f9b2f87146e5b40ec

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

LOG: [lldb][Test] Prevent generating DW_AT_location for unused argument

This test simply checks whether we can print an optimized
function argument. With recent changes to Clang the assumption
that we don't generate a `DW_AT_location` attribute for the
unused funciton parameter breaks.

This patch tries harder to get Clang to drop the location
from DWARF by making it generate an `undef` for `unused1`.
Drop the check for `unused2` since it adds no benefit.

Differential Revision: https://reviews.llvm.org/D132635

Added: 


Modified: 

lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
lldb/test/API/functionalities/unused-inlined-parameters/main.c

Removed: 




diff  --git 
a/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
 
b/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
index 2b4cbf7ce7f4e..c80f398b4cbb8 100644
--- 
a/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
+++ 
b/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
@@ -17,5 +17,3 @@ def test_unused_inlined_parameters(self):
 self.assertIn("(void *) unused1 = ",
   
lldbutil.get_description(self.frame().FindVariable("unused1")))
 self.assertEqual(42, 
self.frame().FindVariable("used").GetValueAsUnsigned())
-self.assertIn("(int) unused2 = ",
-  
lldbutil.get_description(self.frame().FindVariable("unused2")))

diff  --git a/lldb/test/API/functionalities/unused-inlined-parameters/main.c 
b/lldb/test/API/functionalities/unused-inlined-parameters/main.c
index f2ef5dcc213dd..6f79221daa4c1 100644
--- a/lldb/test/API/functionalities/unused-inlined-parameters/main.c
+++ b/lldb/test/API/functionalities/unused-inlined-parameters/main.c
@@ -2,11 +2,12 @@
 
 __attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
 
-__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
+__attribute__((always_inline)) void f(void *unused1, int used) {
   use(used); // break here
 }
 
 int main(int argc, char **argv) {
-  f(argv, 42, 1);
+  char *undefined;
+  f(undefined, 42);
   return 0;
-}
\ No newline at end of file
+}



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


[Lldb-commits] [PATCH] D132635: [lldb][Test] Prevent generating DW_AT_location for unused argument

2022-08-25 Thread Michael Buch via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9427487fdbb2: [lldb][Test] Prevent generating DW_AT_location 
for unused argument (authored by Michael137).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132635/new/

https://reviews.llvm.org/D132635

Files:
  
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
  lldb/test/API/functionalities/unused-inlined-parameters/main.c


Index: lldb/test/API/functionalities/unused-inlined-parameters/main.c
===
--- lldb/test/API/functionalities/unused-inlined-parameters/main.c
+++ lldb/test/API/functionalities/unused-inlined-parameters/main.c
@@ -2,11 +2,12 @@
 
 __attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
 
-__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
+__attribute__((always_inline)) void f(void *unused1, int used) {
   use(used); // break here
 }
 
 int main(int argc, char **argv) {
-  f(argv, 42, 1);
+  char *undefined;
+  f(undefined, 42);
   return 0;
-}
\ No newline at end of file
+}
Index: 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
===
--- 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
+++ 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
@@ -17,5 +17,3 @@
 self.assertIn("(void *) unused1 = ",
   
lldbutil.get_description(self.frame().FindVariable("unused1")))
 self.assertEqual(42, 
self.frame().FindVariable("used").GetValueAsUnsigned())
-self.assertIn("(int) unused2 = ",
-  
lldbutil.get_description(self.frame().FindVariable("unused2")))


Index: lldb/test/API/functionalities/unused-inlined-parameters/main.c
===
--- lldb/test/API/functionalities/unused-inlined-parameters/main.c
+++ lldb/test/API/functionalities/unused-inlined-parameters/main.c
@@ -2,11 +2,12 @@
 
 __attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
 
-__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
+__attribute__((always_inline)) void f(void *unused1, int used) {
   use(used); // break here
 }
 
 int main(int argc, char **argv) {
-  f(argv, 42, 1);
+  char *undefined;
+  f(undefined, 42);
   return 0;
-}
\ No newline at end of file
+}
Index: lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
===
--- lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
+++ lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
@@ -17,5 +17,3 @@
 self.assertIn("(void *) unused1 = ",
   lldbutil.get_description(self.frame().FindVariable("unused1")))
 self.assertEqual(42, self.frame().FindVariable("used").GetValueAsUnsigned())
-self.assertIn("(int) unused2 = ",
-  lldbutil.get_description(self.frame().FindVariable("unused2")))
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D132635: [lldb][Test] Prevent generating DW_AT_location for unused argument

2022-08-25 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 455491.
Michael137 added a comment.
Herald added a subscriber: JDevlieghere.

- clang-format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132635/new/

https://reviews.llvm.org/D132635

Files:
  
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
  lldb/test/API/functionalities/unused-inlined-parameters/main.c


Index: lldb/test/API/functionalities/unused-inlined-parameters/main.c
===
--- lldb/test/API/functionalities/unused-inlined-parameters/main.c
+++ lldb/test/API/functionalities/unused-inlined-parameters/main.c
@@ -2,11 +2,12 @@
 
 __attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
 
-__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
+__attribute__((always_inline)) void f(void *unused1, int used) {
   use(used); // break here
 }
 
 int main(int argc, char **argv) {
-  f(argv, 42, 1);
+  char *undefined;
+  f(undefined, 42);
   return 0;
-}
\ No newline at end of file
+}
Index: 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
===
--- 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
+++ 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
@@ -17,5 +17,3 @@
 self.assertIn("(void *) unused1 = ",
   
lldbutil.get_description(self.frame().FindVariable("unused1")))
 self.assertEqual(42, 
self.frame().FindVariable("used").GetValueAsUnsigned())
-self.assertIn("(int) unused2 = ",
-  
lldbutil.get_description(self.frame().FindVariable("unused2")))


Index: lldb/test/API/functionalities/unused-inlined-parameters/main.c
===
--- lldb/test/API/functionalities/unused-inlined-parameters/main.c
+++ lldb/test/API/functionalities/unused-inlined-parameters/main.c
@@ -2,11 +2,12 @@
 
 __attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
 
-__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
+__attribute__((always_inline)) void f(void *unused1, int used) {
   use(used); // break here
 }
 
 int main(int argc, char **argv) {
-  f(argv, 42, 1);
+  char *undefined;
+  f(undefined, 42);
   return 0;
-}
\ No newline at end of file
+}
Index: lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
===
--- lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
+++ lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
@@ -17,5 +17,3 @@
 self.assertIn("(void *) unused1 = ",
   lldbutil.get_description(self.frame().FindVariable("unused1")))
 self.assertEqual(42, self.frame().FindVariable("used").GetValueAsUnsigned())
-self.assertIn("(int) unused2 = ",
-  lldbutil.get_description(self.frame().FindVariable("unused2")))
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D132635: [lldb][Test] Prevent generating DW_AT_location for unused argument

2022-08-25 Thread Michael Buch via Phabricator via lldb-commits
Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This test simply checks whether we can print an optimized
function argument. With recent changes to Clang the assumption
that we don't generate a `DW_AT_location` attribute for the
unused funciton parameter breaks.

This patch tries harder to get Clang to drop the location
from DWARF by making it generate an `undef` for `unused1`.
Drop the check for `unused2` since it adds no benefit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132635

Files:
  
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
  lldb/test/API/functionalities/unused-inlined-parameters/main.c


Index: lldb/test/API/functionalities/unused-inlined-parameters/main.c
===
--- lldb/test/API/functionalities/unused-inlined-parameters/main.c
+++ lldb/test/API/functionalities/unused-inlined-parameters/main.c
@@ -2,11 +2,12 @@
 
 __attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
 
-__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
+__attribute__((always_inline)) void f(void *unused1, int used) {
   use(used); // break here
 }
 
 int main(int argc, char **argv) {
-  f(argv, 42, 1);
+  char* undefined;
+  f(undefined, 42);
   return 0;
-}
\ No newline at end of file
+}
Index: 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
===
--- 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
+++ 
lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
@@ -17,5 +17,3 @@
 self.assertIn("(void *) unused1 = ",
   
lldbutil.get_description(self.frame().FindVariable("unused1")))
 self.assertEqual(42, 
self.frame().FindVariable("used").GetValueAsUnsigned())
-self.assertIn("(int) unused2 = ",
-  
lldbutil.get_description(self.frame().FindVariable("unused2")))


Index: lldb/test/API/functionalities/unused-inlined-parameters/main.c
===
--- lldb/test/API/functionalities/unused-inlined-parameters/main.c
+++ lldb/test/API/functionalities/unused-inlined-parameters/main.c
@@ -2,11 +2,12 @@
 
 __attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
 
-__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
+__attribute__((always_inline)) void f(void *unused1, int used) {
   use(used); // break here
 }
 
 int main(int argc, char **argv) {
-  f(argv, 42, 1);
+  char* undefined;
+  f(undefined, 42);
   return 0;
-}
\ No newline at end of file
+}
Index: lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
===
--- lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
+++ lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
@@ -17,5 +17,3 @@
 self.assertIn("(void *) unused1 = ",
   lldbutil.get_description(self.frame().FindVariable("unused1")))
 self.assertEqual(42, self.frame().FindVariable("used").GetValueAsUnsigned())
-self.assertIn("(int) unused2 = ",
-  lldbutil.get_description(self.frame().FindVariable("unused2")))
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits