本文整理汇总了C++中Flags::Test方法的典型用法代码示例。如果您正苦于以下问题:C++ Flags::Test方法的具体用法?C++ Flags::Test怎么用?C++ Flags::Test使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flags
的用法示例。
在下文中一共展示了Flags::Test方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: permissions
Error
ProcessMachCore::GetMemoryRegionInfo(addr_t load_addr, MemoryRegionInfo ®ion_info)
{
region_info.Clear();
const VMRangeToPermissions::Entry *permission_entry = m_core_range_infos.FindEntryThatContainsOrFollows(load_addr);
if (permission_entry)
{
if (permission_entry->Contains(load_addr))
{
region_info.GetRange().SetRangeBase(permission_entry->GetRangeBase());
region_info.GetRange().SetRangeEnd(permission_entry->GetRangeEnd());
const Flags permissions(permission_entry->data);
region_info.SetReadable(permissions.Test(ePermissionsReadable) ? MemoryRegionInfo::eYes
: MemoryRegionInfo::eNo);
region_info.SetWritable(permissions.Test(ePermissionsWritable) ? MemoryRegionInfo::eYes
: MemoryRegionInfo::eNo);
region_info.SetExecutable(permissions.Test(ePermissionsExecutable) ? MemoryRegionInfo::eYes
: MemoryRegionInfo::eNo);
}
else if (load_addr < permission_entry->GetRangeBase())
{
region_info.GetRange().SetRangeBase(load_addr);
region_info.GetRange().SetRangeEnd(permission_entry->GetRangeBase());
region_info.SetReadable(MemoryRegionInfo::eNo);
region_info.SetWritable(MemoryRegionInfo::eNo);
region_info.SetExecutable(MemoryRegionInfo::eNo);
}
return Error();
}
return Error("invalid address");
}
示例2:
bool
ThreadPlanShouldStopHere::DefaultShouldStopHereCallback (ThreadPlan *current_plan,
Flags &flags,
FrameComparison operation,
void *baton)
{
bool should_stop_here = true;
StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get();
if (!frame)
return true;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if ((operation == eFrameCompareOlder && flags.Test(eStepOutAvoidNoDebug))
|| (operation == eFrameCompareYounger && flags.Test(eStepInAvoidNoDebug))
|| (operation == eFrameCompareSameParent && flags.Test(eStepInAvoidNoDebug)))
{
if (!frame->HasDebugInformation())
{
if (log)
log->Printf ("Stepping out of frame with no debug info");
should_stop_here = false;
}
}
// Always avoid code with line number 0.
// FIXME: At present the ShouldStop and the StepFromHere calculate this independently. If this ever
// becomes expensive (this one isn't) we can try to have this set a state that the StepFromHere can use.
if (frame)
{
SymbolContext sc;
sc = frame->GetSymbolContext (eSymbolContextLineEntry);
if (sc.line_entry.line == 0)
should_stop_here = false;
}
return should_stop_here;
}
示例3: WriteMessage
void Log::WriteMessage(const std::string &message) {
// Make a copy of our stream shared pointer in case someone disables our log
// while we are logging and releases the stream
auto stream_sp = GetStream();
if (!stream_sp)
return;
Flags options = GetOptions();
if (options.Test(LLDB_LOG_OPTION_THREADSAFE)) {
static std::recursive_mutex g_LogThreadedMutex;
std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
*stream_sp << message;
stream_sp->flush();
} else {
*stream_sp << message;
stream_sp->flush();
}
}
示例4: WriteHeader
void Log::WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file,
llvm::StringRef function) {
Flags options = GetOptions();
static uint32_t g_sequence_id = 0;
// Add a sequence ID if requested
if (options.Test(LLDB_LOG_OPTION_PREPEND_SEQUENCE))
OS << ++g_sequence_id << " ";
// Timestamp if requested
if (options.Test(LLDB_LOG_OPTION_PREPEND_TIMESTAMP)) {
auto now = std::chrono::duration<double>(
std::chrono::system_clock::now().time_since_epoch());
OS << llvm::formatv("{0:f9} ", now.count());
}
// Add the process and thread if requested
if (options.Test(LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD))
OS << llvm::formatv("[{0,0+4}/{1,0+4}] ", getpid(),
llvm::get_threadid());
// Add the thread name if requested
if (options.Test(LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) {
llvm::SmallString<32> thread_name;
llvm::get_thread_name(thread_name);
llvm::SmallString<12> format_str;
llvm::raw_svector_ostream format_os(format_str);
format_os << "{0,-" << llvm::alignTo<16>(thread_name.size()) << "} ";
OS << llvm::formatv(format_str.c_str(), thread_name);
}
if (options.Test(LLDB_LOG_OPTION_BACKTRACE))
llvm::sys::PrintStackTrace(OS);
if (options.Test(LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION) &&
(!file.empty() || !function.empty())) {
file = llvm::sys::path::filename(file).take_front(40);
function = function.take_front(40);
OS << llvm::formatv("{0,-60:60} ", (file + ":" + function).str());
}
}