[Lldb-commits] [PATCH] D111715: [WIP] [lldb] change name demangling to be consistent between windows and linx
thakis added a comment. I don't have an opinion on this change and I don't mind the demangler change, but isn't the type information helpful? The mangled itanium name doesn't include type information which is why it's not printed, but the mangled ms name does include it. But as I said, I don't have an opinion either way. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111715/new/ https://reviews.llvm.org/D111715 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D111632: [lldb] Split ParseSingleMember into Obj-C property and normal member/ivar parsing code.
This revision was automatically updated to reflect the committed changes. Closed by commit rG60b96aa65e59: [lldb] Split ParseSingleMember into Obj-C property and normal member/ivar… (authored by teemperor). Herald added a subscriber: lldb-commits. Changed prior to commit: https://reviews.llvm.org/D111632?vs=378925&id=380175#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111632/new/ https://reviews.llvm.org/D111632 Files: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h === --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h @@ -187,11 +187,26 @@ } }; + /// Parses a DW_TAG_APPLE_property DIE and appends the parsed data to the + /// list of delayed Objective-C properties. + /// + /// Note: The delayed property needs to be finalized to actually create the + /// property declarations in the module AST. + /// + /// \param die The DW_TAG_APPLE_property DIE that will be parsed. + /// \param parent_die The parent DIE. + /// \param class_clang_type The Objective-C class that will contain the + /// created property. + /// \param delayed_properties The list of delayed properties that the result + /// will be appended to. + void ParseObjCProperty(const DWARFDIE &die, const DWARFDIE &parent_die, + const lldb_private::CompilerType &class_clang_type, + DelayedPropertyList &delayed_properties); + void ParseSingleMember(const DWARFDIE &die, const DWARFDIE &parent_die, const lldb_private::CompilerType &class_clang_type, lldb::AccessType default_accessibility, -DelayedPropertyList &delayed_properties, lldb_private::ClangASTImporter::LayoutInfo &layout_info, FieldInfo &last_field_info); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp === --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1915,11 +1915,10 @@ const CompilerType &property_opaque_type, // The property type is only // required if you don't have an // ivar decl - clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, - const char *property_getter_name, uint32_t property_attributes, - const ClangASTMetadata *metadata) + const char *property_setter_name, const char *property_getter_name, + uint32_t property_attributes, const ClangASTMetadata *metadata) : m_class_opaque_type(class_opaque_type), m_property_name(property_name), -m_property_opaque_type(property_opaque_type), m_ivar_decl(ivar_decl), +m_property_opaque_type(property_opaque_type), m_property_setter_name(property_setter_name), m_property_getter_name(property_getter_name), m_property_attributes(property_attributes) { @@ -1938,7 +1937,6 @@ m_class_opaque_type = rhs.m_class_opaque_type; m_property_name = rhs.m_property_name; m_property_opaque_type = rhs.m_property_opaque_type; -m_ivar_decl = rhs.m_ivar_decl; m_property_setter_name = rhs.m_property_setter_name; m_property_getter_name = rhs.m_property_getter_name; m_property_attributes = rhs.m_property_attributes; @@ -1953,7 +1951,7 @@ bool Finalize() { return TypeSystemClang::AddObjCClassProperty( m_class_opaque_type, m_property_name, m_property_opaque_type, -m_ivar_decl, m_property_setter_name, m_property_getter_name, +/*ivar_decl=*/nullptr, m_property_setter_name, m_property_getter_name, m_property_attributes, m_metadata_up.get()); } @@ -1961,7 +1959,6 @@ CompilerType m_class_opaque_type; const char *m_property_name; CompilerType m_property_opaque_type; - clang::ObjCIvarDecl *m_ivar_decl; const char *m_property_setter_name; const char *m_property_getter_name; uint32_t m_property_attributes; @@ -2639,13 +2636,51 @@ } } +void DWARFASTParserClang::ParseObjCProperty( +const DWARFDIE &die, const DWARFDIE &parent_die, +const lldb_private::CompilerType &class_clang_type, +DelayedPropertyList &delayed_properties) { + // This function can only parse DW_TAG_APPLE_property. + assert(die.Tag() == DW_TAG_APPLE_property); + + ModuleSP module_sp = parent_die.GetDWARF()->GetObjectFile()->GetModule(); + + const MemberAttributes attrs(die, parent_die, module_sp); + const PropertyAttributes propAttrs(die); + + if (!propAttrs.prop_name) { +module_sp->ReportError( +"0x%8.8" PRIx64 ": DW
[Lldb-commits] [lldb] 60b96aa - [lldb] Split ParseSingleMember into Obj-C property and normal member/ivar parsing code.
Author: Raphael Isemann Date: 2021-10-16T14:20:04+02:00 New Revision: 60b96aa65e5959361e9edea15b3591f90988ccad URL: https://github.com/llvm/llvm-project/commit/60b96aa65e5959361e9edea15b3591f90988ccad DIFF: https://github.com/llvm/llvm-project/commit/60b96aa65e5959361e9edea15b3591f90988ccad.diff LOG: [lldb] Split ParseSingleMember into Obj-C property and normal member/ivar parsing code. Right now DWARFASTParserClang::ParseSingleMember has two parts: One part parses Objective-C properties and the other part parses C/C++ members/Objective-C ivars. These parts are pretty much independent of each other (with one historical exception, see below) and in practice they parse DIEs with different tags/attributes: `DW_TAG_APPLE_property` and `DW_TAG_member`. I don't see a good reason for keeping the different parsing code intertwined in a single function, so instead split out the Objective-C property parser into its own function. Note that 90% of this commit is just unindenting nearly all of `ParseSingleMember` which was inside a `if (tag == DW_TAG_member)` block. I.e., think of the old `ParseSingleMember` function as: The rest is just moving the property parsing code into its own function and I added the ReportError implementation in case we fail to resolve the property type (which before was just a silent failure). ``` lang=c++ void DWARFASTParserClang::ParseSingleMember(...) { [...] if (tag == DW_TAG_member) { [...] // This huge block got unindented in this patch as the `if` above is gone. } if (property) { [...] // This is the property parsing code that is now its own function. } } ``` There is one exception to the rule that the parsers are independent. Before 2012 Objective-C properties were encoded as `DW_TAG_member` with `DW_AT_APPLE_property*` attributes describing the property. In 2012 this has changed in a series of commits (see for example c0449635b35b057c5a877343b0c5f14506c7cf02 which updates the docs) so that `DW_TAG_APPLE_property` is now used for properties. With the old format we first created an ivar and afterwards used the `DW_AT_APPLE_property*` attributes to create the respective property, but there doesn't seem to be any way to create such debug info with any clang from the last 9 years. So this is technically not NFC in case some finds debug info from that time and tries to use properties. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D111632 Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 0c6d80449affb..ec560f3fdd69d 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1915,11 +1915,10 @@ class DWARFASTParserClang::DelayedAddObjCClassProperty { const CompilerType &property_opaque_type, // The property type is only // required if you don't have an // ivar decl - clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, - const char *property_getter_name, uint32_t property_attributes, - const ClangASTMetadata *metadata) + const char *property_setter_name, const char *property_getter_name, + uint32_t property_attributes, const ClangASTMetadata *metadata) : m_class_opaque_type(class_opaque_type), m_property_name(property_name), -m_property_opaque_type(property_opaque_type), m_ivar_decl(ivar_decl), +m_property_opaque_type(property_opaque_type), m_property_setter_name(property_setter_name), m_property_getter_name(property_getter_name), m_property_attributes(property_attributes) { @@ -1938,7 +1937,6 @@ class DWARFASTParserClang::DelayedAddObjCClassProperty { m_class_opaque_type = rhs.m_class_opaque_type; m_property_name = rhs.m_property_name; m_property_opaque_type = rhs.m_property_opaque_type; -m_ivar_decl = rhs.m_ivar_decl; m_property_setter_name = rhs.m_property_setter_name; m_property_getter_name = rhs.m_property_getter_name; m_property_attributes = rhs.m_property_attributes; @@ -1953,7 +1951,7 @@ class DWARFASTParserClang::DelayedAddObjCClassProperty { bool Finalize() { return TypeSystemClang::AddObjCClassProperty( m_class_opaque_type, m_property_name, m_property_opaque_type, -m_ivar_decl, m_property_setter_name, m_property_getter_name, +/*ivar_decl=*/nullptr, m_property_setter_name, m_property_getter_name, m_property_attributes, m_metadata_up.get()); } @@ -1961,7 +1959,6 @@ class DWARFASTParserClang::DelayedAddObjCClassProperty { CompilerTy
[Lldb-commits] [PATCH] D111715: [WIP] [lldb] change name demangling to be consistent between windows and linx
lassefolger added a comment. created a NFC for formatting: https://reviews.llvm.org/D111934 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111715/new/ https://reviews.llvm.org/D111715 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D111934: [NFC] clang format change
lassefolger created this revision. lassefolger added reviewers: teemperor, werat. lassefolger requested review of this revision. Herald added projects: LLDB, LLVM. Herald added subscribers: llvm-commits, lldb-commits. clang format on some demangling files Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D111934 Files: lldb/source/Core/Mangled.cpp llvm/include/llvm/Demangle/Demangle.h Index: llvm/include/llvm/Demangle/Demangle.h === --- llvm/include/llvm/Demangle/Demangle.h +++ llvm/include/llvm/Demangle/Demangle.h @@ -31,7 +31,6 @@ char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n, int *status); - enum MSDemangleFlags { MSDF_None = 0, MSDF_DumpBackrefs = 1 << 0, @@ -53,9 +52,9 @@ /// receives the size of the demangled string on output if n_buf is not nullptr. /// status receives one of the demangle_ enum entries above if it's not nullptr. /// Flags controls various details of the demangled representation. -char *microsoftDemangle(const char *mangled_name, size_t *n_read, -char *buf, size_t *n_buf, -int *status, MSDemangleFlags Flags = MSDF_None); +char *microsoftDemangle(const char *mangled_name, size_t *n_read, char *buf, +size_t *n_buf, int *status, +MSDemangleFlags Flags = MSDF_None); // Demangles a Rust v0 mangled symbol. The API follows that of __cxa_demangle. char *rustDemangle(const char *MangledName, char *Buf, size_t *N, int *Status); @@ -118,6 +117,7 @@ bool isSpecialName() const; ~ItaniumPartialDemangler(); + private: void *RootNode; void *Context; Index: lldb/source/Core/Mangled.cpp === --- lldb/source/Core/Mangled.cpp +++ lldb/source/Core/Mangled.cpp @@ -260,7 +260,8 @@ if (m_mangled && m_demangled.IsNull()) { // Don't bother running anything that isn't mangled const char *mangled_name = m_mangled.GetCString(); -ManglingScheme mangling_scheme = GetManglingScheme(m_mangled.GetStringRef()); +ManglingScheme mangling_scheme = +GetManglingScheme(m_mangled.GetStringRef()); if (mangling_scheme != eManglingSchemeNone && !m_mangled.GetMangledCounterpart(m_demangled)) { // We didn't already mangle this name, demangle it and if all goes well @@ -296,8 +297,7 @@ return m_demangled; } -ConstString -Mangled::GetDisplayDemangledName() const { +ConstString Mangled::GetDisplayDemangledName() const { return GetDemangledName(); } Index: llvm/include/llvm/Demangle/Demangle.h === --- llvm/include/llvm/Demangle/Demangle.h +++ llvm/include/llvm/Demangle/Demangle.h @@ -31,7 +31,6 @@ char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n, int *status); - enum MSDemangleFlags { MSDF_None = 0, MSDF_DumpBackrefs = 1 << 0, @@ -53,9 +52,9 @@ /// receives the size of the demangled string on output if n_buf is not nullptr. /// status receives one of the demangle_ enum entries above if it's not nullptr. /// Flags controls various details of the demangled representation. -char *microsoftDemangle(const char *mangled_name, size_t *n_read, -char *buf, size_t *n_buf, -int *status, MSDemangleFlags Flags = MSDF_None); +char *microsoftDemangle(const char *mangled_name, size_t *n_read, char *buf, +size_t *n_buf, int *status, +MSDemangleFlags Flags = MSDF_None); // Demangles a Rust v0 mangled symbol. The API follows that of __cxa_demangle. char *rustDemangle(const char *MangledName, char *Buf, size_t *N, int *Status); @@ -118,6 +117,7 @@ bool isSpecialName() const; ~ItaniumPartialDemangler(); + private: void *RootNode; void *Context; Index: lldb/source/Core/Mangled.cpp === --- lldb/source/Core/Mangled.cpp +++ lldb/source/Core/Mangled.cpp @@ -260,7 +260,8 @@ if (m_mangled && m_demangled.IsNull()) { // Don't bother running anything that isn't mangled const char *mangled_name = m_mangled.GetCString(); -ManglingScheme mangling_scheme = GetManglingScheme(m_mangled.GetStringRef()); +ManglingScheme mangling_scheme = +GetManglingScheme(m_mangled.GetStringRef()); if (mangling_scheme != eManglingSchemeNone && !m_mangled.GetMangledCounterpart(m_demangled)) { // We didn't already mangle this name, demangle it and if all goes well @@ -296,8 +297,7 @@ return m_demangled; } -ConstString -Mangled::GetDisplayDemangledName() const { +ConstString Mangled::GetDisplayDemangledName() const { return GetDemangledName(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https:
[Lldb-commits] [PATCH] D111715: [WIP] [lldb] change name demangling to be consistent between windows and linx
lassefolger updated this revision to Diff 380155. lassefolger added a comment. add tests for the change and adjust description to include examples Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111715/new/ https://reviews.llvm.org/D111715 Files: lldb/source/Core/Mangled.cpp llvm/include/llvm/Demangle/Demangle.h llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h llvm/lib/Demangle/MicrosoftDemangle.cpp llvm/lib/Demangle/MicrosoftDemangleNodes.cpp llvm/test/Demangle/ms-options.test llvm/tools/llvm-undname/llvm-undname.cpp Index: llvm/tools/llvm-undname/llvm-undname.cpp === --- llvm/tools/llvm-undname/llvm-undname.cpp +++ llvm/tools/llvm-undname/llvm-undname.cpp @@ -46,6 +46,9 @@ cl::opt NoMemberType("no-member-type", cl::Optional, cl::desc("skip member types"), cl::Hidden, cl::init(false), cl::cat(UndNameCategory)); +cl::opt NoVariableType("no-variable-type", cl::Optional, + cl::desc("skip variable types"), cl::Hidden, + cl::init(false), cl::cat(UndNameCategory)); cl::opt RawFile("raw-file", cl::Optional, cl::desc("for fuzzer data"), cl::Hidden, cl::cat(UndNameCategory)); @@ -68,6 +71,8 @@ Flags = MSDemangleFlags(Flags | MSDF_NoReturnType); if (NoMemberType) Flags = MSDemangleFlags(Flags | MSDF_NoMemberType); + if (NoVariableType) +Flags = MSDemangleFlags(Flags | MSDF_NoVariableType); size_t NRead; char *ResultBuf = Index: llvm/test/Demangle/ms-options.test === --- llvm/test/Demangle/ms-options.test +++ llvm/test/Demangle/ms-options.test @@ -1,14 +1,43 @@ -; RUN: llvm-undname < %s | FileCheck %s -; RUN: llvm-undname --no-calling-convention < %s | FileCheck %s --check-prefix=CHECK-NO-CALLING-CONV -; RUN: llvm-undname --no-return-type < %s | FileCheck %s --check-prefix=CHECK-NO-RETURN -; RUN: llvm-undname --no-access-specifier < %s | FileCheck %s --check-prefix=CHECK-NO-ACCESS -; RUN: llvm-undname --no-member-type < %s | FileCheck %s --check-prefix=CHECK-NO-MEMBER-TYPE -; RUN: llvm-undname --no-calling-convention --no-return-type --no-access-specifier --no-member-type < %s | FileCheck %s --check-prefix=CHECK-NO-ALL - -?func@MyClass@@UEAAHHH@Z -; CHECK: public: virtual int __cdecl MyClass::func(int, int) -; CHECK-NO-CALLING-CONV: public: virtual int MyClass::func(int, int) -; CHECK-NO-RETURN: public: virtual __cdecl MyClass::func(int, int) -; CHECK-NO-ACCESS: {{^}}virtual int __cdecl MyClass::func(int, int) -; CHECK-NO-MEMBER-TYPE: public: int __cdecl MyClass::func(int, int) -; CHECK-NO-ALL: {{^}}MyClass::func(int, int) +; RUN: llvm-undname < %s | FileCheck %s +; RUN: llvm-undname --no-calling-convention < %s | FileCheck %s --check-prefix=CHECK-NO-CALLING-CONV +; RUN: llvm-undname --no-return-type < %s | FileCheck %s --check-prefix=CHECK-NO-RETURN +; RUN: llvm-undname --no-access-specifier < %s | FileCheck %s --check-prefix=CHECK-NO-ACCESS +; RUN: llvm-undname --no-member-type < %s | FileCheck %s --check-prefix=CHECK-NO-MEMBER-TYPE +; RUN: llvm-undname --no-variable-type < %s | FileCheck %s --check-prefix=CHECK-NO-VARIABLE-TYPE +; RUN: llvm-undname --no-calling-convention --no-return-type --no-access-specifier --no-member-type --no-variable-type < %s | FileCheck %s --check-prefix=CHECK-NO-ALL + +?func@MyClass@@UEAAHHH@Z +; CHECK: public: virtual int __cdecl MyClass::func(int, int) +; CHECK-NO-CALLING-CONV: public: virtual int MyClass::func(int, int) +; CHECK-NO-RETURN: public: virtual __cdecl MyClass::func(int, int) +; CHECK-NO-ACCESS: {{^}}virtual int __cdecl MyClass::func(int, int) +; CHECK-NO-MEMBER-TYPE: public: int __cdecl MyClass::func(int, int) +; CHECK-NO-VARIABLE-TYPE: public: virtual int __cdecl MyClass::func(int, int) +; CHECK-NO-ALL: {{^}}MyClass::func(int, int) + +?array2d@@3PAY09HA +; CHECK: int (*array2d)[10] +; CHECK-NO-CALLING-CONV: int (*array2d)[10] +; CHECK-NO-RETURN: int (*array2d)[10] +; CHECK-NO-ACCESS: int (*array2d)[10] +; CHECK-NO-MEMBER-TYPE: int (*array2d)[10] +; CHECK-NO-VARIABLE-TYPE: array2d +; CHECK-NO-ALL: array2d + +?a@abc@@3PAY09HA +; CHECK: int (*abc::a)[10] +; CHECK-NO-CALLING-CONV: int (*abc::a)[10] +; CHECK-NO-RETURN: int (*abc::a)[10] +; CHECK-NO-ACCESS: int (*abc::a)[10] +; CHECK-NO-MEMBER-TYPE: int (*abc::a)[10] +; CHECK-NO-VARIABLE-TYPE: abc::a +; CHECK-NO-ALL: abc::a + +?x@@3PEAEEA +; CHECK: unsigned char *x +; CHECK-NO-CALLING-CONV: unsigned char *x +; CHECK-NO-RETURN: unsigned char *x +; CHECK-NO-ACCESS: unsigned char *x +; CHECK-NO-MEMBER-TYPE: unsigned char *x +; CHECK-NO-VARIABLE-TYPE: x +; CHECK-NO-ALL: x Index: llvm/lib/Demangle/MicrosoftDemangleNodes.cpp === --- llvm/lib/Demangle/MicrosoftDemangleNodes.cpp +++
[Lldb-commits] [PATCH] D111908: [lldb] [Utility] Remove Status::WasInterrupted() along with its only use
mgorny added a comment. FTR, this doesn't make `^c` work any better or worse. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111908/new/ https://reviews.llvm.org/D111908 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D111491: [lldb] [gdb-remote] Remove HardcodeARMRegisters() hack
mgorny added a comment. Gentle ping. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111491/new/ https://reviews.llvm.org/D111491 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits