Factor the code that was eliminating redundant breakpoint locations and moving

line breakpoints past the prologue of functions so it can be shared between the
file & line breakpoint resolver, and the source pattern breakpoint resolver,
and then share it.

llvm-svn: 191478
This commit is contained in:
Jim Ingham
2013-09-27 01:16:58 +00:00
parent 2b89a53181
commit f642373cd5
4 changed files with 166 additions and 183 deletions

View File

@@ -60,54 +60,19 @@ BreakpointResolverFileRegex::SearchCallback
CompileUnit *cu = context.comp_unit;
FileSpec cu_file_spec = *(static_cast<FileSpec *>(cu));
std::vector<uint32_t> line_matches;
context.target_sp->GetSourceManager().FindLinesMatchingRegex(cu_file_spec, m_regex, 1, UINT32_MAX, line_matches);
context.target_sp->GetSourceManager().FindLinesMatchingRegex(cu_file_spec, m_regex, 1, UINT32_MAX, line_matches);
uint32_t num_matches = line_matches.size();
for (uint32_t i = 0; i < num_matches; i++)
{
uint32_t start_idx = 0;
bool exact = false;
while (1)
{
LineEntry line_entry;
SymbolContextList sc_list;
const bool search_inlines = false;
const bool exact = false;
// Cycle through all the line entries that might match this one:
start_idx = cu->FindLineEntry (start_idx, line_matches[i], NULL, exact, &line_entry);
if (start_idx == UINT32_MAX)
break;
exact = true;
start_idx++;
Address line_start = line_entry.range.GetBaseAddress();
if (line_start.IsValid())
{
if (filter.AddressPasses(line_start))
{
BreakpointLocationSP bp_loc_sp (m_breakpoint->AddLocation(line_start));
if (log && bp_loc_sp && !m_breakpoint->IsInternal())
{
StreamString s;
bp_loc_sp->GetDescription (&s, lldb::eDescriptionLevelVerbose);
log->Printf ("Added location: %s\n", s.GetData());
}
}
else if (log)
{
log->Printf ("Breakpoint at file address 0x%" PRIx64 " for %s:%d didn't pass filter.\n",
line_start.GetFileAddress(),
cu_file_spec.GetFilename().AsCString("<Unknown>"),
line_matches[i]);
}
}
else
{
if (log)
log->Printf ("error: Unable to set breakpoint at file address 0x%" PRIx64 " for %s:%d\n",
line_start.GetFileAddress(),
cu_file_spec.GetFilename().AsCString("<Unknown>"),
line_matches[i]);
}
}
cu->ResolveSymbolContext (cu_file_spec, line_matches[i], search_inlines, exact, eSymbolContextEverything, sc_list);
const bool skip_prologue = true;
BreakpointResolver::SetSCMatchesByLine (filter, sc_list, skip_prologue, m_regex.GetText());
}
assert (m_breakpoint != NULL);