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

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 9 Mar 2014 15:13:31 +0100 (CET)

hrev46998 adds 1 changeset to branch 'master'
old head: 0da0db4da0dbc4ca4b121aafb07192b6efbb9024
new head: 198fd050301b2c8e51f22d478e3117e6491b53e6
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=198fd05+%5E0da0db4

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

198fd05: Debugger: Handle DW_AT_signature.
  
  - Per DWARF4's specification, if a type's complete definition is
    contained in a .debug_types unit, it should be referenced via the
    DW_AT_signature attribute. 4.8 now actually does this rather than
    setting e.g. DW_AT_attribute_origin to a signature ref, and
    consequently we weren't finding said reference any more.
  
  Gets .debug_types section support working again.

                                         [ Rene Gollent <rene@xxxxxxxxxxx> ]

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

Revision:    hrev46998
Commit:      198fd050301b2c8e51f22d478e3117e6491b53e6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=198fd05
Author:      Rene Gollent <rene@xxxxxxxxxxx>
Date:        Sun Mar  9 14:10:34 2014 UTC

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

5 files changed, 41 insertions(+), 3 deletions(-)
src/apps/debugger/dwarf/DebugInfoEntries.cpp | 17 +++++++++++++++++
src/apps/debugger/dwarf/DebugInfoEntries.h   |  5 +++++
src/apps/debugger/dwarf/DebugInfoEntry.cpp   |  9 ++++++++-
src/apps/debugger/dwarf/DebugInfoEntry.h     |  3 ++-
src/apps/debugger/dwarf/DwarfUtils.h         | 10 +++++++++-

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

diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp 
b/src/apps/debugger/dwarf/DebugInfoEntries.cpp
index 34ac9d4..8743920 100644
--- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp
+++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp
@@ -314,6 +314,7 @@ DIEDeclaredType::DIEDeclaredType()
        :
        fDescription(NULL),
        fAbstractOrigin(NULL),
+       fSignatureType(NULL),
        fAccessibility(0),
        fDeclaration(false)
 {
@@ -334,6 +335,13 @@ DIEDeclaredType::AbstractOrigin() const
 }
 
 
+DebugInfoEntry*
+DIEDeclaredType::SignatureType() const
+{
+       return fSignatureType;
+}
+
+
 bool
 DIEDeclaredType::IsDeclaration() const
 {
@@ -377,6 +385,15 @@ DIEDeclaredType::AddAttribute_abstract_origin(uint16 
attributeName,
 }
 
 
+status_t
+DIEDeclaredType::AddAttribute_signature(uint16 attributeName,
+       const AttributeValue& value)
+{
+       fSignatureType = value.reference;
+       return B_OK;
+}
+
+
 DeclarationLocation*
 DIEDeclaredType::GetDeclarationLocation()
 {
diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.h 
b/src/apps/debugger/dwarf/DebugInfoEntries.h
index 88de47a..76a9855 100644
--- a/src/apps/debugger/dwarf/DebugInfoEntries.h
+++ b/src/apps/debugger/dwarf/DebugInfoEntries.h
@@ -281,6 +281,8 @@ public:
        virtual const char*                     Description() const;
        virtual DebugInfoEntry*         AbstractOrigin() const;
 
+       virtual DebugInfoEntry*         SignatureType() const;
+
        virtual bool                            IsDeclaration() const;
 
        virtual status_t                        
AddAttribute_accessibility(uint16 attributeName,
@@ -296,6 +298,8 @@ public:
                                                                        uint16 
attributeName,
                                                                        const 
AttributeValue& value);
                                                                                
// TODO: !interface
+       virtual status_t                        AddAttribute_signature(uint16 
attributeName,
+                                                                       const 
AttributeValue& value);
 
 // TODO:
 // DW_AT_visibility                    // !interface
@@ -307,6 +311,7 @@ protected:
                        const char*                     fDescription;
                        DeclarationLocation     fDeclarationLocation;
                        DebugInfoEntry*         fAbstractOrigin;
+                       DebugInfoEntry*         fSignatureType;
                        uint8                           fAccessibility;
                        bool                            fDeclaration;
 };
diff --git a/src/apps/debugger/dwarf/DebugInfoEntry.cpp 
b/src/apps/debugger/dwarf/DebugInfoEntry.cpp
index 4938e8a..0ec4a77 100644
--- a/src/apps/debugger/dwarf/DebugInfoEntry.cpp
+++ b/src/apps/debugger/dwarf/DebugInfoEntry.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2013-2014, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 
@@ -95,6 +95,13 @@ DebugInfoEntry::AbstractOrigin() const
 }
 
 
+DebugInfoEntry*
+DebugInfoEntry::SignatureType() const
+{
+       return NULL;
+}
+
+
 LocationDescription*
 DebugInfoEntry::GetLocationDescription()
 {
diff --git a/src/apps/debugger/dwarf/DebugInfoEntry.h 
b/src/apps/debugger/dwarf/DebugInfoEntry.h
index 11e7865..7bab698 100644
--- a/src/apps/debugger/dwarf/DebugInfoEntry.h
+++ b/src/apps/debugger/dwarf/DebugInfoEntry.h
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2013-2014, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 #ifndef DEBUG_INFO_ENTRY_H
@@ -61,6 +61,7 @@ public:
        virtual const char*                     Description() const;
        virtual DebugInfoEntry*         Specification() const;
        virtual DebugInfoEntry*         AbstractOrigin() const;
+       virtual DebugInfoEntry*         SignatureType() const;
        virtual LocationDescription* GetLocationDescription();
 
                        bool                            
GetDeclarationFile(uint32& _file) const;
diff --git a/src/apps/debugger/dwarf/DwarfUtils.h 
b/src/apps/debugger/dwarf/DwarfUtils.h
index 1bedfd0..bdc41c0 100644
--- a/src/apps/debugger/dwarf/DwarfUtils.h
+++ b/src/apps/debugger/dwarf/DwarfUtils.h
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2013-2014, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 #ifndef DWARF_UTILS_H
@@ -61,6 +61,14 @@ DwarfUtils::GetDIEByPredicate(EntryType* entry, const 
Predicate& predicate)
                        return entry;
        }
 
+       // try the type unit signature
+       if (EntryType* signature = dynamic_cast<EntryType*>(
+                       entry->SignatureType())) {
+               entry = signature;
+               if (predicate(entry))
+                       return entry;
+       }
+
        return NULL;
 }
 


Other related posts:

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