summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
diff options
context:
space:
mode:
authorEnrico Granata <granata.enrico@gmail.com>2011-07-15 23:30:15 +0000
committerEnrico Granata <granata.enrico@gmail.com>2011-07-15 23:30:15 +0000
commit9dd75c88869daad7905fbc457809c9be77d6688b (patch)
treecb6e3be54033c1d489dd854457f807b6e66d80eb /lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
parent6b917bb9b54c0646a7b7b331b5e96419258672fb (diff)
downloadbcm5719-llvm-9dd75c88869daad7905fbc457809c9be77d6688b.tar.gz
bcm5719-llvm-9dd75c88869daad7905fbc457809c9be77d6688b.zip
System-wide summaries:
- Summaries for char*, const char* and char[] are loaded at startup as system-wide summaries. This means you cannot delete them unless you use the -a option to type summary delete/clear - You can add your own system-wide summaries by using the -w option to type summary add Several code improvements for the Python summaries feature llvm-svn: 135326
Diffstat (limited to 'lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py')
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py71
1 files changed, 70 insertions, 1 deletions
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py b/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
index 77a0368b7d4..2ba39705326 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
@@ -56,7 +56,7 @@ class DataFormatterTestCase(TestBase):
# Set the script here to ease the formatting
script = 'a = valobj.GetChildMemberWithName(\'integer\'); a_val = a.GetValue(); str = \'Hello from Python, \' + a_val + \' time\'; return str + (\'!\' if a_val == \'1\' else \'s!\');'
- self.runCmd("type summary add add i_am_cool -s \"%s\"" % script)
+ self.runCmd("type summary add i_am_cool -s \"%s\"" % script)
self.expect("frame variable one",
substrs = ['Hello from Python',
@@ -85,6 +85,9 @@ class DataFormatterTestCase(TestBase):
self.expect("frame variable two",
substrs = ['int says 1'])
+
+ self.expect("frame variable twoptr",
+ substrs = ['int says 1'])
# Change the summary
self.runCmd("type summary add -f \"int says ${var.integer}, and float says ${var.floating}\" i_am_cool")
@@ -103,6 +106,72 @@ class DataFormatterTestCase(TestBase):
self.expect("frame variable twoptr", matching=False,
substrs = ['and float says 2.71'])
+ script = 'return \'Python summary\'';
+
+ self.runCmd("type summary add --name test_summary -s \"%s\"" % script)
+
+ # attach the Python named summary to someone
+ self.runCmd("frame variable one --summary test_summary")
+
+ self.expect("frame variable one",
+ substrs = ['Python summary'])
+
+ # should not bind to the type
+ self.expect("frame variable two", matching=False,
+ substrs = ['Python summary'])
+
+ self.runCmd("type summary add i_am_cool -f \"Text summary\"")
+
+ self.expect("frame variable one",
+ substrs = ['Python summary'])
+
+ # use the type summary
+ self.expect("frame variable two",
+ substrs = ['Text summary'])
+
+ self.runCmd("n"); # skip ahead to make values change
+
+ # both should use the type summary now
+ self.expect("frame variable one",
+ substrs = ['Text summary'])
+
+ self.expect("frame variable two",
+ substrs = ['Text summary'])
+
+ # disable type summary for pointers, and make a Python regex summary
+ self.runCmd("type summary add i_am_cool -p -f \"Text summary\"")
+ self.runCmd("type summary add -x cool -s \"%s\"" % script)
+
+ # variables should stick to the type summary
+ self.expect("frame variable one",
+ substrs = ['Text summary'])
+
+ self.expect("frame variable two",
+ substrs = ['Text summary'])
+
+ # array and pointer should match the Python one
+ self.expect("frame variable twoptr",
+ substrs = ['Python summary'])
+
+ self.expect("frame variable array",
+ substrs = ['Python summary'])
+
+ # return pointers to the type summary
+ self.runCmd("type summary add i_am_cool -f \"Text summary\"")
+
+ self.expect("frame variable one",
+ substrs = ['Text summary'])
+
+ self.expect("frame variable two",
+ substrs = ['Text summary'])
+
+ self.expect("frame variable twoptr",
+ substrs = ['Text summary'])
+
+ self.expect("frame variable array",
+ substrs = ['Python summary'])
+
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
OpenPOWER on IntegriCloud