Fixed an expression parsing issue where if you were stopped somewhere without
debug information and you evaluated an expression, a crash would occur as a
result of an unchecked pointer.
Added the ability to get the expression path for a ValueObject. For a rectangle
point child "x" the expression path would be something like: "rect.top_left.x".
This will allow GUI and command lines to get ahold of the expression path for
a value object without having to explicitly know about the hierarchy. This
means the ValueObject base class now has a "ValueObject *m_parent;" member.
All ValueObject subclasses now correctly track their lineage and are able
to provide value expression paths as well.
Added a new "--flat" option to the "frame variable" to allow for flat variable
output. An example of the current and new outputs:
(lldb) frame variable
argc = 1
argv = 0x00007fff5fbffe80
pt = {
x = 2
y = 3
}
rect = {
bottom_left = {
x = 1
y = 2
}
top_right = {
x = 3
y = 4
}
}
(lldb) frame variable --flat
argc = 1
argv = 0x00007fff5fbffe80
pt.x = 2
pt.y = 3
rect.bottom_left.x = 1
rect.bottom_left.y = 2
rect.top_right.x = 3
rect.top_right.y = 4
As you can see when there is a lot of hierarchy it can help flatten things out.
Also if you want to use a member in an expression, you can copy the text from
the "--flat" output and not have to piece it together manually. This can help
when you want to use parts of the STL in expressions:
(lldb) frame variable --flat
argc = 1
argv = 0x00007fff5fbffea8
hello_world._M_dataplus._M_p = 0x0000000000000000
(lldb) expr hello_world._M_dataplus._M_p[0] == '\0'
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116532 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index a77a649..5a519f9 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -318,6 +318,7 @@
case 'L': show_location= true; break;
case 'c': show_decl = true; break;
case 'D': debug = true; break;
+ case 'f': flat_output = true; break;
case 'd':
max_depth = Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success);
if (!success)
@@ -362,6 +363,7 @@
show_location = false;
show_decl = false;
debug = false;
+ flat_output = false;
max_depth = UINT32_MAX;
ptr_depth = 0;
globals.clear();
@@ -386,7 +388,8 @@
show_summary:1,
show_location:1,
show_decl:1,
- debug:1;
+ debug:1,
+ flat_output:1;
uint32_t max_depth; // The depth to print when dumping concrete (not pointers) aggreate values
uint32_t ptr_depth; // The default depth that is dumped when we find pointers
std::vector<ConstString> globals;
@@ -502,8 +505,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
}
@@ -561,8 +564,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
}
@@ -731,9 +734,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
-
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
else
@@ -813,9 +815,8 @@
m_options.show_types,
m_options.show_location,
m_options.use_objc,
- false);
-
- s.EOL();
+ false,
+ m_options.flat_output);
}
}
}
@@ -849,6 +850,7 @@
{ LLDB_OPT_SET_1, false, "objc", 'o', no_argument, NULL, 0, eArgTypeNone, "When looking up a variable by name (--name), print as an Objective-C object."},
{ LLDB_OPT_SET_1, false, "ptr-depth", 'p', required_argument, NULL, 0, eArgTypeCount, "The number of pointers to be traversed when dumping values (default is zero)."},
{ LLDB_OPT_SET_1, false, "regex", 'r', no_argument, NULL, 0, eArgTypeRegularExpression, "The <variable-name> argument for name lookups are regular expressions."},
+{ LLDB_OPT_SET_1, false, "flat", 'f', no_argument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."},
{ 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
};
#pragma mark CommandObjectMultiwordFrame