summaryrefslogtreecommitdiff
path: root/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp
diff options
context:
space:
mode:
authorEnrico Granata <granata.enrico@gmail.com>2011-07-15 02:26:42 +0000
committerEnrico Granata <granata.enrico@gmail.com>2011-07-15 02:26:42 +0000
commitf2bbf717f72f7f01b83b1b41b0fd014c9471c8aa (patch)
treebcbf57281baa4c9e0fe1c4c440087ff2e6c2528c /lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp
parenta83b37a9db2880091f4f8e7683c30ca142678fff (diff)
Python summary strings:
- you can use a Python script to write a summary string for data-types, in one of three ways: -P option and typing the script a line at a time -s option and passing a one-line Python script -F option and passing the name of a Python function these options all work for the "type summary add" command your Python code (if provided through -P or -s) is wrapped in a function that accepts two parameters: valobj (a ValueObject) and dict (an LLDB internal dictionary object). if you use -F and give a function name, you're expected to define the function on your own and with the right prototype. your function, however defined, must return a Python string - test case for the Python summary feature - a few quirks: Python summaries cannot have names, and cannot use regex as type names both issues will be fixed ASAP major redesign of type summary code: - type summary working with strings and type summary working with Python code are two classes, with a common base class SummaryFormat - SummaryFormat classes now are able to actively format objects rather than just aggregating data - cleaner code to print descriptions for summaries the public API now exports a method to easily navigate a ValueObject hierarchy New InputReaderEZ and PriorityPointerPair classes Several minor fixes and improvements llvm-svn: 135238
Diffstat (limited to 'lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp')
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp b/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp
new file mode 100644
index 000000000000..357062234e15
--- /dev/null
+++ b/lldb/test/functionalities/data-formatter/data-formatter-script/main.cpp
@@ -0,0 +1,49 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+struct i_am_cool
+{
+ int integer;
+ float floating;
+ char character;
+ i_am_cool(int I, float F, char C) :
+ integer(I), floating(F), character(C) {}
+ i_am_cool() : integer(1), floating(2), character('3') {}
+
+};
+
+struct i_am_cooler
+{
+ i_am_cool first_cool;
+ i_am_cool second_cool;
+ float floating;
+
+ i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) :
+ first_cool(I1,F1,C1),
+ second_cool(I2,F2,C2),
+ floating((F1 + F2)/2) {}
+};
+
+int main (int argc, const char * argv[])
+{
+ i_am_cool one(1,3.14,'E');
+ i_am_cool two(4,2.71,'G');
+
+ i_am_cool* twoptr = &two;
+
+ i_am_cooler three(10,4,1985,1/1/2011,'B','E'); // Set break point at this line.
+
+ two.integer = 1;
+
+ return 0;
+} \ No newline at end of file