本文整理汇总了C++中EvaluateExpressionOptions::SetResultIsInternal方法的典型用法代码示例。如果您正苦于以下问题:C++ EvaluateExpressionOptions::SetResultIsInternal方法的具体用法?C++ EvaluateExpressionOptions::SetResultIsInternal怎么用?C++ EvaluateExpressionOptions::SetResultIsInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EvaluateExpressionOptions
的用法示例。
在下文中一共展示了EvaluateExpressionOptions::SetResultIsInternal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: g_TypeHint
bool
lldb_private::formatters::CFBagSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
{
static ConstString g_TypeHint("CFBag");
ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
return false;
ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
if (!runtime)
return false;
ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
if (!descriptor.get() || !descriptor->IsValid())
return false;
uint32_t ptr_size = process_sp->GetAddressByteSize();
lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
if (!valobj_addr)
return false;
uint32_t count = 0;
bool is_type_ok = false; // check to see if this is a CFBag we know about
if (descriptor->IsCFType())
{
ConstString type_name(valobj.GetTypeName());
if (type_name == ConstString("__CFBag") || type_name == ConstString("const struct __CFBag"))
{
if (valobj.IsPointerType())
is_type_ok = true;
}
}
if (is_type_ok == false)
{
StackFrameSP frame_sp(valobj.GetFrameSP());
if (!frame_sp)
return false;
ValueObjectSP count_sp;
StreamString expr;
expr.Printf("(int)CFBagGetCount((void*)0x%" PRIx64 ")",valobj.GetPointerValue());
EvaluateExpressionOptions options;
options.SetResultIsInternal(true);
if (process_sp->GetTarget().EvaluateExpression(expr.GetData(), frame_sp.get(), count_sp, options) != eExpressionCompleted)
return false;
if (!count_sp)
return false;
count = count_sp->GetValueAsUnsigned(0);
}
else
{
uint32_t offset = 2*ptr_size+4 + valobj_addr;
Error error;
count = process_sp->ReadUnsignedIntegerFromMemory(offset, 4, 0, error);
if (error.Fail())
return false;
}
std::string prefix,suffix;
if (Language* language = Language::FindPlugin(options.GetLanguage()))
{
if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
{
prefix.clear();
suffix.clear();
}
}
stream.Printf("%s\"%u value%s\"%s",
prefix.c_str(),
count,(count == 1 ? "" : "s"),
suffix.c_str());
return true;
}
示例2: ConditionSaysStop
bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
Status &error) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS);
std::lock_guard<std::mutex> guard(m_condition_mutex);
size_t condition_hash;
const char *condition_text = GetConditionText(&condition_hash);
if (!condition_text) {
m_user_expression_sp.reset();
return false;
}
error.Clear();
DiagnosticManager diagnostics;
if (condition_hash != m_condition_hash || !m_user_expression_sp ||
!m_user_expression_sp->MatchesContext(exe_ctx)) {
LanguageType language = eLanguageTypeUnknown;
// See if we can figure out the language from the frame, otherwise use the
// default language:
CompileUnit *comp_unit = m_address.CalculateSymbolContextCompileUnit();
if (comp_unit)
language = comp_unit->GetLanguage();
m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(
condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
EvaluateExpressionOptions(), nullptr, error));
if (error.Fail()) {
if (log)
log->Printf("Error getting condition expression: %s.",
error.AsCString());
m_user_expression_sp.reset();
return true;
}
if (!m_user_expression_sp->Parse(diagnostics, exe_ctx,
eExecutionPolicyOnlyWhenNeeded, true,
false)) {
error.SetErrorStringWithFormat(
"Couldn't parse conditional expression:\n%s",
diagnostics.GetString().c_str());
m_user_expression_sp.reset();
return true;
}
m_condition_hash = condition_hash;
}
// We need to make sure the user sees any parse errors in their condition, so
// we'll hook the constructor errors up to the debugger's Async I/O.
ValueObjectSP result_value_sp;
EvaluateExpressionOptions options;
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetTryAllThreads(true);
options.SetResultIsInternal(
true); // Don't generate a user variable for condition expressions.
Status expr_error;
diagnostics.Clear();
ExpressionVariableSP result_variable_sp;
ExpressionResults result_code = m_user_expression_sp->Execute(
diagnostics, exe_ctx, options, m_user_expression_sp, result_variable_sp);
bool ret;
if (result_code == eExpressionCompleted) {
if (!result_variable_sp) {
error.SetErrorString("Expression did not return a result");
return false;
}
result_value_sp = result_variable_sp->GetValueObject();
if (result_value_sp) {
ret = result_value_sp->IsLogicalTrue(error);
if (log) {
if (error.Success()) {
log->Printf("Condition successfully evaluated, result is %s.\n",
ret ? "true" : "false");
} else {
error.SetErrorString(
"Failed to get an integer result from the expression");
ret = false;
}
}
} else {
ret = false;
error.SetErrorString("Failed to get any result from the expression");
}
} else {
ret = false;
//.........这里部分代码省略.........