[haiku-commits] haiku: hrev43447 - src/apps/debugger/dwarf

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 9 Dec 2011 17:37:27 +0100 (CET)

hrev43447 adds 1 changeset to branch 'master'
old head: b5cc636fa4ccd73498a0ac8d184ff192799d5d27
new head: 11d60eaa36f9472dca83833070fd2d1b4714fb6b

----------------------------------------------------------------------------

11d60ea: 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.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev43447
Commit:      11d60eaa36f9472dca83833070fd2d1b4714fb6b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=11d60ea
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Fri Dec  9 16:33:01 2011 UTC

----------------------------------------------------------------------------

1 files changed, 15 insertions(+), 5 deletions(-)
src/apps/debugger/dwarf/DwarfUtils.cpp |   20 +++++++++++++++-----

----------------------------------------------------------------------------

diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp 
b/src/apps/debugger/dwarf/DwarfUtils.cpp
index f76ea48..ada2bed 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 += ", ";
                }


Other related posts:

  • » [haiku-commits] haiku: hrev43447 - src/apps/debugger/dwarf - anevilyak