[Lldb-commits] [lldb] r243736 - Move the computation of whether a DWARF compile unit
Jason Molenda
jmolenda at apple.com
Thu Jul 30 22:47:01 PDT 2015
Author: jmolenda
Date: Fri Jul 31 00:47:00 2015
New Revision: 243736
URL: http://llvm.org/viewvc/llvm-project?rev=243736&view=rev
Log:
Move the computation of whether a DWARF compile unit
is optimized into DWARFCompileUnit, where it should have
been. Next I'll need to call this from another section
of code for DWARF-in-.o-file behavior correctness.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=243736&r1=243735&r2=243736&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri Jul 31 00:47:00 2015
@@ -52,7 +52,8 @@ DWARFCompileUnit::DWARFCompileUnit(Symbo
m_producer_version_minor (0),
m_producer_version_update (0),
m_language_type (eLanguageTypeUnknown),
- m_is_dwarf64 (false)
+ m_is_dwarf64 (false),
+ m_is_optimized (eLazyBoolCalculate)
{
}
@@ -71,6 +72,7 @@ DWARFCompileUnit::Clear()
m_producer = eProducerInvalid;
m_language_type = eLanguageTypeUnknown;
m_is_dwarf64 = false;
+ m_is_optimized = eLazyBoolCalculate;
}
bool
@@ -1108,3 +1110,27 @@ DWARFCompileUnit::IsDWARF64() const
return m_is_dwarf64;
}
+bool
+DWARFCompileUnit::GetIsOptimized ()
+{
+ if (m_is_optimized == eLazyBoolCalculate)
+ {
+ const DWARFDebugInfoEntry *die = GetCompileUnitDIEOnly();
+ if (die)
+ {
+ m_is_optimized = eLazyBoolNo;
+ if (die->GetAttributeValueAsUnsigned (m_dwarf2Data, this, DW_AT_APPLE_optimized, 0) == 1)
+ {
+ m_is_optimized = eLazyBoolYes;
+ }
+ }
+ }
+ if (m_is_optimized == eLazyBoolYes)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=243736&r1=243735&r2=243736&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Fri Jul 31 00:47:00 2015
@@ -196,6 +196,9 @@ public:
bool
IsDWARF64() const;
+ bool
+ GetIsOptimized ();
+
protected:
SymbolFileDWARF* m_dwarf2Data;
const DWARFAbbreviationDeclarationSet *m_abbrevs;
@@ -213,6 +216,7 @@ protected:
uint32_t m_producer_version_update;
lldb::LanguageType m_language_type;
bool m_is_dwarf64;
+ lldb_private::LazyBool m_is_optimized;
void
ParseProducerInfo ();
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=243736&r1=243735&r2=243736&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jul 31 00:47:00 2015
@@ -1100,11 +1100,7 @@ SymbolFileDWARF::ParseCompileUnit (DWARF
LanguageType cu_language = DWARFCompileUnit::LanguageTypeFromDWARF(cu_die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0));
- bool is_optimized = false;
- if (cu_die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_APPLE_optimized, 0) == 1)
- {
- is_optimized = true;
- }
+ bool is_optimized = dwarf_cu->GetIsOptimized ();
cu_sp.reset(new CompileUnit (module_sp,
dwarf_cu,
cu_file_spec,
More information about the lldb-commits
mailing list