Removed some commented out code from the DWARF parser.

Also reduce the size of the lldb_private::Symbol objects by removing the
lldb_private::Function pointer that was in each symbol. Running Instruments
has shown that when debugging large applications with DWARF in .o files that
lldb_private::Symbol objects are one of the highest users of memory. No one
was using the Symbol::GetFunction() call anyway.

llvm-svn: 140881
This commit is contained in:
Greg Clayton
2011-09-30 20:52:25 +00:00
parent 044a5be6fb
commit 0bd4e1b8c9
3 changed files with 7 additions and 64 deletions

View File

@@ -114,9 +114,6 @@ public:
void
GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const;
Function *
GetFunction ();
Address &
GetValue () { return m_addr_range.GetBaseAddress(); }
@@ -203,7 +200,6 @@ protected:
m_searched_for_function:1;// non-zero if we have looked for the function associated with this symbol already.
AddressRange m_addr_range; // Contains the value, or the section offset address when the value is an address in a section, and the size (if any)
uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
Function * m_function;
};
} // namespace lldb_private

View File

@@ -659,39 +659,6 @@ SymbolFileDWARF::ParseCompileUnitFunction (const SymbolContext& sc, DWARFCompile
if (die->Tag() != DW_TAG_subprogram)
return NULL;
// clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die);
// const clang::Decl::Kind containing_decl_kind = containing_decl_ctx->getDeclKind();
//
// switch (containing_decl_kind)
// {
// case clang::Decl::Record:
// case clang::Decl::CXXRecord:
// case clang::Decl::ObjCClass:
// case clang::Decl::ObjCImplementation:
// case clang::Decl::ObjCInterface:
// // We have methods of a class or struct
// {
// const DWARFDebugInfoEntry *containing_decl_die = m_decl_ctx_to_die[containing_decl_ctx];
// assert (containing_decl_die);
// Type *class_type = ResolveType (dwarf_cu, containing_decl_die);
// if (class_type)
// class_type->GetClangFullType();
// // Make sure the class definition contains the funciton DIE
// // we wanted to parse. If it does, we are done. Else, we need
// // to fall through and parse the function DIE stil...
// if (containing_decl_die->Contains (die))
// break; // DIE has been parsed, we are done
// }
// // Fall through...
//
// default:
// // Parse the function prototype as a type that can then be added to concrete function instance
// //ParseTypes (sc, dwarf_cu, die, false, false);
// break;
// }
//FixupTypes();
if (die->GetDIENamesAndRanges(this, dwarf_cu, name, mangled, func_ranges, decl_file, decl_line, decl_column, call_file, call_line, call_column, &frame_base))
{
// Union of all ranges in the function DIE (if the function is discontiguous)
@@ -720,6 +687,7 @@ SymbolFileDWARF::ParseCompileUnitFunction (const SymbolContext& sc, DWARFCompile
decl_line,
decl_column));
// Supply the type _only_ if it has already been parsed
Type *func_type = m_die_to_type.lookup (die);
assert(func_type == NULL || func_type != DIE_IS_BEING_PARSED);
@@ -735,7 +703,8 @@ SymbolFileDWARF::ParseCompileUnitFunction (const SymbolContext& sc, DWARFCompile
if (func_sp.get() != NULL)
{
func_sp->GetFrameBaseExpression() = frame_base;
if (frame_base.IsValid())
func_sp->GetFrameBaseExpression() = frame_base;
sc.comp_unit->AddFunction(func_sp);
return func_sp.get();
}

View File

@@ -33,8 +33,7 @@ Symbol::Symbol() :
m_size_is_synthesized (false),
m_searched_for_function (false),
m_addr_range (),
m_flags (),
m_function (NULL)
m_flags ()
{
}
@@ -66,8 +65,7 @@ Symbol::Symbol
m_size_is_synthesized (false),
m_searched_for_function (false),
m_addr_range (section, offset, size),
m_flags (flags),
m_function (NULL)
m_flags (flags)
{
}
@@ -97,8 +95,7 @@ Symbol::Symbol
m_size_is_synthesized (false),
m_searched_for_function (false),
m_addr_range (range),
m_flags (flags),
m_function (NULL)
m_flags (flags)
{
}
@@ -116,8 +113,7 @@ Symbol::Symbol(const Symbol& rhs):
m_size_is_synthesized (false),
m_searched_for_function (false),
m_addr_range (rhs.m_addr_range),
m_flags (rhs.m_flags),
m_function (NULL)
m_flags (rhs.m_flags)
{
}
@@ -140,7 +136,6 @@ Symbol::operator= (const Symbol& rhs)
m_searched_for_function = rhs.m_searched_for_function;
m_addr_range = rhs.m_addr_range;
m_flags = rhs.m_flags;
m_function = rhs.m_function;
}
return *this;
}
@@ -252,23 +247,6 @@ Symbol::Dump(Stream *s, Target *target, uint32_t index) const
}
}
Function *
Symbol::GetFunction ()
{
if (m_function == NULL && !m_searched_for_function)
{
m_searched_for_function = true;
Module *module = m_addr_range.GetBaseAddress().GetModule();
if (module)
{
SymbolContext sc;
if (module->ResolveSymbolContextForAddress(m_addr_range.GetBaseAddress(), eSymbolContextFunction, sc))
m_function = sc.function;
}
}
return m_function;
}
uint32_t
Symbol::GetPrologueByteSize ()
{