本文整理汇总了C++中ValueObjectSP类的典型用法代码示例。如果您正苦于以下问题:C++ ValueObjectSP类的具体用法?C++ ValueObjectSP怎么用?C++ ValueObjectSP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueObjectSP类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EvaluateExpr
ValueObjectSP
GoUserExpression::GoInterpreter::VisitStarExpr(const GoASTStarExpr *e) {
ValueObjectSP target = EvaluateExpr(e->GetX());
if (!target)
return nullptr;
return target->Dereference(m_error);
}
开发者ID:krytarowski,项目名称:lldb,代码行数:7,代码来源:GoUserExpression.cpp
示例2: PrintChild
void ValueObjectPrinter::PrintChild(
ValueObjectSP child_sp,
const DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
const uint32_t consumed_depth = (!m_options.m_pointer_as_array) ? 1 : 0;
const bool does_consume_ptr_depth =
((IsPtr() && !m_options.m_pointer_as_array) || IsRef());
DumpValueObjectOptions child_options(m_options);
child_options.SetFormat(m_options.m_format)
.SetSummary()
.SetRootValueObjectName();
child_options.SetScopeChecked(true)
.SetHideName(m_options.m_hide_name)
.SetHideValue(m_options.m_hide_value)
.SetOmitSummaryDepth(child_options.m_omit_summary_depth > 1
? child_options.m_omit_summary_depth -
consumed_depth
: 0)
.SetElementCount(0);
if (child_sp.get()) {
ValueObjectPrinter child_printer(
child_sp.get(), m_stream, child_options,
does_consume_ptr_depth ? --curr_ptr_depth : curr_ptr_depth,
m_curr_depth + consumed_depth, m_printed_instance_pointers);
child_printer.PrintValueObject();
}
}
开发者ID:kraj,项目名称:lldb,代码行数:28,代码来源:ValueObjectPrinter.cpp
示例3: EvaluateExpr
ValueObjectSP
GoUserExpression::GoInterpreter::VisitSelectorExpr(const lldb_private::GoASTSelectorExpr *e)
{
ValueObjectSP target = EvaluateExpr(e->GetX());
if (target)
{
if (target->GetCompilerType().IsPointerType())
{
target = target->Dereference(m_error);
if (m_error.Fail())
return nullptr;
}
ConstString field(e->GetSel()->GetName().m_value);
ValueObjectSP result = target->GetChildMemberWithName(field, true);
if (!result)
m_error.SetErrorStringWithFormat("Unknown child %s", field.AsCString());
return result;
}
if (const GoASTIdent *package = llvm::dyn_cast<GoASTIdent>(e->GetX()))
{
if (VariableSP global = FindGlobalVariable(m_exe_ctx.GetTargetSP(),
package->GetName().m_value + "." + e->GetSel()->GetName().m_value))
{
if (m_frame)
{
m_error.Clear();
return m_frame->GetValueObjectForFrameVariable(global, m_use_dynamic);
}
}
}
if (const GoASTBasicLit *packageLit = llvm::dyn_cast<GoASTBasicLit>(e->GetX()))
{
if (packageLit->GetValue().m_type == GoLexer::LIT_STRING)
{
std::string value = packageLit->GetValue().m_value.str();
value = value.substr(1, value.size() - 2);
if (VariableSP global =
FindGlobalVariable(m_exe_ctx.GetTargetSP(), value + "." + e->GetSel()->GetName().m_value))
{
if (m_frame)
{
m_error.Clear();
return m_frame->TrackGlobalVariable(global, m_use_dynamic);
}
}
}
}
// EvaluateExpr should have already set m_error.
return target;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:50,代码来源:GoUserExpression.cpp
示例4: ExtractLibcxxStringInfo
// this function abstracts away the layout and mode details of a libc++ string
// and returns the address of the data and the size ready for callers to consume
static bool
ExtractLibcxxStringInfo (ValueObject& valobj,
ValueObjectSP &location_sp,
uint64_t& size)
{
ValueObjectSP D(valobj.GetChildAtIndexPath({0,0,0,0}));
if (!D)
return false;
ValueObjectSP layout_decider(D->GetChildAtIndexPath({0,0}));
// this child should exist
if (!layout_decider)
return false;
ConstString g_data_name("__data_");
ConstString g_size_name("__size_");
bool short_mode = false; // this means the string is in short-mode and the data is stored inline
LibcxxStringLayoutMode layout = (layout_decider->GetName() == g_data_name) ? eLibcxxStringLayoutModeDSC : eLibcxxStringLayoutModeCSD;
uint64_t size_mode_value = 0;
if (layout == eLibcxxStringLayoutModeDSC)
{
ValueObjectSP size_mode(D->GetChildAtIndexPath({1,1,0}));
if (!size_mode)
return false;
if (size_mode->GetName() != g_size_name)
{
// we are hitting the padding structure, move along
size_mode = D->GetChildAtIndexPath({1,1,1});
if (!size_mode)
return false;
}
size_mode_value = (size_mode->GetValueAsUnsigned(0));
short_mode = ((size_mode_value & 0x80) == 0);
}
else
{
ValueObjectSP size_mode(D->GetChildAtIndexPath({1,0,0}));
if (!size_mode)
return false;
size_mode_value = (size_mode->GetValueAsUnsigned(0));
short_mode = ((size_mode_value & 1) == 0);
}
if (short_mode)
{
ValueObjectSP s(D->GetChildAtIndex(1, true));
if (!s)
return false;
location_sp = s->GetChildAtIndex((layout == eLibcxxStringLayoutModeDSC) ? 0 : 1, true);
size = (layout == eLibcxxStringLayoutModeDSC) ? size_mode_value : ((size_mode_value >> 1) % 256);
return (location_sp.get() != nullptr);
}
else
{
开发者ID:gnuhub,项目名称:lldb,代码行数:61,代码来源:CXXFormatterFunctions.cpp
示例5:
bool
lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType()
{
if (m_element_type.GetOpaqueQualType() && m_element_type.GetTypeSystem())
return true;
m_element_type.Clear();
ValueObjectSP deref;
Error error;
deref = m_root_node->Dereference(error);
if (!deref || error.Fail())
return false;
deref = deref->GetChildMemberWithName(ConstString("__value_"), true);
if (!deref)
return false;
m_element_type = deref->GetCompilerType();
return true;
}
开发者ID:Arhzi,项目名称:lldb,代码行数:17,代码来源:LibCxxMap.cpp
示例6: child_options
void
ValueObjectPrinter::PrintChild (ValueObjectSP child_sp,
const DumpValueObjectOptions::PointerDepth& curr_ptr_depth)
{
DumpValueObjectOptions child_options(m_options);
child_options.SetFormat(m_options.m_format).SetSummary().SetRootValueObjectName();
child_options.SetScopeChecked(true).SetHideName(m_options.m_hide_name).SetHideValue(m_options.m_hide_value)
.SetOmitSummaryDepth(child_options.m_omit_summary_depth > 1 ? child_options.m_omit_summary_depth - 1 : 0);
if (child_sp.get())
{
ValueObjectPrinter child_printer(child_sp.get(),
m_stream,
child_options,
(IsPtr() || IsRef()) ? --curr_ptr_depth : curr_ptr_depth,
m_curr_depth + 1);
child_printer.PrintValueObject();
}
}
开发者ID:Nomad280279,项目名称:lldb,代码行数:18,代码来源:ValueObjectPrinter.cpp
示例7: g___value_
bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() {
static ConstString g___value_("__value_");
static ConstString g_tree_("__tree_");
static ConstString g_pair3("__pair3_");
if (m_element_type.GetOpaqueQualType() && m_element_type.GetTypeSystem())
return true;
m_element_type.Clear();
ValueObjectSP deref;
Status error;
deref = m_root_node->Dereference(error);
if (!deref || error.Fail())
return false;
deref = deref->GetChildMemberWithName(g___value_, true);
if (deref) {
m_element_type = deref->GetCompilerType();
return true;
}
deref = m_backend.GetChildAtNamePath({g_tree_, g_pair3});
if (!deref)
return false;
m_element_type = deref->GetCompilerType()
.GetTypeTemplateArgument(1)
.GetTypeTemplateArgument(1);
if (m_element_type) {
std::string name;
uint64_t bit_offset_ptr;
uint32_t bitfield_bit_size_ptr;
bool is_bitfield_ptr;
m_element_type = m_element_type.GetFieldAtIndex(
0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr);
m_element_type = m_element_type.GetTypedefedType();
return m_element_type.IsValid();
} else {
m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0);
return m_element_type.IsValid();
}
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:38,代码来源:LibCxxMap.cpp
示例8: ValueObjectSP
ValueObjectSP BitsetFrontEnd::GetChildAtIndex(size_t idx) {
if (idx >= m_elements.size() || !m_first)
return ValueObjectSP();
if (m_elements[idx])
return m_elements[idx];
ExecutionContext ctx = m_backend.GetExecutionContextRef().Lock(false);
CompilerType type;
ValueObjectSP chunk;
// For small bitsets __first_ is not an array, but a plain size_t.
if (m_first->GetCompilerType().IsArrayType(&type, nullptr, nullptr)) {
llvm::Optional<uint64_t> bit_size =
type.GetBitSize(ctx.GetBestExecutionContextScope());
if (!bit_size || *bit_size == 0)
return {};
chunk = m_first->GetChildAtIndex(idx / *bit_size, true);
} else {
type = m_first->GetCompilerType();
chunk = m_first;
}
if (!type || !chunk)
return {};
llvm::Optional<uint64_t> bit_size =
type.GetBitSize(ctx.GetBestExecutionContextScope());
if (!bit_size || *bit_size == 0)
return {};
size_t chunk_idx = idx % *bit_size;
uint8_t value = !!(chunk->GetValueAsUnsigned(0) & (uint64_t(1) << chunk_idx));
DataExtractor data(&value, sizeof(value), m_byte_order, m_byte_size);
m_elements[idx] = CreateValueObjectFromData(llvm::formatv("[{0}]", idx).str(),
data, ctx, m_bool_type);
return m_elements[idx];
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:37,代码来源:LibCxxBitset.cpp
示例9: isThrownError
bool
isThrownError(ValueObjectSP valobj_sp)
{
ConstString name = valobj_sp->GetName();
size_t length = name.GetLength();
if (length < 3)
return false;
const char *name_cstr = name.AsCString();
if (name_cstr[0] != '$')
return false;
if (name_cstr[1] != 'E')
return false;
for (int index = 2; index < length; index++)
{
char digit = name_cstr[index];
if (digit < '0' || digit > '9')
return false;
}
return true;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:swift-lldb,代码行数:22,代码来源:SwiftREPL.cpp
示例10: valobj_type_flags
bool
SwiftREPL::PrintOneVariable (Debugger &debugger,
StreamFileSP &output_sp,
ValueObjectSP &valobj_sp,
ExpressionVariable *var)
{
bool is_computed = false;
if (var)
{
if (lldb::ValueObjectSP valobj_sp = var->GetValueObject())
{
Flags valobj_type_flags(valobj_sp->GetCompilerType().GetTypeInfo());
const bool is_swift(valobj_type_flags.AllSet(eTypeIsSwift));
if ((var->GetName().AsCString("anonymous")[0] != '$') &&
is_swift)
{
is_computed = llvm::cast<SwiftExpressionVariable>(var)->GetIsComputed();
}
else
{
return false;
}
}
else
{
return false;
}
}
const bool colorize_out = output_sp->GetFile().GetIsTerminalWithColors();
bool handled = false;
Format format = m_format_options.GetFormat();
bool treat_as_void = (format == eFormatVoid);
// if we are asked to suppress void, check if this is the empty tuple type, and if so suppress it
if (!treat_as_void && !debugger.GetNotifyVoid())
{
const CompilerType &expr_type(valobj_sp->GetCompilerType());
Flags expr_type_flags(expr_type.GetTypeInfo());
if (expr_type_flags.AllSet(eTypeIsSwift | eTypeIsTuple))
{
treat_as_void = (expr_type.GetNumFields() == 0);
}
}
if (!treat_as_void)
{
if (format != eFormatDefault)
valobj_sp->SetFormat (format);
DumpValueObjectOptions options;
options.SetUseDynamicType(lldb::eDynamicCanRunTarget);
options.SetMaximumPointerDepth( {DumpValueObjectOptions::PointerDepth::Mode::Formatters,1} );
options.SetUseSyntheticValue(true);
options.SetRevealEmptyAggregates(false);
options.SetHidePointerValue(true);
options.SetVariableFormatDisplayLanguage(lldb::eLanguageTypeSwift);
options.SetDeclPrintingHelper ([] (ConstString type_name,
ConstString var_name,
const DumpValueObjectOptions &options,
Stream &stream) -> bool {
if (!type_name || !var_name)
return false;
std::string type_name_str(type_name ? type_name.GetCString() : "");
for(auto iter = type_name_str.find(" *");
iter != std::string::npos;
iter = type_name_str.find(" *"))
{
type_name_str.erase(iter, 2);
}
if (!type_name_str.empty())
{
stream.Printf("%s: %s =", var_name.GetCString(), type_name_str.c_str());
return true;
}
return false;
});
if (is_computed)
{
StringSummaryFormat::Flags flags;
flags.SetDontShowChildren(true);
flags.SetDontShowValue(true);
flags.SetHideItemNames(true);
flags.SetShowMembersOneLiner(false);
flags.SetSkipPointers(false);
flags.SetSkipReferences(false);
options.SetHideValue(true);
options.SetShowSummary(true);
options.SetSummary(lldb::TypeSummaryImplSP(new StringSummaryFormat(flags,"<computed property>")));
}
if (colorize_out)
{
const char *color = isThrownError(valobj_sp) ?
//.........这里部分代码省略.........
开发者ID:Mr-Kumar-Abhishek,项目名称:swift-lldb,代码行数:101,代码来源:SwiftREPL.cpp
示例11: name
OperatingSystemGo::Goroutine
OperatingSystemGo::CreateGoroutineAtIndex(uint64_t idx, Error &err)
{
err.Clear();
Goroutine result;
ValueObjectSP g = m_allg_sp->GetSyntheticArrayMember(idx, true)->Dereference(err);
if (err.Fail())
{
return result;
}
ConstString name("goid");
ValueObjectSP val = g->GetChildMemberWithName(name, true);
bool success = false;
result.m_goid = val->GetValueAsUnsigned(0, &success);
if (!success)
{
err.SetErrorToGenericError();
err.SetErrorString("unable to read goid");
return result;
}
name.SetCString("atomicstatus");
val = g->GetChildMemberWithName(name, true);
result.m_status = (uint32_t)val->GetValueAsUnsigned(0, &success);
if (!success)
{
err.SetErrorToGenericError();
err.SetErrorString("unable to read atomicstatus");
return result;
}
name.SetCString("sched");
val = g->GetChildMemberWithName(name, true);
result.m_gobuf = val->GetAddressOf(false);
name.SetCString("stack");
val = g->GetChildMemberWithName(name, true);
name.SetCString("lo");
ValueObjectSP child = val->GetChildMemberWithName(name, true);
result.m_lostack = child->GetValueAsUnsigned(0, &success);
if (!success)
{
err.SetErrorToGenericError();
err.SetErrorString("unable to read stack.lo");
return result;
}
name.SetCString("hi");
child = val->GetChildMemberWithName(name, true);
result.m_histack = child->GetValueAsUnsigned(0, &success);
if (!success)
{
err.SetErrorToGenericError();
err.SetErrorString("unable to read stack.hi");
return result;
}
return result;
}
开发者ID:2asoft,项目名称:freebsd,代码行数:55,代码来源:OperatingSystemGo.cpp
示例12: switch
ValueObjectSP
GoUserExpression::GoInterpreter::VisitIdent(const GoASTIdent *e)
{
ValueObjectSP val;
if (m_frame)
{
VariableSP var_sp;
std::string varname = e->GetName().m_value.str();
if (varname.size() > 1 && varname[0] == '$')
{
RegisterContextSP reg_ctx_sp = m_frame->GetRegisterContext();
const RegisterInfo *reg = reg_ctx_sp->GetRegisterInfoByName(varname.c_str() + 1);
if (reg)
{
std::string type;
switch (reg->encoding)
{
case lldb::eEncodingSint:
type.append("int");
break;
case lldb::eEncodingUint:
type.append("uint");
break;
case lldb::eEncodingIEEE754:
type.append("float");
break;
default:
m_error.SetErrorString("Invaild register encoding");
return nullptr;
}
switch (reg->byte_size)
{
case 8:
type.append("64");
break;
case 4:
type.append("32");
break;
case 2:
type.append("16");
break;
case 1:
type.append("8");
break;
default:
m_error.SetErrorString("Invaild register size");
return nullptr;
}
ValueObjectSP regVal =
ValueObjectRegister::Create(m_frame.get(), reg_ctx_sp, reg->kinds[eRegisterKindLLDB]);
CompilerType goType = LookupType(m_frame->CalculateTarget(), ConstString(type));
if (regVal)
{
regVal = regVal->Cast(goType);
return regVal;
}
}
m_error.SetErrorString("Invaild register name");
return nullptr;
}
VariableListSP var_list_sp(m_frame->GetInScopeVariableList(false));
if (var_list_sp)
{
var_sp = var_list_sp->FindVariable(ConstString(varname));
if (var_sp)
val = m_frame->GetValueObjectForFrameVariable(var_sp, m_use_dynamic);
else
{
// When a variable is on the heap instead of the stack, go records a variable
// '&x' instead of 'x'.
var_sp = var_list_sp->FindVariable(ConstString("&" + varname));
if (var_sp)
{
val = m_frame->GetValueObjectForFrameVariable(var_sp, m_use_dynamic);
if (val)
val = val->Dereference(m_error);
if (m_error.Fail())
return nullptr;
}
}
}
if (!val)
{
m_error.Clear();
TargetSP target = m_frame->CalculateTarget();
if (!target)
{
m_error.SetErrorString("No target");
return nullptr;
}
var_sp = FindGlobalVariable(target, m_package + "." + e->GetName().m_value);
if (var_sp)
return m_frame->TrackGlobalVariable(var_sp, m_use_dynamic);
}
}
if (!val)
m_error.SetErrorStringWithFormat("Unknown variable %s", e->GetName().m_value.str().c_str());
return val;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:99,代码来源:GoUserExpression.cpp
注:本文中的ValueObjectSP类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论