From 216a2c7c8936419c10748de1c28b0d1730fc1a5e Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 10 Dec 2011 16:46:40 -0500 Subject: [PATCH] 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. --- src/apps/debugger/dwarf/DwarfUtils.cpp | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index 3b6f1d7797..67b201faa6 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(subProgram->Parent()) != NULL) - iterator.Next(); - + bool firstParameter = true; while (iterator.HasNext()) { + DebugInfoEntry* parameterEntry = iterator.Next(); + if (dynamic_cast(parameterEntry) + != NULL) { + parameters += ", ..."; + continue; + } + const DIEFormalParameter* parameter - = dynamic_cast(iterator.Next()); + = dynamic_cast(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)