diff options
author | Greg Clayton <gclayton@apple.com> | 2011-07-06 16:49:27 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-07-06 16:49:27 +0000 |
commit | 262f80df5e60c76261ff5a65f02dc7e38a58a0ee (patch) | |
tree | 32f48c66ca9b5ef707367bf4bf4d5f8bbcf16811 | |
parent | 37d30835f0592c32aa403e8ade88b8fc2ad2d612 (diff) | |
download | bcm5719-llvm-262f80df5e60c76261ff5a65f02dc7e38a58a0ee.tar.gz bcm5719-llvm-262f80df5e60c76261ff5a65f02dc7e38a58a0ee.zip |
Made the string representation for a SBValue return what "frame variable"
would return instead of a less than helpful "name: '%s'" description.
Make sure that when we ask for the error from a ValueObject object we
first update the value if needed.
Cleaned up some SB functions to use internal functions and not re-call
through the public API when possible.
llvm-svn: 134497
-rw-r--r-- | lldb/include/lldb/API/SBError.h | 3 | ||||
-rw-r--r-- | lldb/include/lldb/Core/ValueObject.h | 2 | ||||
-rw-r--r-- | lldb/source/API/SBError.cpp | 27 | ||||
-rw-r--r-- | lldb/source/API/SBValue.cpp | 35 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 8 | ||||
-rw-r--r-- | lldb/test/lang/c/array_types/TestArrayTypes.py | 2 |
6 files changed, 32 insertions, 45 deletions
diff --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h index 6b5c62d468f..df26704e29a 100644 --- a/lldb/include/lldb/API/SBError.h +++ b/lldb/include/lldb/API/SBError.h @@ -68,9 +68,6 @@ public: bool GetDescription (lldb::SBStream &description); - bool - GetDescription (lldb::SBStream &description) const; - protected: #ifndef SWIG diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 33c2ebba093..98fb1c51e54 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -326,7 +326,7 @@ public: // The functions below should NOT be modified by sublasses //------------------------------------------------------------------ const Error & - GetError() const; + GetError(); const ConstString & GetName() const; diff --git a/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp index c8aa0cdd4bc..bcbb734cea7 100644 --- a/lldb/source/API/SBError.cpp +++ b/lldb/source/API/SBError.cpp @@ -218,35 +218,16 @@ SBError::GetDescription (SBStream &description) { if (m_opaque_ap.get()) { - if (Success()) - description.Printf ("Status: Success"); + if (m_opaque_ap->Success()) + description.Printf ("success"); else { const char * err_string = GetCString(); - description.Printf ("Status: Error: %s", (err_string != NULL ? err_string : "")); + description.Printf ("error: %s", (err_string != NULL ? err_string : "")); } } else - description.Printf ("No value"); - - return true; -} - -bool -SBError::GetDescription (SBStream &description) const -{ - if (m_opaque_ap.get()) - { - if (Success()) - description.Printf ("Status: Success"); - else - { - const char * err_string = GetCString(); - description.Printf ("Status: Error: %s", (err_string != NULL ? err_string : "")); - } - } - else - description.Printf ("No value"); + description.Printf ("error: <NULL>"); return true; } diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 801d15d060f..c6a26d95c1d 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -599,21 +599,26 @@ SBValue::GetDescription (SBStream &description) { if (m_opaque_sp) { - // Don't call all these APIs and cause more logging! -// const char *name = GetName(); -// const char *type_name = GetTypeName (); -// size_t byte_size = GetByteSize (); -// uint32_t num_children = GetNumChildren (); -// bool is_stale = ValueIsStale (); -// description.Printf ("name: '%s', type: %s, size: %d", (name != NULL ? name : "<unknown name>"), -// (type_name != NULL ? type_name : "<unknown type name>"), (int) byte_size); -// if (num_children > 0) -// description.Printf (", num_children: %d", num_children); -// -// if (is_stale) -// description.Printf (" [value is stale]"); - - description.Printf ("name: '%s'", m_opaque_sp->GetName().GetCString()); + uint32_t ptr_depth = 0; + uint32_t curr_depth = 0; + uint32_t max_depth = UINT32_MAX; + bool show_types = false; + bool show_location = false; + bool use_objc = false; + lldb::DynamicValueType use_dynamic = eNoDynamicValues; + bool scope_already_checked = false; + bool flat_output = false; + ValueObject::DumpValueObject (description.ref(), + m_opaque_sp.get(), + m_opaque_sp->GetName().GetCString(), + ptr_depth, + curr_depth, + max_depth, + show_types, show_location, + use_objc, + use_dynamic, + scope_already_checked, + flat_output); } else description.Printf ("No value"); diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index e0816309708..e892e3e8678 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -212,8 +212,9 @@ ValueObject::GetDataExtractor () } const Error & -ValueObject::GetError() const +ValueObject::GetError() { + UpdateValueIfNeeded(); return m_error; } @@ -1929,7 +1930,10 @@ ValueObject::EvaluationPoint::SyncWithProcessState() { Thread *our_thread = m_process_sp->GetThreadList().FindThreadByIndexID (m_thread_id).get(); if (our_thread == NULL) - SetInvalid(); + { + //SetInvalid(); + m_exe_scope = m_process_sp.get(); + } else { m_exe_scope = our_thread; diff --git a/lldb/test/lang/c/array_types/TestArrayTypes.py b/lldb/test/lang/c/array_types/TestArrayTypes.py index 81cb65fd0d8..af721413452 100644 --- a/lldb/test/lang/c/array_types/TestArrayTypes.py +++ b/lldb/test/lang/c/array_types/TestArrayTypes.py @@ -154,7 +154,7 @@ class ArrayTypesTestCase(TestBase): variable = frame.FindVariable("strings") var = repr(variable) self.expect(var, "Variable for 'strings' looks good with correct name", exe=False, - substrs = ["name: '%s'" % variable.GetName()]) + substrs = ["%s" % variable.GetName()]) self.DebugSBValue(frame, variable) self.assertTrue(variable.GetNumChildren() == 4, "Variable 'strings' should have 4 children") |