[Lldb-commits] [PATCH] D116136: [lldb] Add missing UTF-8 char basic type entries

2022-06-13 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6d5b86f851a1: [lldb] Add missing UTF-8 char basic type 
entries (authored by ljmf00).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116136

Files:
  lldb/bindings/python/python-extensions.swig
  lldb/docs/python_api_enums.rst


Index: lldb/docs/python_api_enums.rst
===
--- lldb/docs/python_api_enums.rst
+++ lldb/docs/python_api_enums.rst
@@ -1017,9 +1017,9 @@
 .. py:data:: eBasicTypeWChar
 .. py:data:: eBasicTypeSignedWChar
 .. py:data:: eBasicTypeUnsignedWChar
-.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeChar16
 .. py:data:: eBasicTypeChar32
+.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeShort
 .. py:data:: eBasicTypeUnsignedShort
 .. py:data:: eBasicTypeInt
Index: lldb/bindings/python/python-extensions.swig
===
--- lldb/bindings/python/python-extensions.swig
+++ lldb/bindings/python/python-extensions.swig
@@ -565,6 +565,7 @@
 if basic_type == eBasicTypeUnsignedWChar: return (True,False)
 if basic_type == eBasicTypeChar16: return (True,False)
 if basic_type == eBasicTypeChar32: return (True,False)
+if basic_type == eBasicTypeChar8: return (True,False)
 if basic_type == eBasicTypeShort: return (True,True)
 if basic_type == eBasicTypeUnsignedShort: return (True,False)
 if basic_type == eBasicTypeInt: return (True,True)


Index: lldb/docs/python_api_enums.rst
===
--- lldb/docs/python_api_enums.rst
+++ lldb/docs/python_api_enums.rst
@@ -1017,9 +1017,9 @@
 .. py:data:: eBasicTypeWChar
 .. py:data:: eBasicTypeSignedWChar
 .. py:data:: eBasicTypeUnsignedWChar
-.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeChar16
 .. py:data:: eBasicTypeChar32
+.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeShort
 .. py:data:: eBasicTypeUnsignedShort
 .. py:data:: eBasicTypeInt
Index: lldb/bindings/python/python-extensions.swig
===
--- lldb/bindings/python/python-extensions.swig
+++ lldb/bindings/python/python-extensions.swig
@@ -565,6 +565,7 @@
 if basic_type == eBasicTypeUnsignedWChar: return (True,False)
 if basic_type == eBasicTypeChar16: return (True,False)
 if basic_type == eBasicTypeChar32: return (True,False)
+if basic_type == eBasicTypeChar8: return (True,False)
 if basic_type == eBasicTypeShort: return (True,True)
 if basic_type == eBasicTypeUnsignedShort: return (True,False)
 if basic_type == eBasicTypeInt: return (True,True)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D116136: [lldb] Add UTF-8 char basic type

2022-06-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

@labath In the meantime, a lot of time passed and someone patched it in D120690 
, but the order on the documentation is wrong 
and the Python bindings need swig definitions. This patch introduces those, 
after rebasing with main.


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

https://reviews.llvm.org/D116136

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


[Lldb-commits] [PATCH] D116136: [lldb] Add UTF-8 char basic type

2022-06-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 434543.
Herald added a project: All.

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

https://reviews.llvm.org/D116136

Files:
  lldb/bindings/python/python-extensions.swig
  lldb/docs/python_api_enums.rst


Index: lldb/docs/python_api_enums.rst
===
--- lldb/docs/python_api_enums.rst
+++ lldb/docs/python_api_enums.rst
@@ -1017,9 +1017,9 @@
 .. py:data:: eBasicTypeWChar
 .. py:data:: eBasicTypeSignedWChar
 .. py:data:: eBasicTypeUnsignedWChar
-.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeChar16
 .. py:data:: eBasicTypeChar32
+.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeShort
 .. py:data:: eBasicTypeUnsignedShort
 .. py:data:: eBasicTypeInt
Index: lldb/bindings/python/python-extensions.swig
===
--- lldb/bindings/python/python-extensions.swig
+++ lldb/bindings/python/python-extensions.swig
@@ -565,6 +565,7 @@
 if basic_type == eBasicTypeUnsignedWChar: return (True,False)
 if basic_type == eBasicTypeChar16: return (True,False)
 if basic_type == eBasicTypeChar32: return (True,False)
+if basic_type == eBasicTypeChar8: return (True,False)
 if basic_type == eBasicTypeShort: return (True,True)
 if basic_type == eBasicTypeUnsignedShort: return (True,False)
 if basic_type == eBasicTypeInt: return (True,True)


Index: lldb/docs/python_api_enums.rst
===
--- lldb/docs/python_api_enums.rst
+++ lldb/docs/python_api_enums.rst
@@ -1017,9 +1017,9 @@
 .. py:data:: eBasicTypeWChar
 .. py:data:: eBasicTypeSignedWChar
 .. py:data:: eBasicTypeUnsignedWChar
-.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeChar16
 .. py:data:: eBasicTypeChar32
+.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeShort
 .. py:data:: eBasicTypeUnsignedShort
 .. py:data:: eBasicTypeInt
Index: lldb/bindings/python/python-extensions.swig
===
--- lldb/bindings/python/python-extensions.swig
+++ lldb/bindings/python/python-extensions.swig
@@ -565,6 +565,7 @@
 if basic_type == eBasicTypeUnsignedWChar: return (True,False)
 if basic_type == eBasicTypeChar16: return (True,False)
 if basic_type == eBasicTypeChar32: return (True,False)
+if basic_type == eBasicTypeChar8: return (True,False)
 if basic_type == eBasicTypeShort: return (True,True)
 if basic_type == eBasicTypeUnsignedShort: return (True,False)
 if basic_type == eBasicTypeInt: return (True,True)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114719: [lldb][NFC] Move non-clang specific method to the generic DWARF Parser

2022-06-02 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3da4f9c57b15: [lldb][NFC] Move non-clang specific method to 
the generic DWARF Parser (authored by ljmf00).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114719

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
 
 #include 
 
+#include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
@@ -63,20 +64,6 @@
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
-  switch (dwarf_accessibility) {
-  case DW_ACCESS_public:
-return eAccessPublic;
-  case DW_ACCESS_private:
-return eAccessPrivate;
-  case DW_ACCESS_protected:
-return eAccessProtected;
-  default:
-break;
-  }
-  return eAccessNone;
-}
-
 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
   switch (decl_kind) {
   case clang::Decl::CXXRecord:
@@ -314,7 +301,7 @@
   break;
 
 case DW_AT_accessibility:
-  accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
   break;
 
 case DW_AT_artificial:
@@ -1423,7 +1410,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
 
   case DW_AT_virtuality:
@@ -2478,7 +2465,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
   case DW_AT_artificial:
 is_artificial = form_value.Boolean();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
 
 class DWARFDIE;
 namespace lldb_private {
@@ -54,6 +55,8 @@
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE _die,
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+  static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -98,3 +98,18 @@
   }
   return array_info;
 }
+
+AccessType
+DWARFASTParser::GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+  switch (dwarf_accessibility) {
+  case DW_ACCESS_public:
+return eAccessPublic;
+  case DW_ACCESS_private:
+return eAccessPrivate;
+  case DW_ACCESS_protected:
+return eAccessProtected;
+  default:
+break;
+  }
+  return eAccessNone;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2022-06-02 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Sorry for leaving this hanging for a long time. Feel free to leave feedback if 
I'm missing something, in the meantime.

I'll try to push the other patches too. I ran the test suite again and didn't 
break anything.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2022-06-02 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf9b8f422e711: [lldb][NFC] Move generic DWARFASTParser code 
out of Clang-specific code (authored by ljmf00).
Herald added a project: All.

Changed prior to commit:
  https://reviews.llvm.org/D114668?vs=391867=433751#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114668

Files:
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3019,99 +3019,6 @@
   return arg_idx;
 }
 
-llvm::Optional
-DWARFASTParser::ParseChildArrayInfo(const DWARFDIE _die,
-const ExecutionContext *exe_ctx) {
-  SymbolFile::ArrayInfo array_info;
-  if (!parent_die)
-return llvm::None;
-
-  for (DWARFDIE die : parent_die.children()) {
-const dw_tag_t tag = die.Tag();
-if (tag != DW_TAG_subrange_type)
-  continue;
-
-DWARFAttributes attributes;
-const size_t num_child_attributes = die.GetAttributes(attributes);
-if (num_child_attributes > 0) {
-  uint64_t num_elements = 0;
-  uint64_t lower_bound = 0;
-  uint64_t upper_bound = 0;
-  bool upper_bound_valid = false;
-  uint32_t i;
-  for (i = 0; i < num_child_attributes; ++i) {
-const dw_attr_t attr = attributes.AttributeAtIndex(i);
-DWARFFormValue form_value;
-if (attributes.ExtractFormValueAtIndex(i, form_value)) {
-  switch (attr) {
-  case DW_AT_name:
-break;
-
-  case DW_AT_count:
-if (DWARFDIE var_die = die.GetReferencedDIE(DW_AT_count)) {
-  if (var_die.Tag() == DW_TAG_variable)
-if (exe_ctx) {
-  if (auto frame = exe_ctx->GetFrameSP()) {
-Status error;
-lldb::VariableSP var_sp;
-auto valobj_sp = frame->GetValueForVariableExpressionPath(
-var_die.GetName(), eNoDynamicValues, 0, var_sp,
-error);
-if (valobj_sp) {
-  num_elements = valobj_sp->GetValueAsUnsigned(0);
-  break;
-}
-  }
-}
-} else
-  num_elements = form_value.Unsigned();
-break;
-
-  case DW_AT_bit_stride:
-array_info.bit_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_byte_stride:
-array_info.byte_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_lower_bound:
-lower_bound = form_value.Unsigned();
-break;
-
-  case DW_AT_upper_bound:
-upper_bound_valid = true;
-upper_bound = form_value.Unsigned();
-break;
-
-  default:
-  case DW_AT_abstract_origin:
-  case DW_AT_accessibility:
-  case DW_AT_allocated:
-  case DW_AT_associated:
-  case DW_AT_data_location:
-  case DW_AT_declaration:
-  case DW_AT_description:
-  case DW_AT_sibling:
-  case DW_AT_threads_scaled:
-  case DW_AT_type:
-  case DW_AT_visibility:
-break;
-  }
-}
-  }
-
-  if (num_elements == 0) {
-if (upper_bound_valid && upper_bound >= lower_bound)
-  num_elements = upper_bound - lower_bound + 1;
-  }
-
-  array_info.element_orders.push_back(num_elements);
-}
-  }
-  return array_info;
-}
-
 Type *DWARFASTParserClang::GetTypeForDIE(const DWARFDIE ) {
   if (die) {
 SymbolFileDWARF *dwarf = die.GetDWARF();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- /dev/null
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -0,0 +1,100 @@
+//===-- DWARFASTParser.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 "DWARFASTParser.h"
+#include "DWARFAttribute.h"
+#include "DWARFDIE.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Target/StackFrame.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::dwarf;
+
+llvm::Optional

[Lldb-commits] [PATCH] D120690: [PDB] Add char8_t type

2022-03-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Thanks for adding this, I ended up forgoting, since I don't use PDB.




Comment at: lldb/include/lldb/lldb-enumerations.h:752
   eBasicTypeChar32,
+  eBasicTypeChar8,
   eBasicTypeShort,

You forgot to add it to the Python API. It should also be added at the end to 
avoid user-code breakage. See D116136 . I can rebase my change and correct this 
:)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120690

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-02-28 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Meanwhile, a commit will land Linux stable branches soon to fix this issue: 
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=44cad52cc14ae10062f142ec16ede489bccf4469
 . Do we have an alternative way to fix this, e.g. a custom XFAIL flag for 
specific linux versions?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-24 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D117928#3265583 , @mgorny wrote:

> Could you try replacing the new function with the old one and seeing if that 
> helps? Or alternatively, trying to build a kernel from the commit just before 
> that change and with that change.

I can reproduce with the introduced change and by removing the `memset` call, I 
can write to the registers. I submitted a patch to the kernel mailing list. See 
the kernel bug tracker for discussion. I talked a bit about the flow of LLDB to 
discover XSAVE and FXSAVE, although correct me there if I'm wrong.

In D117928#3266895 , @labath wrote:

> If you want, I can try to create a patch for this, though it might take me a 
> couple of days to get around to it.

I'm probably not getting the full picture but my idea on this is: if we propose 
this change due to this specific kernel regression is not worth it, although we 
should consider it if there is any other benefit on using `PTRACE_POKEUSER`.

In D117928#3267103 , @mgorny wrote:

> To explain a bit, `PT_SETXMMREGS` exists because originally `PT_SETFPREGS` 
> used FSAVE format on i386, and this format didn't support setting XMM 
> registers. Newer CPUs support FXSAVE instead, and this is exposed via 
> `PT_SETFPREGS` on amd64 and `PT_SETXMMREGS` on i386.

Ok, makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-23 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D117928#3263992 , @mgorny wrote:

> Thank you. Yes, please test on an older kernel, in case it's specifically a 
> kernel regression.

I can confirm regression on Linux LTS 5.10.93. Probably later and introduced by 
the patch I mentioned. I reported to the kernel bug tracker. See 
https://bugzilla.kernel.org/show_bug.cgi?id=215524 .

In D117928#3264795 , @labath wrote:

> If this is a problem with PTRACE_SETREGSET(NT_FPREGSET), then we might be 
> able to work around it by using PTRACE_POKEUSER instead. But it'd definitely 
> be good to confirm this, so that we can report the bug to kernel devs.

According to `ptrace` documentation `PTRACE_SETFPREGS` seems a better fit, 
although either this and `PTRACE_POKEUSER` disallow writing in some specific 
general-purpose registers, so we should only use this for FP/XMM registers? 
AFAIK BSD-based kernels implements `PT_SETXMMREGS` although I don't see any 
documentation on the Linux kernel side about this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-22 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D117928#3263319 , @mgorny wrote:

> Ok, so to summarize: there's some CPU families where setting `xmm2..xmm9` via 
> ptrace doesn't work for some reason? That's quite weird. Could it be an 
> `xsave` bug perhaps?

Exactly. `ptrace` with `NT_FPREGSET` doesn't work properly but `NT_X86_XSTATE` 
does. It makes sense to me that the presence of AVX triggers this, since, from 
my inspection of the LLDB code, there is a fallback system on `ReadRegisterSet` 
that tries to use `ptrace` with `NT_X86_XSTATE` and fallbacks to `NT_FPREGSET` 
if it fails. The call made with `NT_X86_XSTATE` gives me different output on 
`strace`:

  ptrace(PTRACE_SETREGSET, 213817, NT_X86_XSTATE, {iov_base=0x97dcd4a0, 
iov_len=1088}) = 0
  ptrace(PTRACE_GETREGSET, 213817, NT_X86_XSTATE, {iov_base=0x97dcd4a0, 
iov_len=1088}) = 0



> FWICS the corresponding read test passes, so apparently setting them directly 
> within the program works.

Yes, I can confirm that. Writing directly to registers is fine and reading them 
only triggers `PTRACE_GETREGSET` so, it is reading fine. The problem is when 
`ptrace` is called with `PTRACE_SETREGSET`.
Inspecting the kernel source code I see that `NT_FPREGSET` is triggered by 
`xfpregs_set` 
https://github.com/torvalds/linux/blob/master/arch/x86/kernel/fpu/regset.c#L89 
. That `memset` seems very suspicious here. Blaming the source code, seems to 
be before Linux v5.16 .

This makes sense to me since I use Arch with the latest kernel, and a lot of 
people use LTS versions or outdated versions due to Ubuntu/Debian (according to 
Wikipedia, unstable Debian uses Linux 5.10.46). I will downgrade the kernel and 
try to reproduce this. Ultimately, I can try to recompile the kernel without 
that `memset` and see what happens. I can't find a logical reason in my brain 
other than wrong offsets? If I didn't calculate it wrongly, the range of bytes 
is the same size. Would be cool if anyone have any knowledge of the kernel and 
explain this to me.

> Could you tell us what CPU exactly is this? Ideally paste `/proc/cpuinfo`. 
> I'm pretty sure this test passed successfully on my old Athlon64 that 
> definitely didn't have AVX (or SSE3). Unfortunately, I can't retest it 
> anymore since it died almost 2 years ago.

Is `lscpu` enough? See https://termbin.com/c2pt .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D117928#3262874 , @jingham wrote:

> Ah, I think your confusion is that you missed the “Remote” part of all the 
> classes in lldb that start with “GDB”.   They are so called because they use 
> the “gdb remote serial protocol” to communicate with the debug monitor, not 
> because they have anything to do with gdb the debugger.  That’s a protocol 
> for communication between a debugger and a debug monitor of some sort, 
> devised by people working on gdb aeons ago:
>
> https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
>
> In lldb’s case, that debug monitor can be debugserver (the default on Darwin 
> systems) lldb-server (the default on Linux systems) or anything else that 
> speaks the gdb remote protocol (a lot of JTAG parts come with a gdb remote 
> protocol stub) including potentially gdb’s implementation of the monitor: 
> gdbserver...
>
> But there’s no shared code between gdb & lldb, just a shared communication 
> protocol.
>
> Jim

Thanks, this makes much more sense in my brain and gives me much more control 
to debug this. I'm digging a bit more. I'm tracing Linux kernel syscalls to 
check if data is sent correctly. At first glance, it seems fine to me, so maybe 
it's a `ptrace` issue? I need to investigate a bit more to say that tho. 
`strace` say me this:

  ptrace(PTRACE_SETREGSET, 29772, NT_FPREGSET, {iov_base={cwd=0x37f, swd=0, 
ftw=0, fop=0, rip=0, rdp=0, mxcsr=0x1f80, mxcr_mask=0, st_space=[0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0], xmm_space=[0xa090807, 0xe0d0c0b, 0x1211100f, 0x16151413, 0xa090807, 
0xe0d0c0b, 0x1211100f, 0x16151413, 0xa090807, 0xe0d0c0b, 0x1211100f, 
0x16151413, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...], 
padding=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0]}, iov_len=512}) = 0
  ptrace(PTRACE_GETREGSET, 29772, NT_FPREGSET, {iov_base={cwd=0x37f, swd=0, 
ftw=0, fop=0, rip=0, rdp=0, mxcsr=0x1f80, mxcr_mask=0, st_space=[0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0], xmm_space=[0xa090807, 0xe0d0c0b, 0x1211100f, 0x16151413, 0xa090807, 
0xe0d0c0b, 0x1211100f, 0x16151413, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, ...], padding=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, iov_len=512}) = 0

First call when setting xmm2 and second call when getting the current registers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D117928#3262710 , @jingham wrote:

> I guess we're just all confused that you are mentioning GDB at all, and the 
> only thing I could think of is gdbserver, since that's the only way anything 
> GDB could get mixed with anything LLDB...

Ok, I will try to give some context. I can be wrong/confused and this can be 
unrelated to GDB and a coincidence with my observable behaviour, but running 
LLDB with default settings, `register write` command triggers the following 
function 
https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp#L296
 .

Interestingly, I just did a test right now: removed GDB from my machine and did 
a clean build. That function (`GDBRemoteRegisterContext::WriteRegister`) still 
triggers when `register write`. I'm a bit confused now on why this is 
triggered. Maybe there is a fallback system? I don't have any guidance on this 
whatsoever, so my view on how those plugins work can be wrong. Would be cool to 
have a brief explanation about the //pipeline// of `RegisterContext` and how it 
interacts with `GDBRemoteRegisterContext` to be in sync.

Can be confusing to add a link to the GDB bug tracker, but one thing I can be 
sure of is that this is dependent on the CPU and by the observed behaviour, the 
presence of AVX or some other extension introduced on x86_64-v2 related to XMM 
registers (can't think of another one other than SSE). I can also describe my 
testing environment and give the libvirt/qemu parameters I added to virtualize 
the CPU flags, if needed, but the CPU configuration is similar to the models I 
described. I ran LLDB on a clean archiso live installation.

In D117928#3262762 , @mgorny wrote:

> I'm sorry but I don't understand what you're talking about. Could you explain 
> how are you running tests? Is there some way we can reproduce the problem?

You can see a build log I posted on discourse: 
https://ipfs.io/ipfs/bafybeidsf745d4qxrzhbbir4h23ov4rppvo2uke7qh75oj6lfoi6zkcyre/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D117928#3262689 , @jingham wrote:

> In D117928#3262656 , @JDevlieghere 
> wrote:
>
>> Why are we disabling a lldb test because of a bug in GDB?
>
> Maybe somebody is running the lldb testsuite with gdbserver?  That seems a 
> legit thing to do, but if so, we should make an xfail category for gdbserver 
> and xfail with that.

I haven't considered that. Shouldn't the testsuite run with lldb-server anyway? 
I think so, but how can I confirm that for you?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D117928#3262656 , @JDevlieghere 
wrote:

> Why are we disabling a lldb test because of a bug in GDB?

Because GDB is used on systems that don't implement a `RegisterContext`. I 
added an inline comment about Darwin and Windows XFAIL, as I'm not sure if this 
is just Linux specific. See here 
https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp#L296
 . Take a look at the issue. You can also reproduce this with `register 
write`/`register read` right after.

This ended up breaking my testsuite for a long time, since my server has an 
x86-64-v2 CPU, instead of an x86-64-v3. The buildbots seem to have at least 
x86-64-v3. As described by the issue I tested this on an AVX capable machine 
(x86-64-v3) and virtualized an older CPU to reproduce in a clean environment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/test/Shell/Register/x86-mm-xmm-write.test:1-2
 # XFAIL: system-darwin
 # XFAIL: system-windows
+

Maybe those XFAILs are related to this too. Can anyone test this on those 
systems, if you have a CPU with AVX extensions? I don't know the rationale, 
although.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 added a project: LLDB.
Herald added subscribers: JDevlieghere, pengfei.
ljmf00 requested review of this revision.
Herald added a subscriber: lldb-commits.

This patch disables the following tests on non-AVX machines:

- `lldb-shell :: Register/x86-64-write.test`
- `lldb-shell :: Register/x86-mm-xmm-write.test`

This is due to a bug on GDB that prevents writing some XMM registers on
those machines https://sourceware.org/bugzilla/show_bug.cgi?id=28803 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117928

Files:
  lldb/test/Shell/Register/x86-64-write.test
  lldb/test/Shell/Register/x86-mm-xmm-write.test


Index: lldb/test/Shell/Register/x86-mm-xmm-write.test
===
--- lldb/test/Shell/Register/x86-mm-xmm-write.test
+++ lldb/test/Shell/Register/x86-mm-xmm-write.test
@@ -1,5 +1,9 @@
 # XFAIL: system-darwin
 # XFAIL: system-windows
+
+# Bug on GDB https://sourceware.org/bugzilla/show_bug.cgi?id=28803
+# XFAIL: !native-cpu-avx
+
 # REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
 # RUN: %clangxx_host %p/Inputs/x86-mm-xmm-write.cpp -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
Index: lldb/test/Shell/Register/x86-64-write.test
===
--- lldb/test/Shell/Register/x86-64-write.test
+++ lldb/test/Shell/Register/x86-64-write.test
@@ -1,5 +1,9 @@
 # XFAIL: system-darwin
 # XFAIL: system-windows
+
+# Bug on GDB https://sourceware.org/bugzilla/show_bug.cgi?id=28803
+# XFAIL: !native-cpu-avx
+
 # REQUIRES: native && target-x86_64
 # RUN: %clangxx_host %p/Inputs/x86-64-write.cpp -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s


Index: lldb/test/Shell/Register/x86-mm-xmm-write.test
===
--- lldb/test/Shell/Register/x86-mm-xmm-write.test
+++ lldb/test/Shell/Register/x86-mm-xmm-write.test
@@ -1,5 +1,9 @@
 # XFAIL: system-darwin
 # XFAIL: system-windows
+
+# Bug on GDB https://sourceware.org/bugzilla/show_bug.cgi?id=28803
+# XFAIL: !native-cpu-avx
+
 # REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
 # RUN: %clangxx_host %p/Inputs/x86-mm-xmm-write.cpp -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
Index: lldb/test/Shell/Register/x86-64-write.test
===
--- lldb/test/Shell/Register/x86-64-write.test
+++ lldb/test/Shell/Register/x86-64-write.test
@@ -1,5 +1,9 @@
 # XFAIL: system-darwin
 # XFAIL: system-windows
+
+# Bug on GDB https://sourceware.org/bugzilla/show_bug.cgi?id=28803
+# XFAIL: !native-cpu-avx
+
 # REQUIRES: native && target-x86_64
 # RUN: %clangxx_host %p/Inputs/x86-64-write.cpp -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2022-01-14 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Ping @shafik @bulbazord . Can you re-review?


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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D116972: [lldb] Run the test suite in verbose mode

2022-01-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: zorg/buildbot/builders/LLDBBuilder.py:50
 install_cmd = ['ninja','install']
-test_cmd = ['ninja','check-lldb']
+test_cmd = ['ninja','check-lldb', '-v']
 

ljmf00 wrote:
> I don't know if ninja verbosity propagates to `llvm-lit`, but isn't this more 
> appropriate in `LLVM_LIT_ARGS` cmake flag?
See 
https://github.com/llvm/llvm-zorg/blob/main/zorg/buildbot/builders/ClangBuilder.py#L287
 for reference.


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

https://reviews.llvm.org/D116972

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


[Lldb-commits] [PATCH] D116972: [lldb] Run the test suite in verbose mode

2022-01-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: zorg/buildbot/builders/LLDBBuilder.py:50
 install_cmd = ['ninja','install']
-test_cmd = ['ninja','check-lldb']
+test_cmd = ['ninja','check-lldb', '-v']
 

I don't know if ninja verbosity propagates to `llvm-lit`, but isn't this more 
appropriate in `LLVM_LIT_ARGS` cmake flag?


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

https://reviews.llvm.org/D116972

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


[Lldb-commits] [PATCH] D115662: [lldb][DWARF] Remove duplicate DIE type assignment

2021-12-30 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 planned changes to this revision.
ljmf00 added a comment.

In D115662#3211312 , @labath wrote:

> I don't have any issues with this, if everything still works. I hoped there 
> would be more of a discussion on this (I was hoping I'd maybe learn something 
> from it). That obviously didn't happen, but I don't think it needs to hold 
> this back.

I understand your point and I'm fine with discussing this further since this is 
not a blocker for me :)

I did this as an improvement as I saw this as a duplicate and apparently more 
duplicates of this assignment (see here 
https://github.com/llvm/llvm-project/blob/ed6c757d5c5926a72183cdd15a5b1efc54111db0/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L1552
 ) while reading the code.

To give more context, I'm in the process of generalizing 
`UpdateSymbolContextScopeForType` to be able to use it on other non-Clang 
language plugins (I'm creating a D lldb plugin), see D115201 
. Both the `TypeList` and the DIEToType 
mapping are/were duplicated on `ParseTypeFromClangModule`. That said, 
`UpdateSymbolContextScopeForType` included both and it is useful to do that 
there due to generalization, although I also understand that 
`UpdateSymbolContextScopeForType` is targeted for different tasks.

I propose to either:

1. change the name of `UpdateSymbolContextScopeForType` to accommodate both 
insertions (reverting D115308  and removing 
both assignments on `ParseTypeFromClangModule` and elsewhere)
2. create a separate routine to perform  both insertions (removing it from 
`UpdateSymbolContextScopeForType` and elsewhere)
3. simply delete them from `UpdateSymbolContextScopeForType` and keep it on 
`ParseTypeFromClangModule` and other places.

This patch is actually doing none of that since I didn't find the other 
duplicate assignments at the time of writing it.

I don't have the full picture of this, but this seems to be code that is needed 
independent of the DWARFASTParser. Looking at older implementations of language 
plugins (Go, for example), they copy and pasted 
`UpdateSymbolContextScopeForType` in their implementation (see 
https://github.com/llvm/llvm-project/commit/77198bc79b54267f2ce981c3a6c9c0d6384cac01#diff-0cf0246cf7e5ca0f0d43abe83aff7040786afb07703394799a5122cb6b3a18e7L428
 ).

Note: I don't have active guidance on LLDB codebase, so I try to learn from the 
documentation and the actual codebase by myself. Maybe @zequanwu or @labath 
have more knowledge of the code and they can share their thoughts on this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115662

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


[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2021-12-25 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D114668#3159640 , @bulbazord wrote:

> I think breaking it out of the Clang-specific class makes sense if we want 
> LLDB to be more language-agnostic. Do you have an idea of what bits of 
> `DWARFASTParserClang` can be moved out other than `ParseChildArrayInfo` and 
> `GetAccessTypeFromDWARF` (from the patch on top of this)? What is your 
> end-goal with this decoupling? I assume you want to work towards supporting 
> languages non-clang-based languages but I'm curious about the motivation.

@bulbazord Yes, my plan is to make LLDB interfaces more language-agnostic, to 
accommodate D programming language DWARFASTParser and TypeSystem. I've seen 
other language plugins such as Go that simply copy and paste this method, but I 
want to make D addition clearer and avoid such duplication. You can see more 
similar changes on Clang-specific code decoupling on the stacked changes.

I have made the requested changes, can you re-review, please? Also pinging 
@shafik .


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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D112564: [lldb] Add support for UTF-8 unicode formatting

2021-12-25 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG46cdcf087300: [lldb] Add support for UTF-8 unicode 
formatting (authored by ljmf00).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112564

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py


Index: 
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
===
--- 
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
+++ 
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
@@ -115,8 +115,7 @@
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', 
self.getFormatted("character array", string_expr))
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', 
self.getFormatted("character", string_expr))
 self.assertIn('= ..90zaZA... \n', self.getFormatted("printable 
character", string_expr))
-# FIXME: This should probably print the characters in the uint128_t.
-self.assertIn('= 0x2007080c0a0d090b415a617a30391b00\n', 
self.getFormatted("unicode8", string_expr))
+self.assertIn('= 0x00 0x1b 0x39 0x30 0x7a 0x61 0x5a 0x41 0x0b 0x09 
0x0d 0x0a 0x0c 0x08 0x07 0x20\n', self.getFormatted("unicode8", string_expr))
 
 # OSType
 ostype_expr = "(__UINT64_TYPE__)0x"
@@ -137,6 +136,9 @@
 # bytes with ASCII
 self.assertIn(r'= " \U001b\a\b\f\n\r\t\vaA09\0"', 
self.getFormatted("bytes with ASCII", "cstring"))
 
+# unicode8
+self.assertIn('= 0x78 0x56 0x34 0x12\n', self.getFormatted("unicode8", 
"0x12345678"))
+
 # unicode16
 self.assertIn('= U+5678 U+1234\n', self.getFormatted("unicode16", 
"0x12345678"))
 
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5149,6 +5149,8 @@
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:
   return lldb::eFormatChar;
+case clang::BuiltinType::Char8:
+  return lldb::eFormatUnicode8;
 case clang::BuiltinType::Char16:
   return lldb::eFormatUnicode16;
 case clang::BuiltinType::Char32:
@@ -8957,6 +8959,7 @@
 case eFormatCharPrintable:
 case eFormatCharArray:
 case eFormatBytes:
+case eFormatUnicode8:
 case eFormatBytesWithASCII:
   item_count = byte_size;
   byte_size = 1;


Index: lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
===
--- lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
+++ lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
@@ -115,8 +115,7 @@
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', self.getFormatted("character array", string_expr))
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', self.getFormatted("character", string_expr))
 self.assertIn('= ..90zaZA... \n', self.getFormatted("printable character", string_expr))
-# FIXME: This should probably print the characters in the uint128_t.
-self.assertIn('= 0x2007080c0a0d090b415a617a30391b00\n', self.getFormatted("unicode8", string_expr))
+self.assertIn('= 0x00 0x1b 0x39 0x30 0x7a 0x61 0x5a 0x41 0x0b 0x09 0x0d 0x0a 0x0c 0x08 0x07 0x20\n', self.getFormatted("unicode8", string_expr))
 
 # OSType
 ostype_expr = "(__UINT64_TYPE__)0x"
@@ -137,6 +136,9 @@
 # bytes with ASCII
 self.assertIn(r'= " \U001b\a\b\f\n\r\t\vaA09\0"', self.getFormatted("bytes with ASCII", "cstring"))
 
+# unicode8
+self.assertIn('= 0x78 0x56 0x34 0x12\n', self.getFormatted("unicode8", "0x12345678"))
+
 # unicode16
 self.assertIn('= U+5678 U+1234\n', self.getFormatted("unicode16", "0x12345678"))
 
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5149,6 +5149,8 @@
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:
   return lldb::eFormatChar;
+case clang::BuiltinType::Char8:
+  return lldb::eFormatUnicode8;
 case clang::BuiltinType::Char16:
   return lldb::eFormatUnicode16;
 case clang::BuiltinType::Char32:
@@ -8957,6 +8959,7 @@
 case eFormatCharPrintable:
 case eFormatCharArray:
 case eFormatBytes:
+case eFormatUnicode8:
 

[Lldb-commits] [PATCH] D115662: [lldb][DWARF] Remove duplicate DIE type assignment

2021-12-23 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D115662#3192735 , @labath wrote:

> In D115662#3192651 , @ljmf00 wrote:
>
>> In D115662#3192064 , @labath wrote:
>>
>>> I don't have any issues with this per se, but you may want to sync up with 
>>> @zequanwu, as his D115308  tries to 
>>> delete the second instance.
>>
>> Maybe he can reach out here, but how is this related to D115308 
>>  ?
>
> You're right -- it isn't as related as I originally thought -- you're 
> deduplicating the dietotype map, and he's doing it for the type list.
>
> But it still is related at least on a conceptual level, as both patches deal 
> with recording information about the type, and would be good if those things 
> could happen in a central place (and you seem to have picked different 
> centralization points). Maybe there is a reason it has to be that way (I 
> honestly don't know) but it at least seems like to be aware of each other's 
> efforts.

In the meanwhile, D115308  got merged. What 
are your final thoughts on this? I'm going to rebase and test locally but I'm 
confident that the merged changes doesn't have side effects here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115662

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


[Lldb-commits] [PATCH] D116136: [lldb] Add UTF-8 char basic type

2021-12-22 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D116136#3206294 , @labath wrote:

> I guess you'll want to use this type for your language plugin, but it seems a 
> bit weird to have a value with no uses. Should we maybe also make c++ 
> `char8_t` map to this type?

Yes, that is right, but I'm doing it on the stacked patch D116138 
. Perhaps I should squash both? I just tried 
to separate the changes.




Comment at: lldb/include/lldb/lldb-enumerations.h:750
   eBasicTypeUnsignedWChar,
+  eBasicTypeChar8,
   eBasicTypeChar16,

labath wrote:
> ljmf00 wrote:
> > Does the order of the enum matter here? Since this is part of the public 
> > API it might break something externally.
> Yes, this should go the the end of the enum (though we're not very good at 
> enforcing it, so I wouldn't be surprised if some of these values were added 
> "in the middle").
Ok, I'm going to move to the end to avoid user breakage.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116136

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


[Lldb-commits] [PATCH] D116136: [lldb] Add UTF-8 char basic type

2021-12-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/include/lldb/lldb-enumerations.h:750
   eBasicTypeUnsignedWChar,
+  eBasicTypeChar8,
   eBasicTypeChar16,

Does the order of the enum matter here? Since this is part of the public API it 
might break something externally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116136

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


[Lldb-commits] [PATCH] D116136: [lldb] Add UTF-8 char basic type

2021-12-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

A UTF-8 Basic type should be exposed the same way we have UTF-16 and UTF-32 
basic types


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116136

Files:
  lldb/bindings/python/python-extensions.swig
  lldb/docs/python_api_enums.rst
  lldb/include/lldb/lldb-enumerations.h


Index: lldb/include/lldb/lldb-enumerations.h
===
--- lldb/include/lldb/lldb-enumerations.h
+++ lldb/include/lldb/lldb-enumerations.h
@@ -747,6 +747,7 @@
   eBasicTypeWChar,
   eBasicTypeSignedWChar,
   eBasicTypeUnsignedWChar,
+  eBasicTypeChar8,
   eBasicTypeChar16,
   eBasicTypeChar32,
   eBasicTypeShort,
Index: lldb/docs/python_api_enums.rst
===
--- lldb/docs/python_api_enums.rst
+++ lldb/docs/python_api_enums.rst
@@ -1017,6 +1017,7 @@
 .. py:data:: eBasicTypeWChar
 .. py:data:: eBasicTypeSignedWChar
 .. py:data:: eBasicTypeUnsignedWChar
+.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeChar16
 .. py:data:: eBasicTypeChar32
 .. py:data:: eBasicTypeShort
Index: lldb/bindings/python/python-extensions.swig
===
--- lldb/bindings/python/python-extensions.swig
+++ lldb/bindings/python/python-extensions.swig
@@ -563,6 +563,7 @@
 if basic_type == eBasicTypeWChar: return (True,False)
 if basic_type == eBasicTypeSignedWChar: return (True,True)
 if basic_type == eBasicTypeUnsignedWChar: return (True,False)
+if basic_type == eBasicTypeChar8: return (True,False)
 if basic_type == eBasicTypeChar16: return (True,False)
 if basic_type == eBasicTypeChar32: return (True,False)
 if basic_type == eBasicTypeShort: return (True,True)


Index: lldb/include/lldb/lldb-enumerations.h
===
--- lldb/include/lldb/lldb-enumerations.h
+++ lldb/include/lldb/lldb-enumerations.h
@@ -747,6 +747,7 @@
   eBasicTypeWChar,
   eBasicTypeSignedWChar,
   eBasicTypeUnsignedWChar,
+  eBasicTypeChar8,
   eBasicTypeChar16,
   eBasicTypeChar32,
   eBasicTypeShort,
Index: lldb/docs/python_api_enums.rst
===
--- lldb/docs/python_api_enums.rst
+++ lldb/docs/python_api_enums.rst
@@ -1017,6 +1017,7 @@
 .. py:data:: eBasicTypeWChar
 .. py:data:: eBasicTypeSignedWChar
 .. py:data:: eBasicTypeUnsignedWChar
+.. py:data:: eBasicTypeChar8
 .. py:data:: eBasicTypeChar16
 .. py:data:: eBasicTypeChar32
 .. py:data:: eBasicTypeShort
Index: lldb/bindings/python/python-extensions.swig
===
--- lldb/bindings/python/python-extensions.swig
+++ lldb/bindings/python/python-extensions.swig
@@ -563,6 +563,7 @@
 if basic_type == eBasicTypeWChar: return (True,False)
 if basic_type == eBasicTypeSignedWChar: return (True,True)
 if basic_type == eBasicTypeUnsignedWChar: return (True,False)
+if basic_type == eBasicTypeChar8: return (True,False)
 if basic_type == eBasicTypeChar16: return (True,False)
 if basic_type == eBasicTypeChar32: return (True,False)
 if basic_type == eBasicTypeShort: return (True,True)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D112564: [lldb] Add support for UTF-8 unicode formatting

2021-12-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

@labath I found the missing part, DumpTypeValue depends on lldb::Format and 
eFormatUnicode8 case should be added there too. I added tests and also changed 
the patch message. Can you re-review?


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

https://reviews.llvm.org/D112564

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


[Lldb-commits] [PATCH] D112564: [lldb] Add support for UTF-8 unicode formatting

2021-12-21 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 395777.
ljmf00 retitled this revision from "[lldb] Add support for custom char8_t types 
with different name" to "[lldb] Add support for UTF-8 unicode formatting".
ljmf00 edited the summary of this revision.

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

https://reviews.llvm.org/D112564

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py


Index: 
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
===
--- 
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
+++ 
lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
@@ -115,8 +115,7 @@
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', 
self.getFormatted("character array", string_expr))
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', 
self.getFormatted("character", string_expr))
 self.assertIn('= ..90zaZA... \n', self.getFormatted("printable 
character", string_expr))
-# FIXME: This should probably print the characters in the uint128_t.
-self.assertIn('= 0x2007080c0a0d090b415a617a30391b00\n', 
self.getFormatted("unicode8", string_expr))
+self.assertIn('= 0x00 0x1b 0x39 0x30 0x7a 0x61 0x5a 0x41 0x0b 0x09 
0x0d 0x0a 0x0c 0x08 0x07 0x20\n', self.getFormatted("unicode8", string_expr))
 
 # OSType
 ostype_expr = "(__UINT64_TYPE__)0x"
@@ -137,6 +136,9 @@
 # bytes with ASCII
 self.assertIn(r'= " \U001b\a\b\f\n\r\t\vaA09\0"', 
self.getFormatted("bytes with ASCII", "cstring"))
 
+# unicode8
+self.assertIn('= 0x78 0x56 0x34 0x12\n', self.getFormatted("unicode8", 
"0x12345678"))
+
 # unicode16
 self.assertIn('= U+5678 U+1234\n', self.getFormatted("unicode16", 
"0x12345678"))
 
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5149,6 +5149,8 @@
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:
   return lldb::eFormatChar;
+case clang::BuiltinType::Char8:
+  return lldb::eFormatUnicode8;
 case clang::BuiltinType::Char16:
   return lldb::eFormatUnicode16;
 case clang::BuiltinType::Char32:
@@ -8957,6 +8959,7 @@
 case eFormatCharPrintable:
 case eFormatCharArray:
 case eFormatBytes:
+case eFormatUnicode8:
 case eFormatBytesWithASCII:
   item_count = byte_size;
   byte_size = 1;


Index: lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
===
--- lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
+++ lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
@@ -115,8 +115,7 @@
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', self.getFormatted("character array", string_expr))
 self.assertIn('= \\0\\e90zaZA\\v\\t\\r\\n\\f\\b\\a \n', self.getFormatted("character", string_expr))
 self.assertIn('= ..90zaZA... \n', self.getFormatted("printable character", string_expr))
-# FIXME: This should probably print the characters in the uint128_t.
-self.assertIn('= 0x2007080c0a0d090b415a617a30391b00\n', self.getFormatted("unicode8", string_expr))
+self.assertIn('= 0x00 0x1b 0x39 0x30 0x7a 0x61 0x5a 0x41 0x0b 0x09 0x0d 0x0a 0x0c 0x08 0x07 0x20\n', self.getFormatted("unicode8", string_expr))
 
 # OSType
 ostype_expr = "(__UINT64_TYPE__)0x"
@@ -137,6 +136,9 @@
 # bytes with ASCII
 self.assertIn(r'= " \U001b\a\b\f\n\r\t\vaA09\0"', self.getFormatted("bytes with ASCII", "cstring"))
 
+# unicode8
+self.assertIn('= 0x78 0x56 0x34 0x12\n', self.getFormatted("unicode8", "0x12345678"))
+
 # unicode16
 self.assertIn('= U+5678 U+1234\n', self.getFormatted("unicode16", "0x12345678"))
 
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5149,6 +5149,8 @@
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:
   return lldb::eFormatChar;
+case clang::BuiltinType::Char8:
+  return lldb::eFormatUnicode8;
 case clang::BuiltinType::Char16:
   return lldb::eFormatUnicode16;
 case clang::BuiltinType::Char32:
@@ -8957,6 +8959,7 @@
 case eFormatCharPrintable:
 case eFormatCharArray:
 case eFormatBytes:
+case 

[Lldb-commits] [PATCH] D113605: [lldb][NFC] Fix documentation for EncodingDataType

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/include/lldb/Symbol/Type.h:69
   enum EncodingDataType {
+/// Invalid encoding
 eEncodingInvalid,

teemperor wrote:
> nit: LLVM comments end in a period.
Fixed on push.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113605

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


[Lldb-commits] [PATCH] D113605: [lldb][NFC] Fix documentation for EncodingDataType

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1695dd175242: [lldb][NFC] Fix documentation for 
EncodingDataType (authored by ljmf00).

Changed prior to commit:
  https://reviews.llvm.org/D113605?vs=386362=394345#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113605

Files:
  lldb/include/lldb/Symbol/Type.h


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -66,6 +66,7 @@
 class Type : public std::enable_shared_from_this, public UserID {
 public:
   enum EncodingDataType {
+/// Invalid encoding.
 eEncodingInvalid,
 /// This type is the type whose UID is m_encoding_uid.
 eEncodingIsUID,
@@ -78,7 +79,7 @@
 /// This type is the type whose UID is m_encoding_uid with the volatile
 /// qualifier added.
 eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
+/// This type is alias to a type whose UID is m_encoding_uid.
 eEncodingIsTypedefUID,
 /// This type is pointer to a type whose UID is m_encoding_uid.
 eEncodingIsPointerUID,
@@ -88,6 +89,7 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
 


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -66,6 +66,7 @@
 class Type : public std::enable_shared_from_this, public UserID {
 public:
   enum EncodingDataType {
+/// Invalid encoding.
 eEncodingInvalid,
 /// This type is the type whose UID is m_encoding_uid.
 eEncodingIsUID,
@@ -78,7 +79,7 @@
 /// This type is the type whose UID is m_encoding_uid with the volatile
 /// qualifier added.
 eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
+/// This type is alias to a type whose UID is m_encoding_uid.
 eEncodingIsTypedefUID,
 /// This type is pointer to a type whose UID is m_encoding_uid.
 eEncodingIsPointerUID,
@@ -88,6 +89,7 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGefefc4ee3b25: [lldb][NFC] Format 
lldb/include/lldb/Symbol/Type.h (authored by ljmf00).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h
  lldb/source/Symbol/Type.cpp


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,7 +662,7 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
llvm::StringRef ,
llvm::StringRef ,
TypeClass _class) {
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,7 +201,7 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+  static bool GetTypeScopeAndBasename(llvm::StringRef name,
   llvm::StringRef ,
   llvm::StringRef ,
   lldb::TypeClass _class);
@@ -473,8 +477,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,7 +662,7 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
llvm::StringRef ,
llvm::StringRef ,
TypeClass _class) {
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ 

[Lldb-commits] [PATCH] D115662: [lldb][DWARF] Remove duplicate DIE type assignment

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D115662#3192064 , @labath wrote:

> I don't have any issues with this per se, but you may want to sync up with 
> @zequanwu, as his D115308  tries to delete 
> the second instance.

Maybe he can reach out here, but how is this related to D115308 
 ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115662

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


[Lldb-commits] [PATCH] D115662: [lldb][DWARF] Remove duplicate DIE type assignment

2021-12-13 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

  This assignment is already being done via UpdateSymbolContextScopeForType
  routine at the end of the type parsing function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115662

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


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -764,7 +764,6 @@
   dwarf->GetUID(attrs.type.Reference()), encoding_data_type, ,
   clang_type, resolve_state, TypePayloadClang(GetOwningClangModule(die)));
 
-  dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
   return type_sp;
 }
 


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -764,7 +764,6 @@
   dwarf->GetUID(attrs.type.Reference()), encoding_data_type, ,
   clang_type, resolve_state, TypePayloadClang(GetOwningClangModule(die)));
 
-  dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
   return type_sp;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-12-13 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Sorry for the delay. Can you re-review this @dblaikie ?


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

https://reviews.llvm.org/D113604

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


[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-12-13 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 394001.

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

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h
  lldb/source/Symbol/Type.cpp


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,7 +662,7 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
llvm::StringRef ,
llvm::StringRef ,
TypeClass _class) {
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,7 +201,7 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+  static bool GetTypeScopeAndBasename(llvm::StringRef name,
   llvm::StringRef ,
   llvm::StringRef ,
   lldb::TypeClass _class);
@@ -473,8 +477,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,7 +662,7 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
llvm::StringRef ,
llvm::StringRef ,
TypeClass _class) {
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is 

[Lldb-commits] [PATCH] D115201: [lldb] Move UpdateSymbolContextScopeForType

2021-12-13 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D115201#3176955 , @shafik wrote:

> Can you add a motivation for this to your summary, thank you!

I added some description to it. I don't think it is worth mentioning my work on 
upstreaming the D lldb plugin, but I'm doing some effort to decouple non-clang 
specific code from Clang DWARF Parser. I believe this is an important step to 
generalize and modularize Symbol File parsers for other languages.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115201

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


[Lldb-commits] [PATCH] D115201: [lldb] Generalize UpdateSymbolContextScopeForType

2021-12-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: lldb-commits, sstefan1.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115201

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -75,6 +75,7 @@
   friend class DebugMapModule;
   friend class DWARFCompileUnit;
   friend class DWARFDIE;
+  friend class DWARFASTParser;
   friend class DWARFASTParserClang;
 
   // Static Functions
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -153,14 +153,6 @@
 
   void LinkDeclToDIE(clang::Decl *decl, const DWARFDIE );
 
-  /// If \p type_sp is valid, calculate and set its symbol context scope, and
-  /// update the type list for its backing symbol file.
-  ///
-  /// Returns \p type_sp.
-  lldb::TypeSP
-  UpdateSymbolContextScopeForType(const lldb_private::SymbolContext ,
-  const DWARFDIE , lldb::TypeSP type_sp);
-
   /// Follow Clang Module Skeleton CU references to find a type definition.
   lldb::TypeSP ParseTypeFromClangModule(const lldb_private::SymbolContext ,
 const DWARFDIE ,
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1382,40 +1382,6 @@
   }
 }
 
-TypeSP DWARFASTParserClang::UpdateSymbolContextScopeForType(
-const SymbolContext , const DWARFDIE , TypeSP type_sp) {
-  if (!type_sp)
-return type_sp;
-
-  SymbolFileDWARF *dwarf = die.GetDWARF();
-  TypeList _list = dwarf->GetTypeList();
-  DWARFDIE sc_parent_die = SymbolFileDWARF::GetParentSymbolContextDIE(die);
-  dw_tag_t sc_parent_tag = sc_parent_die.Tag();
-
-  SymbolContextScope *symbol_context_scope = nullptr;
-  if (sc_parent_tag == DW_TAG_compile_unit ||
-  sc_parent_tag == DW_TAG_partial_unit) {
-symbol_context_scope = sc.comp_unit;
-  } else if (sc.function != nullptr && sc_parent_die) {
-symbol_context_scope =
-sc.function->GetBlock(true).FindBlockByID(sc_parent_die.GetID());
-if (symbol_context_scope == nullptr)
-  symbol_context_scope = sc.function;
-  } else {
-symbol_context_scope = sc.module_sp.get();
-  }
-
-  if (symbol_context_scope != nullptr)
-type_sp->SetSymbolContextScope(symbol_context_scope);
-
-  // We are ready to put this type into the uniqued list up at the module
-  // level.
-  type_list.Insert(type_sp);
-
-  dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
-  return type_sp;
-}
-
 TypeSP
 DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext ,
const DWARFDIE ,
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -61,6 +61,14 @@
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
 
   static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
+
+  /// If \p type_sp is valid, calculate and set its symbol context scope, and
+  /// update the type list for its backing symbol file.
+  ///
+  /// Returns \p type_sp.
+  lldb::TypeSP
+  UpdateSymbolContextScopeForType(const lldb_private::SymbolContext ,
+  const DWARFDIE , lldb::TypeSP type_sp);
 };
 
 /// Parsed form of all attributes that are relevant for type reconstruction.
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -11,7 +11,9 @@
 #include "DWARFDIE.h"
 #include "DWARFUnit.h"
 
+#include "lldb/Core/Module.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Target/StackFrame.h"
 
@@ -251,3 +253,37 @@
 }
   }
 }
+
+TypeSP DWARFASTParser::UpdateSymbolContextScopeForType(
+  

[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-12-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 392087.

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

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -252,39 +252,4 @@
   lldb_private::ClangASTImporter::LayoutInfo _info);
 };
 
-/// Parsed form of all attributes that are relevant for type reconstruction.
-/// Some attributes are relevant for all kinds of types (declaration), while
-/// others are only meaningful to a specific type (is_virtual)
-struct ParsedDWARFTypeAttributes {
-  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
-
-  lldb::AccessType accessibility = lldb::eAccessNone;
-  bool is_artificial = false;
-  bool is_complete_objc_class = false;
-  bool is_explicit = false;
-  bool is_forward_declaration = false;
-  bool is_inline = false;
-  bool is_scoped_enum = false;
-  bool is_vector = false;
-  bool is_virtual = false;
-  bool is_objc_direct_call = false;
-  bool exports_symbols = false;
-  clang::StorageClass storage = clang::SC_None;
-  const char *mangled_name = nullptr;
-  lldb_private::ConstString name;
-  lldb_private::Declaration decl;
-  DWARFDIE object_pointer;
-  DWARFFormValue abstract_origin;
-  DWARFFormValue containing_type;
-  DWARFFormValue signature;
-  DWARFFormValue specification;
-  DWARFFormValue type;
-  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
-  llvm::Optional byte_size;
-  size_t calling_convention = llvm::dwarf::DW_CC_normal;
-  uint32_t bit_stride = 0;
-  uint32_t byte_stride = 0;
-  uint32_t encoding = 0;
-};
-
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSERCLANG_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -286,135 +286,6 @@
   ForcefullyCompleteType(type);
 }
 
-ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
-  DWARFAttributes attributes;
-  size_t num_attributes = die.GetAttributes(attributes);
-  for (size_t i = 0; i < num_attributes; ++i) {
-dw_attr_t attr = attributes.AttributeAtIndex(i);
-DWARFFormValue form_value;
-if (!attributes.ExtractFormValueAtIndex(i, form_value))
-  continue;
-switch (attr) {
-case DW_AT_abstract_origin:
-  abstract_origin = form_value;
-  break;
-
-case DW_AT_accessibility:
-  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
-  break;
-
-case DW_AT_artificial:
-  is_artificial = form_value.Boolean();
-  break;
-
-case DW_AT_bit_stride:
-  bit_stride = form_value.Unsigned();
-  break;
-
-case DW_AT_byte_size:
-  byte_size = form_value.Unsigned();
-  break;
-
-case DW_AT_byte_stride:
-  byte_stride = form_value.Unsigned();
-  break;
-
-case DW_AT_calling_convention:
-  calling_convention = form_value.Unsigned();
-  break;
-
-case DW_AT_containing_type:
-  containing_type = form_value;
-  break;
-
-case DW_AT_decl_file:
-  // die.GetCU() can differ if DW_AT_specification uses DW_FORM_ref_addr.
-  decl.SetFile(
-  attributes.CompileUnitAtIndex(i)->GetFile(form_value.Unsigned()));
-  break;
-case DW_AT_decl_line:
-  decl.SetLine(form_value.Unsigned());
-  break;
-case DW_AT_decl_column:
-  decl.SetColumn(form_value.Unsigned());
-  break;
-
-case DW_AT_declaration:
-  is_forward_declaration = form_value.Boolean();
-  break;
-
-case DW_AT_encoding:
-  encoding = form_value.Unsigned();
-  break;
-
-case DW_AT_enum_class:
-  is_scoped_enum = form_value.Boolean();
-  break;
-
-case DW_AT_explicit:
-  is_explicit = form_value.Boolean();
-  break;
-
-case DW_AT_external:
-  

[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-12-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 resigned from this revision.
ljmf00 added a comment.
This revision now requires review to proceed.

Ops, clicked on the wrong button


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

https://reviews.llvm.org/D114746

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


[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-12-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 accepted this revision.
ljmf00 added a comment.
This revision is now accepted and ready to land.

In D114746#3160908 , @labath wrote:

> I don't think we should be putting this into the DWARFAttribute file. It is 
> substantially higher-level than the rest of the file, and the DWARFAttribute 
> file is destined to be merged with the llvm implementation at some point. Is 
> there a reason for not putting it into `DWARFASTParser` (like the other 
> patch)?

I changed to DWARFASTParser. There was no particular reason other than naming, 
but since I lack some knowledge about the overall infrastructure I was not sure.

> In D114746#3160331 , @ljmf00 wrote:
>
>> I'm not sure if this falls into NFC category since I'm changing how flags 
>> are stored.
>
> There's no formal definition of "NFC", so it does not really matter.

Oh ok. I read it on the Developers Policy glossary, so I was not sure. Thanks 
for the clarification.

>> This patch also reduces the memory footprint of the struct by using bit 
>> flags instead of individual booleans.
>
> The class was never meant to be stored anywhere else except the stack of the 
> function doing the parsing, so it's not really necessary to optimize it that 
> much. But since, you've already done it, I suppose it can stay...

Well, I didn't make any performance tests but it surely can improve memory 
usage. I guess the compiler can also be smart if the memory is only on the 
stack.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:1140
   : containing_decl_ctx,
-GetOwningClangModule(die), name, clang_type, attrs.storage,
-attrs.is_inline);
+GetOwningClangModule(die), name, clang_type, attrs.is_external() ? 
clang::SC_Extern : clang::SC_None,
+attrs.is_inline());

shafik wrote:
> Is there a reason not to use an attribute `storage` like before? This feels 
> like we are leaking out of the abstraction where before we were not.
I think the abstraction of the external attribute is valid since `storage` is 
Clang specific StorageClass.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:1493
 // and the byte size is zero.
-attrs.is_forward_declaration = true;
+attrs.attr_flags |= eDWARFAttributeIsForwardDecl;
   }

shafik wrote:
> if we are going to have getter abstraction why not have a 
> `setIsForwardDeclaration()` or something similar.
Yeah, I can see the improvement, I added setters too. I didn't add them since 
the set was only used as a statement rather than an expression.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h:86
+  /// Whether it is an artificially generated symbol.
+  eDWARFAttributeIsArtificial = (1u << 0),
+  eDWARFAttributeIsExplicit = (1u << 1),

ljmf00 wrote:
> I forgot to add the rest of the documentation. Leaving a note here for myself
Added documentation.


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

https://reviews.llvm.org/D114746

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


[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-12-06 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 392069.

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

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -10,6 +10,8 @@
 #include "DWARFUnit.h"
 #include "DWARFDebugInfo.h"
 
+using namespace lldb;
+
 DWARFAttributes::DWARFAttributes() : m_infos() {}
 
 DWARFAttributes::~DWARFAttributes() = default;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -252,39 +252,4 @@
   lldb_private::ClangASTImporter::LayoutInfo _info);
 };
 
-/// Parsed form of all attributes that are relevant for type reconstruction.
-/// Some attributes are relevant for all kinds of types (declaration), while
-/// others are only meaningful to a specific type (is_virtual)
-struct ParsedDWARFTypeAttributes {
-  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
-
-  lldb::AccessType accessibility = lldb::eAccessNone;
-  bool is_artificial = false;
-  bool is_complete_objc_class = false;
-  bool is_explicit = false;
-  bool is_forward_declaration = false;
-  bool is_inline = false;
-  bool is_scoped_enum = false;
-  bool is_vector = false;
-  bool is_virtual = false;
-  bool is_objc_direct_call = false;
-  bool exports_symbols = false;
-  clang::StorageClass storage = clang::SC_None;
-  const char *mangled_name = nullptr;
-  lldb_private::ConstString name;
-  lldb_private::Declaration decl;
-  DWARFDIE object_pointer;
-  DWARFFormValue abstract_origin;
-  DWARFFormValue containing_type;
-  DWARFFormValue signature;
-  DWARFFormValue specification;
-  DWARFFormValue type;
-  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
-  llvm::Optional byte_size;
-  size_t calling_convention = llvm::dwarf::DW_CC_normal;
-  uint32_t bit_stride = 0;
-  uint32_t byte_stride = 0;
-  uint32_t encoding = 0;
-};
-
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSERCLANG_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -286,135 +286,6 @@
   ForcefullyCompleteType(type);
 }
 
-ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
-  DWARFAttributes attributes;
-  size_t num_attributes = die.GetAttributes(attributes);
-  for (size_t i = 0; i < num_attributes; ++i) {
-dw_attr_t attr = attributes.AttributeAtIndex(i);
-DWARFFormValue form_value;
-if (!attributes.ExtractFormValueAtIndex(i, form_value))
-  continue;
-switch (attr) {
-case DW_AT_abstract_origin:
-  abstract_origin = form_value;
-  break;
-
-case DW_AT_accessibility:
-  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
-  break;
-
-case DW_AT_artificial:
-  is_artificial = form_value.Boolean();
-  break;
-
-case DW_AT_bit_stride:
-  bit_stride = form_value.Unsigned();
-  break;
-
-case DW_AT_byte_size:
-  byte_size = form_value.Unsigned();
-  break;
-
-case DW_AT_byte_stride:
-  byte_stride = form_value.Unsigned();
-  break;
-
-case DW_AT_calling_convention:
-  calling_convention = form_value.Unsigned();
-  break;
-
-case DW_AT_containing_type:
-  containing_type = form_value;
-  break;
-
-case DW_AT_decl_file:
-  // die.GetCU() can differ if DW_AT_specification uses DW_FORM_ref_addr.
-  decl.SetFile(
-  attributes.CompileUnitAtIndex(i)->GetFile(form_value.Unsigned()));
-  break;
-case DW_AT_decl_line:
-  

[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2021-12-04 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 391867.

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

https://reviews.llvm.org/D114668

Files:
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3074,99 +3074,6 @@
   return arg_idx;
 }
 
-llvm::Optional
-DWARFASTParser::ParseChildArrayInfo(const DWARFDIE _die,
-const ExecutionContext *exe_ctx) {
-  SymbolFile::ArrayInfo array_info;
-  if (!parent_die)
-return llvm::None;
-
-  for (DWARFDIE die : parent_die.children()) {
-const dw_tag_t tag = die.Tag();
-if (tag != DW_TAG_subrange_type)
-  continue;
-
-DWARFAttributes attributes;
-const size_t num_child_attributes = die.GetAttributes(attributes);
-if (num_child_attributes > 0) {
-  uint64_t num_elements = 0;
-  uint64_t lower_bound = 0;
-  uint64_t upper_bound = 0;
-  bool upper_bound_valid = false;
-  uint32_t i;
-  for (i = 0; i < num_child_attributes; ++i) {
-const dw_attr_t attr = attributes.AttributeAtIndex(i);
-DWARFFormValue form_value;
-if (attributes.ExtractFormValueAtIndex(i, form_value)) {
-  switch (attr) {
-  case DW_AT_name:
-break;
-
-  case DW_AT_count:
-if (DWARFDIE var_die = die.GetReferencedDIE(DW_AT_count)) {
-  if (var_die.Tag() == DW_TAG_variable)
-if (exe_ctx) {
-  if (auto frame = exe_ctx->GetFrameSP()) {
-Status error;
-lldb::VariableSP var_sp;
-auto valobj_sp = frame->GetValueForVariableExpressionPath(
-var_die.GetName(), eNoDynamicValues, 0, var_sp,
-error);
-if (valobj_sp) {
-  num_elements = valobj_sp->GetValueAsUnsigned(0);
-  break;
-}
-  }
-}
-} else
-  num_elements = form_value.Unsigned();
-break;
-
-  case DW_AT_bit_stride:
-array_info.bit_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_byte_stride:
-array_info.byte_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_lower_bound:
-lower_bound = form_value.Unsigned();
-break;
-
-  case DW_AT_upper_bound:
-upper_bound_valid = true;
-upper_bound = form_value.Unsigned();
-break;
-
-  default:
-  case DW_AT_abstract_origin:
-  case DW_AT_accessibility:
-  case DW_AT_allocated:
-  case DW_AT_associated:
-  case DW_AT_data_location:
-  case DW_AT_declaration:
-  case DW_AT_description:
-  case DW_AT_sibling:
-  case DW_AT_threads_scaled:
-  case DW_AT_type:
-  case DW_AT_visibility:
-break;
-  }
-}
-  }
-
-  if (num_elements == 0) {
-if (upper_bound_valid && upper_bound >= lower_bound)
-  num_elements = upper_bound - lower_bound + 1;
-  }
-
-  array_info.element_orders.push_back(num_elements);
-}
-  }
-  return array_info;
-}
-
 Type *DWARFASTParserClang::GetTypeForDIE(const DWARFDIE ) {
   if (die) {
 SymbolFileDWARF *dwarf = die.GetDWARF();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- /dev/null
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -0,0 +1,99 @@
+//===-- DWARFASTParser.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 "DWARFASTParser.h"
+#include "DWARFAttribute.h"
+#include "DWARFDIE.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Target/StackFrame.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+llvm::Optional
+DWARFASTParser::ParseChildArrayInfo(const DWARFDIE _die,
+const ExecutionContext *exe_ctx) {
+  SymbolFile::ArrayInfo array_info;
+  if (!parent_die)
+return llvm::None;
+
+  for (DWARFDIE die : parent_die.children()) {
+const dw_tag_t tag = die.Tag();
+if (tag != DW_TAG_subrange_type)
+  continue;
+
+DWARFAttributes 

[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2021-12-04 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:1
+#include "DWARFASTParser.h"
+#include "DWARFAttribute.h"

ljmf00 wrote:
> bulbazord wrote:
> > This file will need a license header.
> Yes, my bad. Thanks for noticing it.
Added.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:77
+  default:
+  case DW_AT_abstract_origin:
+  case DW_AT_accessibility:

clayborg wrote:
> shafik wrote:
> > ljmf00 wrote:
> > > bulbazord wrote:
> > > > ljmf00 wrote:
> > > > > Why we are including just these specific attributes? Maybe we should 
> > > > > add a comment explaining it. According to the DWARF standard, any 
> > > > > attribute is eligible for any tag.
> > > > I'm not sure why. Possibly they were added to make sure the switch was 
> > > > fully covered (potentially to silence a warning)? You could add a 
> > > > `FIXME` or a `TODO` if you feel that these attributes should have 
> > > > functionality associated with them like the ones above.
> > > I don't think it is to mark it as fully covered since there are much more 
> > > attributes, the default label will address it anyway, and according to 
> > > the DWARF standard, any attribute can be in a type tag (realistically, 
> > > any tag). We can take the example of `DW_AT_description` which is just a 
> > > description associated with the symbol. I feel like this can be safely 
> > > deleted but I'm afraid to do it in favour of some other rationale I'm not 
> > > seeing.
> > @clayborg it looks like this has been this way since you put this in: 
> > https://github.com/llvm/llvm-project/commit/261ac3f4b5b98d02dd8718078015a92cf07df736
> > 
> > Do you agree this is dead code or is there something we are missing?
> Fine to remove these extra attributes that are in the default case as we 
> definitely don't have all of the attributes listed here.
Done.


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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2021-12-04 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 391856.

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

https://reviews.llvm.org/D114668

Files:
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3074,99 +3074,6 @@
   return arg_idx;
 }
 
-llvm::Optional
-DWARFASTParser::ParseChildArrayInfo(const DWARFDIE _die,
-const ExecutionContext *exe_ctx) {
-  SymbolFile::ArrayInfo array_info;
-  if (!parent_die)
-return llvm::None;
-
-  for (DWARFDIE die : parent_die.children()) {
-const dw_tag_t tag = die.Tag();
-if (tag != DW_TAG_subrange_type)
-  continue;
-
-DWARFAttributes attributes;
-const size_t num_child_attributes = die.GetAttributes(attributes);
-if (num_child_attributes > 0) {
-  uint64_t num_elements = 0;
-  uint64_t lower_bound = 0;
-  uint64_t upper_bound = 0;
-  bool upper_bound_valid = false;
-  uint32_t i;
-  for (i = 0; i < num_child_attributes; ++i) {
-const dw_attr_t attr = attributes.AttributeAtIndex(i);
-DWARFFormValue form_value;
-if (attributes.ExtractFormValueAtIndex(i, form_value)) {
-  switch (attr) {
-  case DW_AT_name:
-break;
-
-  case DW_AT_count:
-if (DWARFDIE var_die = die.GetReferencedDIE(DW_AT_count)) {
-  if (var_die.Tag() == DW_TAG_variable)
-if (exe_ctx) {
-  if (auto frame = exe_ctx->GetFrameSP()) {
-Status error;
-lldb::VariableSP var_sp;
-auto valobj_sp = frame->GetValueForVariableExpressionPath(
-var_die.GetName(), eNoDynamicValues, 0, var_sp,
-error);
-if (valobj_sp) {
-  num_elements = valobj_sp->GetValueAsUnsigned(0);
-  break;
-}
-  }
-}
-} else
-  num_elements = form_value.Unsigned();
-break;
-
-  case DW_AT_bit_stride:
-array_info.bit_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_byte_stride:
-array_info.byte_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_lower_bound:
-lower_bound = form_value.Unsigned();
-break;
-
-  case DW_AT_upper_bound:
-upper_bound_valid = true;
-upper_bound = form_value.Unsigned();
-break;
-
-  default:
-  case DW_AT_abstract_origin:
-  case DW_AT_accessibility:
-  case DW_AT_allocated:
-  case DW_AT_associated:
-  case DW_AT_data_location:
-  case DW_AT_declaration:
-  case DW_AT_description:
-  case DW_AT_sibling:
-  case DW_AT_threads_scaled:
-  case DW_AT_type:
-  case DW_AT_visibility:
-break;
-  }
-}
-  }
-
-  if (num_elements == 0) {
-if (upper_bound_valid && upper_bound >= lower_bound)
-  num_elements = upper_bound - lower_bound + 1;
-  }
-
-  array_info.element_orders.push_back(num_elements);
-}
-  }
-  return array_info;
-}
-
 Type *DWARFASTParserClang::GetTypeForDIE(const DWARFDIE ) {
   if (die) {
 SymbolFileDWARF *dwarf = die.GetDWARF();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- /dev/null
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -0,0 +1,99 @@
+//===-- DWARFASTParser.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 "DWARFASTParser.h"
+#include "DWARFAttribute.h"
+#include "DWARFDIE.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Target/StackFrame.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+llvm::Optional
+DWARFASTParser::ParseChildArrayInfo(const DWARFDIE _die,
+const ExecutionContext *exe_ctx) {
+  SymbolFile::ArrayInfo array_info;
+  if (!parent_die)
+return llvm::None;
+
+  for (DWARFDIE die : parent_die.children()) {
+const dw_tag_t tag = die.Tag();
+if (tag != DW_TAG_subrange_type)
+  continue;
+
+DWARFAttributes 

[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

I'm not sure if this falls into NFC category since I'm changing how flags are 
stored.


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

https://reviews.llvm.org/D114746

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


[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:1
+#include "DWARFASTParser.h"
+#include "DWARFAttribute.h"

bulbazord wrote:
> This file will need a license header.
Yes, my bad. Thanks for noticing it.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:77
+  default:
+  case DW_AT_abstract_origin:
+  case DW_AT_accessibility:

bulbazord wrote:
> ljmf00 wrote:
> > Why we are including just these specific attributes? Maybe we should add a 
> > comment explaining it. According to the DWARF standard, any attribute is 
> > eligible for any tag.
> I'm not sure why. Possibly they were added to make sure the switch was fully 
> covered (potentially to silence a warning)? You could add a `FIXME` or a 
> `TODO` if you feel that these attributes should have functionality associated 
> with them like the ones above.
I don't think it is to mark it as fully covered since there are much more 
attributes, the default label will address it anyway, and according to the 
DWARF standard, any attribute can be in a type tag (realistically, any tag). We 
can take the example of `DW_AT_description` which is just a description 
associated with the symbol. I feel like this can be safely deleted but I'm 
afraid to do it in favour of some other rationale I'm not seeing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6f99e1aa58e3: [lldb][NFC] Format 
lldb/include/lldb/Symbol/Type.h (authored by ljmf00).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h
  lldb/source/Symbol/Type.cpp


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
-   llvm::StringRef ,
-   llvm::StringRef ,
+bool Type::GetTypeScopeAndBasename(const llvm::StringRef name,
+   llvm::StringRef scope,
+   llvm::StringRef basename,
TypeClass _class) {
   type_class = eTypeClassAny;
 
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,9 +201,9 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
-  llvm::StringRef ,
-  llvm::StringRef ,
+  static bool GetTypeScopeAndBasename(const llvm::StringRef name,
+  llvm::StringRef scope,
+  llvm::StringRef basename,
   lldb::TypeClass _class);
   void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; 
}
 
@@ -473,8 +477,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& 

[Lldb-commits] [PATCH] D114746: [lldb][NFC] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390489.

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

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
@@ -77,4 +80,79 @@
   collection m_infos;
 };
 
+FLAGS_ENUM(DWARFAttributeFlags)
+{
+  /// Whether it is an artificially generated symbol.
+  eDWARFAttributeIsArtificial = (1u << 0),
+  eDWARFAttributeIsExplicit = (1u << 1),
+  eDWARFAttributeIsForwardDecl = (1u << 2),
+  eDWARFAttributeIsInline = (1u << 3),
+  eDWARFAttributeIsScopedEnum = (1u << 4),
+  eDWARFAttributeIsVector = (1u << 5),
+  eDWARFAttributeIsVirtual = (1u << 6),
+  eDWARFAttributeIsExternal = (1u << 7),
+  eDWARFAttributeExportSymbols = (1u << 8),
+  eDWARFAttributeIsObjCDirect = (1u << 9),
+  eDWARFAttributeIsObjCCompleteType = (1u << 10),
+};
+
+/// Parsed form of all attributes that are relevant for type reconstruction.
+/// Some attributes are relevant for all kinds of types (declaration), while
+/// others are only meaningful to a specific type (is_virtual).
+struct ParsedDWARFTypeAttributes {
+  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
+
+  lldb::AccessType accessibility = lldb::eAccessNone;
+  uint32_t attr_flags = 0;
+  const char *mangled_name = nullptr;
+  lldb_private::ConstString name;
+  lldb_private::Declaration decl;
+  DWARFDIE object_pointer;
+  DWARFFormValue abstract_origin;
+  DWARFFormValue containing_type;
+  DWARFFormValue signature;
+  DWARFFormValue specification;
+  DWARFFormValue type;
+  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
+  llvm::Optional byte_size;
+  size_t calling_convention = llvm::dwarf::DW_CC_normal;
+  uint32_t bit_stride = 0;
+  uint32_t byte_stride = 0;
+  uint32_t encoding = 0;
+
+  inline bool is_artificial() const {
+return attr_flags & eDWARFAttributeIsArtificial;
+  }
+  inline bool is_explicit() const {
+return attr_flags & eDWARFAttributeIsExplicit;
+  }
+  inline bool is_forward_declaration() const {
+return attr_flags & eDWARFAttributeIsForwardDecl;
+  }
+  inline bool is_inline() const {
+return attr_flags & eDWARFAttributeIsInline;
+  }
+  inline bool is_scoped_enum() const {
+return attr_flags 
+  }
+  inline bool is_vector() const {
+return attr_flags & eDWARFAttributeIsVector;
+  }
+  inline bool is_virtual() const {
+return attr_flags & eDWARFAttributeIsVirtual;
+  }
+  inline bool is_external() const {
+return attr_flags & eDWARFAttributeIsExternal;
+  }
+  inline bool exports_symbols() const {
+return attr_flags & eDWARFAttributeExportSymbols;
+  }
+  inline bool is_objc_direct_call() const {
+return attr_flags & eDWARFAttributeIsObjCDirect;
+  }
+  inline bool is_objc_complete_type() const {
+return attr_flags & eDWARFAttributeIsObjCCompleteType;
+  }
+};
+
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -7,8 +7,11 @@
 //===--===//
 
 #include "DWARFAttribute.h"
-#include "DWARFUnit.h"
+#include "DWARFASTParser.h"
 #include "DWARFDebugInfo.h"
+#include "DWARFUnit.h"
+
+using namespace lldb;
 
 DWARFAttributes::DWARFAttributes() : m_infos() {}
 
@@ -61,3 +64,141 @@
 return form_value.Reference();
   return {};
 }
+
+ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
+  DWARFAttributes attributes;
+  size_t num_attributes = die.GetAttributes(attributes);
+  for (size_t i = 0; i < num_attributes; ++i) {
+dw_attr_t attr = attributes.AttributeAtIndex(i);
+DWARFFormValue form_value;
+if (!attributes.ExtractFormValueAtIndex(i, form_value))
+  continue;
+switch (attr) {
+case DW_AT_abstract_origin:
+  abstract_origin = form_value;
+  break;
+
+case DW_AT_accessibility:
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
+  break;
+
+case DW_AT_artificial:
+  if (form_value.Boolean())
+attr_flags 

[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D114719#3159587 , @bulbazord wrote:

> This makes sense to me. Out of curiosity, do you have plans to use this for 
> non-clang-based languages?

Yes. I'm currently working on a D language plugin. You can see my fork, until I 
upstream it https://github.com/ljmf00/lldb-d .


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

https://reviews.llvm.org/D114719

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


[Lldb-commits] [PATCH] D114746: [lldb][NFC] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390487.

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

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
@@ -77,4 +80,79 @@
   collection m_infos;
 };
 
+FLAGS_ENUM(DWARFAttributeFlags)
+{
+  /// Whether it is an artificially generated symbol.
+  eDWARFAttributeIsArtificial = (1u << 0),
+  eDWARFAttributeIsExplicit = (1u << 1),
+  eDWARFAttributeIsForwardDecl = (1u << 2),
+  eDWARFAttributeIsInline = (1u << 3),
+  eDWARFAttributeIsScopedEnum = (1u << 4),
+  eDWARFAttributeIsVector = (1u << 5),
+  eDWARFAttributeIsVirtual = (1u << 6),
+  eDWARFAttributeIsExternal = (1u << 7),
+  eDWARFAttributeExportSymbols = (1u << 8),
+  eDWARFAttributeIsObjCDirect = (1u << 9),
+  eDWARFAttributeIsObjCCompleteType = (1u << 10),
+};
+
+/// Parsed form of all attributes that are relevant for type reconstruction.
+/// Some attributes are relevant for all kinds of types (declaration), while
+/// others are only meaningful to a specific type (is_virtual).
+struct ParsedDWARFTypeAttributes {
+  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
+
+  lldb::AccessType accessibility = lldb::eAccessNone;
+  uint32_t attr_flags = 0;
+  const char *mangled_name = nullptr;
+  lldb_private::ConstString name;
+  lldb_private::Declaration decl;
+  DWARFDIE object_pointer;
+  DWARFFormValue abstract_origin;
+  DWARFFormValue containing_type;
+  DWARFFormValue signature;
+  DWARFFormValue specification;
+  DWARFFormValue type;
+  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
+  llvm::Optional byte_size;
+  size_t calling_convention = llvm::dwarf::DW_CC_normal;
+  uint32_t bit_stride = 0;
+  uint32_t byte_stride = 0;
+  uint32_t encoding = 0;
+
+  inline bool is_artificial() const {
+return attr_flags & eDWARFAttributeIsArtificial;
+  }
+  inline bool is_explicit() const {
+return attr_flags & eDWARFAttributeIsExplicit;
+  }
+  inline bool is_forward_declaration() const {
+return attr_flags & eDWARFAttributeIsForwardDecl;
+  }
+  inline bool is_inline() const {
+return attr_flags & eDWARFAttributeIsInline;
+  }
+  inline bool is_scoped_enum() const {
+return attr_flags 
+  }
+  inline bool is_vector() const {
+return attr_flags & eDWARFAttributeIsVector;
+  }
+  inline bool is_virtual() const {
+return attr_flags & eDWARFAttributeIsVirtual;
+  }
+  inline bool is_external() const {
+return attr_flags & eDWARFAttributeIsExternal;
+  }
+  inline bool exports_symbols() const {
+return attr_flags & eDWARFAttributeExportSymbols;
+  }
+  inline bool is_objc_direct_call() const {
+return attr_flags & eDWARFAttributeIsObjCDirect;
+  }
+  inline bool is_objc_complete_type() const {
+return attr_flags & eDWARFAttributeIsObjCCompleteType;
+  }
+};
+
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -7,8 +7,11 @@
 //===--===//
 
 #include "DWARFAttribute.h"
-#include "DWARFUnit.h"
+#include "DWARFASTParser.h"
 #include "DWARFDebugInfo.h"
+#include "DWARFUnit.h"
+
+using namespace lldb;
 
 DWARFAttributes::DWARFAttributes() : m_infos() {}
 
@@ -61,3 +64,141 @@
 return form_value.Reference();
   return {};
 }
+
+ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
+  DWARFAttributes attributes;
+  size_t num_attributes = die.GetAttributes(attributes);
+  for (size_t i = 0; i < num_attributes; ++i) {
+dw_attr_t attr = attributes.AttributeAtIndex(i);
+DWARFFormValue form_value;
+if (!attributes.ExtractFormValueAtIndex(i, form_value))
+  continue;
+switch (attr) {
+case DW_AT_abstract_origin:
+  abstract_origin = form_value;
+  break;
+
+case DW_AT_accessibility:
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
+  break;
+
+case DW_AT_artificial:
+  if (form_value.Boolean())
+attr_flags 

[Lldb-commits] [PATCH] D114746: [lldb] Generalize ParsedDWARFTypeAttributes

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch generalizes the ParsedDWARFTypeAttributes struct to be able to share 
with other DWARF parsers other than clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114746

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
@@ -9,8 +9,11 @@
 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
 
+#include "DWARFDIE.h"
 #include "DWARFDefines.h"
 #include "DWARFFormValue.h"
+#include "lldb/Core/Declaration.h"
+#include "lldb/Utility/ConstString.h"
 #include "llvm/ADT/SmallVector.h"
 #include 
 
@@ -77,4 +80,79 @@
   collection m_infos;
 };
 
+FLAGS_ENUM(DWARFAttributeFlags)
+{
+  /// Whether it is an artificially generated symbol.
+  eDWARFAttributeIsArtificial = (1u << 0),
+  eDWARFAttributeIsExplicit = (1u << 1),
+  eDWARFAttributeIsForwardDecl = (1u << 2),
+  eDWARFAttributeIsInline = (1u << 3),
+  eDWARFAttributeIsScopedEnum = (1u << 4),
+  eDWARFAttributeIsVector = (1u << 5),
+  eDWARFAttributeIsVirtual = (1u << 6),
+  eDWARFAttributeIsExternal = (1u << 7),
+  eDWARFAttributeExportSymbols = (1u << 8),
+  eDWARFAttributeIsObjCDirect = (1u << 9),
+  eDWARFAttributeIsObjCCompleteType = (1u << 10),
+};
+
+/// Parsed form of all attributes that are relevant for type reconstruction.
+/// Some attributes are relevant for all kinds of types (declaration), while
+/// others are only meaningful to a specific type (is_virtual).
+struct ParsedDWARFTypeAttributes {
+  explicit ParsedDWARFTypeAttributes(const DWARFDIE );
+
+  lldb::AccessType accessibility = lldb::eAccessNone;
+  uint32_t attr_flags = 0;
+  const char *mangled_name = nullptr;
+  lldb_private::ConstString name;
+  lldb_private::Declaration decl;
+  DWARFDIE object_pointer;
+  DWARFFormValue abstract_origin;
+  DWARFFormValue containing_type;
+  DWARFFormValue signature;
+  DWARFFormValue specification;
+  DWARFFormValue type;
+  lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
+  llvm::Optional byte_size;
+  size_t calling_convention = llvm::dwarf::DW_CC_normal;
+  uint32_t bit_stride = 0;
+  uint32_t byte_stride = 0;
+  uint32_t encoding = 0;
+
+  inline bool is_artificial() const {
+return attr_flags & eDWARFAttributeIsArtificial;
+  }
+  inline bool is_explicit() const {
+return attr_flags & eDWARFAttributeIsExplicit;
+  }
+  inline bool is_forward_declaration() const {
+return attr_flags & eDWARFAttributeIsForwardDecl;
+  }
+  inline bool is_inline() const {
+return attr_flags & eDWARFAttributeIsInline;
+  }
+  inline bool is_scoped_enum() const {
+return attr_flags 
+  }
+  inline bool is_vector() const {
+return attr_flags & eDWARFAttributeIsVector;
+  }
+  inline bool is_virtual() const {
+return attr_flags & eDWARFAttributeIsVirtual;
+  }
+  inline bool is_external() const {
+return attr_flags & eDWARFAttributeIsExternal;
+  }
+  inline bool exports_symbols() const {
+return attr_flags & eDWARFAttributeExportSymbols;
+  }
+  inline bool is_objc_direct_call() const {
+return attr_flags & eDWARFAttributeIsObjCDirect;
+  }
+  inline bool is_objc_complete_type() const {
+return attr_flags & eDWARFAttributeIsObjCCompleteType;
+  }
+};
+
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFATTRIBUTE_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
@@ -7,8 +7,11 @@
 //===--===//
 
 #include "DWARFAttribute.h"
-#include "DWARFUnit.h"
+#include "DWARFASTParser.h"
 #include "DWARFDebugInfo.h"
+#include "DWARFUnit.h"
+
+using namespace lldb;
 
 DWARFAttributes::DWARFAttributes() : m_infos() {}
 
@@ -61,3 +64,141 @@
 return form_value.Reference();
   return {};
 }
+
+ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE ) {
+  DWARFAttributes attributes;
+  size_t num_attributes = die.GetAttributes(attributes);
+  for (size_t i = 0; i < num_attributes; ++i) {
+dw_attr_t attr = attributes.AttributeAtIndex(i);
+DWARFFormValue form_value;
+if (!attributes.ExtractFormValueAtIndex(i, form_value))
+  continue;
+switch (attr) {
+case DW_AT_abstract_origin:
+  abstract_origin = form_value;

[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390412.

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

https://reviews.llvm.org/D114719

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
 
 #include 
 
+#include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
@@ -62,20 +63,6 @@
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
-  switch (dwarf_accessibility) {
-  case DW_ACCESS_public:
-return eAccessPublic;
-  case DW_ACCESS_private:
-return eAccessPrivate;
-  case DW_ACCESS_protected:
-return eAccessProtected;
-  default:
-break;
-  }
-  return eAccessNone;
-}
-
 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
   switch (decl_kind) {
   case clang::Decl::CXXRecord:
@@ -313,7 +300,7 @@
   break;
 
 case DW_AT_accessibility:
-  accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
   break;
 
 case DW_AT_artificial:
@@ -1463,7 +1450,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
 
   case DW_AT_virtuality:
@@ -2532,7 +2519,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
   case DW_AT_artificial:
 is_artificial = form_value.Boolean();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
 
 class DWARFDIE;
 namespace lldb_private {
@@ -54,6 +55,8 @@
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE _die,
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+  static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -100,3 +100,18 @@
   }
   return array_info;
 }
+
+AccessType
+DWARFASTParser::GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+  switch (dwarf_accessibility) {
+  case DW_ACCESS_public:
+return eAccessPublic;
+  case DW_ACCESS_private:
+return eAccessPrivate;
+  case DW_ACCESS_protected:
+return eAccessProtected;
+  default:
+break;
+  }
+  return eAccessNone;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 390392.

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

https://reviews.llvm.org/D114719

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
 
 #include 
 
+#include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
@@ -62,20 +63,6 @@
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
-  switch (dwarf_accessibility) {
-  case DW_ACCESS_public:
-return eAccessPublic;
-  case DW_ACCESS_private:
-return eAccessPrivate;
-  case DW_ACCESS_protected:
-return eAccessProtected;
-  default:
-break;
-  }
-  return eAccessNone;
-}
-
 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
   switch (decl_kind) {
   case clang::Decl::CXXRecord:
@@ -313,7 +300,7 @@
   break;
 
 case DW_AT_accessibility:
-  accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
   break;
 
 case DW_AT_artificial:
@@ -1463,7 +1450,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
 
   case DW_AT_virtuality:
@@ -2532,7 +2519,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
   case DW_AT_artificial:
 is_artificial = form_value.Boolean();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
 
 class DWARFDIE;
 namespace lldb_private {
@@ -54,6 +55,8 @@
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE _die,
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+  static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -100,3 +100,18 @@
   }
   return array_info;
 }
+
+
+AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+  switch (dwarf_accessibility) {
+  case DW_ACCESS_public:
+return eAccessPublic;
+  case DW_ACCESS_private:
+return eAccessPrivate;
+  case DW_ACCESS_protected:
+return eAccessProtected;
+  default:
+break;
+  }
+  return eAccessNone;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D114719: [lldb] Move non-clang specific method to the generic DWARF Parser

2021-11-29 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

  This patch renames DW_ACCESS_to_AccessType function and move it to the 
abstract
  DWARFASTParser, since there is no clang-specific code there. This is useful 
for
  plugins other than Clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114719

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
 
 #include 
 
+#include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
@@ -62,20 +63,6 @@
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
-  switch (dwarf_accessibility) {
-  case DW_ACCESS_public:
-return eAccessPublic;
-  case DW_ACCESS_private:
-return eAccessPrivate;
-  case DW_ACCESS_protected:
-return eAccessProtected;
-  default:
-break;
-  }
-  return eAccessNone;
-}
-
 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
   switch (decl_kind) {
   case clang::Decl::CXXRecord:
@@ -313,7 +300,7 @@
   break;
 
 case DW_AT_accessibility:
-  accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+  accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
   break;
 
 case DW_AT_artificial:
@@ -1463,7 +1450,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
 
   case DW_AT_virtuality:
@@ -2532,7 +2519,7 @@
 break;
 
   case DW_AT_accessibility:
-accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
 break;
   case DW_AT_artificial:
 is_artificial = form_value.Boolean();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
 
 class DWARFDIE;
 namespace lldb_private {
@@ -54,6 +55,8 @@
   static llvm::Optional
   ParseChildArrayInfo(const DWARFDIE _die,
   const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+  static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -100,3 +100,18 @@
   }
   return array_info;
 }
+
+
+AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+  switch (dwarf_accessibility) {
+  case DW_ACCESS_public:
+return eAccessPublic;
+  case DW_ACCESS_private:
+return eAccessPrivate;
+  case DW_ACCESS_protected:
+return eAccessProtected;
+  default:
+break;
+  }
+  return eAccessNone;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D112564: [lldb] Add support for custom char8_t types with different name

2021-11-28 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D112564#3089399 , @labath wrote:

> What exactly do you need the test to do? Is printing a global variable 
> (`char8_t_ish foo[] = "my string"`) sufficient?
> If so, you can take a look at the tests in `test/Shell/SymbolFile/DWARF` for 
> inspiration. There are .s and .ll tests there.
> The pattern would roughly be:
>
>   # RUN: llvm-mc (or llc) -o %t %s
>   # RUN: %lldb %t -o "target variable foo" | FileCheck %s
>   
>   # CHECK: (char8_t_ish[]) foo = "my string"
>   
>   your code here

I was writing the tests locally, although I can't reproduce the failure with a 
simple type. I can get the error when using a custom LLDB formatter, however. 
See 
https://github.com/ljmf00/lldb-d/blob/main/lldb/source/Plugins/Language/D/DTypeUtils.cpp#L82
 . I should also rename this patch to something less misleading, since it is 
not the type name the issue, I just got this right due to fallback on invalid 
encoding on my side.

That said, do you know an easier way to test this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112564

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


[Lldb-commits] [PATCH] D114668: [lldb] Move generic DWARFASTParser code out of Clang-specific code

2021-11-28 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp:77
+  default:
+  case DW_AT_abstract_origin:
+  case DW_AT_accessibility:

Why we are including just these specific attributes? Maybe we should add a 
comment explaining it. According to the DWARF standard, any attribute is 
eligible for any tag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114668

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


[Lldb-commits] [PATCH] D114668: [lldb] Move generic DWARFASTParser code out of Clang-specific code

2021-11-27 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 added a project: LLDB.
Herald added subscribers: JDevlieghere, mgorny.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114668

Files:
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3074,99 +3074,6 @@
   return arg_idx;
 }
 
-llvm::Optional
-DWARFASTParser::ParseChildArrayInfo(const DWARFDIE _die,
-const ExecutionContext *exe_ctx) {
-  SymbolFile::ArrayInfo array_info;
-  if (!parent_die)
-return llvm::None;
-
-  for (DWARFDIE die : parent_die.children()) {
-const dw_tag_t tag = die.Tag();
-if (tag != DW_TAG_subrange_type)
-  continue;
-
-DWARFAttributes attributes;
-const size_t num_child_attributes = die.GetAttributes(attributes);
-if (num_child_attributes > 0) {
-  uint64_t num_elements = 0;
-  uint64_t lower_bound = 0;
-  uint64_t upper_bound = 0;
-  bool upper_bound_valid = false;
-  uint32_t i;
-  for (i = 0; i < num_child_attributes; ++i) {
-const dw_attr_t attr = attributes.AttributeAtIndex(i);
-DWARFFormValue form_value;
-if (attributes.ExtractFormValueAtIndex(i, form_value)) {
-  switch (attr) {
-  case DW_AT_name:
-break;
-
-  case DW_AT_count:
-if (DWARFDIE var_die = die.GetReferencedDIE(DW_AT_count)) {
-  if (var_die.Tag() == DW_TAG_variable)
-if (exe_ctx) {
-  if (auto frame = exe_ctx->GetFrameSP()) {
-Status error;
-lldb::VariableSP var_sp;
-auto valobj_sp = frame->GetValueForVariableExpressionPath(
-var_die.GetName(), eNoDynamicValues, 0, var_sp,
-error);
-if (valobj_sp) {
-  num_elements = valobj_sp->GetValueAsUnsigned(0);
-  break;
-}
-  }
-}
-} else
-  num_elements = form_value.Unsigned();
-break;
-
-  case DW_AT_bit_stride:
-array_info.bit_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_byte_stride:
-array_info.byte_stride = form_value.Unsigned();
-break;
-
-  case DW_AT_lower_bound:
-lower_bound = form_value.Unsigned();
-break;
-
-  case DW_AT_upper_bound:
-upper_bound_valid = true;
-upper_bound = form_value.Unsigned();
-break;
-
-  default:
-  case DW_AT_abstract_origin:
-  case DW_AT_accessibility:
-  case DW_AT_allocated:
-  case DW_AT_associated:
-  case DW_AT_data_location:
-  case DW_AT_declaration:
-  case DW_AT_description:
-  case DW_AT_sibling:
-  case DW_AT_threads_scaled:
-  case DW_AT_type:
-  case DW_AT_visibility:
-break;
-  }
-}
-  }
-
-  if (num_elements == 0) {
-if (upper_bound_valid && upper_bound >= lower_bound)
-  num_elements = upper_bound - lower_bound + 1;
-  }
-
-  array_info.element_orders.push_back(num_elements);
-}
-  }
-  return array_info;
-}
-
 Type *DWARFASTParserClang::GetTypeForDIE(const DWARFDIE ) {
   if (die) {
 SymbolFileDWARF *dwarf = die.GetDWARF();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
===
--- /dev/null
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -0,0 +1,102 @@
+#include "DWARFASTParser.h"
+#include "DWARFAttribute.h"
+#include "DWARFDIE.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Target/StackFrame.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+llvm::Optional
+DWARFASTParser::ParseChildArrayInfo(const DWARFDIE _die,
+const ExecutionContext *exe_ctx) {
+  SymbolFile::ArrayInfo array_info;
+  if (!parent_die)
+return llvm::None;
+
+  for (DWARFDIE die : parent_die.children()) {
+const dw_tag_t tag = die.Tag();
+if (tag != DW_TAG_subrange_type)
+  continue;
+
+DWARFAttributes attributes;
+const size_t num_child_attributes = die.GetAttributes(attributes);
+if (num_child_attributes > 0) {
+  uint64_t num_elements = 0;
+  uint64_t lower_bound = 0;
+  uint64_t upper_bound = 0;
+  bool 

[Lldb-commits] [PATCH] D113604: [lldb] Format lldb/include/lldb/Symbol/Type.h

2021-11-25 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D113604#3138107 , @JDevlieghere 
wrote:

> LGTM modulo the inline comment.

I addressed what you requested. Please review. If it is good to land, please 
do, as I don't have permissions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113604

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


[Lldb-commits] [PATCH] D113604: [lldb] Format lldb/include/lldb/Symbol/Type.h

2021-11-25 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 389836.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h
  lldb/source/Symbol/Type.cpp


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
-   llvm::StringRef ,
-   llvm::StringRef ,
+bool Type::GetTypeScopeAndBasename(const llvm::StringRef name,
+   llvm::StringRef scope,
+   llvm::StringRef basename,
TypeClass _class) {
   type_class = eTypeClassAny;
 
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,9 +201,9 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
-  llvm::StringRef ,
-  llvm::StringRef ,
+  static bool GetTypeScopeAndBasename(const llvm::StringRef name,
+  llvm::StringRef scope,
+  llvm::StringRef basename,
   lldb::TypeClass _class);
   void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; 
}
 
@@ -473,8 +477,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,9 +662,9 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
-   llvm::StringRef ,
-   llvm::StringRef ,
+bool 

[Lldb-commits] [PATCH] D113604: [lldb] Format lldb/include/lldb/Symbol/Type.h

2021-11-17 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Friendly ping, maybe you forgot this, can you check it now @teemperor ? :)


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

https://reviews.llvm.org/D113604

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


[Lldb-commits] [PATCH] D113634: [lldb] Add support for DW_TAG_immutable_type

2021-11-11 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D113634#3124428 , @teemperor wrote:

> In D113634#3124401 , @ljmf00 wrote:
>
>> In D113634#3124042 , @teemperor 
>> wrote:
>>
>>> Are the DWARFASTParserClang changes meant as a step towards making it parse 
>>> D?
>>
>> Yes, not only D but any language that currently falls here 
>> (https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L106-L112).
>>  AFAIK, rust have immutable variables too. Since I'm working on a 
>> DWARFFASTParser for D this won't affect it in the future, but for languages 
>> like Rust that uses the Python API and rely on Clang DWARFParser, this could 
>> be beneficial.
>
> I know the change is well intended, but the Rust support is 100% untested and 
> completely broken (it can't deal with pretty much any non-trivial program 
> from my recollections). So I would split out the Clang changes (which 
> probably require some longer discussion) and just keep the Type/DWARFDIe 
> changes (which look good to me).

Ok, makes sense to me. I'm going to make a separate patch, mark you as a 
subscriber and discuss this there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113634

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


[Lldb-commits] [PATCH] D113634: [lldb] Add support for DW_TAG_immutable_type

2021-11-11 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D113634#3124042 , @teemperor wrote:

> Are the DWARFASTParserClang changes meant as a step towards making it parse D?

Yes, not only D but any language that currently falls here 
(https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L106-L112).
 AFAIK, rust have immutable variables too. Since I'm working on a 
DWARFFASTParser for D this won't affect it in the future, but for languages 
like Rust that uses the Python API and rely on Clang DWARFParser, this could be 
beneficial.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113634

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


[Lldb-commits] [PATCH] D113634: [lldb] Add support for DW_TAG_immutable_type

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 planned changes to this revision.
ljmf00 added a comment.

I still need to add tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113634

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


[Lldb-commits] [PATCH] D113634: [lldb] Add support for DW_TAG_immutable_type

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
Herald added a reviewer: shafik.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113634

Files:
  lldb/include/lldb/Symbol/Type.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -268,6 +268,9 @@
   case DW_TAG_const_type:
 s.PutCString("const ");
 break;
+  case DW_TAG_immutable_type:
+s.PutCString("immutable ");
+break;
   case DW_TAG_enumeration_type:
 s.PutCString("enum ");
 break;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -496,6 +496,7 @@
   case DW_TAG_reference_type:
   case DW_TAG_rvalue_reference_type:
   case DW_TAG_const_type:
+  case DW_TAG_immutable_type:
   case DW_TAG_restrict_type:
   case DW_TAG_volatile_type:
   case DW_TAG_atomic_type:
@@ -646,6 +647,9 @@
   case DW_TAG_const_type:
 encoding_data_type = Type::eEncodingIsConstUID;
 break;
+  case DW_TAG_immutable_type:
+encoding_data_type = Type::eEncodingIsImmutableUID;
+break;
   case DW_TAG_restrict_type:
 encoding_data_type = Type::eEncodingIsRestrictUID;
 break;
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -89,6 +89,9 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the type whose UID is m_encoding_uid with the immutable
+/// qualifier added.
+eEncodingIsImmutableUID,
 /// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -268,6 +268,9 @@
   case DW_TAG_const_type:
 s.PutCString("const ");
 break;
+  case DW_TAG_immutable_type:
+s.PutCString("immutable ");
+break;
   case DW_TAG_enumeration_type:
 s.PutCString("enum ");
 break;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -496,6 +496,7 @@
   case DW_TAG_reference_type:
   case DW_TAG_rvalue_reference_type:
   case DW_TAG_const_type:
+  case DW_TAG_immutable_type:
   case DW_TAG_restrict_type:
   case DW_TAG_volatile_type:
   case DW_TAG_atomic_type:
@@ -646,6 +647,9 @@
   case DW_TAG_const_type:
 encoding_data_type = Type::eEncodingIsConstUID;
 break;
+  case DW_TAG_immutable_type:
+encoding_data_type = Type::eEncodingIsImmutableUID;
+break;
   case DW_TAG_restrict_type:
 encoding_data_type = Type::eEncodingIsRestrictUID;
 break;
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -89,6 +89,9 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the type whose UID is m_encoding_uid with the immutable
+/// qualifier added.
+eEncodingIsImmutableUID,
 /// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113605: [lldb] Fix documentation for EncodingDataType

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 386362.
ljmf00 retitled this revision from "[lldb] Add documentation for 
eEncodingIsSyntheticUID" to "[lldb] Fix documentation for EncodingDataType".

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

https://reviews.llvm.org/D113605

Files:
  lldb/include/lldb/Symbol/Type.h


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -66,6 +66,7 @@
 class Type : public std::enable_shared_from_this, public UserID {
 public:
   enum EncodingDataType {
+/// Invalid encoding
 eEncodingInvalid,
 /// This type is the type whose UID is m_encoding_uid.
 eEncodingIsUID,
@@ -78,7 +79,7 @@
 /// This type is the type whose UID is m_encoding_uid with the volatile
 /// qualifier added.
 eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
+/// This type is alias to a type whose UID is m_encoding_uid.
 eEncodingIsTypedefUID,
 /// This type is pointer to a type whose UID is m_encoding_uid.
 eEncodingIsPointerUID,
@@ -88,6 +89,7 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
 


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -66,6 +66,7 @@
 class Type : public std::enable_shared_from_this, public UserID {
 public:
   enum EncodingDataType {
+/// Invalid encoding
 eEncodingInvalid,
 /// This type is the type whose UID is m_encoding_uid.
 eEncodingIsUID,
@@ -78,7 +79,7 @@
 /// This type is the type whose UID is m_encoding_uid with the volatile
 /// qualifier added.
 eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
+/// This type is alias to a type whose UID is m_encoding_uid.
 eEncodingIsTypedefUID,
 /// This type is pointer to a type whose UID is m_encoding_uid.
 eEncodingIsPointerUID,
@@ -88,6 +89,7 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113604: [lldb] Format lldb/include/lldb/Symbol/Type.h

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Can you check now? If looks good, can you land it please?




Comment at: lldb/include/lldb/Symbol/Type.h:86
 eEncodingIsAtomicUID,  ///< This type is the type whose UID is
/// m_encoding_uid as an atomic type.
 eEncodingIsSyntheticUID

teemperor wrote:
> teemperor wrote:
> > FWIW, we usually update the comments to something less >squished< such as:
> > ```
> > ///< This type is the type whose UID is m_encoding_uid
> > eEcodingIsUID.
> > /// This type is the type whose UID is m_encoding_uid with the const 
> > qualifier added
> > eEncodingIsConstUID,
> > ```
> > 
> > I think this patch is good as-is, but there would be bonus points for 
> > fixing up the comment style :)
> I meant
> ```
> lang=c++
> /// This type is the type whose UID is m_encoding_uid
> eEcodingIsUID.
> /// This type is the type whose UID is m_encoding_uid with the const 
> qualifier added
> eEncodingIsConstUID,
> ```
Done


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

https://reviews.llvm.org/D113604

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


[Lldb-commits] [PATCH] D113604: [lldb] Format lldb/include/lldb/Symbol/Type.h

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 386361.

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

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,7 +201,7 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+  static bool GetTypeScopeAndBasename(const llvm::StringRef ,
   llvm::StringRef ,
   llvm::StringRef ,
   lldb::TypeClass _class);
@@ -473,8 +477,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
- 

[Lldb-commits] [PATCH] D110578: [lldb] Add support for D programming language

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a subscriber: dblaikie.
ljmf00 added a comment.

@dblaikie Maybe you can land this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110578

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


[Lldb-commits] [PATCH] D113605: [lldb] Add documentation for eEncodingIsSyntheticUID

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113605

Files:
  lldb/include/lldb/Symbol/Type.h


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -84,7 +84,8 @@
/// whose UID is m_encoding_uid,
 eEncodingIsAtomicUID,  ///< This type is the type whose UID is
/// m_encoding_uid as an atomic type.
-eEncodingIsSyntheticUID
+eEncodingIsSyntheticUID///< This type is the synthetic type whose 
UID is
+   /// m_encoding_uid
   };
 
   enum class ResolveState : unsigned char {


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -84,7 +84,8 @@
/// whose UID is m_encoding_uid,
 eEncodingIsAtomicUID,  ///< This type is the type whose UID is
/// m_encoding_uid as an atomic type.
-eEncodingIsSyntheticUID
+eEncodingIsSyntheticUID///< This type is the synthetic type whose UID is
+   /// m_encoding_uid
   };
 
   enum class ResolveState : unsigned char {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113604: [lldb] Format lldb/include/lldb/Symbol/Type.h

2021-11-10 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,17 +67,17 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
+eEncodingIsUID,///< This type is the type whose UID is 
m_encoding_uid
+eEncodingIsConstUID,   ///< This type is the type whose UID is 
m_encoding_uid
+   /// with the const qualifier added
+eEncodingIsRestrictUID,///< This type is the type whose UID is
+   /// m_encoding_uid with the restrict 
qualifier added
+eEncodingIsVolatileUID,///< This type is the type whose UID is
+   /// m_encoding_uid with the volatile 
qualifier added
+eEncodingIsTypedefUID, ///< This type is pointer to a type whose 
UID is
+   /// m_encoding_uid
+eEncodingIsPointerUID, ///< This type is pointer to a type whose 
UID is
+   /// m_encoding_uid
 eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
/// whose UID is m_encoding_uid
 eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
@@ -197,7 +197,7 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+  static bool GetTypeScopeAndBasename(const llvm::StringRef ,
   llvm::StringRef ,
   llvm::StringRef ,
   lldb::TypeClass _class);
@@ -473,8 +473,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp,
- ConstString name, const llvm::APSInt );
+  TypeEnumMemberImpl(const lldb::TypeImplSP _type_sp, ConstString name,
+ const llvm::APSInt );
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl ) = default;
 


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,17 +67,17 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
+eEncodingIsUID,///< This type is the type whose UID is m_encoding_uid
+eEncodingIsConstUID,   ///< This type is the type whose UID is m_encoding_uid
+   /// with the const qualifier added
+eEncodingIsRestrictUID,///< This type is the type whose UID is
+   /// m_encoding_uid with the restrict qualifier added
+eEncodingIsVolatileUID,///< This type is the type whose UID is
+   /// m_encoding_uid with the volatile qualifier added
+eEncodingIsTypedefUID, ///< This type is pointer to a type whose UID is
+   

[Lldb-commits] [PATCH] D110578: [lldb] Add support for D programming language

2021-11-09 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

Since D111414  got merged, @teemperor can you 
land this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110578

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


[Lldb-commits] [PATCH] D113098: [lldb] (Partially) enable formatting of utf strings before the program is started

2021-11-03 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D113098#3105809 , @labath wrote:

> bug reported in PR45856.

Thanks for your time fixing this. So, for better understanding, does the 
infrastructure behind LLDB, Target and Process have similar APIs but Process is 
just for the running state?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113098

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


[Lldb-commits] [PATCH] D112658: [lldb] Refactor C/C++ string and char summary providers

2021-10-28 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D112658#3092586 , @labath wrote:

> Thanks for doing this. Just a couple of small remarks.

Can you re-review?




Comment at: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp:35
 
-bool lldb_private::formatters::Char8StringSummaryProvider(
-ValueObject , Stream , const TypeSummaryOptions &) {
-  ProcessSP process_sp = valobj.GetProcessSP();
-  if (!process_sp)
-return false;
+namespace {
+

labath wrote:
> We don't use [[ 
> https://llvm.org/docs/CodingStandards.html#anonymous-namespaces | anonymous 
> namespaces]] like this. `static` is sufficient.
Done



Comment at: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp:76-85
+if (ElemType == StringPrinter::StringElementType::UTF8) {
+  options.SetPrefixToken("u8");
+  valobj.GetValueAsCString(lldb::eFormatUnicode8, value);
+} else if (ElemType == StringPrinter::StringElementType::UTF16) {
+  options.SetPrefixToken("u");
+  valobj.GetValueAsCString(lldb::eFormatUnicode16, value);
+} else if (ElemType == StringPrinter::StringElementType::UTF32) {

labath wrote:
> Maybe a helper function like `pair 
> getElementTraits(StringElementType)` would reduce the repetition further? Or 
> possibly it could be a static array indexed by `ElemType`.
Done. I used `constexpr auto`, I'm not sure if `auto` is a practice here in the 
LLVM codebase or I should explicitly specify the pair type.


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

https://reviews.llvm.org/D112658

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


[Lldb-commits] [PATCH] D112658: [lldb] Refactor C/C++ string and char summary providers

2021-10-28 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 383121.

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

https://reviews.llvm.org/D112658

Files:
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp

Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -32,8 +32,25 @@
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-bool lldb_private::formatters::Char8StringSummaryProvider(
-ValueObject , Stream , const TypeSummaryOptions &) {
+using StringElementType = StringPrinter::StringElementType;
+
+static constexpr std::pair getElementTraits(StringElementType ElemType)
+{
+  switch(ElemType)
+  {
+case StringElementType::UTF8:
+  return std::make_pair("u8", lldb::eFormatUnicode8);
+case StringElementType::UTF16:
+  return std::make_pair("u", lldb::eFormatUnicode16);
+case StringElementType::UTF32:
+  return std::make_pair("U", lldb::eFormatUnicode32);
+default:
+  return std::make_pair(nullptr, lldb::eFormatInvalid);
+  }
+}
+
+template
+static bool CharStringSummaryProvider(ValueObject , Stream ) {
   ProcessSP process_sp = valobj.GetProcessSP();
   if (!process_sp)
 return false;
@@ -46,65 +63,55 @@
   options.SetLocation(valobj_addr);
   options.SetProcessSP(process_sp);
   options.SetStream();
-  options.SetPrefixToken("u8");
+  options.SetPrefixToken(getElementTraits(ElemType).first);
 
-  if (!StringPrinter::ReadStringAndDumpToStream<
-  StringPrinter::StringElementType::UTF8>(options)) {
+  if (!StringPrinter::ReadStringAndDumpToStream(options))
 stream.Printf("Summary Unavailable");
-return true;
-  }
 
   return true;
 }
 
-bool lldb_private::formatters::Char16StringSummaryProvider(
-ValueObject , Stream , const TypeSummaryOptions &) {
-  ProcessSP process_sp = valobj.GetProcessSP();
-  if (!process_sp)
-return false;
+template
+static bool CharSummaryProvider(ValueObject , Stream ) {
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
 
-  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
-  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
+  if (error.Fail())
 return false;
 
-  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
-  options.SetLocation(valobj_addr);
-  options.SetProcessSP(process_sp);
-  options.SetStream();
-  options.SetPrefixToken("u");
+  std::string value;
+  StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
 
-  if (!StringPrinter::ReadStringAndDumpToStream<
-  StringPrinter::StringElementType::UTF16>(options)) {
-stream.Printf("Summary Unavailable");
-return true;
-  }
+  constexpr auto ElemTraits = getElementTraits(ElemType);
+  valobj.GetValueAsCString(ElemTraits.second, value);
 
-  return true;
-}
+  if (!value.empty())
+stream.Printf("%s ", value.c_str());
 
-bool lldb_private::formatters::Char32StringSummaryProvider(
-ValueObject , Stream , const TypeSummaryOptions &) {
-  ProcessSP process_sp = valobj.GetProcessSP();
-  if (!process_sp)
-return false;
+  options.SetData(std::move(data));
+  options.SetStream();
+  options.SetPrefixToken(ElemTraits.first);
+  options.SetQuote('\'');
+  options.SetSourceSize(1);
+  options.SetBinaryZeroIsTerminator(false);
 
-  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
-  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
-return false;
+  return StringPrinter::ReadBufferAndDumpToStream(options);
+}
 
-  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
-  options.SetLocation(valobj_addr);
-  options.SetProcessSP(process_sp);
-  options.SetStream();
-  options.SetPrefixToken("U");
+bool lldb_private::formatters::Char8StringSummaryProvider(
+ValueObject , Stream , const TypeSummaryOptions &) {
+  return CharStringSummaryProvider(valobj, stream);
+}
 
-  if (!StringPrinter::ReadStringAndDumpToStream<
-  StringPrinter::StringElementType::UTF32>(options)) {
-stream.Printf("Summary Unavailable");
-return true;
-  }
+bool lldb_private::formatters::Char16StringSummaryProvider(
+ValueObject , Stream , const TypeSummaryOptions &) {
+  return CharStringSummaryProvider(valobj, stream);
+}
 
-  return true;
+bool lldb_private::formatters::Char32StringSummaryProvider(
+ValueObject , Stream , const TypeSummaryOptions &) {
+  return CharStringSummaryProvider(valobj, stream);
 }
 
 bool lldb_private::formatters::WCharStringSummaryProvider(
@@ -139,13 +146,13 @@
   switch (wchar_size) {
   case 8:
 return StringPrinter::ReadStringAndDumpToStream<
-StringPrinter::StringElementType::UTF8>(options);
+StringElementType::UTF8>(options);
   case 16:
 return StringPrinter::ReadStringAndDumpToStream<
-

[Lldb-commits] [PATCH] D112586: [lldb] Remove forgotten FIXME on CPlusPlus formatters

2021-10-28 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D112586#3093490 , @teemperor wrote:

> LGTM, thanks.

Note: I can't land it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112586

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


[Lldb-commits] [PATCH] D112658: [lldb] Refactor C/C++ string and char summary providers

2021-10-27 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 added projects: LLDB, LLVM.
Herald added a subscriber: JDevlieghere.
ljmf00 requested review of this revision.
Herald added a subscriber: lldb-commits.

  Signed-off-by: Luís Ferreira 

This patch refactors C/C++ formatters to avoid repetitive code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112658

Files:
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp

Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -32,79 +32,86 @@
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-bool lldb_private::formatters::Char8StringSummaryProvider(
-ValueObject , Stream , const TypeSummaryOptions &) {
-  ProcessSP process_sp = valobj.GetProcessSP();
-  if (!process_sp)
-return false;
+namespace {
+
+  template
+  static bool CharStringSummaryProvider(ValueObject , Stream ) {
+ProcessSP process_sp = valobj.GetProcessSP();
+if (!process_sp)
+  return false;
+
+lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
+if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
+  return false;
+
+StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
+options.SetLocation(valobj_addr);
+options.SetProcessSP(process_sp);
+options.SetStream();
+if (ElemType == StringPrinter::StringElementType::UTF8)
+  options.SetPrefixToken("u8");
+else if (ElemType == StringPrinter::StringElementType::UTF16)
+  options.SetPrefixToken("u");
+else if (ElemType == StringPrinter::StringElementType::UTF32)
+  options.SetPrefixToken("U");
+
+if (!StringPrinter::ReadStringAndDumpToStream(options))
+  stream.Printf("Summary Unavailable");
 
-  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
-  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
-return false;
-
-  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
-  options.SetLocation(valobj_addr);
-  options.SetProcessSP(process_sp);
-  options.SetStream();
-  options.SetPrefixToken("u8");
-
-  if (!StringPrinter::ReadStringAndDumpToStream<
-  StringPrinter::StringElementType::UTF8>(options)) {
-stream.Printf("Summary Unavailable");
 return true;
   }
 
-  return true;
-}
-
-bool lldb_private::formatters::Char16StringSummaryProvider(
-ValueObject , Stream , const TypeSummaryOptions &) {
-  ProcessSP process_sp = valobj.GetProcessSP();
-  if (!process_sp)
-return false;
+  template
+  static bool CharSummaryProvider(ValueObject , Stream ) {
+DataExtractor data;
+Status error;
+valobj.GetData(data, error);
+
+if (error.Fail())
+  return false;
+
+std::string value;
+StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
+
+if (ElemType == StringPrinter::StringElementType::UTF8) {
+  options.SetPrefixToken("u8");
+  valobj.GetValueAsCString(lldb::eFormatUnicode8, value);
+} else if (ElemType == StringPrinter::StringElementType::UTF16) {
+  options.SetPrefixToken("u");
+  valobj.GetValueAsCString(lldb::eFormatUnicode16, value);
+} else if (ElemType == StringPrinter::StringElementType::UTF32) {
+  options.SetPrefixToken("U");
+  valobj.GetValueAsCString(lldb::eFormatUnicode32, value);
+}
+
+if (!value.empty())
+  stream.Printf("%s ", value.c_str());
+
+options.SetData(std::move(data));
+options.SetStream();
+options.SetQuote('\'');
+options.SetSourceSize(1);
+options.SetBinaryZeroIsTerminator(false);
+
+return StringPrinter::ReadBufferAndDumpToStream(options);
+  }
 
-  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
-  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
-return false;
+} // namespace
 
-  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
-  options.SetLocation(valobj_addr);
-  options.SetProcessSP(process_sp);
-  options.SetStream();
-  options.SetPrefixToken("u");
 
-  if (!StringPrinter::ReadStringAndDumpToStream<
-  StringPrinter::StringElementType::UTF16>(options)) {
-stream.Printf("Summary Unavailable");
-return true;
-  }
+bool lldb_private::formatters::Char8StringSummaryProvider(
+ValueObject , Stream , const TypeSummaryOptions &) {
+  return CharStringSummaryProvider(valobj, stream);
+}
 
-  return true;
+bool lldb_private::formatters::Char16StringSummaryProvider(
+ValueObject , Stream , const TypeSummaryOptions &) {
+  return CharStringSummaryProvider(valobj, stream);
 }
 
 bool lldb_private::formatters::Char32StringSummaryProvider(
 ValueObject , Stream , const TypeSummaryOptions &) {
-  ProcessSP process_sp = valobj.GetProcessSP();
-  if (!process_sp)
-return false;
-
-  lldb::addr_t valobj_addr = 

[Lldb-commits] [PATCH] D112564: [lldb] Add support for custom char8_t types with different name

2021-10-27 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D112564#3089399 , @labath wrote:

> What exactly do you need the test to do? Is printing a global variable 
> (`char8_t_ish foo[] = "my string"`) sufficient?
> If so, you can take a look at the tests in `test/Shell/SymbolFile/DWARF` for 
> inspiration. There are .s and .ll tests there.
> The pattern would roughly be:
>
>   # RUN: llvm-mc (or llc) -o %t %s
>   # RUN: %lldb %t -o "target variable foo" | FileCheck %s
>   
>   # CHECK: (char8_t_ish[]) foo = "my string"
>   
>   your code here

Yeah, it is a bit more complicated than that although, due to 
https://bugs.llvm.org/show_bug.cgi?id=45856 . I'm going to take a look at those 
tests and write some.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112564

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


[Lldb-commits] [PATCH] D112586: [lldb] Remove forgotten FIXME on CPlusPlus formatters

2021-10-26 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

  The patch [1] introduced this FIXME but ended up not being removed when fixed.
  
  [1]: 
https://github.com/llvm/llvm-project/commit/f68df12fb039d5177e34f4541fa242b891949db6
  
  Signed-off-by: Luís Ferreira 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112586

Files:
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp


Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1010,8 +1010,6 @@
   .SetShowMembersOneLiner(false)
   .SetHideItemNames(false);
 
-  // FIXME because of a bug in the FormattersContainer we need to add a summary
-  // for both X* and const X* ()
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::Char8StringSummaryProvider,
   "char8_t * summary provider", ConstString("char8_t *"), string_flags);


Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1010,8 +1010,6 @@
   .SetShowMembersOneLiner(false)
   .SetHideItemNames(false);
 
-  // FIXME because of a bug in the FormattersContainer we need to add a summary
-  // for both X* and const X* ()
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::Char8StringSummaryProvider,
   "char8_t * summary provider", ConstString("char8_t *"), string_flags);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D112564: [lldb] Add support for custom char8_t types with different name

2021-10-26 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

https://bugs.llvm.org/show_bug.cgi?id=52324


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112564

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


[Lldb-commits] [PATCH] D112564: [lldb] Add support for custom char8_t types with different name

2021-10-26 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

I will also create an issue and cross-reference this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112564

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


[Lldb-commits] [PATCH] D112564: [lldb] Add support for custom char8_t types with different name

2021-10-26 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

I can reproduce this with LDC (D LLVM-based compiler), but I don't know a way 
to do it with clang. Probably I need to manually write a .ll file for this. Can 
someone guide me on adding tests for this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112564

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


[Lldb-commits] [PATCH] D112564: [lldb] Add support for custom char8_t types with different name

2021-10-26 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 created this revision.
ljmf00 added projects: LLDB, LLVM.
Herald added a subscriber: JDevlieghere.
ljmf00 requested review of this revision.
Herald added a subscriber: lldb-commits.

  Currently for UTF-16 and UTF-32 types that are recognized by the DWARF 
encoding
  tags without `char16_t` and `char32_t` names respectively are recognized, but
  other names different than `char8_t` are not. To support the same behaviour of
  the previous encodings, DWARF encoding tags should be taken to consideration
  before fallbacking into the type name.
  
  Signed-off-by: Luís Ferreira 

Cross-referencing https://reviews.llvm.org/D66447


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112564

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
@@ -5155,6 +5155,8 @@
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:
   return lldb::eFormatChar;
+case clang::BuiltinType::Char8:
+  return lldb::eFormatUnicode8;
 case clang::BuiltinType::Char16:
   return lldb::eFormatUnicode16;
 case clang::BuiltinType::Char32:


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5155,6 +5155,8 @@
 case clang::BuiltinType::UChar:
 case clang::BuiltinType::WChar_U:
   return lldb::eFormatChar;
+case clang::BuiltinType::Char8:
+  return lldb::eFormatUnicode8;
 case clang::BuiltinType::Char16:
   return lldb::eFormatUnicode16;
 case clang::BuiltinType::Char32:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D110578: [lldb] Add support for D programming language

2021-10-08 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 updated this revision to Diff 378255.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110578

Files:
  lldb/include/lldb/Core/Mangled.h
  lldb/source/Core/Mangled.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/unittests/Core/MangledTest.cpp

Index: lldb/unittests/Core/MangledTest.cpp
===
--- lldb/unittests/Core/MangledTest.cpp
+++ lldb/unittests/Core/MangledTest.cpp
@@ -72,6 +72,24 @@
   EXPECT_STREQ("", the_demangled.GetCString());
 }
 
+TEST(MangledTest, ResultForValidDLangName) {
+  ConstString mangled_name("_Dmain");
+  Mangled the_mangled(mangled_name);
+  ConstString the_demangled = the_mangled.GetDemangledName();
+
+  ConstString expected_result("D main");
+  EXPECT_STREQ(expected_result.GetCString(), the_demangled.GetCString());
+}
+
+TEST(MangledTest, EmptyForInvalidDLangName) {
+  ConstString mangled_name("_DDD");
+  Mangled the_mangled(mangled_name);
+  ConstString the_demangled = the_mangled.GetDemangledName();
+
+  EXPECT_STREQ("", the_demangled.GetCString());
+}
+
+
 TEST(MangledTest, NameIndexes_FindFunctionSymbols) {
   SubsystemRAII
   subsystems;
Index: lldb/source/Symbol/Symtab.cpp
===
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -248,10 +248,8 @@
 
   // No filters for this scheme yet. Include all names in indexing.
   case Mangled::eManglingSchemeMSVC:
-return false;
-
-  // No filters for this scheme yet. Include all names in indexing.
   case Mangled::eManglingSchemeRustV0:
+  case Mangled::eManglingSchemeD:
 return false;
 
   // Don't try and demangle things we can't categorize.
Index: lldb/source/Core/Mangled.cpp
===
--- lldb/source/Core/Mangled.cpp
+++ lldb/source/Core/Mangled.cpp
@@ -45,6 +45,9 @@
   if (name.startswith("_R"))
 return Mangled::eManglingSchemeRustV0;
 
+  if (name.startswith("_D"))
+return Mangled::eManglingSchemeD;
+
   if (name.startswith("_Z"))
 return Mangled::eManglingSchemeItanium;
 
@@ -185,6 +188,19 @@
   return demangled_cstr;
 }
 
+static char *GetDLangDemangledStr(const char *M) {
+  char *demangled_cstr = llvm::dlangDemangle(M);
+
+  if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) {
+if (demangled_cstr && demangled_cstr[0])
+  LLDB_LOG(log, "demangled dlang: {0} -> \"{1}\"", M, demangled_cstr);
+else
+  LLDB_LOG(log, "demangled dlang: {0} -> error: failed to demangle", M);
+  }
+
+  return demangled_cstr;
+}
+
 // Explicit demangling for scheduled requests during batch processing. This
 // makes use of ItaniumPartialDemangler's rich demangle info
 bool Mangled::DemangleWithRichManglingInfo(
@@ -244,7 +260,8 @@
   }
 
   case eManglingSchemeRustV0:
-// Rich demangling scheme is not supported for Rust
+  case eManglingSchemeD:
+// Rich demangling scheme is not supported
 return false;
   }
   llvm_unreachable("Fully covered switch above!");
@@ -277,6 +294,9 @@
   case eManglingSchemeRustV0:
 demangled_name = GetRustV0DemangledStr(mangled_name);
 break;
+  case eManglingSchemeD:
+demangled_name = GetDLangDemangledStr(mangled_name);
+break;
   case eManglingSchemeNone:
 llvm_unreachable("eManglingSchemeNone was handled already");
   }
Index: lldb/include/lldb/Core/Mangled.h
===
--- lldb/include/lldb/Core/Mangled.h
+++ lldb/include/lldb/Core/Mangled.h
@@ -44,7 +44,8 @@
 eManglingSchemeNone = 0,
 eManglingSchemeMSVC,
 eManglingSchemeItanium,
-eManglingSchemeRustV0
+eManglingSchemeRustV0,
+eManglingSchemeD
   };
 
   /// Default constructor.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D110578: [lldb] Add support for D programming language

2021-09-28 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D110578#3027692 , @teemperor wrote:

> Do you have commit access or should someone land this for you?

I don't have commit access, although this is a stacked revision, so there are 
some dependent patches.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110578

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