本文整理汇总了C++中SearchFilter::AddressPasses方法的典型用法代码示例。如果您正苦于以下问题:C++ SearchFilter::AddressPasses方法的具体用法?C++ SearchFilter::AddressPasses怎么用?C++ SearchFilter::AddressPasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchFilter
的用法示例。
在下文中一共展示了SearchFilter::AddressPasses方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bp_loc_sp
Searcher::CallbackReturn
BreakpointResolverAddress::SearchCallback
(
SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing
)
{
assert (m_breakpoint != NULL);
if (filter.AddressPasses (m_addr))
{
BreakpointLocationSP bp_loc_sp(m_breakpoint->AddLocation(m_addr));
if (bp_loc_sp && !m_breakpoint->IsInternal())
{
StreamString s;
bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Added location: %s\n", s.GetData());
}
}
return Searcher::eCallbackReturnStop;
}
示例2: AddLocation
void BreakpointResolver::AddLocation(SearchFilter &filter,
const SymbolContext &sc,
bool skip_prologue,
llvm::StringRef log_ident) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
Address line_start = sc.line_entry.range.GetBaseAddress();
if (!line_start.IsValid()) {
if (log)
log->Printf("error: Unable to set breakpoint %s at file address "
"0x%" PRIx64 "\n",
log_ident.str().c_str(), line_start.GetFileAddress());
return;
}
if (!filter.AddressPasses(line_start)) {
if (log)
log->Printf("Breakpoint %s at file address 0x%" PRIx64
" didn't pass the filter.\n",
log_ident.str().c_str(), line_start.GetFileAddress());
}
// If the line number is before the prologue end, move it there...
bool skipped_prologue = false;
if (skip_prologue && sc.function) {
Address prologue_addr(sc.function->GetAddressRange().GetBaseAddress());
if (prologue_addr.IsValid() && (line_start == prologue_addr)) {
const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
if (prologue_byte_size) {
prologue_addr.Slide(prologue_byte_size);
if (filter.AddressPasses(prologue_addr)) {
skipped_prologue = true;
line_start = prologue_addr;
}
}
}
}
BreakpointLocationSP bp_loc_sp(AddLocation(line_start));
if (log && bp_loc_sp && !m_breakpoint->IsInternal()) {
StreamString s;
bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
log->Printf("Added location (skipped prologue: %s): %s \n",
skipped_prologue ? "yes" : "no", s.GetData());
}
}
示例3: bp_loc_sp
//.........这里部分代码省略.........
if (log)
log->Warning("glob is not supported yet.");
break;
}
// If the filter specifies a Compilation Unit, remove the ones that don't
// pass at this point.
if (filter_by_cu || filter_by_language) {
uint32_t num_functions = func_list.GetSize();
for (size_t idx = 0; idx < num_functions; idx++) {
bool remove_it = false;
SymbolContext sc;
func_list.GetContextAtIndex(idx, sc);
if (filter_by_cu) {
if (!sc.comp_unit || !filter.CompUnitPasses(*sc.comp_unit))
remove_it = true;
}
if (filter_by_language) {
LanguageType sym_language = sc.GetLanguage();
if ((Language::GetPrimaryLanguage(sym_language) !=
Language::GetPrimaryLanguage(m_language)) &&
(sym_language != eLanguageTypeUnknown)) {
remove_it = true;
}
}
if (remove_it) {
func_list.RemoveContextAtIndex(idx);
num_functions--;
idx--;
}
}
}
// Remove any duplicates between the function list and the symbol list
SymbolContext sc;
if (func_list.GetSize()) {
for (i = 0; i < func_list.GetSize(); i++) {
if (func_list.GetContextAtIndex(i, sc)) {
bool is_reexported = false;
if (sc.block && sc.block->GetInlinedFunctionInfo()) {
if (!sc.block->GetStartAddress(break_addr))
break_addr.Clear();
} else if (sc.function) {
break_addr = sc.function->GetAddressRange().GetBaseAddress();
if (m_skip_prologue && break_addr.IsValid()) {
const uint32_t prologue_byte_size =
sc.function->GetPrologueByteSize();
if (prologue_byte_size)
break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
}
} else if (sc.symbol) {
if (sc.symbol->GetType() == eSymbolTypeReExported) {
const Symbol *actual_symbol =
sc.symbol->ResolveReExportedSymbol(m_breakpoint->GetTarget());
if (actual_symbol) {
is_reexported = true;
break_addr = actual_symbol->GetAddress();
}
} else {
break_addr = sc.symbol->GetAddress();
}
if (m_skip_prologue && break_addr.IsValid()) {
const uint32_t prologue_byte_size =
sc.symbol->GetPrologueByteSize();
if (prologue_byte_size)
break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
else {
const Architecture *arch =
m_breakpoint->GetTarget().GetArchitecturePlugin();
if (arch)
arch->AdjustBreakpointAddress(*sc.symbol, break_addr);
}
}
}
if (break_addr.IsValid()) {
if (filter.AddressPasses(break_addr)) {
BreakpointLocationSP bp_loc_sp(
AddLocation(break_addr, &new_location));
bp_loc_sp->SetIsReExported(is_reexported);
if (bp_loc_sp && new_location && !m_breakpoint->IsInternal()) {
if (log) {
StreamString s;
bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
log->Printf("Added location: %s\n", s.GetData());
}
}
}
}
}
}
}
return Searcher::eCallbackReturnContinue;
}
示例4: prologue_addr
void
BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, const char *log_ident)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
while (sc_list.GetSize() > 0)
{
SymbolContextList tmp_sc_list;
unsigned current_idx = 0;
SymbolContext sc;
bool first_entry = true;
FileSpec match_file_spec;
FileSpec match_original_file_spec;
uint32_t closest_line_number = UINT32_MAX;
// Pull out the first entry, and all the others that match its file spec, and stuff them in the tmp list.
while (current_idx < sc_list.GetSize())
{
bool matches;
sc_list.GetContextAtIndex (current_idx, sc);
if (first_entry)
{
match_file_spec = sc.line_entry.file;
match_original_file_spec = sc.line_entry.original_file;
matches = true;
first_entry = false;
}
else
matches = ((sc.line_entry.file == match_file_spec) ||
(sc.line_entry.original_file == match_original_file_spec));
if (matches)
{
tmp_sc_list.Append (sc);
sc_list.RemoveContextAtIndex(current_idx);
// ResolveSymbolContext will always return a number that is >= the line number you pass in.
// So the smaller line number is always better.
if (sc.line_entry.line < closest_line_number)
closest_line_number = sc.line_entry.line;
}
else
current_idx++;
}
// Okay, we've found the closest line number match, now throw away all the others:
current_idx = 0;
while (current_idx < tmp_sc_list.GetSize())
{
if (tmp_sc_list.GetContextAtIndex(current_idx, sc))
{
if (sc.line_entry.line != closest_line_number)
tmp_sc_list.RemoveContextAtIndex(current_idx);
else
current_idx++;
}
}
// Next go through and see if there are line table entries that are contiguous, and if so keep only the
// first of the contiguous range:
current_idx = 0;
std::map<Block *, lldb::addr_t> blocks_with_breakpoints;
while (current_idx < tmp_sc_list.GetSize())
{
if (tmp_sc_list.GetContextAtIndex(current_idx, sc))
{
if (blocks_with_breakpoints.find (sc.block) != blocks_with_breakpoints.end())
tmp_sc_list.RemoveContextAtIndex(current_idx);
else
{
blocks_with_breakpoints.insert (std::pair<Block *, lldb::addr_t>(sc.block, sc.line_entry.range.GetBaseAddress().GetFileAddress()));
current_idx++;
}
}
}
// and make breakpoints out of the closest line number match.
uint32_t tmp_sc_list_size = tmp_sc_list.GetSize();
for (uint32_t i = 0; i < tmp_sc_list_size; i++)
{
if (tmp_sc_list.GetContextAtIndex(i, sc))
{
Address line_start = sc.line_entry.range.GetBaseAddress();
if (line_start.IsValid())
{
if (filter.AddressPasses(line_start))
{
// If the line number is before the prologue end, move it there...
bool skipped_prologue = false;
if (skip_prologue)
{
if (sc.function)
{
//.........这里部分代码省略.........
示例5: log
//.........这里部分代码省略.........
context.module_sp->FindFunctions (m_regex,
include_symbols,
append,
func_list);
}
break;
case AddressResolver::Glob:
if (log)
log->Warning ("glob is not supported yet.");
break;
}
// Remove any duplicates between the funcion list and the symbol list
if (func_list.GetSize())
{
for (i = 0; i < func_list.GetSize(); i++)
{
if (func_list.GetContextAtIndex(i, sc) == false)
continue;
if (sc.function == NULL)
continue;
uint32_t j = 0;
while (j < sym_list.GetSize())
{
SymbolContext symbol_sc;
if (sym_list.GetContextAtIndex(j, symbol_sc))
{
if (symbol_sc.symbol && symbol_sc.symbol->GetAddressRangePtr())
{
if (sc.function->GetAddressRange().GetBaseAddress() == symbol_sc.symbol->GetAddressRangePtr()->GetBaseAddress())
{
sym_list.RemoveContextAtIndex(j);
continue; // Don't increment j
}
}
}
j++;
}
}
for (i = 0; i < func_list.GetSize(); i++)
{
if (func_list.GetContextAtIndex(i, sc))
{
if (sc.function)
{
func_addr = sc.function->GetAddressRange().GetBaseAddress();
addr_t byte_size = sc.function->GetAddressRange().GetByteSize();
if (skip_prologue)
{
const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
if (prologue_byte_size)
{
func_addr.SetOffset (func_addr.GetOffset() + prologue_byte_size);
byte_size -= prologue_byte_size;
}
}
if (filter.AddressPasses (func_addr))
{
AddressRange new_range (func_addr, byte_size);
m_address_ranges.push_back (new_range);
}
}
}
}
}
for (i = 0; i < sym_list.GetSize(); i++)
{
if (sym_list.GetContextAtIndex(i, sc))
{
if (sc.symbol && sc.symbol->GetAddressRangePtr())
{
func_addr = sc.symbol->GetAddressRangePtr()->GetBaseAddress();
addr_t byte_size = sc.symbol->GetAddressRangePtr()->GetByteSize();
if (skip_prologue)
{
const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
if (prologue_byte_size)
{
func_addr.SetOffset (func_addr.GetOffset() + prologue_byte_size);
byte_size -= prologue_byte_size;
}
}
if (filter.AddressPasses (func_addr))
{
AddressRange new_range (func_addr, byte_size);
m_address_ranges.push_back (new_range);
}
}
}
}
return Searcher::eCallbackReturnContinue;
}
示例6: bp_loc_sp
Searcher::CallbackReturn
BreakpointResolverFileRegex::SearchCallback
(
SearchFilter &filter,
SymbolContext &context,
Address *addr,
bool containing
)
{
assert (m_breakpoint != NULL);
if (!context.target_sp)
return eCallbackReturnContinue;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
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);
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;
// 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]);
}
}
}
assert (m_breakpoint != NULL);
return Searcher::eCallbackReturnContinue;
}