diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-07-22 22:01:35 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-07-22 22:01:35 +0000 |
| commit | 36d7d91616c1f27ed7c734c4419aa76cd1c71e1a (patch) | |
| tree | bf7c912a1bcc749b7f057ac3126076c2b00e4b05 /lldb/test/python_api/value | |
| parent | c391a58b2bbbbe1bab184198ac0761bf7831ac14 (diff) | |
| download | bcm5719-llvm-36d7d91616c1f27ed7c734c4419aa76cd1c71e1a.tar.gz bcm5719-llvm-36d7d91616c1f27ed7c734c4419aa76cd1c71e1a.zip | |
Add an additional formatter class RecursiveDecentFormatter which prints the
value and the decendents. For an example,
rdf = lldbutil.RecursiveDecentFormatter(indent_child=2)
print rdf.format(g_table)
produces:
(const char **[2]) g_table = 0x00000001055a80f0 (location)
(const char **) [0] = 0x00000001055a8080
(const char *) *[0] = "Sunday"
(const char **) [1] = 0x00000001055a80c0
(const char *) *[1] = "Monday"
llvm-svn: 135815
Diffstat (limited to 'lldb/test/python_api/value')
| -rw-r--r-- | lldb/test/python_api/value/TestValueAPI.py | 19 | ||||
| -rw-r--r-- | lldb/test/python_api/value/main.c | 8 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lldb/test/python_api/value/TestValueAPI.py b/lldb/test/python_api/value/TestValueAPI.py index f89ffbf58b2..91de002b7d9 100644 --- a/lldb/test/python_api/value/TestValueAPI.py +++ b/lldb/test/python_api/value/TestValueAPI.py @@ -66,11 +66,28 @@ class ValueAPITestCase(TestBase): self.assertTrue(days_of_week.GetNumChildren() == 7, VALID_VARIABLE) self.DebugSBValue(days_of_week) + # Get global variable 'weekdays'. + list = target.FindGlobalVariables('weekdays', 1) + weekdays = list.GetValueAtIndex(0) + self.assertTrue(weekdays, VALID_VARIABLE) + self.assertTrue(weekdays.GetNumChildren() == 5, VALID_VARIABLE) + self.DebugSBValue(weekdays) + + # Get global variable 'g_table'. + list = target.FindGlobalVariables('g_table', 1) + g_table = list.GetValueAtIndex(0) + self.assertTrue(g_table, VALID_VARIABLE) + self.assertTrue(g_table.GetNumChildren() == 2, VALID_VARIABLE) + self.DebugSBValue(g_table) + fmt = lldbutil.BasicFormatter() - cvf = lldbutil.ChildVisitingFormatter(indent=2) + cvf = lldbutil.ChildVisitingFormatter(indent_child=2) + rdf = lldbutil.RecursiveDecentFormatter(indent_child=2) if self.TraceOn(): print fmt.format(days_of_week) print cvf.format(days_of_week) + print cvf.format(weekdays) + print rdf.format(g_table) # Get variable 'str_ptr'. value = frame0.FindVariable('str_ptr') diff --git a/lldb/test/python_api/value/main.c b/lldb/test/python_api/value/main.c index 108edfa8c8e..0554ff0284b 100644 --- a/lldb/test/python_api/value/main.c +++ b/lldb/test/python_api/value/main.c @@ -20,6 +20,14 @@ const char *days_of_week[7] = { "Sunday", "Friday", "Saturday" }; +const char *weekdays[5] = { "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday" }; + +const char **g_table[2] = { days_of_week, weekdays }; + int main (int argc, char const *argv[]) { int i; |

