summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBTarget.h1
-rw-r--r--lldb/include/lldb/API/SBVariablesOptions.h2
-rw-r--r--lldb/include/lldb/Target/Target.h4
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py21
-rw-r--r--lldb/scripts/interface/SBVariablesOptions.i2
-rw-r--r--lldb/source/API/SBFrame.cpp3
-rw-r--r--lldb/source/API/SBVariablesOptions.cpp26
-rw-r--r--lldb/source/Target/Target.cpp13
8 files changed, 57 insertions, 15 deletions
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index 6db3056d363..18de267fee0 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -903,6 +903,7 @@ protected:
friend class SBSourceManager;
friend class SBSymbol;
friend class SBValue;
+ friend class SBVariablesOptions;
//------------------------------------------------------------------
// Constructors are private, use static Target::Create function to create an
diff --git a/lldb/include/lldb/API/SBVariablesOptions.h b/lldb/include/lldb/API/SBVariablesOptions.h
index 23ff4265be5..0059a41129c 100644
--- a/lldb/include/lldb/API/SBVariablesOptions.h
+++ b/lldb/include/lldb/API/SBVariablesOptions.h
@@ -33,7 +33,7 @@ public:
void SetIncludeArguments(bool);
- bool GetIncludeRecognizedArguments() const;
+ bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const;
void SetIncludeRecognizedArguments(bool);
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index b70f123989c..b2c0eb5ccd8 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -188,6 +188,10 @@ public:
void SetDisplayRuntimeSupportValues(bool b);
+ bool GetDisplayRecognizedArguments() const;
+
+ void SetDisplayRecognizedArguments(bool b);
+
const ProcessLaunchInfo &GetProcessLaunchInfo();
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
index abd4ae8b382..1162157bad5 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py
@@ -67,9 +67,24 @@ class FrameRecognizerTestCase(TestBase):
self.expect("frame variable",
substrs=['(int) a = 42', '(int) b = 56'])
- opts = lldb.SBVariablesOptions();
- opts.SetIncludeRecognizedArguments(True);
- variables = frame.GetVariables(opts);
+ # Recognized arguments don't show up by default...
+ variables = frame.GetVariables(lldb.SBVariablesOptions())
+ self.assertEqual(variables.GetSize(), 0)
+
+ # ...unless you set target.display-recognized-arguments to 1...
+ self.runCmd("settings set target.display-recognized-arguments 1")
+ variables = frame.GetVariables(lldb.SBVariablesOptions())
+ self.assertEqual(variables.GetSize(), 2)
+
+ # ...and you can reset it back to 0 to hide them again...
+ self.runCmd("settings set target.display-recognized-arguments 0")
+ variables = frame.GetVariables(lldb.SBVariablesOptions())
+ self.assertEqual(variables.GetSize(), 0)
+
+ # ... or explicitly ask for them with SetIncludeRecognizedArguments(True).
+ opts = lldb.SBVariablesOptions()
+ opts.SetIncludeRecognizedArguments(True)
+ variables = frame.GetVariables(opts)
self.assertEqual(variables.GetSize(), 2)
self.assertEqual(variables.GetValueAtIndex(0).name, "a")
diff --git a/lldb/scripts/interface/SBVariablesOptions.i b/lldb/scripts/interface/SBVariablesOptions.i
index 1d58a4d3b85..8ce74140e63 100644
--- a/lldb/scripts/interface/SBVariablesOptions.i
+++ b/lldb/scripts/interface/SBVariablesOptions.i
@@ -28,7 +28,7 @@ public:
SetIncludeArguments (bool);
bool
- GetIncludeRecognizedArguments () const;
+ GetIncludeRecognizedArguments (const lldb::SBTarget &) const;
void
SetIncludeRecognizedArguments (bool);
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 4fc467893e0..44dcfd806be 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -957,7 +957,8 @@ SBValueList SBFrame::GetVariables(const lldb::SBVariablesOptions &options) {
const bool statics = options.GetIncludeStatics();
const bool arguments = options.GetIncludeArguments();
- const bool recognized_arguments = options.GetIncludeRecognizedArguments();
+ const bool recognized_arguments =
+ options.GetIncludeRecognizedArguments(SBTarget(exe_ctx.GetTargetSP()));
const bool locals = options.GetIncludeLocals();
const bool in_scope_only = options.GetInScopeOnly();
const bool include_runtime_support_values =
diff --git a/lldb/source/API/SBVariablesOptions.cpp b/lldb/source/API/SBVariablesOptions.cpp
index 1db8fc31f1e..2651ce11d02 100644
--- a/lldb/source/API/SBVariablesOptions.cpp
+++ b/lldb/source/API/SBVariablesOptions.cpp
@@ -9,6 +9,10 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBVariablesOptions.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/Target/Target.h"
+
+#include "lldb/lldb-private.h"
using namespace lldb;
using namespace lldb_private;
@@ -16,9 +20,10 @@ using namespace lldb_private;
class VariablesOptionsImpl {
public:
VariablesOptionsImpl()
- : m_include_arguments(false), m_include_recognized_arguments(false),
- m_include_locals(false), m_include_statics(false),
- m_in_scope_only(false), m_include_runtime_support_values(false),
+ : m_include_arguments(false), m_include_locals(false),
+ m_include_statics(false), m_in_scope_only(false),
+ m_include_runtime_support_values(false),
+ m_include_recognized_arguments(eLazyBoolCalculate),
m_use_dynamic(lldb::eNoDynamicValues) {}
VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
@@ -31,12 +36,14 @@ public:
void SetIncludeArguments(bool b) { m_include_arguments = b; }
- bool GetIncludeRecognizedArguments() const {
- return m_include_recognized_arguments;
+ bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
+ if (m_include_recognized_arguments != eLazyBoolCalculate)
+ return m_include_recognized_arguments;
+ return target_sp ? target_sp->GetDisplayRecognizedArguments() : false;
}
void SetIncludeRecognizedArguments(bool b) {
- m_include_recognized_arguments = b;
+ m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
}
bool GetIncludeLocals() const { return m_include_locals; }
@@ -65,11 +72,11 @@ public:
private:
bool m_include_arguments : 1;
- bool m_include_recognized_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;
+ LazyBool m_include_recognized_arguments; // can be overridden with a setting
lldb::DynamicValueType m_use_dynamic;
};
@@ -97,8 +104,9 @@ void SBVariablesOptions::SetIncludeArguments(bool arguments) {
m_opaque_ap->SetIncludeArguments(arguments);
}
-bool SBVariablesOptions::GetIncludeRecognizedArguments() const {
- return m_opaque_ap->GetIncludeRecognizedArguments();
+bool SBVariablesOptions::GetIncludeRecognizedArguments(
+ const lldb::SBTarget &target) const {
+ return m_opaque_ap->GetIncludeRecognizedArguments(target.GetSP());
}
void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index e6a7e5f5831..cc383f004d2 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3356,6 +3356,8 @@ static constexpr PropertyDefinition g_properties[] = {
{"display-runtime-support-values", OptionValue::eTypeBoolean, false, false,
nullptr, {}, "If true, LLDB will show variables that are meant to "
"support the operation of a language's runtime support."},
+ {"display-recognized-arguments", OptionValue::eTypeBoolean, false, false,
+ nullptr, {}, "Show recognized arguments in variable listings by default."},
{"non-stop-mode", OptionValue::eTypeBoolean, false, 0, nullptr, {},
"Disable lock-step debugging, instead control threads independently."},
{"require-hardware-breakpoint", OptionValue::eTypeBoolean, false, 0,
@@ -3404,6 +3406,7 @@ enum {
ePropertyDisplayExpressionsInCrashlogs,
ePropertyTrapHandlerNames,
ePropertyDisplayRuntimeSupportValues,
+ ePropertyDisplayRecognizedArguments,
ePropertyNonStopModeEnabled,
ePropertyRequireHardwareBreakpoints,
ePropertyExperimental,
@@ -3963,6 +3966,16 @@ void TargetProperties::SetDisplayRuntimeSupportValues(bool b) {
m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
}
+bool TargetProperties::GetDisplayRecognizedArguments() const {
+ const uint32_t idx = ePropertyDisplayRecognizedArguments;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, false);
+}
+
+void TargetProperties::SetDisplayRecognizedArguments(bool b) {
+ const uint32_t idx = ePropertyDisplayRecognizedArguments;
+ m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
bool TargetProperties::GetNonStopModeEnabled() const {
const uint32_t idx = ePropertyNonStopModeEnabled;
return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, false);
OpenPOWER on IntegriCloud