[Lldb-commits] [lldb] r232151 - Respect include_inlines when looking up functions in SymbolFileDWARF
Pavel Labath
labath at google.com
Fri Mar 13 03:22:00 PDT 2015
Author: labath
Date: Fri Mar 13 05:22:00 2015
New Revision: 232151
URL: http://llvm.org/viewvc/llvm-project?rev=232151&view=rev
Log:
Respect include_inlines when looking up functions in SymbolFileDWARF
Summary:
SymbolFileDWARF was not respecting the include_inlines argument in function lookup in all code
paths. This resulted in an attempt to call an inlined function during expression evaluation,
which is impossible, and usually resulted in a segfault in the inferior. This patch makes sure
include_inlines is respected in all code paths.
Reviewers: clayborg
Subscribers: lldb-commits, sivachandra
Differential Revision: http://reviews.llvm.org/D8286
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
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=232151&r1=232150&r2=232151&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Mar 13 05:22:00 2015
@@ -3455,16 +3455,18 @@ SymbolFileDWARF::FindGlobalVariables(con
bool
SymbolFileDWARF::ResolveFunction (dw_offset_t die_offset,
DWARFCompileUnit *&dwarf_cu,
+ bool include_inlines,
SymbolContextList& sc_list)
{
const DWARFDebugInfoEntry *die = DebugInfo()->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
- return ResolveFunction (dwarf_cu, die, sc_list);
+ return ResolveFunction (dwarf_cu, die, include_inlines, sc_list);
}
bool
SymbolFileDWARF::ResolveFunction (DWARFCompileUnit *cu,
const DWARFDebugInfoEntry *die,
+ bool include_inlines,
SymbolContextList& sc_list)
{
SymbolContext sc;
@@ -3473,7 +3475,7 @@ SymbolFileDWARF::ResolveFunction (DWARFC
return false;
// If we were passed a die that is not a function, just return false...
- if (die->Tag() != DW_TAG_subprogram && die->Tag() != DW_TAG_inlined_subroutine)
+ if (! (die->Tag() == DW_TAG_subprogram || (include_inlines && die->Tag() == DW_TAG_inlined_subroutine)))
return false;
const DWARFDebugInfoEntry* inlined_die = NULL;
@@ -3520,12 +3522,13 @@ SymbolFileDWARF::ResolveFunction (DWARFC
void
SymbolFileDWARF::FindFunctions (const ConstString &name,
const NameToDIE &name_to_die,
+ bool include_inlines,
SymbolContextList& sc_list)
{
DIEArray die_offsets;
if (name_to_die.Find (name, die_offsets))
{
- ParseFunctions (die_offsets, sc_list);
+ ParseFunctions (die_offsets, include_inlines, sc_list);
}
}
@@ -3533,12 +3536,13 @@ SymbolFileDWARF::FindFunctions (const Co
void
SymbolFileDWARF::FindFunctions (const RegularExpression ®ex,
const NameToDIE &name_to_die,
+ bool include_inlines,
SymbolContextList& sc_list)
{
DIEArray die_offsets;
if (name_to_die.Find (regex, die_offsets))
{
- ParseFunctions (die_offsets, sc_list);
+ ParseFunctions (die_offsets, include_inlines, sc_list);
}
}
@@ -3546,6 +3550,7 @@ SymbolFileDWARF::FindFunctions (const Re
void
SymbolFileDWARF::FindFunctions (const RegularExpression ®ex,
const DWARFMappedHash::MemoryTable &memory_table,
+ bool include_inlines,
SymbolContextList& sc_list)
{
DIEArray die_offsets;
@@ -3553,12 +3558,13 @@ SymbolFileDWARF::FindFunctions (const Re
if (memory_table.AppendAllDIEsThatMatchingRegex (regex, hash_data_array))
{
DWARFMappedHash::ExtractDIEArray (hash_data_array, die_offsets);
- ParseFunctions (die_offsets, sc_list);
+ ParseFunctions (die_offsets, include_inlines, sc_list);
}
}
void
SymbolFileDWARF::ParseFunctions (const DIEArray &die_offsets,
+ bool include_inlines,
SymbolContextList& sc_list)
{
const size_t num_matches = die_offsets.size();
@@ -3568,7 +3574,7 @@ SymbolFileDWARF::ParseFunctions (const D
for (size_t i=0; i<num_matches; ++i)
{
const dw_offset_t die_offset = die_offsets[i];
- ResolveFunction (die_offset, dwarf_cu, sc_list);
+ ResolveFunction (die_offset, dwarf_cu, include_inlines, sc_list);
}
}
}
@@ -3759,12 +3765,9 @@ SymbolFileDWARF::FindFunctions (const Co
if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
continue;
- if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
- continue;
-
if (resolved_dies.find(die) == resolved_dies.end())
{
- if (ResolveFunction (dwarf_cu, die, sc_list))
+ if (ResolveFunction (dwarf_cu, die, include_inlines, sc_list))
resolved_dies.insert(die);
}
}
@@ -3794,12 +3797,9 @@ SymbolFileDWARF::FindFunctions (const Co
const char *die_name = die->GetName(this, dwarf_cu);
if (ObjCLanguageRuntime::IsPossibleObjCMethodName(die_name))
{
- if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
- continue;
-
if (resolved_dies.find(die) == resolved_dies.end())
{
- if (ResolveFunction (dwarf_cu, die, sc_list))
+ if (ResolveFunction (dwarf_cu, die, include_inlines, sc_list))
resolved_dies.insert(die);
}
}
@@ -3828,15 +3828,12 @@ SymbolFileDWARF::FindFunctions (const Co
const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
if (die)
{
- if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
- continue;
-
if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
continue;
// If we get to here, the die is good, and we should add it:
if (resolved_dies.find(die) == resolved_dies.end())
- if (ResolveFunction (dwarf_cu, die, sc_list))
+ if (ResolveFunction (dwarf_cu, die, include_inlines, sc_list))
{
bool keep_die = true;
if ((name_type_mask & (eFunctionNameTypeBase|eFunctionNameTypeMethod)) != (eFunctionNameTypeBase|eFunctionNameTypeMethod))
@@ -3905,7 +3902,7 @@ SymbolFileDWARF::FindFunctions (const Co
if (name_type_mask & eFunctionNameTypeFull)
{
- FindFunctions (name, m_function_fullname_index, sc_list);
+ FindFunctions (name, m_function_fullname_index, include_inlines, sc_list);
// FIXME Temporary workaround for global/anonymous namespace
// functions on FreeBSD and Linux
@@ -3917,7 +3914,7 @@ SymbolFileDWARF::FindFunctions (const Co
if (sc_list.GetSize() == 0)
{
SymbolContextList temp_sc_list;
- FindFunctions (name, m_function_basename_index, temp_sc_list);
+ FindFunctions (name, m_function_basename_index, include_inlines, temp_sc_list);
if (!namespace_decl)
{
SymbolContext sc;
@@ -3949,16 +3946,13 @@ SymbolFileDWARF::FindFunctions (const Co
const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
if (die)
{
- if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
- continue;
-
if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
continue;
// If we get to here, the die is good, and we should add it:
if (resolved_dies.find(die) == resolved_dies.end())
{
- if (ResolveFunction (dwarf_cu, die, sc_list))
+ if (ResolveFunction (dwarf_cu, die, include_inlines, sc_list))
resolved_dies.insert(die);
}
}
@@ -3978,13 +3972,10 @@ SymbolFileDWARF::FindFunctions (const Co
const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
if (die)
{
- if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
- continue;
-
// If we get to here, the die is good, and we should add it:
if (resolved_dies.find(die) == resolved_dies.end())
{
- if (ResolveFunction (dwarf_cu, die, sc_list))
+ if (ResolveFunction (dwarf_cu, die, include_inlines, sc_list))
resolved_dies.insert(die);
}
}
@@ -3995,7 +3986,7 @@ SymbolFileDWARF::FindFunctions (const Co
if ((name_type_mask & eFunctionNameTypeSelector) && (!namespace_decl || !*namespace_decl))
{
- FindFunctions (name, m_function_selector_index, sc_list);
+ FindFunctions (name, m_function_selector_index, include_inlines, sc_list);
}
}
@@ -4006,9 +3997,10 @@ SymbolFileDWARF::FindFunctions (const Co
if (log && num_matches > 0)
{
GetObjectFile()->GetModule()->LogMessage (log,
- "SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, append=%u, sc_list) => %u",
+ "SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, include_inlines=%d, append=%u, sc_list) => %u",
name.GetCString(),
name_type_mask,
+ include_inlines,
append,
num_matches);
}
@@ -4044,7 +4036,7 @@ SymbolFileDWARF::FindFunctions(const Reg
if (m_using_apple_tables)
{
if (m_apple_names_ap.get())
- FindFunctions (regex, *m_apple_names_ap, sc_list);
+ FindFunctions (regex, *m_apple_names_ap, include_inlines, sc_list);
}
else
{
@@ -4052,9 +4044,9 @@ SymbolFileDWARF::FindFunctions(const Reg
if (!m_indexed)
Index ();
- FindFunctions (regex, m_function_basename_index, sc_list);
+ FindFunctions (regex, m_function_basename_index, include_inlines, sc_list);
- FindFunctions (regex, m_function_fullname_index, sc_list);
+ FindFunctions (regex, m_function_fullname_index, include_inlines, sc_list);
}
// Return the number of variable that were appended to the list
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=232151&r1=232150&r2=232151&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Mar 13 05:22:00 2015
@@ -393,10 +393,12 @@ protected:
// Given a die_offset, figure out the symbol context representing that die.
bool ResolveFunction (dw_offset_t offset,
DWARFCompileUnit *&dwarf_cu,
+ bool include_inlines,
lldb_private::SymbolContextList& sc_list);
bool ResolveFunction (DWARFCompileUnit *cu,
const DWARFDebugInfoEntry *die,
+ bool include_inlines,
lldb_private::SymbolContextList& sc_list);
bool FunctionDieMatchesPartialName (
@@ -410,16 +412,19 @@ protected:
void FindFunctions(
const lldb_private::ConstString &name,
const NameToDIE &name_to_die,
+ bool include_inlines,
lldb_private::SymbolContextList& sc_list);
void FindFunctions (
const lldb_private::RegularExpression ®ex,
const NameToDIE &name_to_die,
+ bool include_inlines,
lldb_private::SymbolContextList& sc_list);
void FindFunctions (
const lldb_private::RegularExpression ®ex,
const DWARFMappedHash::MemoryTable &memory_table,
+ bool include_inlines,
lldb_private::SymbolContextList& sc_list);
lldb::TypeSP FindDefinitionTypeForDWARFDeclContext (
@@ -438,6 +443,7 @@ protected:
lldb_private::Symbol * GetObjCClassSymbol (const lldb_private::ConstString &objc_class_name);
void ParseFunctions (const DIEArray &die_offsets,
+ bool include_inlines,
lldb_private::SymbolContextList& sc_list);
lldb::TypeSP GetTypeForDIE (DWARFCompileUnit *cu,
const DWARFDebugInfoEntry* die);
More information about the lldb-commits
mailing list