[Lldb-commits] [lldb] r137185 - in /lldb/trunk: examples/synthetic/CFString.py include/lldb/Interpreter/OptionGroupValueObjectDisplay.h source/Commands/CommandObjectFrame.cpp source/Commands/CommandObjectMemory.cpp source/Commands/CommandObjectTarget.cpp source/Commands/CommandObjectType.cpp source/Interpreter/OptionGroupValueObjectDisplay.cpp test/functionalities/data-formatter/data-formatter-objc/CFString.py test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
Enrico Granata
granata.enrico at gmail.com
Tue Aug 9 16:50:01 PDT 2011
Author: enrico
Date: Tue Aug 9 18:50:01 2011
New Revision: 137185
URL: http://llvm.org/viewvc/llvm-project?rev=137185&view=rev
Log:
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
Modified:
lldb/trunk/examples/synthetic/CFString.py
lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
Modified: lldb/trunk/examples/synthetic/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/CFString.py?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/CFString.py (original)
+++ lldb/trunk/examples/synthetic/CFString.py Tue Aug 9 18:50:01 2011
@@ -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
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h Tue Aug 9 18:50:01 2011
@@ -55,6 +55,7 @@
uint32_t ptr_depth;
lldb::DynamicValueType use_dynamic;
bool use_synth;
+ bool be_raw;
};
} // namespace lldb_private
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Aug 9 18:50:01 2011
@@ -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);
}
}
}
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Aug 9 18:50:01 2011
@@ -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
{
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Aug 9 18:50:01 2011
@@ -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);
}
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Tue Aug 9 18:50:01 2011
@@ -660,6 +660,7 @@
m_name = NULL;
m_python_script = "";
m_python_function = "";
+ m_format_string = "";
m_is_add_script = false;
m_category = NULL;
}
Modified: lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp Tue Aug 9 18:50:01 2011
@@ -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)
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/CFString.py Tue Aug 9 18:50:01 2011
@@ -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
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py?rev=137185&r1=137184&r2=137185&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py Tue Aug 9 18:50:01 2011
@@ -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',
More information about the lldb-commits
mailing list