[Lldb-commits] [lldb] r238307 - Parse function name from DWARF DW_AT_abstract_origin

Tamas Berghammer tberghammer at google.com
Wed May 27 02:43:45 PDT 2015


Author: tberghammer
Date: Wed May 27 04:43:44 2015
New Revision: 238307

URL: http://llvm.org/viewvc/llvm-project?rev=238307&view=rev
Log:
Parse function name from DWARF DW_AT_abstract_origin

A DW_TAG_subprogram entry can contain a reference to a
DW_AT_abstract_origin entry instead of duplicating the information
from it (e.g.: name) when the same function is inlined in some case
and not inlined in other cases.

This CL fixes name parsing for the case when the DW_TAG_subprogram
for the non inlined version contains just a reference to the
DW_AT_abstract_origin entry instead of the full information.

Differential revision: http://reviews.llvm.org/D10034

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=238307&r1=238306&r2=238307&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Wed May 27 04:43:44 2015
@@ -1582,17 +1582,21 @@ DWARFDebugInfoEntry::GetName
     DWARFFormValue form_value;
     if (GetAttributeValue(dwarf2Data, cu, DW_AT_name, form_value))
         return form_value.AsCString(&dwarf2Data->get_debug_str_data());
-    else
+    else if (GetAttributeValue(dwarf2Data, cu, DW_AT_specification, form_value))
     {
-        if (GetAttributeValue(dwarf2Data, cu, DW_AT_specification, form_value))
-        {
-            DWARFCompileUnitSP cu_sp_ptr;
-            const DWARFDebugInfoEntry* die = const_cast<SymbolFileDWARF*>(dwarf2Data)->DebugInfo()->GetDIEPtr(form_value.Reference(), &cu_sp_ptr);
-            if (die)
-                return die->GetName(dwarf2Data, cu_sp_ptr.get());
-        }
+        DWARFCompileUnitSP cu_sp_ptr;
+        const DWARFDebugInfoEntry* die = const_cast<SymbolFileDWARF*>(dwarf2Data)->DebugInfo()->GetDIEPtr(form_value.Reference(), &cu_sp_ptr);
+        if (die)
+            return die->GetName(dwarf2Data, cu_sp_ptr.get());
     }
-    return NULL;
+    else if (GetAttributeValue(dwarf2Data, cu, DW_AT_abstract_origin, form_value))
+    {
+        DWARFCompileUnitSP cu_sp_ptr;
+        const DWARFDebugInfoEntry* die = const_cast<SymbolFileDWARF*>(dwarf2Data)->DebugInfo()->GetDIEPtr(form_value.Reference(), &cu_sp_ptr);
+        if (die)
+            return die->GetName(dwarf2Data, cu_sp_ptr.get());
+    }
+    return nullptr;
 }
 
 





More information about the lldb-commits mailing list