hrev43465 adds 3 changesets to branch 'master' old head: eed9bc771c5006dfadc394555b5f4ed653ab80de new head: 828294f3dfeaec6ba5f68cd886c8b5015e87c595 ---------------------------------------------------------------------------- 03da607: Implement handling of DW_AT_artificial for DIEFormalParameter. 216a2c7: Fix several broken instances of function name generation. - Use the artificial attribute to more intelligently determine when to omit parameters. Fixes the first parameter on static class functions being skipped incorrectly. - Correctly handle varargs functions. 828294f: Fix broken handling of nested namespaces. - If multiple nested namespaces were involved in a name, GetFullyQualifiedDIEName() would erroneously wipe out each one as it walked up, leaving you with only the top level namespace. - Don't touch the output parameter unless we're certain we succeeded. [ Rene Gollent <anevilyak@xxxxxxxxx> ] ---------------------------------------------------------------------------- 3 files changed, 41 insertions(+), 17 deletions(-) src/apps/debugger/dwarf/DebugInfoEntries.cpp | 9 +++++ src/apps/debugger/dwarf/DebugInfoEntries.h | 6 +++- src/apps/debugger/dwarf/DwarfUtils.cpp | 43 ++++++++++++++-------- ############################################################################ Commit: 03da60709cfc0a2a021ea213ab503770e6cad637 URL: http://cgit.haiku-os.org/haiku/commit/?id=03da607 Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Sat Dec 10 21:45:37 2011 UTC Implement handling of DW_AT_artificial for DIEFormalParameter. ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index 34b0b4c..56fe294 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -873,6 +873,15 @@ DIEFormalParameter::AddAttribute_abstract_origin(uint16 attributeName, status_t +DIEFormalParameter::AddAttribute_artificial(uint16 attributeName, + const AttributeValue& value) +{ + fArtificial = value.flag; + return B_OK; +} + + +status_t DIEFormalParameter::AddAttribute_const_value(uint16 attributeName, const AttributeValue& value) { diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.h b/src/apps/debugger/dwarf/DebugInfoEntries.h index 6f7d904..7086689 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.h +++ b/src/apps/debugger/dwarf/DebugInfoEntries.h @@ -558,16 +558,19 @@ public: const ConstantAttributeValue* ConstValue() const { return &fValue; } + bool IsArtificial() const { return fArtificial; } + virtual status_t AddAttribute_abstract_origin( uint16 attributeName, const AttributeValue& value); + virtual status_t AddAttribute_artificial(uint16 attributeName, + const AttributeValue& value); virtual status_t AddAttribute_const_value(uint16 attributeName, const AttributeValue& value); virtual status_t AddAttribute_type(uint16 attributeName, const AttributeValue& value); // TODO: -// DW_AT_artificial // DW_AT_default_value // DW_AT_endianity // DW_AT_is_optional @@ -579,6 +582,7 @@ private: DebugInfoEntry* fAbstractOrigin; DIEType* fType; ConstantAttributeValue fValue; + bool fArtificial; }; ############################################################################ Commit: 216a2c7c8936419c10748de1c28b0d1730fc1a5e URL: http://cgit.haiku-os.org/haiku/commit/?id=216a2c7 Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Sat Dec 10 21:46:40 2011 UTC Fix several broken instances of function name generation. - Use the artificial attribute to more intelligently determine when to omit parameters. Fixes the first parameter on static class functions being skipped incorrectly. - Correctly handle varargs functions. ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index 3b6f1d7..67b201f 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.cpp +++ b/src/apps/debugger/dwarf/DwarfUtils.cpp @@ -76,20 +76,25 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) DebugInfoEntryList::ConstIterator iterator = subProgram->Parameters().GetIterator(); - // this function is a class method, skip the first parameter - // as it supplies our 'this' pointer and shouldn't be visible - // in the signature - if (dynamic_cast<const DIECompoundType*>(subProgram->Parent()) != NULL) - iterator.Next(); - + bool firstParameter = true; while (iterator.HasNext()) { + DebugInfoEntry* parameterEntry = iterator.Next(); + if (dynamic_cast<DIEUnspecifiedParameters*>(parameterEntry) + != NULL) { + parameters += ", ..."; + continue; + } + const DIEFormalParameter* parameter - = dynamic_cast<DIEFormalParameter*>(iterator.Next()); + = dynamic_cast<DIEFormalParameter*>(parameterEntry); if (parameter == NULL) { // this shouldn't happen return; } + if (parameter->IsArtificial()) + continue; + BString paramName; BString modifier; DIEType* type = parameter->GetType(); @@ -133,10 +138,12 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) paramName += modifier; } - parameters += paramName; - - if (iterator.HasNext()) + if (firstParameter) + firstParameter = false; + else parameters += ", "; + + parameters += paramName; } if (parameters.Length() > 0) ############################################################################ Revision: hrev43465 Commit: 828294f3dfeaec6ba5f68cd886c8b5015e87c595 URL: http://cgit.haiku-os.org/haiku/commit/?id=828294f Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Sat Dec 10 21:57:05 2011 UTC Fix broken handling of nested namespaces. - If multiple nested namespaces were involved in a name, GetFullyQualifiedDIEName() would erroneously wipe out each one as it walked up, leaving you with only the top level namespace. - Don't touch the output parameter unless we're certain we succeeded. ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index 67b201f..233a41c 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.cpp +++ b/src/apps/debugger/dwarf/DwarfUtils.cpp @@ -176,12 +176,18 @@ DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry, } _name.Truncate(0); + BString generatedName; // Get the namespace, if any. DebugInfoEntry* parent = entry->Parent(); while (parent != NULL) { if (parent->IsNamespace()) { - GetFullyQualifiedDIEName(parent, _name); + BString parentName; + GetFullyQualifiedDIEName(parent, parentName); + if (parentName.Length() > 0) { + parentName += "::"; + generatedName.Prepend(parentName); + } break; } @@ -190,14 +196,12 @@ DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry, BString name; GetFullDIEName(entry, name); - if (name.Length() == 0) return; - if (_name.Length() > 0) { - _name << "::" << name; - } else - _name = name; + generatedName += name; + + _name = generatedName; }