diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py')
-rw-r--r-- | packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py | 84 |
1 files changed, 55 insertions, 29 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py index d202ff5d64e1..c7ff28874c5a 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py @@ -8,8 +8,9 @@ from __future__ import print_function import os, time import lldb +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * -import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test import lldbutil class PythonSynthDataFormatterTestCase(TestBase): @@ -43,6 +44,8 @@ class PythonSynthDataFormatterTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) + process = self.dbg.GetSelectedTarget().GetProcess() + # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs = ['stopped', @@ -61,39 +64,46 @@ class PythonSynthDataFormatterTestCase(TestBase): # print the f00_1 variable without a synth self.expect("frame variable f00_1", - substrs = ['a = 0', - 'b = 1', - 'r = 33']); + substrs = ['a = 1', + 'b = 2', + 'r = 34']); # now set up the synth self.runCmd("script from fooSynthProvider import *") self.runCmd("type synth add -l fooSynthProvider foo") + self.expect("type synthetic list foo", substrs=['fooSynthProvider']) + + # note that the value of fake_a depends on target byte order + if process.GetByteOrder() == lldb.eByteOrderLittle: + fake_a_val = 0x02000000 + else: + fake_a_val = 0x00000100 # check that we get the two real vars and the fake_a variables self.expect("frame variable f00_1", - substrs = ['r = 33', - 'fake_a = 16777216', - 'a = 0']); + substrs = ['r = 34', + 'fake_a = %d' % fake_a_val, + 'a = 1']); # check that we do not get the extra vars self.expect("frame variable f00_1", matching=False, - substrs = ['b = 1']); + substrs = ['b = 2']); # check access to members by name self.expect('frame variable f00_1.fake_a', - substrs = ['16777216']) + substrs = ['%d' % fake_a_val]) # check access to members by index self.expect('frame variable f00_1[1]', - substrs = ['16777216']) + substrs = ['%d' % fake_a_val]) # put synthetic children in summary in several combinations self.runCmd("type summary add --summary-string \"fake_a=${svar.fake_a}\" foo") self.expect('frame variable f00_1', - substrs = ['fake_a=16777216']) + substrs = ['fake_a=%d' % fake_a_val]) self.runCmd("type summary add --summary-string \"fake_a=${svar[1]}\" foo") self.expect('frame variable f00_1', - substrs = ['fake_a=16777216']) + substrs = ['fake_a=%d' % fake_a_val]) # clear the summary self.runCmd("type summary delete foo") @@ -101,23 +111,39 @@ class PythonSynthDataFormatterTestCase(TestBase): # check that the caching does not span beyond the stopoint self.runCmd("n") + if process.GetByteOrder() == lldb.eByteOrderLittle: + fake_a_val = 0x02000000 + else: + fake_a_val = 0x00000200 + self.expect("frame variable f00_1", - substrs = ['r = 33', - 'fake_a = 16777216', - 'a = 1']); + substrs = ['r = 34', + 'fake_a = %d' % fake_a_val, + 'a = 2']); # check that altering the object also alters fake_a self.runCmd("expr f00_1.a = 280") + + if process.GetByteOrder() == lldb.eByteOrderLittle: + fake_a_val = 0x02000001 + else: + fake_a_val = 0x00011800 + self.expect("frame variable f00_1", - substrs = ['r = 33', - 'fake_a = 16777217', + substrs = ['r = 34', + 'fake_a = %d' % fake_a_val, 'a = 280']); # check that expanding a pointer does the right thing + if process.GetByteOrder() == lldb.eByteOrderLittle: + fake_a_val = 0x0d000000 + else: + fake_a_val = 0x00000c00 + self.expect("frame variable --ptr-depth 1 f00_ptr", - substrs = ['r = 45', - 'fake_a = 218103808', - 'a = 12']) + substrs = ['r = 45', + 'fake_a = %d' % fake_a_val, + 'a = 12']) # now add a filter.. it should fail self.expect("type filter add foo --child b --child j", error=True, @@ -129,7 +155,7 @@ class PythonSynthDataFormatterTestCase(TestBase): 'j = 17']) self.expect("frame variable --ptr-depth 1 f00_ptr", substrs = ['r = 45', - 'fake_a = 218103808', + 'fake_a = %d' % fake_a_val, 'a = 12']) # now delete the synth and add the filter @@ -137,11 +163,11 @@ class PythonSynthDataFormatterTestCase(TestBase): self.runCmd("type filter add foo --child b --child j") self.expect('frame variable f00_1', - substrs = ['b = 1', - 'j = 17']) + substrs = ['b = 2', + 'j = 18']) self.expect("frame variable --ptr-depth 1 f00_ptr", matching=False, substrs = ['r = 45', - 'fake_a = 218103808', + 'fake_a = %d' % fake_a_val, 'a = 12']) # now add the synth and it should fail @@ -162,11 +188,11 @@ class PythonSynthDataFormatterTestCase(TestBase): self.runCmd("type synth add -l fooSynthProvider foo") self.expect('frame variable f00_1', matching=False, - substrs = ['b = 1', - 'j = 17']) + substrs = ['b = 2', + 'j = 18']) self.expect("frame variable --ptr-depth 1 f00_ptr", substrs = ['r = 45', - 'fake_a = 218103808', + 'fake_a = %d' % fake_a_val, 'a = 12']) # check the listing @@ -183,8 +209,8 @@ class PythonSynthDataFormatterTestCase(TestBase): self.expect("frame variable f00_1", substrs = ['a = 280', - 'b = 1', - 'j = 17']); + 'b = 2', + 'j = 18']); self.expect("frame variable f00_1", matching=False, substrs = ['fake_a = ']) |