[Lldb-commits] [lldb] [lldb] Scaffolding for extended variable support. (PR #181500)

via lldb-commits lldb-commits at lists.llvm.org
Sat Feb 14 11:02:35 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Aman LaChapelle (bzcheeseman)

<details>
<summary>Changes</summary>

Stacked PRs:
 * #<!-- -->181501
 * __->__#<!-- -->181500


--- --- ---

### [lldb] Scaffolding for extended variable support.


This patch handles most of the scaffolding for extended variable support that isn't directly tied to functional changes. This patch will be used by one following patch that actually modifies the lldb_private::StackFrame API to allow us to fetch extended variables.

There were a couple important/interesting decisions made in this patch that should be noted:
- Any value type may be 'extended', which is why it's a mask applied over the top of another value type.
- When printing frame variables with `fr v`, default to showing extended variables.

This new value type mask makes some of the ValueType handling more interesting, but since nothing generates objects with this mask until the next patch, we can land the concept in this patch in some amount of isolation.

---
Full diff: https://github.com/llvm/llvm-project/pull/181500.diff


5 Files Affected:

- (modified) lldb/include/lldb/API/SBVariablesOptions.h (+4) 
- (modified) lldb/include/lldb/Interpreter/OptionGroupVariable.h (+1) 
- (modified) lldb/include/lldb/lldb-enumerations.h (+5) 
- (modified) lldb/source/API/SBVariablesOptions.cpp (+19-2) 
- (modified) lldb/source/Interpreter/OptionGroupVariable.cpp (+10-2) 


``````````diff
diff --git a/lldb/include/lldb/API/SBVariablesOptions.h b/lldb/include/lldb/API/SBVariablesOptions.h
index 53ab4b7e14f2f..4868c618a1c10 100644
--- a/lldb/include/lldb/API/SBVariablesOptions.h
+++ b/lldb/include/lldb/API/SBVariablesOptions.h
@@ -46,6 +46,10 @@ class LLDB_API SBVariablesOptions {
 
   void SetIncludeStatics(bool);
 
+  bool GetIncludeExtended() const;
+
+  void SetIncludeExtended(bool);
+
   bool GetInScopeOnly() const;
 
   void SetInScopeOnly(bool);
diff --git a/lldb/include/lldb/Interpreter/OptionGroupVariable.h b/lldb/include/lldb/Interpreter/OptionGroupVariable.h
index c9f1283d4de20..4bea1eada6f6b 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupVariable.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupVariable.h
@@ -35,6 +35,7 @@ class OptionGroupVariable : public OptionGroup {
                                  // true)
       show_locals : 1,  // Frame option only (include_frame_options == true)
       show_globals : 1, // Frame option only (include_frame_options == true)
+      show_extended : 1, // Frame option only (include_frame_options == true)
       use_regex : 1, show_scope : 1, show_decl : 1;
   OptionValueString summary;        // the name of a named summary
   OptionValueString summary_string; // a summary string
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 4cbbabbf879ad..e42526309bca5 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -340,6 +340,11 @@ enum ValueType {
   eValueTypeVTableEntry = 10, ///< function pointer in virtual function table
 };
 
+/// A mask that we can use to check if the value type is 'extended' or not.
+// NOTE: This limits the number of value types to 31, but that's 3x more than
+// what we currently have now.
+static constexpr unsigned ValueTypeExtendedMask = 0x20;
+
 /// Token size/granularities for Input Readers.
 
 enum InputReaderGranularity {
diff --git a/lldb/source/API/SBVariablesOptions.cpp b/lldb/source/API/SBVariablesOptions.cpp
index 989d159139cca..402af0039495e 100644
--- a/lldb/source/API/SBVariablesOptions.cpp
+++ b/lldb/source/API/SBVariablesOptions.cpp
@@ -20,8 +20,8 @@ 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_include_statics(false), m_include_extended(false),
+        m_in_scope_only(false), m_include_runtime_support_values(false) {}
 
   VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
 
@@ -51,6 +51,10 @@ class VariablesOptionsImpl {
 
   void SetIncludeStatics(bool b) { m_include_statics = b; }
 
+  bool GetIncludeExtended() const { return m_include_extended; }
+
+  void SetIncludeExtended(bool b) { m_include_extended = b; }
+
   bool GetInScopeOnly() const { return m_in_scope_only; }
 
   void SetInScopeOnly(bool b) { m_in_scope_only = b; }
@@ -71,6 +75,7 @@ class VariablesOptionsImpl {
   bool m_include_arguments : 1;
   bool m_include_locals : 1;
   bool m_include_statics : 1;
+  bool m_include_extended : 1;
   bool m_in_scope_only : 1;
   bool m_include_runtime_support_values : 1;
   LazyBool m_include_recognized_arguments =
@@ -157,6 +162,18 @@ void SBVariablesOptions::SetIncludeStatics(bool statics) {
   m_opaque_up->SetIncludeStatics(statics);
 }
 
+bool SBVariablesOptions::GetIncludeExtended() const {
+  LLDB_INSTRUMENT_VA(this);
+
+  return m_opaque_up->GetIncludeExtended();
+}
+
+void SBVariablesOptions::SetIncludeExtended(bool extended) {
+  LLDB_INSTRUMENT_VA(this, extended);
+
+  m_opaque_up->SetIncludeExtended(extended);
+}
+
 bool SBVariablesOptions::GetInScopeOnly() const {
   LLDB_INSTRUMENT_VA(this);
 
diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp
index 9bffe1dba85e7..e97a4013c9f9a 100644
--- a/lldb/source/Interpreter/OptionGroupVariable.cpp
+++ b/lldb/source/Interpreter/OptionGroupVariable.cpp
@@ -32,6 +32,9 @@ static constexpr OptionDefinition g_variable_options[] = {
     {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-globals", 'g',
      OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
      "Show the current frame source file global and static variables."},
+     {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-extended", 'e',
+     OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
+     "Omit extended variables."},
     {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-declaration", 'c',
      OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
      "Show variable declaration information (source file and line where the "
@@ -77,8 +80,9 @@ static Status ValidateSummaryString(const char *str, void *) {
 OptionGroupVariable::OptionGroupVariable(bool show_frame_options)
     : include_frame_options(show_frame_options), show_args(false),
       show_recognized_args(false), show_locals(false), show_globals(false),
-      use_regex(false), show_scope(false), show_decl(false),
-      summary(ValidateNamedSummary), summary_string(ValidateSummaryString) {}
+      show_extended(true), use_regex(false), show_scope(false),
+      show_decl(false), summary(ValidateNamedSummary),
+      summary_string(ValidateSummaryString) {}
 
 Status
 OptionGroupVariable::SetOptionValue(uint32_t option_idx,
@@ -101,6 +105,9 @@ OptionGroupVariable::SetOptionValue(uint32_t option_idx,
   case 'g':
     show_globals = true;
     break;
+  case 'e':
+    show_extended = false;
+    break;
   case 'c':
     show_decl = true;
     break;
@@ -129,6 +136,7 @@ void OptionGroupVariable::OptionParsingStarting(
   show_recognized_args = true; // Frame option only
   show_locals = true;   // Frame option only
   show_globals = false; // Frame option only
+  show_extended = true; // Frame option only
   show_decl = false;
   use_regex = false;
   show_scope = false;

``````````

</details>


https://github.com/llvm/llvm-project/pull/181500


More information about the lldb-commits mailing list