Symtab *exe_symtab = exe_symfile->GetObjectFile()->GetSymtab();
ModuleSP oso_module_sp (oso_objfile->GetModule());
Symtab *oso_symtab = oso_objfile->GetSymtab();
-#if defined(DEBUG_OSO_DMAP)
- StreamFile s(stdout, false);
- s << "OSO symtab:\n";
- oso_symtab->Dump(&s, NULL, eSortOrderNone);
- s << "OSO sections before:\n";
- oso_objfile->GetSectionList()->Dump(&s, NULL, true, UINT32_MAX);
-#endif
///const uint32_t fun_resolve_flags = SymbolContext::Module | eSymbolContextCompUnit | eSymbolContextFunction;
//SectionList *oso_sections = oso_objfile->Sections();
}
exe_symfile->FinalizeOSOFileRanges (this);
-#if defined(DEBUG_OSO_DMAP)
- s << "OSO sections after:\n";
- oso_objfile->GetSectionList()->Dump(&s, NULL, true, UINT32_MAX);
-#endif
// We don't need the symbols anymore for the .o files
oso_objfile->ClearSymtab();
}
}
m_debug_map.Sort();
-#if defined(DEBUG_OSO_DMAP)
- StreamFile s(stdout, false);
- symtab->Dump(&s, NULL, m_func_indexes);
- symtab->Dump(&s, NULL, m_glob_indexes);
-#endif
m_compile_unit_infos.resize(oso_index_count);
-
-// s.Printf("%s N_OSO symbols:\n", __PRETTY_FUNCTION__);
-// symtab->Dump(&s, oso_indexes);
for (uint32_t i=0; i<oso_index_count; ++i)
{
#if defined(DEBUG_OSO_DMAP)
const FileRangeMap &oso_file_range_map = cu_info->GetFileRangeMap(this);
const size_t n = oso_file_range_map.GetSize();
- printf ("SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (cu_info = %p)\n", cu_info);
+ printf ("SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (cu_info = %p) %s/%s\n",
+ cu_info,
+ cu_info->oso_sp->module_sp->GetFileSpec().GetDirectory().GetCString(),
+ cu_info->oso_sp->module_sp->GetFileSpec().GetFilename().GetCString());
for (size_t i=0; i<n; ++i)
{
const FileRangeMap::Entry &entry = oso_file_range_map.GetEntryRef(i);
const FileRangeMap::Entry *prev_file_range_entry = NULL;
lldb::addr_t prev_file_addr = LLDB_INVALID_ADDRESS;
bool prev_entry_was_linked = false;
+ bool range_changed = false;
for (size_t idx = 0; idx < count; ++idx)
{
const Entry& entry = m_entries[idx];
{
prev_file_range_entry = file_range_entry;
file_range_entry = file_range_map.FindEntryThatContains(lookup_file_addr);
+ range_changed = true;
}
-
+
+ lldb::addr_t prev_end_entry_linked_file_addr = LLDB_INVALID_ADDRESS;
+ lldb::addr_t entry_linked_file_addr = LLDB_INVALID_ADDRESS;
+
+ bool terminate_previous_entry = false;
if (file_range_entry)
{
- // This entry has an address remapping and it needs to have its address relinked
- sequence.m_entries.push_back(entry);
- // Fix tha addresss
- const lldb::addr_t linked_file_addr = entry.file_addr - file_range_entry->GetRangeBase() + file_range_entry->data;
-// if (linked_file_addr == 0x000000000128b7d5)
-// puts("remove this");
- sequence.m_entries.back().file_addr = linked_file_addr;
+ entry_linked_file_addr = entry.file_addr - file_range_entry->GetRangeBase() + file_range_entry->data;
+ // Determine if we need to terminate the previous entry when the previous
+ // entry was not contguous with this one after being linked.
+ if (range_changed && prev_file_range_entry)
+ {
+ prev_end_entry_linked_file_addr = std::min<lldb::addr_t>(entry.file_addr, prev_file_range_entry->GetRangeEnd()) - prev_file_range_entry->GetRangeBase() + prev_file_range_entry->data;
+ if (prev_end_entry_linked_file_addr != entry_linked_file_addr)
+ terminate_previous_entry = true;
+ }
}
else if (prev_entry_was_linked)
{
!sequence.m_entries.empty() &&
!sequence.m_entries.back().is_terminal_entry)
{
- assert (prev_file_addr != LLDB_INVALID_ADDRESS);
- sequence.m_entries.push_back(sequence.m_entries.back());
- const lldb::addr_t linked_file_addr = std::min<lldb::addr_t>(entry.file_addr,prev_file_range_entry->GetRangeEnd()) - prev_file_range_entry->GetRangeBase() + prev_file_range_entry->data;
- sequence.m_entries.back().file_addr = linked_file_addr;
- sequence.m_entries.back().is_terminal_entry = true;
+ terminate_previous_entry = true;
}
}
+ if (terminate_previous_entry)
+ {
+ assert (prev_file_addr != LLDB_INVALID_ADDRESS);
+ sequence.m_entries.push_back(sequence.m_entries.back());
+ if (prev_end_entry_linked_file_addr == LLDB_INVALID_ADDRESS)
+ prev_end_entry_linked_file_addr = std::min<lldb::addr_t>(entry.file_addr,prev_file_range_entry->GetRangeEnd()) - prev_file_range_entry->GetRangeBase() + prev_file_range_entry->data;
+ sequence.m_entries.back().file_addr = prev_end_entry_linked_file_addr;
+ sequence.m_entries.back().is_terminal_entry = true;
+
+ // Append the sequence since we just terminated the previous one
+ line_table_ap->InsertSequence (&sequence);
+ sequence.Clear();
+ prev_entry_was_linked = false;
+ }
+
+ // Now link the current entry
+ if (file_range_entry)
+ {
+ // This entry has an address remapping and it needs to have its address relinked
+ sequence.m_entries.push_back(entry);
+ sequence.m_entries.back().file_addr = entry_linked_file_addr;
+ }
+
// If we have items in the sequence and the last entry is a terminal entry,
// insert this sequence into our new line table.
if (!sequence.m_entries.empty() && sequence.m_entries.back().is_terminal_entry)
line_table_ap->InsertSequence (&sequence);
sequence.Clear();
prev_entry_was_linked = false;
- prev_file_addr = LLDB_INVALID_ADDRESS;
}
else
{
prev_entry_was_linked = file_range_entry != NULL;
- prev_file_addr = entry.file_addr;
}
+ prev_file_addr = entry.file_addr;
+ range_changed = false;
}
if (line_table_ap->m_entries.empty())
return NULL;