class Scalar;
class Stream;
-// A ValueObject that contains a root variable that may or may not
-// have children.
-class ValueObjectRegisterContext : public ValueObject {
-public:
- ~ValueObjectRegisterContext() override;
-
- uint64_t GetByteSize() override;
-
- lldb::ValueType GetValueType() const override {
- return lldb::eValueTypeRegisterSet;
- }
-
- ConstString GetTypeName() override;
-
- ConstString GetQualifiedTypeName() override;
-
- ConstString GetDisplayTypeName() override;
-
- size_t CalculateNumChildren(uint32_t max) override;
-
- ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
- int32_t synthetic_index) override;
-
-protected:
- bool UpdateValue() override;
-
- CompilerType GetCompilerTypeImpl() override;
-
- lldb::RegisterContextSP m_reg_ctx_sp;
-
-private:
- ValueObjectRegisterContext(ValueObject &parent,
- lldb::RegisterContextSP ®_ctx_sp);
- // For ValueObject only
- DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext);
-};
-
class ValueObjectRegisterSet : public ValueObject {
public:
~ValueObjectRegisterSet() override;
using namespace lldb;
using namespace lldb_private;
-#pragma mark ValueObjectRegisterContext
-
-ValueObjectRegisterContext::ValueObjectRegisterContext(
- ValueObject &parent, RegisterContextSP ®_ctx)
- : ValueObject(parent), m_reg_ctx_sp(reg_ctx) {
- assert(reg_ctx);
- m_name.SetCString("Registers");
- SetValueIsValid(true);
-}
-
-ValueObjectRegisterContext::~ValueObjectRegisterContext() {}
-
-CompilerType ValueObjectRegisterContext::GetCompilerTypeImpl() {
- return CompilerType();
-}
-
-ConstString ValueObjectRegisterContext::GetTypeName() { return ConstString(); }
-
-ConstString ValueObjectRegisterContext::GetDisplayTypeName() {
- return ConstString();
-}
-
-ConstString ValueObjectRegisterContext::GetQualifiedTypeName() {
- return ConstString();
-}
-
-size_t ValueObjectRegisterContext::CalculateNumChildren(uint32_t max) {
- auto reg_set_count = m_reg_ctx_sp->GetRegisterSetCount();
- return reg_set_count <= max ? reg_set_count : max;
-}
-
-uint64_t ValueObjectRegisterContext::GetByteSize() { return 0; }
-
-bool ValueObjectRegisterContext::UpdateValue() {
- m_error.Clear();
- ExecutionContext exe_ctx(GetExecutionContextRef());
- StackFrame *frame = exe_ctx.GetFramePtr();
- if (frame)
- m_reg_ctx_sp = frame->GetRegisterContext();
- else
- m_reg_ctx_sp.reset();
-
- if (m_reg_ctx_sp.get() == nullptr) {
- SetValueIsValid(false);
- m_error.SetErrorToGenericError();
- } else
- SetValueIsValid(true);
-
- return m_error.Success();
-}
-
-ValueObject *ValueObjectRegisterContext::CreateChildAtIndex(
- size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
- ValueObject *new_valobj = nullptr;
-
- const size_t num_children = GetNumChildren();
- if (idx < num_children) {
- ExecutionContext exe_ctx(GetExecutionContextRef());
- new_valobj = new ValueObjectRegisterSet(
- exe_ctx.GetBestExecutionContextScope(), m_reg_ctx_sp, idx);
- }
-
- return new_valobj;
-}
-
-#pragma mark -
#pragma mark ValueObjectRegisterSet
ValueObjectSP