[Lldb-commits] [lldb] r266315 - Fix test cases for big-endian systems
Ulrich Weigand via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 14 07:35:03 PDT 2016
Author: uweigand
Date: Thu Apr 14 09:35:02 2016
New Revision: 266315
URL: http://llvm.org/viewvc/llvm-project?rev=266315&view=rev
Log:
Fix test cases for big-endian systems
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.
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
python_api/sbdata/TestSBData.py (first change)
could be fixed to check for big-endian target byte order and update the
expected result strings accordingly. For the two synthetic tests, I've
also updated the source to make sure the fake_a value is always nonzero
on both big- and little-endian platforms.
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.
Differential Revision: http://reviews.llvm.org/D18985
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py Thu Apr 14 09:35:02 2016
@@ -44,6 +44,8 @@ class PythonSynthDataFormatterTestCase(T
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',
@@ -62,40 +64,46 @@ class PythonSynthDataFormatterTestCase(T
# 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")
@@ -103,23 +111,39 @@ class PythonSynthDataFormatterTestCase(T
# 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,
@@ -131,7 +155,7 @@ class PythonSynthDataFormatterTestCase(T
'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
@@ -139,11 +163,11 @@ class PythonSynthDataFormatterTestCase(T
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
@@ -164,11 +188,11 @@ class PythonSynthDataFormatterTestCase(T
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
@@ -185,8 +209,8 @@ class PythonSynthDataFormatterTestCase(T
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 = '])
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp Thu Apr 14 09:35:02 2016
@@ -48,7 +48,7 @@ struct wrapint
int main()
{
- foo f00_1(0);
+ foo f00_1(1);
foo *f00_ptr = new foo(12);
f00_1.a++; // Set break point at this line.
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py Thu Apr 14 09:35:02 2016
@@ -36,6 +36,8 @@ class SmartArrayDataFormatterTestCase(Te
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',
@@ -311,39 +313,81 @@ class SmartArrayDataFormatterTestCase(Te
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,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42'])
-
- 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'])
-
- 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'])
-
- 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'])
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ 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'])
+ else:
+ self.expect("frame variable flarr",
+ substrs = ['flarr = arr =',
+ '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'])
+
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ 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'])
+ else:
+ self.expect("frame variable other.flarr",
+ substrs = ['flarr = arr =',
+ '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'])
+
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ 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'])
+ else:
+ self.expect("frame variable intarr",
+ substrs = ['intarr = arr =',
+ '00 00 00 01,00 00 00 01,00 00 00 02,00 00 00 03,00 00 00 05'])
+
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ 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'])
+ else:
+ self.expect("frame variable other.intarr",
+ substrs = ['intarr = arr = ',
+ '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 . at .B,00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...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'])
-
- self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '....,01 00 00 00',
- '....,05 00 00 00'])
-
- self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '09 00 00 00',
- '....,07 00 00 00'])
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ 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 . at .B,00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...B'])
+ else:
+ self.expect("frame variable flarr",
+ substrs = ['flarr = arr =',
+ '42 9d 00 00 B...,42 9a 80 00 B...,42 9c 00 00 B...,42 98 40 00 B. at .,42 99 80 00 B...,42 99 c0 00 B...,42 9a 00 00 B...'])
+
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ 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'])
+ else:
+ self.expect("frame variable other.flarr",
+ substrs = ['flarr = arr =',
+ '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...'])
+
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ self.expect("frame variable intarr",
+ substrs = ['intarr = arr =',
+ '....,01 00 00 00',
+ '....,05 00 00 00'])
+ else:
+ self.expect("frame variable intarr",
+ substrs = ['intarr = arr =',
+ '....,00 00 00 01',
+ '....,00 00 00 05'])
+
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ self.expect("frame variable other.intarr",
+ substrs = ['intarr = arr = ',
+ '09 00 00 00',
+ '....,07 00 00 00'])
+ else:
+ self.expect("frame variable other.intarr",
+ substrs = ['intarr = arr = ',
+ '00 00 00 09',
+ '....,00 00 00 07'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py Thu Apr 14 09:35:02 2016
@@ -31,6 +31,8 @@ class SyntheticCappingTestCase(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',
@@ -52,25 +54,31 @@ class SyntheticCappingTestCase(TestBase)
self.runCmd("script from fooSynthProvider import *")
self.runCmd("type synth add -l fooSynthProvider foo")
+ # 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 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']);
+ substrs = ['r = 34',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 1']);
# 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']);
+ 'fake_a = %d' % fake_a_val,
+ 'a = 1']);
self.expect("frame variable f00_1", matching=False,
- substrs = ['r = 33']);
+ substrs = ['r = 34']);
self.runCmd("settings set target.max-children-count 256", check=False)
self.expect("frame variable f00_1", matching=True,
- substrs = ['r = 33']);
+ substrs = ['r = 34']);
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/main.cpp Thu Apr 14 09:35:02 2016
@@ -48,7 +48,7 @@ struct wrapint
int main()
{
- foo f00_1(0);
+ foo f00_1(1);
foo *f00_ptr = new foo(12);
f00_1.a++; // Set break point at this line.
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py Thu Apr 14 09:35:02 2016
@@ -51,7 +51,7 @@ class MemoryCacheTestCase(TestBase):
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'.
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py Thu Apr 14 09:35:02 2016
@@ -19,7 +19,13 @@ class FrameVariableAnonymousUnionsTestCa
self.runCmd("process launch", RUN_SUCCEEDED)
- self.expect('frame variable -f x i', substrs=['ffffff41'])
+ process = self.dbg.GetSelectedTarget().GetProcess()
+
+ if process.GetByteOrder() == lldb.eByteOrderLittle:
+ self.expect('frame variable -f x i', substrs=['ffffff41'])
+ else:
+ self.expect('frame variable -f x i', substrs=['41ffff00'])
+
self.expect('frame variable c', substrs=["'A"])
self.expect('frame variable x', matching=False, substrs=['3'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py Thu Apr 14 09:35:02 2016
@@ -232,6 +232,7 @@ class ProcessAPITestCase(TestBase):
# 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)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py Thu Apr 14 09:35:02 2016
@@ -186,7 +186,10 @@ class SBDataAPICase(TestBase):
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 @@ class SBDataAPICase(TestBase):
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)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py?rev=266315&r1=266314&r2=266315&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py Thu Apr 14 09:35:02 2016
@@ -387,7 +387,10 @@ def pack_register_hex(endian, value, byt
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
More information about the lldb-commits
mailing list