CFString.py now shows contents in a more NSString-like way (e.g. you get @"Hello" instead of "Hello")
new --raw-output (-R) option to frame variable prevents using summaries and synthetic children
other future formatting enhancements will be excluded by using the -R option
test case enhanced to check that -R works correctly
llvm-svn: 137185
diff --git a/lldb/examples/synthetic/CFString.py b/lldb/examples/synthetic/CFString.py
index 57c5721..4d85885 100644
--- a/lldb/examples/synthetic/CFString.py
+++ b/lldb/examples/synthetic/CFString.py
@@ -1,7 +1,13 @@
-# synthetic children provider for CFString
+# synthetic children and summary provider for CFString
# (and related NSString class)
import lldb
+def CFString_SummaryProvider (valobj,dict):
+ provider = CFStringSynthProvider(valobj,dict);
+ if provider.invalid == False:
+ return '@'+provider.get_child_at_index(provider.get_child_index("content")).GetSummary();
+ return ''
+
class CFStringSynthProvider:
def __init__(self,valobj,dict):
self.valobj = valobj;
@@ -228,11 +234,4 @@
def update(self):
self.adjust_for_architecture();
- self.compute_flags();
-
-def CFString_SummaryProvider (valobj,dict):
- provider = CFStringSynthProvider(valobj,dict);
- if provider.invalid == False:
- return provider.get_child_at_index(provider.get_child_index("content")).GetSummary();
- return ''
-
+ self.compute_flags();
\ No newline at end of file
diff --git a/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
index c714525..94ac1e7 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
@@ -55,6 +55,7 @@
uint32_t ptr_depth;
lldb::DynamicValueType use_dynamic;
bool use_synth;
+ bool be_raw;
};
} // namespace lldb_private
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index eedc0cc..f0a061d 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -500,10 +500,10 @@
m_varobj_options.show_location,
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
- m_varobj_options.use_synth,
+ m_varobj_options.be_raw ? false : m_varobj_options.use_synth,
false,
m_varobj_options.flat_output,
- m_varobj_options.no_summary_depth);
+ m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth);
}
}
}
@@ -553,10 +553,10 @@
m_varobj_options.show_location,
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
- m_varobj_options.use_synth,
+ m_varobj_options.be_raw ? false : m_varobj_options.use_synth,
false,
m_varobj_options.flat_output,
- m_varobj_options.no_summary_depth);
+ m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth);
}
else
{
@@ -645,10 +645,10 @@
m_varobj_options.show_location,
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
- m_varobj_options.use_synth,
+ m_varobj_options.be_raw ? false : m_varobj_options.use_synth,
false,
m_varobj_options.flat_output,
- m_varobj_options.no_summary_depth);
+ m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth);
}
}
}
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 2a2c936..fb0bb94 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -657,10 +657,10 @@
m_varobj_options.show_location,
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
- m_varobj_options.use_synth,
+ m_varobj_options.be_raw ? false : m_varobj_options.use_synth,
scope_already_checked,
m_varobj_options.flat_output,
- 0);
+ m_varobj_options.be_raw ? UINT32_MAX : 0);
}
else
{
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index c8daf92..8b9abcf 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -488,10 +488,10 @@
m_varobj_options.show_location,
m_varobj_options.use_objc,
m_varobj_options.use_dynamic,
- m_varobj_options.use_synth,
+ m_varobj_options.be_raw ? false : m_varobj_options.use_synth,
false,
m_varobj_options.flat_output,
- m_varobj_options.no_summary_depth);
+ m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth);
}
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 9687986..a59c992 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -660,6 +660,7 @@
m_name = NULL;
m_python_script = "";
m_python_function = "";
+ m_format_string = "";
m_is_add_script = false;
m_category = NULL;
}
diff --git a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index b2ca4ae..b274521 100644
--- a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -40,6 +40,7 @@
{ 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, "show-types", 'T', no_argument, NULL, 0, eArgTypeNone, "Show variable types when dumping values."},
{ LLDB_OPT_SET_1, false, "no-summary-depth",'Y', optional_argument, NULL, 0, eArgTypeCount, "Set a depth for omitting summary information (default is 1)."},
+ { LLDB_OPT_SET_1, false, "raw-output", 'R', no_argument, NULL, 0, eArgTypeNone, "Don't use formatting options."},
{ 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }
};
@@ -83,7 +84,9 @@
case 'T': show_types = true; break;
case 'L': show_location= true; break;
case 'F': flat_output = true; break;
- case 'O': use_objc = true; break;
+ case 'O': use_objc = true; break;
+ case 'R': be_raw = true; break;
+
case 'D':
max_depth = Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success);
if (!success)
@@ -131,6 +134,7 @@
max_depth = UINT32_MAX;
ptr_depth = 0;
use_synth = true;
+ be_raw = false;
Target *target = interpreter.GetExecutionContext().target;
if (target != NULL)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py b/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py
index 57c5721..4d85885 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/CFString.py
@@ -1,7 +1,13 @@
-# synthetic children provider for CFString
+# synthetic children and summary provider for CFString
# (and related NSString class)
import lldb
+def CFString_SummaryProvider (valobj,dict):
+ provider = CFStringSynthProvider(valobj,dict);
+ if provider.invalid == False:
+ return '@'+provider.get_child_at_index(provider.get_child_index("content")).GetSummary();
+ return ''
+
class CFStringSynthProvider:
def __init__(self,valobj,dict):
self.valobj = valobj;
@@ -228,11 +234,4 @@
def update(self):
self.adjust_for_architecture();
- self.compute_flags();
-
-def CFString_SummaryProvider (valobj,dict):
- provider = CFStringSynthProvider(valobj,dict);
- if provider.invalid == False:
- return provider.get_child_at_index(provider.get_child_index("content")).GetSummary();
- return ''
-
+ self.compute_flags();
\ No newline at end of file
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py b/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
index c542e6a..eaccd9c 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
@@ -69,7 +69,19 @@
self.expect("frame variable int_bag", matching=False,
substrs = ['x = 6',
'z = 8'])
+
+ # if we skip synth and summary show y
+ self.expect("frame variable int_bag -S false -Y1",
+ substrs = ['x = 6',
+ 'y = 7',
+ 'z = 8'])
+ # if we ask for raw output same happens
+ self.expect("frame variable int_bag --raw-output",
+ substrs = ['x = 6',
+ 'y = 7',
+ 'z = 8'])
+
# Summary+Synth must work together
self.runCmd("type summary add BagOfInts -f \"y=${var.y}\" -e")
self.expect('frame variable int_bag',