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; }
ValueObjectSP GoUserExpression::GoInterpreter::VisitUnaryExpr(const GoASTUnaryExpr *e) { ValueObjectSP x = EvaluateExpr(e->GetX()); if (!x) return nullptr; switch (e->GetOp()) { case GoLexer::OP_AMP: { CompilerType type = x->GetCompilerType().GetPointerType(); uint64_t address = x->GetAddressOf(); return ValueObject::CreateValueObjectFromAddress(nullptr, address, m_exe_ctx, type); } case GoLexer::OP_PLUS: return x; default: m_error.SetErrorStringWithFormat( "Operator %s not supported", GoLexer::LookupToken(e->GetOp()).str().c_str()); return nullptr; } }