summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-08-17 23:16:15 +0000
committerGreg Clayton <gclayton@apple.com>2010-08-17 23:16:15 +0000
commit3ef3fc6462518c9159d1ac8aa199d20a6afb65f8 (patch)
treedb8cf321331010e77d88cc6e53cb34b76fa9bdee /lldb
parentce3b2c3f77a2ba64439e30cd11828aef4ec87c31 (diff)
downloadbcm5719-llvm-3ef3fc6462518c9159d1ac8aa199d20a6afb65f8.tar.gz
bcm5719-llvm-3ef3fc6462518c9159d1ac8aa199d20a6afb65f8.zip
Fixed an issue where we would return matches for DWARF in the .o files when
the resulting function from the .o file DWARF didn't make it into the final executable. I recently changed the way FindFunctions() worked in the DWARF with debug map case that caused regressions in our test suite for dead stripped functions. The previous changes allowed us to leverage the powerful searching added to the DWARF parser (search by full name, basename, selector, or method name), without having to chop up the symbol names from the symbol table and do any special parsing of the names to extract the basename, selector or method. Previously we would look through the symbol table for matches first, then try and find the .o file with DWARF for that symbol and only search those .o files. Now we let the DWARF for the .o file search using the new search styles, and filter out any functions that didn't make it. llvm-svn: 111322
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp42
1 files changed, 38 insertions, 4 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 22b08c68c95..007cec97f3c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -762,6 +762,33 @@ SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithIndex (uint32_t symbol_i
return comp_unit_info;
}
+static void
+RemoveFunctionsWithModuleNotEqualTo (Module *module, SymbolContextList &sc_list, uint32_t start_idx)
+{
+ // We found functions in .o files. Not all functions in the .o files
+ // will have made it into the final output file. The ones that did
+ // make it into the final output file will have a section whose module
+ // matches the module from the ObjectFile for this SymbolFile. When
+ // the modules don't match, then we have something that was in a
+ // .o file, but doesn't map to anything in the final executable.
+ uint32_t i=start_idx;
+ while (i < sc_list.GetSize())
+ {
+ SymbolContext sc;
+ sc_list.GetContextAtIndex(i, sc);
+ if (sc.function)
+ {
+ const Section *section = sc.function->GetAddressRange().GetBaseAddress().GetSection();
+ if (section->GetModule() != module)
+ {
+ sc_list.RemoveContextAtIndex(i);
+ continue;
+ }
+ }
+ ++i;
+ }
+}
+
uint32_t
SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
{
@@ -779,7 +806,11 @@ SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, uint32_t name_ty
SymbolFileDWARF *oso_dwarf;
while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL)
{
- oso_dwarf->FindFunctions(name, name_type_mask, true, sc_list);
+ uint32_t sc_idx = sc_list.GetSize();
+ if (oso_dwarf->FindFunctions(name, name_type_mask, true, sc_list))
+ {
+ RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx);
+ }
}
return sc_list.GetSize() - initial_size;
@@ -803,12 +834,15 @@ SymbolFileDWARFDebugMap::FindFunctions (const RegularExpression& regex, bool app
SymbolFileDWARF *oso_dwarf;
while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL)
{
- oso_dwarf->FindFunctions(regex, true, sc_list);
+ uint32_t sc_idx = sc_list.GetSize();
+
+ if (oso_dwarf->FindFunctions(regex, true, sc_list))
+ {
+ RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx);
+ }
}
return sc_list.GetSize() - initial_size;
-
- return 0;
}
OpenPOWER on IntegriCloud