[Lldb-commits] [lldb] r134497 - in /lldb/trunk: include/lldb/API/SBError.h include/lldb/Core/ValueObject.h source/API/SBError.cpp source/API/SBValue.cpp source/Core/ValueObject.cpp test/lang/c/array_types/TestArrayTypes.py
Greg Clayton
gclayton at apple.com
Wed Jul 6 09:49:27 PDT 2011
Author: gclayton
Date: Wed Jul 6 11:49:27 2011
New Revision: 134497
URL: http://llvm.org/viewvc/llvm-project?rev=134497&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/API/SBError.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/source/API/SBError.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
Modified: lldb/trunk/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=134497&r1=134496&r2=134497&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBError.h (original)
+++ lldb/trunk/include/lldb/API/SBError.h Wed Jul 6 11:49:27 2011
@@ -68,9 +68,6 @@
bool
GetDescription (lldb::SBStream &description);
- bool
- GetDescription (lldb::SBStream &description) const;
-
protected:
#ifndef SWIG
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=134497&r1=134496&r2=134497&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Wed Jul 6 11:49:27 2011
@@ -326,7 +326,7 @@
// The functions below should NOT be modified by sublasses
//------------------------------------------------------------------
const Error &
- GetError() const;
+ GetError();
const ConstString &
GetName() const;
Modified: lldb/trunk/source/API/SBError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=134497&r1=134496&r2=134497&view=diff
==============================================================================
--- lldb/trunk/source/API/SBError.cpp (original)
+++ lldb/trunk/source/API/SBError.cpp Wed Jul 6 11:49:27 2011
@@ -218,35 +218,16 @@
{
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;
}
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=134497&r1=134496&r2=134497&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Wed Jul 6 11:49:27 2011
@@ -599,21 +599,26 @@
{
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");
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=134497&r1=134496&r2=134497&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Wed Jul 6 11:49:27 2011
@@ -212,8 +212,9 @@
}
const Error &
-ValueObject::GetError() const
+ValueObject::GetError()
{
+ UpdateValueIfNeeded();
return m_error;
}
@@ -1929,7 +1930,10 @@
{
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;
Modified: lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/array_types/TestArrayTypes.py?rev=134497&r1=134496&r2=134497&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/lang/c/array_types/TestArrayTypes.py Wed Jul 6 11:49:27 2011
@@ -154,7 +154,7 @@
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")
More information about the lldb-commits
mailing list