uweigand created this revision.
uweigand added reviewers: granata.enrico, clayborg.
uweigand added a subscriber: lldb-commits.
A number of test cases were failing on big-endian systems simply due to
byte order assumptions in the tests themselves, and no underlying bug
in LLDB.
These two test cases:
tools/lldb-server/lldbgdbserverutils.py
python_api/process/TestProcessAPI.py
actually check for big-endian target byte order, but contain Python errors
in the corresponding code paths.
This test case:
python_api/sbdata/TestSBData.py (first change)
could be fixed to check for big-endian target byte order.
These test case:
python_api/sbdata/TestSBData.py (second change)
functionalities/memory/cache/TestMemoryCache.py
simply accessed memory with the wrong size, which wasn't noticed on LE
but fails on BE.
These test cases:
functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
make byte order assumption, but since they're not using the Python API, I didn't
see an easy way to check for target byte order. Instead, I've changes those
test
to simply accept either the results see on a little-endian system or those seen
on a big-endian system.
http://reviews.llvm.org/D18985
Files:
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
Index: packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
@@ -387,7 +387,10 @@
return retval
elif endian == 'big':
- retval = value.encode("hex")
+ retval = ""
+ while value != 0:
+ retval = "{:02x}".format(value & 0xff) + retval
+ value = value >> 8
if byte_size:
# Add zero-fill to the left/front (MSB side) of the value.
retval = ("00" * (byte_size - len(retval)/2)) + retval
Index: packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
===================================================================
--- packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
+++ packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
@@ -186,7 +186,10 @@
self.assertTrue(new_object.GetValue() == "1", 'new_object == 1')
- data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize())
+ if data.GetByteOrder() == lldb.eByteOrderBig:
+ data.SetData(error, '\0\0\0A', data.GetByteOrder(), data.GetAddressByteSize())
+ else:
+ data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize())
self.assertTrue(error.Success())
data2 = lldb.SBData()
@@ -311,8 +314,8 @@
self.assert_data(data2.GetSignedInt32, 4, -2)
data2.SetDataFromSInt64Array([2, -2])
- self.assert_data(data2.GetSignedInt32, 0, 2)
- self.assert_data(data2.GetSignedInt32, 8, -2)
+ self.assert_data(data2.GetSignedInt64, 0, 2)
+ self.assert_data(data2.GetSignedInt64, 8, -2)
data2.SetDataFromUInt32Array([1,2,3,4,5])
self.assert_data(data2.GetUnsignedInt32, 0, 1)
Index: packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
===================================================================
--- packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
+++ packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
@@ -232,6 +232,7 @@
# The bytearray_to_int utility function expects a little endian bytearray.
if byteOrder == lldb.eByteOrderBig:
+ content = bytearray(content, 'ascii')
content.reverse()
new_value = bytearray_to_int(content, byteSize)
Index: packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
===================================================================
--- packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
+++ packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
@@ -19,7 +19,7 @@
self.runCmd("process launch", RUN_SUCCEEDED)
- self.expect('frame variable -f x i', substrs=['ffffff41'])
+ self.expect('frame variable -f x i', patterns=['(ffffff41|41ffff00)'])
self.expect('frame variable c', substrs=["'A"])
self.expect('frame variable x', matching=False, substrs=['3'])
Index: packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
+++ packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
@@ -51,7 +51,7 @@
self.assertTrue(0x00000042 == int(line.split(':')[1], 0))
# Change the value of my_ints[0] in memory.
- self.runCmd("memory write `&my_ints` AA")
+ self.runCmd("memory write -s 4 `&my_ints` AA")
# Re-read the chunk of memory. The cache line should have been
# flushed because of the 'memory write'.
Index: packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
+++ packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
@@ -54,17 +54,17 @@
# check that the synthetic children work, so we know we are doing the right thing
self.expect("frame variable f00_1",
- substrs = ['r = 33',
- 'fake_a = 16777216',
- 'a = 0']);
+ patterns = ['r = 33',
+ 'fake_a = (16777216|0)',
+ 'a = 0']);
# check that capping works
self.runCmd("settings set target.max-children-count 2", check=False)
self.expect("frame variable f00_1",
- substrs = ['...',
- 'fake_a = 16777216',
- 'a = 0']);
+ patterns = ['...',
+ 'fake_a = (16777216|0)',
+ 'a = 0']);
self.expect("frame variable f00_1", matching=False,
substrs = ['r = 33']);
Index: packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
+++ packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
@@ -312,38 +312,38 @@
self.runCmd("type summary add --summary-string \"arr = ${var%y}\" \"int [5]\"")
self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '00 00 9d 42,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42'])
+ patterns = ['flarr = arr =',
+ '(00 00 9d 42,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42|42 9d 00 00,42 9a 80 00,42 9c 00 00,42 98 40 00,42 99 80 00,42 99 c0 00,42 9a 00 00)'])
self.expect("frame variable other.flarr",
- substrs = ['flarr = arr =',
- '00 00 cc 41,00 00 ca 41,00 00 c9 41,00 00 d6 41,00 00 db 41,00 00 dc 41,00 00 d1 41'])
+ patterns = ['flarr = arr =',
+ '(00 00 cc 41,00 00 ca 41,00 00 c9 41,00 00 d6 41,00 00 db 41,00 00 dc 41,00 00 d1 41|41 cc 00 00,41 ca 00 00,41 c9 00 00,41 d6 00 00,41 db 00 00,41 dc 00 00,41 d1 00 00)'])
self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '01 00 00 00,01 00 00 00,02 00 00 00,03 00 00 00,05 00 00 00'])
+ patterns = ['intarr = arr =',
+ '(01 00 00 00,01 00 00 00,02 00 00 00,03 00 00 00,05 00 00 00|00 00 00 01,00 00 00 01,00 00 00 02,00 00 00 03,00 00 00 05)'])
self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '09 00 00 00,08 00 00 00,07 00 00 00,06 00 00 00,05 00 00 00'])
+ patterns = ['intarr = arr = ',
+ '(09 00 00 00,08 00 00 00,07 00 00 00,06 00 00 00,05 00 00 00|00 00 00 09,00 00 00 08,00 00 00 07,00 00 00 06,00 00 00 05)'])
self.runCmd("type summary add --summary-string \"arr = ${var%Y}\" \"float [7]\"")
self.runCmd("type summary add --summary-string \"arr = ${var%Y}\" \"int [5]\"")
self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '00 00 9d 42 ...B,00 80 9a 42 ...B,00 00 9c 42 ...B,00 40 98 42 [email protected],00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...B'])
+ patterns = ['flarr = arr =',
+ '(00 00 9d 42 \.\.\.B,00 80 9a 42 \.\.\.B,00 00 9c 42 \.\.\.B,00 40 98 42 \.@\.B,00 80 99 42 \.\.\.B,00 c0 99 42 \.\.\.B,00 00 9a 42 \.\.\.B|42 9d 00 00 B\.\.\.,42 9a 80 00 B\.\.\.,42 9c 00 00 B\.\.\.,42 98 40 00 B\.@\.,42 99 80 00 B\.\.\.,42 99 c0 00 B\.\.\.,42 9a 00 00 B\.\.\.)'])
self.expect("frame variable other.flarr",
- substrs = ['flarr = arr =',
- '00 00 cc 41 ...A,00 00 ca 41 ...A,00 00 c9 41 ...A,00 00 d6 41 ...A,00 00 db 41 ...A,00 00 dc 41 ...A,00 00 d1 41 ...A'])
+ patterns = ['flarr =\ arr =',
+ '(00 00 cc 41 \.\.\.A,00 00 ca 41 \.\.\.A,00 00 c9 41 \.\.\.A,00 00 d6 41 \.\.\.A,00 00 db 41 \.\.\.A,00 00 dc 41 \.\.\.A,00 00 d1 41 \.\.\.A|41 cc 00 00 A\.\.\.,41 ca 00 00 A\.\.\.,41 c9 00 00 A\.\.\.,41 d6 00 00 A\.\.\.,41 db 00 00 A\.\.\.,41 dc 00 00 A\.\.\.,41 d1 00 00 A\.\.\.)'])
self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '....,01 00 00 00',
- '....,05 00 00 00'])
+ patterns = ['intarr = arr =',
+ '\.\.\.\.,(01 00 00 00|00 00 00 01)',
+ '\.\.\.\.,(05 00 00 00|00 00 00 05)'])
self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '09 00 00 00',
- '....,07 00 00 00'])
+ patterns = ['intarr = arr = ',
+ '(09 00 00 00|00 00 00 09)',
+ '\.\.\.\.,(07 00 00 00|00 00 00 07)'])
Index: packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
+++ packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
@@ -72,54 +72,55 @@
self.expect("type synthetic list foo", substrs=['fooSynthProvider'])
# check that we get the two real vars and the fake_a variables
+ # note that the value of fake_a depends on target byte order
self.expect("frame variable f00_1",
- substrs = ['r = 33',
- 'fake_a = 16777216',
- 'a = 0']);
+ patterns = ['r = 33',
+ 'fake_a = (16777216|0)',
+ 'a = 0']);
# check that we do not get the extra vars
self.expect("frame variable f00_1", matching=False,
substrs = ['b = 1']);
# check access to members by name
self.expect('frame variable f00_1.fake_a',
- substrs = ['16777216'])
+ patterns = ['(16777216|0)'])
# check access to members by index
self.expect('frame variable f00_1[1]',
- substrs = ['16777216'])
+ patterns = ['(16777216|0)'])
# 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'])
+ patterns = ['fake_a=(16777216|0)'])
self.runCmd("type summary add --summary-string \"fake_a=${svar[1]}\" foo")
self.expect('frame variable f00_1',
- substrs = ['fake_a=16777216'])
+ patterns = ['fake_a=(16777216|0)'])
# clear the summary
self.runCmd("type summary delete foo")
# check that the caching does not span beyond the stopoint
self.runCmd("n")
self.expect("frame variable f00_1",
- substrs = ['r = 33',
- 'fake_a = 16777216',
- 'a = 1']);
+ patterns = ['r = 33',
+ 'fake_a = (16777216|256)',
+ 'a = 1']);
# check that altering the object also alters fake_a
self.runCmd("expr f00_1.a = 280")
self.expect("frame variable f00_1",
- substrs = ['r = 33',
- 'fake_a = 16777217',
- 'a = 280']);
+ patterns = ['r = 33',
+ 'fake_a = (16777217|71680)',
+ 'a = 280']);
# check that expanding a pointer does the right thing
self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs = ['r = 45',
- 'fake_a = 218103808',
- 'a = 12'])
+ patterns = ['r = 45',
+ 'fake_a = (218103808|3072)',
+ 'a = 12'])
# now add a filter.. it should fail
self.expect("type filter add foo --child b --child j", error=True,
@@ -130,9 +131,9 @@
substrs = ['b = 1',
'j = 17'])
self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs = ['r = 45',
- 'fake_a = 218103808',
- 'a = 12'])
+ patterns = ['r = 45',
+ 'fake_a = (218103808|3072)',
+ 'a = 12'])
# now delete the synth and add the filter
self.runCmd("type synth delete foo")
@@ -142,9 +143,9 @@
substrs = ['b = 1',
'j = 17'])
self.expect("frame variable --ptr-depth 1 f00_ptr", matching=False,
- substrs = ['r = 45',
- 'fake_a = 218103808',
- 'a = 12'])
+ patterns = ['r = 45',
+ 'fake_a = (218103808|3072)',
+ 'a = 12'])
# now add the synth and it should fail
self.expect("type synth add -l fooSynthProvider foo", error=True,
@@ -167,9 +168,9 @@
substrs = ['b = 1',
'j = 17'])
self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs = ['r = 45',
- 'fake_a = 218103808',
- 'a = 12'])
+ patterns = ['r = 45',
+ 'fake_a = (218103808|3072)',
+ 'a = 12'])
# check the listing
self.expect('type synth list',
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits