From 11d60eaa36f9472dca83833070fd2d1b4714fb6b Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 9 Dec 2011 11:33:01 -0500 Subject: [PATCH] Fix handling of modifiers. When retrieving modifiers, we're actually pulling them off the type in reverse order. Consequently we need to build the type's modifier string similarly. If the first modifier is a const, prepend it to type name instead. --- src/apps/debugger/dwarf/DwarfUtils.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index f76ea48431..ada2bed028 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.cpp +++ b/src/apps/debugger/dwarf/DwarfUtils.cpp @@ -101,13 +101,13 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) baseType)) != NULL && modifiedType->GetType() != NULL) { switch (modifiedType->Tag()) { case DW_TAG_pointer_type: - modifier += "*"; + modifier.Prepend("*"); break; case DW_TAG_reference_type: - modifier += "&"; + modifier.Prepend("&"); break; case DW_TAG_const_type: - modifier += " const "; + modifier.Prepend(" const "); break; default: break; @@ -119,13 +119,23 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) } GetFullyQualifiedDIEName(type, paramName); - parameters += paramName; if (modifier.Length() > 0) { if (modifier[modifier.Length() - 1] == ' ') modifier.Truncate(modifier.Length() - 1); - parameters += modifier; + + // if the modifier has a leading const, treat it + // as the degenerate case and prepend it to the + // type name since that's the more typically used + // representation in source + if (modifier[0] == ' ') { + paramName.Prepend("const "); + modifier.Remove(0, 7); + } + paramName += modifier; } + parameters += paramName; + if (iterator.HasNext()) parameters += ", "; }