本文整理汇总了C++中EvaluateExpressionOptions::SetCoerceToId方法的典型用法代码示例。如果您正苦于以下问题:C++ EvaluateExpressionOptions::SetCoerceToId方法的具体用法?C++ EvaluateExpressionOptions::SetCoerceToId怎么用?C++ EvaluateExpressionOptions::SetCoerceToId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EvaluateExpressionOptions
的用法示例。
在下文中一共展示了EvaluateExpressionOptions::SetCoerceToId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exe_ctx
lldb::ValueObjectSP
lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
const char* return_type,
const char* selector,
uint64_t index)
{
lldb::ValueObjectSP valobj_sp;
if (!return_type || !*return_type)
return valobj_sp;
if (!selector || !*selector)
return valobj_sp;
StreamString expr_path_stream;
valobj.GetExpressionPath(expr_path_stream, false);
StreamString expr;
expr.Printf("(%s)[%s %s:%" PRId64 "]",return_type,expr_path_stream.GetData(),selector,index);
ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
lldb::ValueObjectSP result_sp;
Target* target = exe_ctx.GetTargetPtr();
StackFrame* stack_frame = GetViableFrame(exe_ctx);
if (!target || !stack_frame)
return valobj_sp;
EvaluateExpressionOptions options;
options.SetCoerceToId(false);
options.SetUnwindOnError(true);
options.SetKeepInMemory(true);
options.SetUseDynamic(lldb::eDynamicCanRunTarget);
target->EvaluateExpression(expr.GetData(),
stack_frame,
valobj_sp,
options);
return valobj_sp;
}
示例2: exe_ctx
bool
lldb_private::formatters::ExtractValueFromObjCExpression (ValueObject &valobj,
const char* target_type,
const char* selector,
uint64_t &value)
{
if (!target_type || !*target_type)
return false;
if (!selector || !*selector)
return false;
StreamString expr;
expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
lldb::ValueObjectSP result_sp;
Target* target = exe_ctx.GetTargetPtr();
StackFrame* stack_frame = exe_ctx.GetFramePtr();
if (!target || !stack_frame)
return false;
EvaluateExpressionOptions options;
options.SetCoerceToId(false)
.SetUnwindOnError(true)
.SetKeepInMemory(true);
target->EvaluateExpression(expr.GetData(),
stack_frame,
result_sp,
options);
if (!result_sp)
return false;
value = result_sp->GetValueAsUnsigned(0);
return true;
}