summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/data-formatter
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/functionalities/data-formatter')
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py71
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp4
2 files changed, 74 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()
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp b/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp
index 357062234e1..aaccb6329ac 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp
+++ b/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp
@@ -41,9 +41,13 @@ int main (int argc, const char * argv[])
i_am_cool* twoptr = &two;
+ i_am_cool array[5];
+
i_am_cooler three(10,4,1985,1/1/2011,'B','E'); // Set break point at this line.
two.integer = 1;
+ int dummy = 1;
+
return 0;
} \ No newline at end of file
OpenPOWER on IntegriCloud