[Lldb-commits] [PATCH] D140262: [lldb][TypeSystemClang][NFC] Introduce TemplateParameterInfos::ArgumentMetadata

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Not needed anymore due to simpler implementation at 
https://reviews.llvm.org/D141828


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140262

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


[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 492456.
Michael137 added a comment.

- Use constructor instead of setter


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml

Index: lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
@@ -0,0 +1,314 @@
+# template 
+# class foo {};
+#
+# template  class CT = foo>
+# class baz {};
+#
+# template >
+# class bar {};
+#
+# int main() {
+# bar<> br;
+# baz<> bz;
+# return 0;
+# }
+#
+# YAML generated on Linux using obj2yaml on the above program
+# compiled with Clang.
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+AddressAlign:0x4
+Content: FF4300D1E0031F2AFF0F00B9FF430091C0035FD6
+  - Name:.linker-options
+Type:SHT_LLVM_LINKER_OPTIONS
+Flags:   [ SHF_EXCLUDE ]
+AddressAlign:0x1
+Content: ''
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 011101252513050325721710171B25111B12067317022E0B1206401803253A0B3B0B49133F19033400021803253A0B3B0B491304240003253E0B0B0B050201360B03250B0B3A0B3B0B062F00491303251E19073000491303251E191C0D083000491303251E191C0F09020003253C190A8682010003251E1990422500
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 7F000500010801002100010200140002001400016F03000B49000302910B05000C4D000302910A0E000D780404050405050D010009066E000707490008030872000A010676000C000406080104090201090B0505110100050A0F10
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 4C000500
+  - Name:.comment
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 00636C616E672076657273696F6E2031362E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A65637420343764323862376138323638653337616130646537366238353966343530386533646261633663652900
+  - Name:.note.GNU-stack
+Type:SHT_PROGBITS
+AddressAlign:0x1
+  - Name:.eh_frame
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 117A5200017C1E011B0C1F001800180014440E104C0E
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 5800050008003700010101FB0E0D000101010100010101011F0103011F020F051E010019537E33C1D1006B79E3D1C33D6EE6A3040902030A0105050ABD0208000101
+  - Name:.debug_line_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 2F686F6D652F6761726465690064656661756C74732E63707000
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.debug_info
+Relocations:
+  - Offset:  0x8
+Symbol:  .debug_abbrev
+Type:R_AARCH64_ABS32
+  - Offset:  0x11
+Symbol:  .debug_str_offsets
+Type:R_AARCH64_ABS32
+Addend:  8
+  - Offset:  0x15
+Symbol:  .debug_line
+Type:R_AARCH64_ABS32
+  -

[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:2057
+case DW_AT_default_value:
+  if (attributes.ExtractFormValueAtIndex(i, form_value)) {
+is_default_template_arg = form_value.Boolean();

nit: LLVM coding style doesn't use `{}` on single-statement conditionals.



Comment at: 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py:63
 "sp_str",
-type="std::shared_ptr, std::allocator > >",
+type="std::shared_ptr >",
 children=[ValueCheck(name="__ptr_", summary='"hello"')],

Nice!



Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:38
+Platform::SetHostPlatform(
+PlatformRemoteMacOSX::CreateInstance(true, &arch, nullptr, nullptr));
+  }

Does this work on Linux?



Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:435
+  std::stringstream buffer;
+  std::ifstream ifs{"Inputs/DW_AT_default_value-test.yaml"};
+  ASSERT_TRUE(ifs.is_open());

I don't know if this API is a good match here, but just in case you didn't 
know, the canonical LLVM way of reading from files is to use MemoryBuffer 
https://llvm.org/doxygen/classllvm_1_1MemoryBuffer.html#aa98611beefe78f907b7305cc8174



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

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


[Lldb-commits] [PATCH] D141910: [OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend

2023-01-26 Thread Johannes Doerfert via Phabricator via lldb-commits
jdoerfert accepted this revision.
jdoerfert added a comment.

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141910

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


[Lldb-commits] [PATCH] D138618: [LLDB] Enable 64 bit debug/type offset

2023-01-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D138618#4080706 , @labath wrote:

> In D138618#4077851 , @ayermolo 
> wrote:
>
>> In D138618#4073329 , @labath wrote:
>>
>>> I think that the 1-based index thingy helps a lot here, but I haven't seen 
>>> anything (in your reponse, or in the new patch) that would address my 
>>> concernt DIERef<->user_id conversion ambiguity. I.e. how is one supposed to 
>>> know what is the "right" way to convert a DIERef to a user_id:
>>>
>>> - `die_ref.get_id()`
>>> - or `symbol_file.GetUID(die_ref)` (which, funnily enough, will construct 
>>> another DIERef, and *then* call get_id? (`return DIERef(GetID(), 
>>> ref.section(), ref.die_offset()).get_id();`)
>>>
>>> What's your position on that? That we should live with the ambiguity?
>>
>> Searching for GetUID doesn't look like it's used all that often, maybe 
>> follow up patch is just to get rid of it, and replace with DIERef?
>
> If you could make that work, that would be awesome, but I think that's going 
> to be fairly hard. It's true that there aren't that many call sites of this 
> functions, but the ones that are there are very crucial. The user_id_t type 
> represents a symbol-file-neutral identifier (cookie, if you will) that 
> different symbol file implementations use to identify parsed objects (types, 
> mostly). SymbolFileDWARF uses it (via DIERef et al.) to identify the DIE 
> belonging to that type. PDB symbol files use it differently, but the idea is 
> the same. If we wanted to remove that, we'd have to come up with a whole new 
> way to parse/link types -- and one that would work for non-dwarf symbol files 
> as well.

SymbolFileDWARF is the only SymbolFile that inherits from UserID. So this is a 
DWARF internal thing only where symbol files have user_id_t values. So as long 
as we make this work for all things DWARF we are good to go.

> (also, this would not really address my concern, because the question would 
> then become "which DIERef is safe to be used as a Type cookie" (answer: only 
> the one which has the OSO field set), but the reduction in complexity 
> resulting from removing one step from the conversion process 
> (DWARFDIE->DIERef->user_id) might be well worth it.)

DIERef should be used anywhere a DIE needs a user_id_t. If DIERef now uses the 
file index (OSO index, or DWO index) in the same way where we always ask the 
SymbolFileDWARFXXX::GetID() as the file index, then things will be the same 
between the two (DWO or OSO).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138618

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


[Lldb-commits] [PATCH] D138618: [LLDB] Enable 64 bit debug/type offset

2023-01-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

We just need to create all DIERef objects using the GetID() from the symbol 
file as the file index, and we should be able to remove the 
SymbolFile::GetUID() function now. As long as file index zero is reserved for 
"vanilla DWARF that doesn't use DWO or OSO we will know the difference. We 
might want to not have SymbolFileDWARF inherit from UserID at all, and switch 
over to have SymbolFileDWARF add a virtual function:

  uint32_t m_file_index = 0; // Zero means main DWARF file, 1...N identifies 
the Nth DWO file or OSO file
  virtual uint32_t GetFileIndex() { return m_file_index; }

Then anyone can set the file index correctly for DWO or OSO files. And we avoid 
using user_id_t values for the symbol files since they aren't needed.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DIERef.h:53
+
+  void set_die_offset(dw_offset_t offset) {
+lldbassert(offset <= DW_INVALID_OFFSET);

labath wrote:
> Can we remove this function now?
We should be able to, and we should move this lldbassert to the constructor to 
ensure that die_offset is not too large.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138618

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


[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 492537.
Michael137 added a comment.

- Use `GetInputFilePath` and `MemoryBuffer` to read test YAML file
- Remove redundant test-fixture initialization


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml

Index: lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
@@ -0,0 +1,314 @@
+# template 
+# class foo {};
+#
+# template  class CT = foo>
+# class baz {};
+#
+# template >
+# class bar {};
+#
+# int main() {
+# bar<> br;
+# baz<> bz;
+# return 0;
+# }
+#
+# YAML generated on Linux using obj2yaml on the above program
+# compiled with Clang.
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+AddressAlign:0x4
+Content: FF4300D1E0031F2AFF0F00B9FF430091C0035FD6
+  - Name:.linker-options
+Type:SHT_LLVM_LINKER_OPTIONS
+Flags:   [ SHF_EXCLUDE ]
+AddressAlign:0x1
+Content: ''
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 011101252513050325721710171B25111B12067317022E0B1206401803253A0B3B0B49133F19033400021803253A0B3B0B491304240003253E0B0B0B050201360B03250B0B3A0B3B0B062F00491303251E19073000491303251E191C0D083000491303251E191C0F09020003253C190A8682010003251E1990422500
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 7F000500010801002100010200140002001400016F03000B49000302910B05000C4D000302910A0E000D780404050405050D010009066E000707490008030872000A010676000C000406080104090201090B0505110100050A0F10
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 4C000500
+  - Name:.comment
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 00636C616E672076657273696F6E2031362E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A65637420343764323862376138323638653337616130646537366238353966343530386533646261633663652900
+  - Name:.note.GNU-stack
+Type:SHT_PROGBITS
+AddressAlign:0x1
+  - Name:.eh_frame
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 117A5200017C1E011B0C1F001800180014440E104C0E
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 5800050008003700010101FB0E0D000101010100010101011F0103011F020F051E010019537E33C1D1006B79E3D1C33D6EE6A3040902030A0105050ABD0208000101
+  - Name:.debug_line_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 2F686F6D652F6761726465690064656661756C74732E63707000
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.debug_info
+Relocations:
+  - Offset:  0x8
+Symbol:  .debug_abbrev
+Type:R_AARCH64_ABS32
+  - Offset:  0x11
+Symbol:  .debug_str_offsets
+Type:R_AARCH64_ABS32
+Addend:

[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added inline comments.



Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:38
+Platform::SetHostPlatform(
+PlatformRemoteMacOSX::CreateInstance(true, &arch, nullptr, nullptr));
+  }

aprantl wrote:
> Does this work on Linux?
Didn't actually need these


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

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


[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 492538.
Michael137 added a comment.

- clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml

Index: lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
@@ -0,0 +1,314 @@
+# template 
+# class foo {};
+#
+# template  class CT = foo>
+# class baz {};
+#
+# template >
+# class bar {};
+#
+# int main() {
+# bar<> br;
+# baz<> bz;
+# return 0;
+# }
+#
+# YAML generated on Linux using obj2yaml on the above program
+# compiled with Clang.
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+AddressAlign:0x4
+Content: FF4300D1E0031F2AFF0F00B9FF430091C0035FD6
+  - Name:.linker-options
+Type:SHT_LLVM_LINKER_OPTIONS
+Flags:   [ SHF_EXCLUDE ]
+AddressAlign:0x1
+Content: ''
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 011101252513050325721710171B25111B12067317022E0B1206401803253A0B3B0B49133F19033400021803253A0B3B0B491304240003253E0B0B0B050201360B03250B0B3A0B3B0B062F00491303251E19073000491303251E191C0D083000491303251E191C0F09020003253C190A8682010003251E1990422500
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 7F000500010801002100010200140002001400016F03000B49000302910B05000C4D000302910A0E000D780404050405050D010009066E000707490008030872000A010676000C000406080104090201090B0505110100050A0F10
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 4C000500
+  - Name:.comment
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 00636C616E672076657273696F6E2031362E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A65637420343764323862376138323638653337616130646537366238353966343530386533646261633663652900
+  - Name:.note.GNU-stack
+Type:SHT_PROGBITS
+AddressAlign:0x1
+  - Name:.eh_frame
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 117A5200017C1E011B0C1F001800180014440E104C0E
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 5800050008003700010101FB0E0D000101010100010101011F0103011F020F051E010019537E33C1D1006B79E3D1C33D6EE6A3040902030A0105050ABD0208000101
+  - Name:.debug_line_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 2F686F6D652F6761726465690064656661756C74732E63707000
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.debug_info
+Relocations:
+  - Offset:  0x8
+Symbol:  .debug_abbrev
+Type:R_AARCH64_ABS32
+  - Offset:  0x11
+Symbol:  .debug_str_offsets
+Type:R_AARCH64_ABS32
+Addend:  8
+  - Offset:  0x15
+Symbol:  .debug_line
+Type:

[Lldb-commits] [PATCH] D142662: Allow bytes-only mach-o corefile to load into lldb

2023-01-26 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda created this revision.
jasonmolenda added reviewers: JDevlieghere, mib.
jasonmolenda added a project: LLDB.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

`ProcessMachCore::DoLoadCore` has an error check that if it found no thread 
contexts (`LC_THREAD`s), it is an improperly formed corefile and will be 
rejected.  We have a group that is creating memory-only corefiles, and will 
provide threads from an operating system or scripted process python plugin that 
they write.  This removes the error handling from DoLoadCore -- I can't 
remember this catching problems with corrupt corefiles in real world use.

I haven't cooked up a test for it at this point; it would be possible to run a 
user process, `process save-core` it, write a utility program that rewrites the 
corefiles to remove the LC_THREAD load commands, loads it into lldb, and 
confirms that memory can still be examined.  But given the simplicity of the 
change, I don't feel super motivated to write all that.  I'm open to it though, 
if other people feel it would be a good addition to our test coverage.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142662

Files:
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp


Index: lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
===
--- lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -483,13 +483,6 @@
 return error;
   }
 
-  if (core_objfile->GetNumThreadContexts() == 0) {
-error.SetErrorString("core file doesn't contain any LC_THREAD load "
- "commands, or the LC_THREAD architecture is not "
- "supported in this lldb");
-return error;
-  }
-
   SetCanJIT(false);
 
   // The corefile's architecture is our best starting point.


Index: lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
===
--- lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -483,13 +483,6 @@
 return error;
   }
 
-  if (core_objfile->GetNumThreadContexts() == 0) {
-error.SetErrorString("core file doesn't contain any LC_THREAD load "
- "commands, or the LC_THREAD architecture is not "
- "supported in this lldb");
-return error;
-  }
-
   SetCanJIT(false);
 
   // The corefile's architecture is our best starting point.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ca44603 - [OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend

2023-01-26 Thread Dominik Adamski via lldb-commits

Author: Dominik Adamski
Date: 2023-01-26T15:10:19-06:00
New Revision: ca446037af019d1aa01b1352a30a18df33038359

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

LOG: [OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend

Currently default simd alignment is defined by Clang specific TargetInfo class.
This class cannot be reused for LLVM Flang. That's why default simd alignment
calculation has been moved to OMPIRBuilder which is common for Flang and Clang.

Previous attempt: https://reviews.llvm.org/D138496 was wrong because
the default alignment depended on the number of built LLVM targets.

If we wanted to calculate the default alignment for PPC and we hadn't specified
PPC LLVM target to build, then we would get 0 as the alignment because
OMPIRBuilder couldn't create PPCTargetMachine object and it returned 0 as
the default value.

If PPC LLVM target had been built earlier, then OMPIRBuilder could have created
PPCTargetMachine object and it would have returned 128.

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

Reviewed By: jdoerfert

Added: 


Modified: 
clang/include/clang/Basic/TargetInfo.h
clang/lib/AST/ASTContext.cpp
clang/lib/Basic/TargetInfo.cpp
clang/lib/Basic/Targets/PPC.h
clang/lib/Basic/Targets/WebAssembly.h
clang/lib/Basic/Targets/X86.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index bb2a453f46573..b30368aa822f5 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -225,7 +225,6 @@ class TargetInfo : public virtual TransferrableTargetInfo,
   bool HasStrictFP;
 
   unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
-  unsigned short SimdDefaultAlign;
   std::string DataLayoutString;
   const char *UserLabelPrefix;
   const char *MCountName;
@@ -794,10 +793,6 @@ class TargetInfo : public virtual TransferrableTargetInfo,
 
   /// Return the maximum vector alignment supported for the given target.
   unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
-  /// Return default simd alignment for the given target. Generally, this
-  /// value is type-specific, but this alignment can be used for most of the
-  /// types for the given target.
-  unsigned getSimdDefaultAlign() const { return SimdDefaultAlign; }
 
   unsigned getMaxOpenCLWorkGroupSize() const { return MaxOpenCLWorkGroupSize; }
 

diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index bdbf1891190e4..84434ced242d3 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -78,6 +78,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/Support/Capacity.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Compiler.h"
@@ -2542,7 +2543,8 @@ unsigned ASTContext::getTypeUnadjustedAlign(const Type 
*T) const {
 }
 
 unsigned ASTContext::getOpenMPDefaultSimdAlign(QualType T) const {
-  unsigned SimdAlign = getTargetInfo().getSimdDefaultAlign();
+  unsigned SimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
+  getTargetInfo().getTriple(), Target->getTargetOpts().FeatureMap);
   return SimdAlign;
 }
 

diff  --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 8ee43261fc1d3..fa5e568d599d0 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -119,7 +119,6 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
   MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0;
   MaxVectorAlign = 0;
   MaxTLSAlign = 0;
-  SimdDefaultAlign = 0;
   SizeType = UnsignedLong;
   PtrDiffType = SignedLong;
   IntMaxType = SignedLongLong;

diff  --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index cc185fdadfcbc..4c02183feb4c1 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -87,7 +87,6 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public 
TargetInfo {
   PPCTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
 SuitableAlign = 128;
-SimdDefaultAlign = 128;
 LongDoubleWidth = LongDoubleAlign = 128;
 LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble();
 HasStrictFP = true;

diff  --git a/clang/lib/Basic/Targets/WebAssembly.h 
b/clang/lib/Basic/Targets/WebAssembly.h
index 1e73450fdd0c3..1f0bb08665347 100644
--- a/clang/lib/Basic/Targets/WebAssembly.h
+++ b/clang/lib/Basic/Targets/WebAssembly.h
@@ -49,7 +49,6 @@ class LLVM_LIBRARY_VISIBILITY WebA

[Lldb-commits] [PATCH] D141910: [OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend

2023-01-26 Thread Dominik Adamski 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 rGca446037af01: [OpenMP][OMPIRBuilder]Move SIMD alignment 
calculation to LLVM Frontend (authored by domada).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141910

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/Basic/Targets/WebAssembly.h
  clang/lib/Basic/Targets/X86.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3053,6 +3053,23 @@
   Builder.CreateBr(NewBlocks.front());
 }
 
+unsigned
+OpenMPIRBuilder::getOpenMPDefaultSimdAlign(const Triple &TargetTriple,
+   const StringMap &Features) {
+  if (TargetTriple.isX86()) {
+if (Features.lookup("avx512f"))
+  return 512;
+else if (Features.lookup("avx"))
+  return 256;
+return 128;
+  }
+  if (TargetTriple.isPPC())
+return 128;
+  if (TargetTriple.isWasm())
+return 128;
+  return 0;
+}
+
 void OpenMPIRBuilder::applySimd(CanonicalLoopInfo *CanonicalLoop,
 MapVector AlignedVars,
 Value *IfCond, OrderKind Order,
Index: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
===
--- llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -502,6 +502,13 @@
ArrayRef Loops,
InsertPointTy ComputeIP);
 
+  /// Get the default alignment value for given target
+  ///
+  /// \param TargetTriple   Target triple
+  /// \param Features   StringMap which describes extra CPU features
+  static unsigned getOpenMPDefaultSimdAlign(const Triple &TargetTriple,
+const StringMap &Features);
+
 private:
   /// Modifies the canonical loop to be a statically-scheduled workshare loop.
   ///
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -500,8 +500,6 @@
   auto target_info = TargetInfo::CreateTargetInfo(
   m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts);
   if (log) {
-LLDB_LOGF(log, "Using SIMD alignment: %d",
-  target_info->getSimdDefaultAlign());
 LLDB_LOGF(log, "Target datalayout string: '%s'",
   target_info->getDataLayoutString());
 LLDB_LOGF(log, "Target ABI: '%s'", target_info->getABI().str().c_str());
Index: clang/lib/Basic/Targets/X86.cpp
===
--- clang/lib/Basic/Targets/X86.cpp
+++ clang/lib/Basic/Targets/X86.cpp
@@ -400,9 +400,6 @@
 return false;
   }
 
-  SimdDefaultAlign =
-  hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
-
   // FIXME: We should allow long double type on 32-bits to match with GCC.
   // This requires backend to be able to lower f80 without x87 first.
   if (!HasX87 && LongDoubleFormat == &llvm::APFloat::x87DoubleExtended())
Index: clang/lib/Basic/Targets/WebAssembly.h
===
--- clang/lib/Basic/Targets/WebAssembly.h
+++ clang/lib/Basic/Targets/WebAssembly.h
@@ -49,7 +49,6 @@
 SuitableAlign = 128;
 LargeArrayMinWidth = 128;
 LargeArrayAlign = 128;
-SimdDefaultAlign = 128;
 SigAtomicType = SignedLong;
 LongDoubleWidth = LongDoubleAlign = 128;
 LongDoubleFormat = &llvm::APFloat::IEEEquad();
Index: clang/lib/Basic/Targets/PPC.h
===
--- clang/lib/Basic/Targets/PPC.h
+++ clang/lib/Basic/Targets/PPC.h
@@ -87,7 +87,6 @@
   PPCTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
 SuitableAlign = 128;
-SimdDefaultAlign = 128;
 LongDoubleWidth = LongDoubleAlign = 128;
 LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble();
 HasStrictFP = true;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -119,7 +119,6 @@
   MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0;
   MaxVectorAlign = 0;
   MaxTLSAlign = 0;
-  SimdDefaultAlign = 0;

[Lldb-commits] [PATCH] D142662: Allow bytes-only mach-o corefile to load into lldb

2023-01-26 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib accepted this revision.
mib 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/D142662/new/

https://reviews.llvm.org/D142662

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


[Lldb-commits] [PATCH] D142663: Improve disable-language-runtime-unwindplans description to be more searchable

2023-01-26 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda created this revision.
jasonmolenda added a reviewer: kastiglione.
jasonmolenda added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

The current description for "disable-language-runtime-unwindplans" can only be 
found with `apropos` by searching for `backtracing`.  It should be discoverable 
with terms like `stack` and `backtrace`.  I'm also not thrilled with my mention 
of "LanguageRuntime" here, because no one outside lldb developers would know 
what that means.  Maybe this is a little better.  Open to suggestions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142663

Files:
  lldb/source/Target/TargetProperties.td


Index: lldb/source/Target/TargetProperties.td
===
--- lldb/source/Target/TargetProperties.td
+++ lldb/source/Target/TargetProperties.td
@@ -216,7 +216,7 @@
   def DisableLangRuntimeUnwindPlans: 
Property<"disable-language-runtime-unwindplans", "Boolean">,
 Global,
 DefaultFalse,
-Desc<"If true, LanguageRuntime plugins' UnwindPlans will not be used when 
backtracing.">;
+Desc<"If true, language runtime augmented/overidden backtraces will not be 
used when printing a stack trace.">;
   def DetachKeepsStopped: Property<"detach-keeps-stopped", "Boolean">,
 Global,
 DefaultFalse,


Index: lldb/source/Target/TargetProperties.td
===
--- lldb/source/Target/TargetProperties.td
+++ lldb/source/Target/TargetProperties.td
@@ -216,7 +216,7 @@
   def DisableLangRuntimeUnwindPlans: Property<"disable-language-runtime-unwindplans", "Boolean">,
 Global,
 DefaultFalse,
-Desc<"If true, LanguageRuntime plugins' UnwindPlans will not be used when backtracing.">;
+Desc<"If true, language runtime augmented/overidden backtraces will not be used when printing a stack trace.">;
   def DetachKeepsStopped: Property<"detach-keeps-stopped", "Boolean">,
 Global,
 DefaultFalse,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D142552: [lldb] Make GetDIENamesAndRanges() allow 0-valued decl and call lines

2023-01-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

As long as there are no regressions in the test suite this looks good to me


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142552

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


[Lldb-commits] [PATCH] D139957: [LLDB] Change OSO to use DieRef

2023-01-26 Thread Alexander Yermolovich via Phabricator via lldb-commits
ayermolo marked an inline comment as done.
ayermolo added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DIERef.h:32
 
-  DIERef(std::optional dwo_num, Section section,
+  DIERef(std::optional dwo_oso_num, Section section,
  dw_offset_t die_offset)

labath wrote:
> Where is this constructor being used?
In SymbolFileDWARF.cpp
SymbolFileDWARF::GetUID
SymbolFileDWARF::DecodeUID


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139957

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


[Lldb-commits] [lldb] dc682ed - [test][lldb-vscode] Fix unclean shutdown in test_terminate_commands

2023-01-26 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2023-01-26T14:29:48-08:00
New Revision: dc682ed590f73f7b7417ecf66d18b303ab957c62

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

LOG: [test][lldb-vscode] Fix unclean shutdown in test_terminate_commands

This test manually sends `terminateCommands` to shutdown, but then the test 
attempts another `terminateCommands` request in test tear down, which fails 
since it's already torn down. This error is ignored in LLDB's old fork of 
unittest2, but will be reported as a test failure in `unittest` from the Python 
standard library. Use `disconnectAutomatically` to avoid terminating twice.

Added: 


Modified: 
lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py 
b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
index 6e916d72dda7d..e6976a8abffdc 100644
--- a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -445,7 +445,8 @@ def test_terminate_commands(self):
 
 terminateCommands = ['expr 4+2']
 self.launch(program=program,
-terminateCommands=terminateCommands)
+terminateCommands=terminateCommands,
+disconnectAutomatically=False)
 self.get_console()
 # Once it's disconnected the console should contain the
 # "terminateCommands"



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


[Lldb-commits] [PATCH] D142672: [lldb] Make SBSection::GetSectionData call Section::GetSectionData.

2023-01-26 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
jgorbe created this revision.
jgorbe added a reviewer: labath.
jgorbe added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jgorbe requested review of this revision.

`SBSection::GetSectionData` and `Section::GetSectionData` are
implemented differently, and the `SBSection` method doesn't handle
compressed sections correctly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142672

Files:
  lldb/source/API/SBSection.cpp
  lldb/test/API/python_api/section/TestSectionAPI.py
  lldb/test/API/python_api/section/compressed-sections.yaml


Index: lldb/test/API/python_api/section/compressed-sections.yaml
===
--- /dev/null
+++ lldb/test/API/python_api/section/compressed-sections.yaml
@@ -0,0 +1,11 @@
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_386
+Sections:
+  - Name:.compressed
+Type:SHT_PROGBITS
+Flags:   [ SHF_COMPRESSED ]
+Content: 010008000100789c533070084828689809c802c1
Index: lldb/test/API/python_api/section/TestSectionAPI.py
===
--- lldb/test/API/python_api/section/TestSectionAPI.py
+++ lldb/test/API/python_api/section/TestSectionAPI.py
@@ -48,3 +48,18 @@
 section = target.modules[0].sections[0]
 self.assertEqual(section.GetAlignment(), 0x1000)
 self.assertEqual(section.alignment, 0x1000)
+
+def test_compressed_section_data(self):
+exe = self.getBuildArtifact("compressed-sections.out")
+self.yaml2obj("compressed-sections.yaml", exe)
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# exe contains a single section with SHF_COMPRESSED. Check that
+# GetSectionData returns the uncompressed data and not the raw contents
+# of the section.
+section = target.modules[0].sections[0]
+section_data = section.GetSectionData().uint8s
+self.assertEqual(section_data,
+ [0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90])
+
Index: lldb/source/API/SBSection.cpp
===
--- lldb/source/API/SBSection.cpp
+++ lldb/source/API/SBSection.cpp
@@ -182,35 +182,11 @@
   SBData sb_data;
   SectionSP section_sp(GetSP());
   if (section_sp) {
-const uint64_t sect_file_size = section_sp->GetFileSize();
-if (sect_file_size > 0) {
-  ModuleSP module_sp(section_sp->GetModule());
-  if (module_sp) {
-ObjectFile *objfile = module_sp->GetObjectFile();
-if (objfile) {
-  const uint64_t sect_file_offset =
-  objfile->GetFileOffset() + section_sp->GetFileOffset();
-  const uint64_t file_offset = sect_file_offset + offset;
-  uint64_t file_size = size;
-  if (file_size == UINT64_MAX) {
-file_size = section_sp->GetByteSize();
-if (file_size > offset)
-  file_size -= offset;
-else
-  file_size = 0;
-  }
-  auto data_buffer_sp = FileSystem::Instance().CreateDataBuffer(
-  objfile->GetFileSpec().GetPath(), file_size, file_offset);
-  if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0) {
-DataExtractorSP data_extractor_sp(
-new DataExtractor(data_buffer_sp, objfile->GetByteOrder(),
-  objfile->GetAddressByteSize()));
-
-sb_data.SetOpaque(data_extractor_sp);
-  }
-}
-  }
-}
+DataExtractor section_data;
+section_sp->GetSectionData(section_data);
+DataExtractorSP result_data_sp =
+std::make_shared(section_data, offset, size);
+sb_data.SetOpaque(result_data_sp);
   }
   return sb_data;
 }


Index: lldb/test/API/python_api/section/compressed-sections.yaml
===
--- /dev/null
+++ lldb/test/API/python_api/section/compressed-sections.yaml
@@ -0,0 +1,11 @@
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_386
+Sections:
+  - Name:.compressed
+Type:SHT_PROGBITS
+Flags:   [ SHF_COMPRESSED ]
+Content: 010008000100789c533070084828689809c802c1
Index: lldb/test/API/python_api/section/TestSectionAPI.py
===
--- lldb/test/API/python_api/section/TestSectionAPI.py
+++ lldb/test/API/python_api/section/TestSectionAPI.py
@@ -48,3 +48,18 @@
 section = target.modules[0].sections[0]
 self.assertEqual(section.GetAlignment(), 0x1000)
 self.assertEqual(section.alignment, 0x1000)
+
+def test_compressed_section_data(self):
+exe 

[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 492580.
Michael137 added a comment.

- Remove dead code


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml

Index: lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
@@ -0,0 +1,314 @@
+# template 
+# class foo {};
+#
+# template  class CT = foo>
+# class baz {};
+#
+# template >
+# class bar {};
+#
+# int main() {
+# bar<> br;
+# baz<> bz;
+# return 0;
+# }
+#
+# YAML generated on Linux using obj2yaml on the above program
+# compiled with Clang.
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+AddressAlign:0x4
+Content: FF4300D1E0031F2AFF0F00B9FF430091C0035FD6
+  - Name:.linker-options
+Type:SHT_LLVM_LINKER_OPTIONS
+Flags:   [ SHF_EXCLUDE ]
+AddressAlign:0x1
+Content: ''
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 011101252513050325721710171B25111B12067317022E0B1206401803253A0B3B0B49133F19033400021803253A0B3B0B491304240003253E0B0B0B050201360B03250B0B3A0B3B0B062F00491303251E19073000491303251E191C0D083000491303251E191C0F09020003253C190A8682010003251E1990422500
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 7F000500010801002100010200140002001400016F03000B49000302910B05000C4D000302910A0E000D780404050405050D010009066E000707490008030872000A010676000C000406080104090201090B0505110100050A0F10
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 4C000500
+  - Name:.comment
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 00636C616E672076657273696F6E2031362E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A65637420343764323862376138323638653337616130646537366238353966343530386533646261633663652900
+  - Name:.note.GNU-stack
+Type:SHT_PROGBITS
+AddressAlign:0x1
+  - Name:.eh_frame
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 117A5200017C1E011B0C1F001800180014440E104C0E
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 5800050008003700010101FB0E0D000101010100010101011F0103011F020F051E010019537E33C1D1006B79E3D1C33D6EE6A3040902030A0105050ABD0208000101
+  - Name:.debug_line_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 2F686F6D652F6761726465690064656661756C74732E63707000
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.debug_info
+Relocations:
+  - Offset:  0x8
+Symbol:  .debug_abbrev
+Type:R_AARCH64_ABS32
+  - Offset:  0x11
+Symbol:  .debug_str_offsets
+Type:R_AARCH64_ABS32
+Addend:  8
+  - Offset:  0x15
+Symbol:  .debug_line
+Type:

[Lldb-commits] [PATCH] D142672: [lldb] Make SBSection::GetSectionData call Section::GetSectionData.

2023-01-26 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added inline comments.



Comment at: lldb/source/API/SBSection.cpp:187-189
+DataExtractorSP result_data_sp =
+std::make_shared(section_data, offset, size);
+sb_data.SetOpaque(result_data_sp);

Probably either use `std::move` when passing `result_data_sp` to `SetOpaque`, 
or roll the expressions together (to avoid an unnecessary copy of a ref counted 
smart pointer, that would cause extra increment/decrement of the ref count)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142672

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


[Lldb-commits] [PATCH] D142672: [lldb] Make SBSection::GetSectionData call Section::GetSectionData.

2023-01-26 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
jgorbe updated this revision to Diff 492602.
jgorbe added a comment.

Addressing review comment.


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

https://reviews.llvm.org/D142672

Files:
  lldb/source/API/SBSection.cpp
  lldb/test/API/python_api/section/TestSectionAPI.py
  lldb/test/API/python_api/section/compressed-sections.yaml


Index: lldb/test/API/python_api/section/compressed-sections.yaml
===
--- /dev/null
+++ lldb/test/API/python_api/section/compressed-sections.yaml
@@ -0,0 +1,11 @@
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_386
+Sections:
+  - Name:.compressed
+Type:SHT_PROGBITS
+Flags:   [ SHF_COMPRESSED ]
+Content: 010008000100789c533070084828689809c802c1
Index: lldb/test/API/python_api/section/TestSectionAPI.py
===
--- lldb/test/API/python_api/section/TestSectionAPI.py
+++ lldb/test/API/python_api/section/TestSectionAPI.py
@@ -48,3 +48,18 @@
 section = target.modules[0].sections[0]
 self.assertEqual(section.GetAlignment(), 0x1000)
 self.assertEqual(section.alignment, 0x1000)
+
+def test_compressed_section_data(self):
+exe = self.getBuildArtifact("compressed-sections.out")
+self.yaml2obj("compressed-sections.yaml", exe)
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# exe contains a single section with SHF_COMPRESSED. Check that
+# GetSectionData returns the uncompressed data and not the raw contents
+# of the section.
+section = target.modules[0].sections[0]
+section_data = section.GetSectionData().uint8s
+self.assertEqual(section_data,
+ [0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90])
+
Index: lldb/source/API/SBSection.cpp
===
--- lldb/source/API/SBSection.cpp
+++ lldb/source/API/SBSection.cpp
@@ -182,35 +182,10 @@
   SBData sb_data;
   SectionSP section_sp(GetSP());
   if (section_sp) {
-const uint64_t sect_file_size = section_sp->GetFileSize();
-if (sect_file_size > 0) {
-  ModuleSP module_sp(section_sp->GetModule());
-  if (module_sp) {
-ObjectFile *objfile = module_sp->GetObjectFile();
-if (objfile) {
-  const uint64_t sect_file_offset =
-  objfile->GetFileOffset() + section_sp->GetFileOffset();
-  const uint64_t file_offset = sect_file_offset + offset;
-  uint64_t file_size = size;
-  if (file_size == UINT64_MAX) {
-file_size = section_sp->GetByteSize();
-if (file_size > offset)
-  file_size -= offset;
-else
-  file_size = 0;
-  }
-  auto data_buffer_sp = FileSystem::Instance().CreateDataBuffer(
-  objfile->GetFileSpec().GetPath(), file_size, file_offset);
-  if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0) {
-DataExtractorSP data_extractor_sp(
-new DataExtractor(data_buffer_sp, objfile->GetByteOrder(),
-  objfile->GetAddressByteSize()));
-
-sb_data.SetOpaque(data_extractor_sp);
-  }
-}
-  }
-}
+DataExtractor section_data;
+section_sp->GetSectionData(section_data);
+sb_data.SetOpaque(
+std::make_shared(section_data, offset, size));
   }
   return sb_data;
 }


Index: lldb/test/API/python_api/section/compressed-sections.yaml
===
--- /dev/null
+++ lldb/test/API/python_api/section/compressed-sections.yaml
@@ -0,0 +1,11 @@
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_386
+Sections:
+  - Name:.compressed
+Type:SHT_PROGBITS
+Flags:   [ SHF_COMPRESSED ]
+Content: 010008000100789c533070084828689809c802c1
Index: lldb/test/API/python_api/section/TestSectionAPI.py
===
--- lldb/test/API/python_api/section/TestSectionAPI.py
+++ lldb/test/API/python_api/section/TestSectionAPI.py
@@ -48,3 +48,18 @@
 section = target.modules[0].sections[0]
 self.assertEqual(section.GetAlignment(), 0x1000)
 self.assertEqual(section.alignment, 0x1000)
+
+def test_compressed_section_data(self):
+exe = self.getBuildArtifact("compressed-sections.out")
+self.yaml2obj("compressed-sections.yaml", exe)
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# exe contains a single section with SHF_COMPRESSED. Check that
+# GetSectio

[Lldb-commits] [PATCH] D142672: [lldb] Make SBSection::GetSectionData call Section::GetSectionData.

2023-01-26 Thread Jorge Gorbe Moya via Phabricator via lldb-commits
jgorbe marked an inline comment as done.
jgorbe added inline comments.



Comment at: lldb/source/API/SBSection.cpp:187-189
+DataExtractorSP result_data_sp =
+std::make_shared(section_data, offset, size);
+sb_data.SetOpaque(result_data_sp);

dblaikie wrote:
> Probably either use `std::move` when passing `result_data_sp` to `SetOpaque`, 
> or roll the expressions together (to avoid an unnecessary copy of a ref 
> counted smart pointer, that would cause extra increment/decrement of the ref 
> count)
Done, inlined `result_data_sp` into the `SetOpaque` call. Thanks!


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

https://reviews.llvm.org/D142672

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


[Lldb-commits] [lldb] d5c0b1f - [test] Remove unused `unittest2` import

2023-01-26 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2023-01-26T18:02:16-08:00
New Revision: d5c0b1f73b0502158d9b3afa0ba7b22b69f0823e

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

LOG: [test] Remove unused `unittest2` import

Added: 


Modified: 
lldb/test/API/python_api/target/TestTargetAPI.py

Removed: 




diff  --git a/lldb/test/API/python_api/target/TestTargetAPI.py 
b/lldb/test/API/python_api/target/TestTargetAPI.py
index f1a379bc2f30e..15ac04cfa74c4 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -2,7 +2,6 @@
 Test SBTarget APIs.
 """
 
-import unittest2
 import os
 import lldb
 from lldbsuite.test.decorators import *
@@ -29,7 +28,6 @@ def setUp(self):
 #
 # It does not segfaults now.  But for dwarf, the variable value is None if
 # the inferior process does not exist yet.  The radar has been updated.
-#@unittest232.skip("segmentation fault -- skipping")
 def test_find_global_variables(self):
 """Exercise SBTarget.FindGlobalVariables() API."""
 d = {'EXE': 'b.out'}
@@ -128,7 +126,8 @@ def test_get_ABIName(self):
 process = target.LaunchSimple(
 None, None, self.get_process_working_directory())
 abi_after_launch = target.GetABIName()
-self.assertEqual(abi_pre_launch, abi_after_launch, "ABI's match before 
and during run")
+self.assertEqual(abi_pre_launch, abi_after_launch,
+ "ABI's match before and during run")
 
 def test_read_memory(self):
 d = {'EXE': 'b.out'}
@@ -157,7 +156,6 @@ def test_read_memory(self):
 self.assertSuccess(error, "Make sure memory read succeeded")
 self.assertEqual(len(content), 1)
 
-
 @skipIfWindows  # stdio manipulation unsupported on Windows
 @skipIfRemote   # stdio manipulation unsupported on remote iOS 
devices
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
@@ -371,7 +369,7 @@ def test_launch_new_process_and_redirect_stdout(self):
 
 if lldb.remote_platform:
 stdout_path = lldbutil.append_to_process_working_directory(self,
-"lldb-stdout-redirect.txt")
+   
"lldb-stdout-redirect.txt")
 else:
 stdout_path = local_path
 error = lldb.SBError()
@@ -492,16 +490,17 @@ def test_default_arch(self):
 """ Test the other two target create methods using LLDB_ARCH_DEFAULT. 
"""
 self.build()
 exe = self.getBuildArtifact("a.out")
-target = self.dbg.CreateTargetWithFileAndArch(exe, 
lldb.LLDB_ARCH_DEFAULT)
+target = self.dbg.CreateTargetWithFileAndArch(
+exe, lldb.LLDB_ARCH_DEFAULT)
 self.assertTrue(target.IsValid(), "Default arch made a valid target.")
 # This should also work with the target's triple:
 target2 = self.dbg.CreateTargetWithFileAndArch(exe, target.GetTriple())
 self.assertTrue(target2.IsValid(), "Round trip with triple works")
 # And this triple should work for the FileAndTriple API:
-target3 = self.dbg.CreateTargetWithFileAndTargetTriple(exe, 
target.GetTriple())
+target3 = self.dbg.CreateTargetWithFileAndTargetTriple(
+exe, target.GetTriple())
 self.assertTrue(target3.IsValid())
 
-
 @skipIfWindows
 def test_is_loaded(self):
 """Exercise SBTarget.IsLoaded(SBModule&) API."""



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


[Lldb-commits] [PATCH] D142683: Manual DWARF index: don't skip over -gmodules debug info

2023-01-26 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: clayborg, JDevlieghere.
Herald added a subscriber: arphaman.
Herald added a project: All.
aprantl requested review of this revision.

This fixes a regression introduced by https://reviews.llvm.org/D131437. The 
intention of the patch was to avoid indexing DWO skeleton units, but it also 
skipped over full DWARF compile units linked via a -gmodules DW_AT_dwo_name 
attribute. This patch restores the functionality and adds a test for it.


https://reviews.llvm.org/D142683

Files:
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/test/Shell/SymbolFile/DWARF/Inputs/pch.h
  lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c


Index: lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c
@@ -0,0 +1,18 @@
+// UNSUPPORTED: system-windows
+
+// Test that LLDB can follow DWO links produced by -gmodules debug
+// info to find a type in a precompiled header.
+// 
+// RUN: %clangxx_host -g -gmodules -fmodules -std=c99 -x c-header 
%S/Inputs/pch.h -g -c -o %t.pch
+// RUN: %clangxx_host -g -gmodules -fmodules -std=c99 -x c -include-pch %t.pch 
%s -c -o %t.o
+// RUN: %clangxx_host %t.o -o %t.exe
+// RUN: lldb-test symbols -dump-clang-ast -find type --language=C99 \
+// RUN:   -compiler-context 'AnyModule:*,Struct:TypeFromPCH' %t.exe | 
FileCheck %s
+
+anchor_t anchor;
+
+int main(int argc, char **argv) { return 0; }
+
+// CHECK: Found 1 type
+// CHECK: "TypeFromPCH"
+// CHECK: FieldDecl {{.*}} field
Index: lldb/test/Shell/SymbolFile/DWARF/Inputs/pch.h
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/Inputs/pch.h
@@ -0,0 +1,5 @@
+typedef int anchor_t;
+
+struct TypeFromPCH {
+  int field;
+};
Index: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -162,12 +162,12 @@
   // though as some functions have template parameter types and other things
   // that cause extra copies of types to be included, but we should find these
   // types in the .dwo file only as methods could have return types removed and
-  // we don't have to index incomplete types from the skeletone compile unit.
+  // we don't have to index incomplete types from the skeleton compile unit.
   if (unit.GetDWOId()) {
 if (SymbolFileDWARFDwo *dwo_symbol_file = unit.GetDwoSymbolFile()) {
   // Type units in a dwp file are indexed separately, so we just need to
-  // process the split unit here. However, if the split unit is in a dwo 
file,
-  // then we need to process type units here.
+  // process the split unit here. However, if the split unit is in a dwo
+  // file, then we need to process type units here.
   if (dwo_symbol_file == dwp) {
 IndexUnitImpl(unit.GetNonSkeletonUnit(), cu_language, set);
   } else {
@@ -175,11 +175,14 @@
 for (size_t i = 0; i < dwo_info.GetNumUnits(); ++i)
   IndexUnitImpl(*dwo_info.GetUnitAtIndex(i), cu_language, set);
   }
+  return;
 }
-  } else {
-// We either have a normal compile unit which we want to index.
-IndexUnitImpl(unit, cu_language, set);
+// The unit has a dwo_id, but this isn't a .dwo skeleton unit, so
+// the assumption is that this is a file produced by -gmodules and
+// that we want to index it.
   }
+  // We have a normal compile unit which we want to index.
+  IndexUnitImpl(unit, cu_language, set);
 }
 
 void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,


Index: lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c
@@ -0,0 +1,18 @@
+// UNSUPPORTED: system-windows
+
+// Test that LLDB can follow DWO links produced by -gmodules debug
+// info to find a type in a precompiled header.
+// 
+// RUN: %clangxx_host -g -gmodules -fmodules -std=c99 -x c-header %S/Inputs/pch.h -g -c -o %t.pch
+// RUN: %clangxx_host -g -gmodules -fmodules -std=c99 -x c -include-pch %t.pch %s -c -o %t.o
+// RUN: %clangxx_host %t.o -o %t.exe
+// RUN: lldb-test symbols -dump-clang-ast -find type --language=C99 \
+// RUN:   -compiler-context 'AnyModule:*,Struct:TypeFromPCH' %t.exe | FileCheck %s
+
+anchor_t anchor;
+
+int main(int argc, char **argv) { return 0; }
+
+// CHECK: Found 1 type
+// CHECK: "TypeFromPCH"
+// CHECK: FieldDecl {{.*}} field
Index: lldb/test/Shell/SymbolFile/DWARF/Inputs/pch.h
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/Inputs/pch.h
@@ -0,0 +1,5 @@
+typedef int anchor_t;
+
+struct TypeFromPCH {
+  int

[Lldb-commits] [PATCH] D142683: Manual DWARF index: don't skip over -gmodules debug info

2023-01-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:167
   if (unit.GetDWOId()) {
 if (SymbolFileDWARFDwo *dwo_symbol_file = unit.GetDwoSymbolFile()) {
   // Type units in a dwp file are indexed separately, so we just need to

Won't this return nullptr in the fission case where the .dwo file is missing or 
deleted?



Comment at: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:180-182
+// The unit has a dwo_id, but this isn't a .dwo skeleton unit, so
+// the assumption is that this is a file produced by -gmodules and
+// that we want to index it.

Can we do a bit more to ensure we aren't using fission here? Are there no other 
differences between -gmodules and fission we can key off of? Existence of 
.debug_addr section for fission only?


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

https://reviews.llvm.org/D142683

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


[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

LGTM! (I think you some superfluous #includes now)




Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:21
+#include 
+#include 
+

I think this is no longer needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

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


[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 492621.
Michael137 added a comment.

- Remove redundant includes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml

Index: lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
@@ -0,0 +1,314 @@
+# template 
+# class foo {};
+#
+# template  class CT = foo>
+# class baz {};
+#
+# template >
+# class bar {};
+#
+# int main() {
+# bar<> br;
+# baz<> bz;
+# return 0;
+# }
+#
+# YAML generated on Linux using obj2yaml on the above program
+# compiled with Clang.
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+AddressAlign:0x4
+Content: FF4300D1E0031F2AFF0F00B9FF430091C0035FD6
+  - Name:.linker-options
+Type:SHT_LLVM_LINKER_OPTIONS
+Flags:   [ SHF_EXCLUDE ]
+AddressAlign:0x1
+Content: ''
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 011101252513050325721710171B25111B12067317022E0B1206401803253A0B3B0B49133F19033400021803253A0B3B0B491304240003253E0B0B0B050201360B03250B0B3A0B3B0B062F00491303251E19073000491303251E191C0D083000491303251E191C0F09020003253C190A8682010003251E1990422500
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 7F000500010801002100010200140002001400016F03000B49000302910B05000C4D000302910A0E000D780404050405050D010009066E000707490008030872000A010676000C000406080104090201090B0505110100050A0F10
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 4C000500
+  - Name:.comment
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 00636C616E672076657273696F6E2031362E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A65637420343764323862376138323638653337616130646537366238353966343530386533646261633663652900
+  - Name:.note.GNU-stack
+Type:SHT_PROGBITS
+AddressAlign:0x1
+  - Name:.eh_frame
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 117A5200017C1E011B0C1F001800180014440E104C0E
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 5800050008003700010101FB0E0D000101010100010101011F0103011F020F051E010019537E33C1D1006B79E3D1C33D6EE6A3040902030A0105050ABD0208000101
+  - Name:.debug_line_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 2F686F6D652F6761726465690064656661756C74732E63707000
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.debug_info
+Relocations:
+  - Offset:  0x8
+Symbol:  .debug_abbrev
+Type:R_AARCH64_ABS32
+  - Offset:  0x11
+Symbol:  .debug_str_offsets
+Type:R_AARCH64_ABS32
+Addend:  8
+  - Offset:  0x15
+Symbol:  .debug_line
+

[Lldb-commits] [lldb] dd9b31e - [test] Remove unused `unittest2` import from concurrent_base.py

2023-01-26 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2023-01-26T18:23:23-08:00
New Revision: dd9b31e2c2a271c9e6059dde6a406aea5ed8b663

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

LOG: [test] Remove unused `unittest2` import from concurrent_base.py

Added: 


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

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/concurrent_base.py 
b/lldb/packages/Python/lldbsuite/test/concurrent_base.py
index a235ceb76413f..b695b3a1a8f3b 100644
--- a/lldb/packages/Python/lldbsuite/test/concurrent_base.py
+++ b/lldb/packages/Python/lldbsuite/test/concurrent_base.py
@@ -11,8 +11,6 @@
 """
 
 
-
-import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *



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


[Lldb-commits] [lldb] a29e06b - [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2023-01-27T02:24:35Z
New Revision: a29e06bbeaad7012ac85b221f1aaba3fe1d5fd35

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

LOG: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

This patch makes the members of `TemplateParameterInfos` only accessible
via public APIs. The motivation for this is that
`TemplateParameterInfos` attempts to maintain two vectors in tandem
(`args` for the template arguments and `names` for the corresponding
name). Working with this structure as it's currently designed makes
it easy to run into out-of-bounds accesses later down the line.

This patch proposes to introduce a new
`TemplateParameterInfos::InsertArg` which is the only way to
set the `TemplateArgument` and name of an entry and since we
require both to be specified we maintain the vectors in sync
out-of-the-box.

To avoid adding non-const getters just for unit-tests a new
`TemplateParameterInfosManipulatorForTests` is introduced
that can be used to control internal state from tests.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/unittests/Symbol/TestTypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 56bd089b86a1e..49c8fae64ed8a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1980,14 +1980,14 @@ bool DWARFASTParserClang::ParseTemplateDIE(
 
   switch (tag) {
   case DW_TAG_GNU_template_parameter_pack: {
-template_param_infos.packed_args =
-std::make_unique();
+template_param_infos.SetParameterPack(
+std::make_unique());
 for (DWARFDIE child_die : die.children()) {
-  if (!ParseTemplateDIE(child_die, *template_param_infos.packed_args))
+  if (!ParseTemplateDIE(child_die, 
template_param_infos.GetParameterPack()))
 return false;
 }
 if (const char *name = die.GetName()) {
-  template_param_infos.pack_name = name;
+  template_param_infos.SetPackName(name);
 }
 return true;
   }
@@ -2044,31 +2044,30 @@ bool DWARFASTParserClang::ParseTemplateDIE(
 
   if (!is_template_template_argument) {
 bool is_signed = false;
-if (name && name[0])
-  template_param_infos.names.push_back(name);
-else
-  template_param_infos.names.push_back(nullptr);
-
 // Get the signed value for any integer or enumeration if available
 clang_type.IsIntegerOrEnumerationType(is_signed);
 
+if (name && !name[0])
+  name = nullptr;
+
 if (tag == DW_TAG_template_value_parameter && uval64_valid) {
   std::optional size = clang_type.GetBitSize(nullptr);
   if (!size)
 return false;
   llvm::APInt apint(*size, uval64, is_signed);
-  template_param_infos.args.push_back(
+  template_param_infos.InsertArg(
+  name,
   clang::TemplateArgument(ast, llvm::APSInt(apint, !is_signed),
   ClangUtil::GetQualType(clang_type)));
 } else {
-  template_param_infos.args.push_back(
+  template_param_infos.InsertArg(
+  name,
   clang::TemplateArgument(ClangUtil::GetQualType(clang_type)));
 }
   } else {
 auto *tplt_type = m_ast.CreateTemplateTemplateParmDecl(template_name);
-template_param_infos.names.push_back(name);
-template_param_infos.args.push_back(
-clang::TemplateArgument(clang::TemplateName(tplt_type)));
+template_param_infos.InsertArg(
+name, clang::TemplateArgument(clang::TemplateName(tplt_type)));
   }
 }
   }
@@ -2102,10 +2101,9 @@ bool DWARFASTParserClang::ParseTemplateParameterInfos(
   break;
 }
   }
-  return template_param_infos.args.size() ==
- template_param_infos.names.size() &&
- (!template_param_infos.args.empty() ||
-  template_param_infos.packed_args);
+
+  return !template_param_infos.IsEmpty() ||
+ template_param_infos.hasParameterPack();
 }
 
 bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die,

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index e3c61b0f00bb4..ec43ed2593916 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1379,18 +1379,21 @@ static TemplateParameterList 
*CreateTem

[Lldb-commits] [lldb] 1aee040 - [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2023-01-27T02:24:36Z
New Revision: 1aee040c6545ad65d87b14a694078c182b9fa359

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

LOG: [lldb] Add support for DW_AT_default_value in template params

**Summary**

This patch makes LLDB understand the `DW_AT_default_value` on
template argument DIEs. As a result, type summaries will no
longer contain the defaulted template arguments, reducing
noise substantially. E.g.,

Before:
```
(lldb) v nested
(std::vector, 
std::allocator >, std::allocator, std::allocator > > >, 
std::allocator, 
std::allocator >, std::allocator, std::allocator  > > > > >) nested = size=0 {}
```

After:
```
(lldb) v nested
(std::vector > >) nested = size=0 {}
```

See discussion in https://reviews.llvm.org/D140423

**Testing**

* Adjust API tests
* Added unit-test

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

Added: 
lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 49c8fae64ed8a..4429b4fcae2a0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2003,6 +2003,7 @@ bool DWARFASTParserClang::ParseTemplateDIE(
 CompilerType clang_type;
 uint64_t uval64 = 0;
 bool uval64_valid = false;
+bool is_default_template_arg = false;
 if (num_attributes > 0) {
   DWARFFormValue form_value;
   for (size_t i = 0; i < num_attributes; ++i) {
@@ -2033,6 +2034,10 @@ bool DWARFASTParserClang::ParseTemplateDIE(
 uval64 = form_value.Unsigned();
   }
   break;
+case DW_AT_default_value:
+  if (attributes.ExtractFormValueAtIndex(i, form_value))
+is_default_template_arg = form_value.Boolean();
+  break;
 default:
   break;
 }
@@ -2058,16 +2063,19 @@ bool DWARFASTParserClang::ParseTemplateDIE(
   template_param_infos.InsertArg(
   name,
   clang::TemplateArgument(ast, llvm::APSInt(apint, !is_signed),
-  ClangUtil::GetQualType(clang_type)));
+  ClangUtil::GetQualType(clang_type),
+  is_default_template_arg));
 } else {
   template_param_infos.InsertArg(
-  name,
-  clang::TemplateArgument(ClangUtil::GetQualType(clang_type)));
+  name, clang::TemplateArgument(ClangUtil::GetQualType(clang_type),
+/*isNullPtr*/ false,
+is_default_template_arg));
 }
   } else {
 auto *tplt_type = m_ast.CreateTemplateTemplateParmDecl(template_name);
 template_param_infos.InsertArg(
-name, clang::TemplateArgument(clang::TemplateName(tplt_type)));
+name, clang::TemplateArgument(clang::TemplateName(tplt_type),
+  is_default_template_arg));
   }
 }
   }

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
index c646fccc2f5eb..b20ac521c7c32 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
@@ -60,7 +60,7 @@ def test_shared_ptr_variables(self):
 
 valobj = self.expect_var_path(
 "sp_str",
-type="std::shared_ptr, std::allocator > >",
+type="std::shared_ptr >",
 children=[ValueCheck(name="__ptr_", summary='"hello"')],
 )
 self.assertRegex(valobj.summary, r'^"hello"( strong=1)? weak=1$')

diff  --

[Lldb-commits] [PATCH] D141828: [lldb] Add support for DW_AT_default_value in template params

2023-01-26 Thread Michael Buch 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 rG1aee040c6545: [lldb] Add support for DW_AT_default_value in 
template params (authored by Michael137).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141828

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml

Index: lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_default_value-test.yaml
@@ -0,0 +1,314 @@
+# template 
+# class foo {};
+#
+# template  class CT = foo>
+# class baz {};
+#
+# template >
+# class bar {};
+#
+# int main() {
+# bar<> br;
+# baz<> bz;
+# return 0;
+# }
+#
+# YAML generated on Linux using obj2yaml on the above program
+# compiled with Clang.
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+AddressAlign:0x4
+Content: FF4300D1E0031F2AFF0F00B9FF430091C0035FD6
+  - Name:.linker-options
+Type:SHT_LLVM_LINKER_OPTIONS
+Flags:   [ SHF_EXCLUDE ]
+AddressAlign:0x1
+Content: ''
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 011101252513050325721710171B25111B12067317022E0B1206401803253A0B3B0B49133F19033400021803253A0B3B0B491304240003253E0B0B0B050201360B03250B0B3A0B3B0B062F00491303251E19073000491303251E191C0D083000491303251E191C0F09020003253C190A8682010003251E1990422500
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 7F000500010801002100010200140002001400016F03000B49000302910B05000C4D000302910A0E000D780404050405050D010009066E000707490008030872000A010676000C000406080104090201090B0505110100050A0F10
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 4C000500
+  - Name:.comment
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 00636C616E672076657273696F6E2031362E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A65637420343764323862376138323638653337616130646537366238353966343530386533646261633663652900
+  - Name:.note.GNU-stack
+Type:SHT_PROGBITS
+AddressAlign:0x1
+  - Name:.eh_frame
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+AddressAlign:0x8
+Content: 117A5200017C1E011B0C1F001800180014440E104C0E
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 5800050008003700010101FB0E0D000101010100010101011F0103011F020F051E010019537E33C1D1006B79E3D1C33D6EE6A3040902030A0105050ABD0208000101
+  - Name:.debug_line_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 2F686F6D652F6761726465690064656661756C74732E63707000
+  - Name:.rela.debug_info
+Type:SHT_RELA
+Flags:   [ SHF_INFO_LINK ]
+Link:.symtab
+AddressAlign:0x8
+Info:.debug_info
+Relocations:
+  - Offset:  0x8
+Symbol:  .debug_abbrev
+Type:R_AARCH64_ABS32
+  - Offset:  0x11
+Symbol:  .debug_str_offsets
+  

[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Got landed in 
https://reviews.llvm.org/rGa29e06bbeaad7012ac85b221f1aaba3fe1d5fd35

Forgot about your last comment re. variable names in the tests Pavel. Will 
change in a follow-up commit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140030

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


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Didn't rebase properly and broke the build
Fixing...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140030

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


[Lldb-commits] [lldb] 41a2d7a - [lldb][NFC] Build fix: use TemplateParameterInfos public APIs instead of accessing private members

2023-01-26 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2023-01-27T03:10:21Z
New Revision: 41a2d7a37cb1665f061a6ec6edd31a749417b024

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

LOG: [lldb][NFC] Build fix: use TemplateParameterInfos public APIs instead of 
accessing private members

Fixes build failures caused by a faulty rebase
in `a29e06bbeaad7012ac85b221f1aaba3fe1d5fd35`

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

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index ec43ed259391..3c1fc4093c3b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1440,10 +1440,12 @@ std::string TypeSystemClang::PrintTemplateParams(
   clang::TemplateParameterList *template_param_list =
   CreateTemplateParameterList(getASTContext(), template_param_infos,
   ignore);
-  llvm::SmallVector args =
-  template_param_infos.args;
+  llvm::SmallVector args(
+  template_param_infos.GetArgs());
   if (template_param_infos.hasParameterPack()) {
-args.append(template_param_infos.packed_args->args);
+llvm::ArrayRef pack_args =
+template_param_infos.GetParameterPackArgs();
+args.append(pack_args.begin(), pack_args.end());
   }
   std::string str;
   llvm::raw_string_ostream os(str);



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


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG41a2d7a37cb1: [lldb][NFC] Build fix: use 
TemplateParameterInfos public APIs instead of… (authored by Michael137).

Changed prior to commit:
  https://reviews.llvm.org/D140030?vs=483759&id=492631#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140030

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


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1440,10 +1440,12 @@
   clang::TemplateParameterList *template_param_list =
   CreateTemplateParameterList(getASTContext(), template_param_infos,
   ignore);
-  llvm::SmallVector args =
-  template_param_infos.args;
+  llvm::SmallVector args(
+  template_param_infos.GetArgs());
   if (template_param_infos.hasParameterPack()) {
-args.append(template_param_infos.packed_args->args);
+llvm::ArrayRef pack_args =
+template_param_infos.GetParameterPackArgs();
+args.append(pack_args.begin(), pack_args.end());
   }
   std::string str;
   llvm::raw_string_ostream os(str);


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1440,10 +1440,12 @@
   clang::TemplateParameterList *template_param_list =
   CreateTemplateParameterList(getASTContext(), template_param_infos,
   ignore);
-  llvm::SmallVector args =
-  template_param_infos.args;
+  llvm::SmallVector args(
+  template_param_infos.GetArgs());
   if (template_param_infos.hasParameterPack()) {
-args.append(template_param_infos.packed_args->args);
+llvm::ArrayRef pack_args =
+template_param_infos.GetParameterPackArgs();
+args.append(pack_args.begin(), pack_args.end());
   }
   std::string str;
   llvm::raw_string_ostream os(str);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Argh seems like Phabricator didn't like the fact I linked the revision in a 
different commit. So to see the actual change that got landed as part of this 
you need to visit the history tab.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140030

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


[Lldb-commits] [lldb] 8e8dd11 - [lldb][Test][NFC] TestCreateClassTemplateDecl: make variable names more readable

2023-01-26 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2023-01-27T03:46:50Z
New Revision: 8e8dd110be5f1b4944a9dacd4f4a09bf8ecc6892

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

LOG: [lldb][Test][NFC] TestCreateClassTemplateDecl: make variable names more 
readable

Suggested in https://reviews.llvm.org/D140030

Added: 


Modified: 
lldb/unittests/Symbol/TestTypeSystemClang.cpp

Removed: 




diff  --git a/lldb/unittests/Symbol/TestTypeSystemClang.cpp 
b/lldb/unittests/Symbol/TestTypeSystemClang.cpp
index 556eb333c3f35..ec5cc776d960f 100644
--- a/lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ b/lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -600,25 +600,25 @@ TEST_F(TestCreateClassTemplateDecl, 
FindExistingTemplates) {
   // Test an empty template parameter list: <>
   ExpectNewTemplate("<>", {{}, {}});
 
-  clang::TemplateArgument intArg1(m_ast->getASTContext().IntTy);
-  clang::TemplateArgument intArg2(m_ast->getASTContext(),
-  llvm::APSInt(llvm::APInt(32, 47)),
-  m_ast->getASTContext().IntTy);
+  clang::TemplateArgument intArg(m_ast->getASTContext().IntTy);
+  clang::TemplateArgument int47Arg(m_ast->getASTContext(),
+   llvm::APSInt(llvm::APInt(32, 47)),
+   m_ast->getASTContext().IntTy);
   clang::TemplateArgument floatArg(m_ast->getASTContext().FloatTy);
-  clang::TemplateArgument charArg1(m_ast->getASTContext(),
-   llvm::APSInt(llvm::APInt(8, 47)),
-   m_ast->getASTContext().SignedCharTy);
+  clang::TemplateArgument char47Arg(m_ast->getASTContext(),
+llvm::APSInt(llvm::APInt(8, 47)),
+m_ast->getASTContext().SignedCharTy);
 
-  clang::TemplateArgument charArg2(m_ast->getASTContext(),
-   llvm::APSInt(llvm::APInt(8, 123)),
-   m_ast->getASTContext().SignedCharTy);
+  clang::TemplateArgument char123Arg(m_ast->getASTContext(),
+ llvm::APSInt(llvm::APInt(8, 123)),
+ m_ast->getASTContext().SignedCharTy);
 
   // Test that  with T = int creates a new template.
   ClassTemplateDecl *single_type_arg =
-  ExpectNewTemplate("", {{"T"}, {intArg1}});
+  ExpectNewTemplate("", {{"T"}, {intArg}});
 
   // Test that changing the parameter name doesn't create a new class template.
-  ExpectReusedTemplate(" (A = int)", {{"A"}, {intArg1}},
+  ExpectReusedTemplate(" (A = int)", {{"A"}, {intArg}},
single_type_arg);
 
   // Test that changing the used type doesn't create a new class template.
@@ -629,50 +629,51 @@ TEST_F(TestCreateClassTemplateDecl, 
FindExistingTemplates) {
   // and I = 47;
   ClassTemplateDecl *type_and_char_value =
   ExpectNewTemplate(" (I = 47)",
-{{"A", "I"}, {floatArg, charArg1}});
+{{"A", "I"}, {floatArg, char47Arg}});
 
   // Change the value of the I parameter to 123. The previously created
   // class template should still be reused.
   ExpectReusedTemplate(" (I = 123)",
-   {{"A", "I"}, {floatArg, charArg2}}, 
type_and_char_value);
+   {{"A", "I"}, {floatArg, char123Arg}},
+   type_and_char_value);
 
   // Change the type of the I parameter to int so we have .
   // The class template from above can't be reused.
   ExpectNewTemplate(" (I = 123)",
-{{"A", "I"}, {floatArg, intArg2}});
+{{"A", "I"}, {floatArg, int47Arg}});
 
   // Test a second type parameter will also cause a new template to be created.
   // We now have .
   ClassTemplateDecl *type_and_char_value_and_type =
   ExpectNewTemplate("",
-{{"A", "I", "B"}, {floatArg, intArg2, intArg1}});
+{{"A", "I", "B"}, {floatArg, int47Arg, intArg}});
 
   // Remove all the names from the parameters which shouldn't influence the
   // way the templates get merged.
   ExpectReusedTemplate("",
-   {{"", "", ""}, {floatArg, intArg2, intArg1}},
+   {{"", "", ""}, {floatArg, int47Arg, intArg}},
type_and_char_value_and_type);
 }
 
 TEST_F(TestCreateClassTemplateDecl, FindExistingTemplatesWithParameterPack) {
   // The same as FindExistingTemplates but for templates with parameter packs.
   TypeSystemClang::TemplateParameterInfos infos;
-  clang::TemplateArgument intArg1(m_ast->getASTContext().IntTy);
-  clang::TemplateArgument intArg2(m_ast->getASTContext(),
+  clang::TemplateArgument intArg(m_ast->getASTContext().IntTy);
+  clang::TemplateArgument int1Ar

[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Test variable renaming committed in https://reviews.llvm.org/rG8e8dd110be5f


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140030

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