本文整理汇总了C++中Searcher::SearchCallback方法的典型用法代码示例。如果您正苦于以下问题:C++ Searcher::SearchCallback方法的具体用法?C++ Searcher::SearchCallback怎么用?C++ Searcher::SearchCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Searcher
的用法示例。
在下文中一共展示了Searcher::SearchCallback方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cu_sp
Searcher::CallbackReturn
SearchFilter::DoCUIteration(const ModuleSP &module_sp,
const SymbolContext &context, Searcher &searcher) {
Searcher::CallbackReturn shouldContinue;
if (context.comp_unit == nullptr) {
const size_t num_comp_units = module_sp->GetNumCompileUnits();
for (size_t i = 0; i < num_comp_units; i++) {
CompUnitSP cu_sp(module_sp->GetCompileUnitAtIndex(i));
if (cu_sp) {
if (!CompUnitPasses(*(cu_sp.get())))
continue;
if (searcher.GetDepth() == Searcher::eDepthCompUnit) {
SymbolContext matchingContext(m_target_sp, module_sp, cu_sp.get());
shouldContinue =
searcher.SearchCallback(*this, matchingContext, nullptr, false);
if (shouldContinue == Searcher::eCallbackReturnPop)
return Searcher::eCallbackReturnContinue;
else if (shouldContinue == Searcher::eCallbackReturnStop)
return shouldContinue;
} else {
// FIXME Descend to block.
}
}
}
} else {
if (CompUnitPasses(*context.comp_unit)) {
SymbolContext matchingContext(m_target_sp, module_sp, context.comp_unit);
return searcher.SearchCallback(*this, matchingContext, nullptr, false);
}
}
return Searcher::eCallbackReturnContinue;
}
示例2: cu_sp
Searcher::CallbackReturn
SearchFilter::DoCUIteration(const ModuleSP &module_sp,
const SymbolContext &context, Searcher &searcher) {
Searcher::CallbackReturn shouldContinue;
if (context.comp_unit == nullptr) {
const size_t num_comp_units = module_sp->GetNumCompileUnits();
for (size_t i = 0; i < num_comp_units; i++) {
CompUnitSP cu_sp(module_sp->GetCompileUnitAtIndex(i));
if (cu_sp) {
if (!CompUnitPasses(*(cu_sp.get())))
continue;
if (searcher.GetDepth() == lldb::eSearchDepthCompUnit) {
SymbolContext matchingContext(m_target_sp, module_sp, cu_sp.get());
shouldContinue =
searcher.SearchCallback(*this, matchingContext, nullptr, false);
if (shouldContinue == Searcher::eCallbackReturnPop)
return Searcher::eCallbackReturnContinue;
else if (shouldContinue == Searcher::eCallbackReturnStop)
return shouldContinue;
} else {
// First make sure this compile unit's functions are parsed
// since CompUnit::ForeachFunction only iterates over already
// parsed functions.
SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
if (!sym_vendor)
continue;
if (!sym_vendor->ParseFunctions(*cu_sp))
continue;
// If we got any functions, use ForeachFunction to do the iteration.
cu_sp->ForeachFunction([&](const FunctionSP &func_sp) {
if (!FunctionPasses(*func_sp.get()))
return false; // Didn't pass the filter, just keep going.
if (searcher.GetDepth() == lldb::eSearchDepthFunction) {
SymbolContext matchingContext(m_target_sp, module_sp,
cu_sp.get(), func_sp.get());
shouldContinue = searcher.SearchCallback(*this,
matchingContext,
nullptr, false);
} else {
shouldContinue = DoFunctionIteration(func_sp.get(), context,
searcher);
}
return shouldContinue != Searcher::eCallbackReturnContinue;
});
}
}
}
} else {
if (CompUnitPasses(*context.comp_unit)) {
SymbolContext matchingContext(m_target_sp, module_sp, context.comp_unit);
return searcher.SearchCallback(*this, matchingContext, nullptr, false);
}
}
return Searcher::eCallbackReturnContinue;
}
示例3: modules_locker
Searcher::CallbackReturn
SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searcher)
{
Searcher::CallbackReturn shouldContinue;
if (searcher.GetDepth () >= Searcher::eDepthModule)
{
if (!context.module_sp)
{
ModuleList &target_images = m_target_sp->GetImages();
Mutex::Locker modules_locker(target_images.GetMutex());
size_t n_modules = target_images.GetSize();
for (size_t i = 0; i < n_modules; i++)
{
// If this is the last level supplied, then call the callback directly,
// otherwise descend.
ModuleSP module_sp(target_images.GetModuleAtIndexUnlocked (i));
if (!ModulePasses (module_sp))
continue;
if (searcher.GetDepth () == Searcher::eDepthModule)
{
SymbolContext matchingContext(m_target_sp, module_sp);
shouldContinue = searcher.SearchCallback (*this, matchingContext, NULL, false);
if (shouldContinue == Searcher::eCallbackReturnStop
|| shouldContinue == Searcher::eCallbackReturnPop)
return shouldContinue;
}
else
{
shouldContinue = DoCUIteration(module_sp, context, searcher);
if (shouldContinue == Searcher::eCallbackReturnStop)
return shouldContinue;
else if (shouldContinue == Searcher::eCallbackReturnPop)
continue;
}
}
}
else
{
if (searcher.GetDepth () == Searcher::eDepthModule)
{
SymbolContext matchingContext(context.module_sp.get());
shouldContinue = searcher.SearchCallback (*this, matchingContext, NULL, false);
}
else
{
return DoCUIteration(context.module_sp, context, searcher);
}
}
}
return Searcher::eCallbackReturnContinue;
}
示例4: Search
void SearchFilterByModuleList::Search(Searcher &searcher) {
if (!m_target_sp)
return;
if (searcher.GetDepth() == lldb::eSearchDepthTarget) {
SymbolContext empty_sc;
empty_sc.target_sp = m_target_sp;
searcher.SearchCallback(*this, empty_sc, nullptr, false);
}
// If the module file spec is a full path, then we can just find the one
// filespec that passes. Otherwise, we need to go through all modules and
// find the ones that match the file name.
const ModuleList &target_modules = m_target_sp->GetImages();
std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
const size_t num_modules = target_modules.GetSize();
for (size_t i = 0; i < num_modules; i++) {
Module *module = target_modules.GetModulePointerAtIndexUnlocked(i);
if (m_module_spec_list.FindFileIndex(0, module->GetFileSpec(), false) !=
UINT32_MAX) {
SymbolContext matchingContext(m_target_sp, module->shared_from_this());
Searcher::CallbackReturn shouldContinue;
shouldContinue = DoModuleIteration(matchingContext, searcher);
if (shouldContinue == Searcher::eCallbackReturnStop)
return;
}
}
}
示例5: matchingContext
void
SearchFilterByModule::Search (Searcher &searcher)
{
if (!m_target_sp)
return;
if (searcher.GetDepth() == Searcher::eDepthTarget)
{
SymbolContext empty_sc;
empty_sc.target_sp = m_target_sp;
searcher.SearchCallback (*this, empty_sc, NULL, false);
}
// If the module file spec is a full path, then we can just find the one
// filespec that passes. Otherwise, we need to go through all modules and
// find the ones that match the file name.
ModuleList matching_modules;
const size_t num_modules = m_target_sp->GetImages().GetSize ();
for (size_t i = 0; i < num_modules; i++)
{
Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0)
{
SymbolContext matchingContext(m_target_sp, module->GetSP());
Searcher::CallbackReturn shouldContinue;
shouldContinue = DoModuleIteration(matchingContext, searcher);
if (shouldContinue == Searcher::eCallbackReturnStop)
return;
}
}
}
示例6: module_sp
void
SearchFilter::SearchInModuleList (Searcher &searcher, ModuleList &modules)
{
SymbolContext empty_sc;
if (m_target_sp == NULL)
return;
empty_sc.target_sp = m_target_sp;
if (searcher.GetDepth() == Searcher::eDepthTarget)
searcher.SearchCallback (*this, empty_sc, NULL, false);
else
{
const size_t numModules = modules.GetSize();
for (size_t i = 0; i < numModules; i++)
{
ModuleSP module_sp(modules.GetModuleAtIndex(i));
if (ModulePasses(module_sp))
{
if (DoModuleIteration(module_sp, searcher) == Searcher::eCallbackReturnStop)
return;
}
}
}
}
示例7: DoModuleIteration
void
SearchFilter::Search (Searcher &searcher)
{
SymbolContext empty_sc;
if (m_target_sp == NULL)
return;
empty_sc.target_sp = m_target_sp;
if (searcher.GetDepth() == Searcher::eDepthTarget)
searcher.SearchCallback (*this, empty_sc, NULL, false);
else
DoModuleIteration(empty_sc, searcher);
}
示例8: SearchInModuleList
void SearchFilter::SearchInModuleList(Searcher &searcher, ModuleList &modules) {
SymbolContext empty_sc;
if (!m_target_sp)
return;
empty_sc.target_sp = m_target_sp;
if (searcher.GetDepth() == lldb::eSearchDepthTarget)
searcher.SearchCallback(*this, empty_sc, nullptr, false);
else {
std::lock_guard<std::recursive_mutex> guard(modules.GetMutex());
const size_t numModules = modules.GetSize();
for (size_t i = 0; i < numModules; i++) {
ModuleSP module_sp(modules.GetModuleAtIndexUnlocked(i));
if (ModulePasses(module_sp)) {
if (DoModuleIteration(module_sp, searcher) ==
Searcher::eCallbackReturnStop)
return;
}
}
}
}