Author: gclayton
Date: Wed Dec 28 15:22:37 2016
New Revision: 290688
URL: http://llvm.org/viewvc/llvm-project?rev=290688&view=rev
Log:
Fix the variable view in the "gui" curses mode so that variables whose children
change will update correctly. Previously the variable view would update the
children once and not change. If you were stepping through code where the
dynamic type of a variable would change the value and its children, or a
synthetic type (like say for a std::vector), the variable view wouldn't
update. Now it caches the children and uses the process stop ID to tell when
the children need to be updated.
Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectList.h
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Core/ValueObject.cpp
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=290688&r1=290687&r2=290688&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Wed Dec 28 15:22:37 2016
@@ -1011,6 +1011,48 @@ private:
DISALLOW_COPY_AND_ASSIGN(ValueObject);
};
+//--
+// A value object manager class that is seeded with the static variable value
+// and it vends the user facing value object. If the type is dynamic it can
+// vend the dynamic type. If this user type also has a synthetic type
associated
+// with it, it will vend the synthetic type. The class watches the process'
stop
+// ID and will update the user type when needed.
+//--
+class ValueObjectManager {
+ // The root value object is the static typed variable object.
+ lldb::ValueObjectSP m_root_valobj_sp;
+ // The user value object is the value object the user wants to see.
+ lldb::ValueObjectSP m_user_valobj_sp;
+ lldb::DynamicValueType m_use_dynamic;
+ uint32_t m_stop_id; // The stop ID that m_user_valobj_sp is valid for.
+ bool m_use_synthetic;
+
+public:
+ ValueObjectManager() {}
+
+ ValueObjectManager(lldb::ValueObjectSP in_valobj_sp,
+ lldb::DynamicValueType use_dynamic, bool use_synthetic);
+
+ bool IsValid() const;
+
+ lldb::ValueObjectSP GetRootSP() const { return m_root_valobj_sp; }
+
+ // Gets the correct value object from the root object for a given process
+ // stop ID. If dynamic values are enabled, or if synthetic children are
+ // enabled, the value object that the user wants to see might change while
+ // debugging.
+ lldb::ValueObjectSP GetSP();
+
+ void SetUseDynamic(lldb::DynamicValueType use_dynamic);
+ void SetUseSynthetic(bool use_synthetic);
+ lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
+ bool GetUseSynthetic() const { return m_use_synthetic; }
+ lldb::TargetSP GetTargetSP() const;
+ lldb::ProcessSP GetProcessSP() const;
+ lldb::ThreadSP GetThreadSP() const;
+ lldb::StackFrameSP GetFrameSP() const;
+};
+
} // namespace lldb_private
#endif // liblldb_ValueObject_h_
Modified: lldb/trunk/include/lldb/Core/ValueObjectList.h
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectList.h?rev=290688&r1=290687&r2=290688&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectList.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectList.h Wed Dec 28 15:22:37 2016
@@ -62,6 +62,9 @@ public:
void Clear() { m_value_objects.clear(); }
+ const std::vector &GetObjects() const {
+return m_value_objects;
+ }
protected:
typedef std::vector collection;
//--
Modified: lldb/trunk/source/Core/IOHandler.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=290688&r1=290687&r2=290688&view=diff
==
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Wed Dec 28 15:22:37 2016
@@ -1905,8 +1905,10 @@ protected:
using namespace curses;
struct Row {
- ValueObjectSP valobj;
+ ValueObjectManager value;
Row *parent;
+ // The process stop ID when the children were calculated.
+ uint32_t children_stop_id;
int row_idx;
int x;
int y;
@@ -1916,8 +1918,8 @@ struct Row {
std::vector children;
Row(const ValueObjectSP &v, Row *p)
- : valobj(v), parent(p), row_idx(0), x(1), y(1),
-might_have_children(v ? v->MightHaveChildren() : false),
+ : value(v, lldb::eDynamicDontRunTarget, true), parent(p), row_idx(0),
+x(1), y(1), might_have_children(v ? v->MightHaveChildren() : false),
expanded(false), calculated_children(false), childre