summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-02-12 23:09:17 +0000
committerEnrico Granata <egranata@apple.com>2015-02-12 23:09:17 +0000
commite0d951db44c7f86bcb643165ee0f419a6d2a119d (patch)
treeab07c0cf5d04124256d6e1e7733f4fe9e281f733 /lldb/source/API
parent64a3f3084e2834aa91ea4730d1b6ff9ff0786660 (diff)
downloadbcm5719-llvm-e0d951db44c7f86bcb643165ee0f419a6d2a119d.tar.gz
bcm5719-llvm-e0d951db44c7f86bcb643165ee0f419a6d2a119d.zip
I had recently added a new SBFrame::GetVariables() overload with yet another bool argument
We talked about it internally - and came to the conclusion that it's time to have an options class This commit adds an SBVariablesOptions class and goes through all the required dance llvm-svn: 228975
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/CMakeLists.txt1
-rw-r--r--lldb/source/API/SBFrame.cpp51
-rw-r--r--lldb/source/API/SBVariablesOptions.cpp254
3 files changed, 289 insertions, 17 deletions
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index ffd419f66f1..ba06fecee88 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -57,6 +57,7 @@ add_lldb_library(lldbAPI
SBTypeSynthetic.cpp
SBValue.cpp
SBValueList.cpp
+ SBVariablesOptions.cpp
SBWatchpoint.cpp
SBUnixSignals.cpp
)
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index da1d32f2e80..d51f59c2307 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -44,6 +44,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBThread.h"
+#include "lldb/API/SBVariablesOptions.h"
using namespace lldb;
using namespace lldb_private;
@@ -1075,7 +1076,17 @@ SBFrame::GetVariables (bool arguments,
if (frame && target)
{
lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue();
- value_list = GetVariables (arguments, locals, statics, in_scope_only, use_dynamic);
+ const bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false;
+
+ SBVariablesOptions options;
+ options.SetIncludeArguments(arguments);
+ options.SetIncludeLocals(locals);
+ options.SetIncludeStatics(statics);
+ options.SetInScopeOnly(in_scope_only);
+ options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
+ options.SetUseDynamic(use_dynamic);
+
+ value_list = GetVariables (options);
}
return value_list;
}
@@ -1089,22 +1100,19 @@ SBFrame::GetVariables (bool arguments,
{
ExecutionContext exe_ctx(m_opaque_sp.get());
Target *target = exe_ctx.GetTargetPtr();
- bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false;
- return GetVariables(arguments,
- locals,
- statics,
- in_scope_only,
- include_runtime_support_values,
- use_dynamic);
+ const bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false;
+ SBVariablesOptions options;
+ options.SetIncludeArguments(arguments);
+ options.SetIncludeLocals(locals);
+ options.SetIncludeStatics(statics);
+ options.SetInScopeOnly(in_scope_only);
+ options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
+ options.SetUseDynamic(use_dynamic);
+ return GetVariables(options);
}
SBValueList
-SBFrame::GetVariables (bool arguments,
- bool locals,
- bool statics,
- bool in_scope_only,
- bool include_runtime_support_values,
- lldb::DynamicValueType use_dynamic)
+SBFrame::GetVariables (const lldb::SBVariablesOptions& options)
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -1115,10 +1123,19 @@ SBFrame::GetVariables (bool arguments,
StackFrame *frame = NULL;
Target *target = exe_ctx.GetTargetPtr();
+ const bool statics = options.GetIncludeStatics();
+ const bool arguments = options.GetIncludeArguments();
+ const bool locals = options.GetIncludeLocals();
+ const bool in_scope_only = options.GetInScopeOnly();
+ const bool include_runtime_support_values = options.GetIncludeRuntimeSupportValues();
+ const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
+
if (log)
- log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
- arguments, locals, statics, in_scope_only);
-
+ log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i runtime=%i dynamic=%i)",
+ arguments, locals,
+ statics, in_scope_only,
+ include_runtime_support_values, use_dynamic);
+
Process *process = exe_ctx.GetProcessPtr();
if (target && process)
{
diff --git a/lldb/source/API/SBVariablesOptions.cpp b/lldb/source/API/SBVariablesOptions.cpp
new file mode 100644
index 00000000000..7c453567c0a
--- /dev/null
+++ b/lldb/source/API/SBVariablesOptions.cpp
@@ -0,0 +1,254 @@
+//===-- SBVariablesOptions.cpp --------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+#include "lldb/API/SBVariablesOptions.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+class VariablesOptionsImpl
+{
+public:
+ VariablesOptionsImpl () :
+ m_include_arguments(false),
+ m_include_locals(false),
+ m_include_statics(false),
+ m_in_scope_only(false),
+ m_include_runtime_support_values(false),
+ m_use_dynamic(lldb::eNoDynamicValues)
+ {}
+
+ VariablesOptionsImpl (const VariablesOptionsImpl&) = default;
+
+ ~VariablesOptionsImpl () = default;
+
+ VariablesOptionsImpl&
+ operator = (const VariablesOptionsImpl&) = default;
+
+ bool
+ GetIncludeArguments () const
+ {
+ return m_include_arguments;
+ }
+
+ void
+ SetIncludeArguments (bool b)
+ {
+ m_include_arguments = b;
+ }
+
+ bool
+ GetIncludeLocals () const
+ {
+ return m_include_locals;
+ }
+
+ void
+ SetIncludeLocals (bool b)
+ {
+ m_include_locals = b;
+ }
+
+ bool
+ GetIncludeStatics () const
+ {
+ return m_include_statics;
+ }
+
+ void
+ SetIncludeStatics (bool b)
+ {
+ m_include_statics = b;
+ }
+
+ bool
+ GetInScopeOnly () const
+ {
+ return m_in_scope_only;
+ }
+
+ void
+ SetInScopeOnly (bool b)
+ {
+ m_in_scope_only = b;
+ }
+
+ bool
+ GetIncludeRuntimeSupportValues () const
+ {
+ return m_include_runtime_support_values;
+ }
+
+ void
+ SetIncludeRuntimeSupportValues (bool b)
+ {
+ m_include_runtime_support_values = b;
+ }
+
+ lldb::DynamicValueType
+ GetUseDynamic () const
+ {
+ return m_use_dynamic;
+ }
+
+ void
+ SetUseDynamic (lldb::DynamicValueType d)
+ {
+ m_use_dynamic = d;
+ }
+
+
+private:
+ bool m_include_arguments : 1;
+ bool m_include_locals : 1;
+ bool m_include_statics : 1;
+ bool m_in_scope_only : 1;
+ bool m_include_runtime_support_values : 1;
+ lldb::DynamicValueType m_use_dynamic;
+};
+
+SBVariablesOptions::SBVariablesOptions () :
+m_opaque_ap(new VariablesOptionsImpl())
+{
+}
+
+SBVariablesOptions::SBVariablesOptions (const SBVariablesOptions& options) :
+m_opaque_ap(new VariablesOptionsImpl(options.ref()))
+{
+}
+
+SBVariablesOptions&
+SBVariablesOptions::operator = (const SBVariablesOptions& options)
+{
+ m_opaque_ap.reset(new VariablesOptionsImpl(options.ref()));
+ return *this;
+}
+
+SBVariablesOptions::~SBVariablesOptions () = default;
+
+bool
+SBVariablesOptions::IsValid () const
+{
+ return m_opaque_ap.get() != nullptr;
+}
+
+bool
+SBVariablesOptions::GetIncludeArguments () const
+{
+ return m_opaque_ap->GetIncludeArguments();
+}
+
+void
+SBVariablesOptions::SetIncludeArguments (bool arguments)
+{
+ m_opaque_ap->SetIncludeArguments(arguments);
+}
+
+bool
+SBVariablesOptions::GetIncludeLocals () const
+{
+ return m_opaque_ap->GetIncludeLocals();
+}
+
+void
+SBVariablesOptions::SetIncludeLocals (bool locals)
+{
+ m_opaque_ap->SetIncludeLocals(locals);
+}
+
+bool
+SBVariablesOptions::GetIncludeStatics () const
+{
+ return m_opaque_ap->GetIncludeStatics();
+}
+
+void
+SBVariablesOptions::SetIncludeStatics (bool statics)
+{
+ m_opaque_ap->SetIncludeStatics(statics);
+}
+
+bool
+SBVariablesOptions::GetInScopeOnly () const
+{
+ return m_opaque_ap->GetInScopeOnly();
+}
+
+void
+SBVariablesOptions::SetInScopeOnly (bool in_scope_only)
+{
+ m_opaque_ap->SetInScopeOnly(in_scope_only);
+}
+
+bool
+SBVariablesOptions::GetIncludeRuntimeSupportValues () const
+{
+ return m_opaque_ap->GetIncludeRuntimeSupportValues();
+}
+
+void
+SBVariablesOptions::SetIncludeRuntimeSupportValues (bool runtime_support_values)
+{
+ m_opaque_ap->SetIncludeRuntimeSupportValues(runtime_support_values);
+}
+
+lldb::DynamicValueType
+SBVariablesOptions::GetUseDynamic () const
+{
+ return m_opaque_ap->GetUseDynamic();
+}
+
+void
+SBVariablesOptions::SetUseDynamic (lldb::DynamicValueType dynamic)
+{
+ m_opaque_ap->SetUseDynamic(dynamic);
+}
+
+VariablesOptionsImpl *
+SBVariablesOptions::operator->()
+{
+ return m_opaque_ap.operator->();
+}
+
+const VariablesOptionsImpl *
+SBVariablesOptions::operator->() const
+{
+ return m_opaque_ap.operator->();
+}
+
+VariablesOptionsImpl *
+SBVariablesOptions::get ()
+{
+ return m_opaque_ap.get();
+}
+
+VariablesOptionsImpl &
+SBVariablesOptions::ref()
+{
+ return *m_opaque_ap;
+}
+
+const VariablesOptionsImpl &
+SBVariablesOptions::ref() const
+{
+ return *m_opaque_ap;
+}
+
+SBVariablesOptions::SBVariablesOptions (VariablesOptionsImpl *lldb_object_ptr) :
+m_opaque_ap(std::move(lldb_object_ptr))
+{
+}
+
+void
+SBVariablesOptions::SetOptions (VariablesOptionsImpl *lldb_object_ptr)
+{
+ m_opaque_ap.reset(std::move(lldb_object_ptr));
+}
+
OpenPOWER on IntegriCloud