Skip to content

Commit 4a8cc28

Browse files
committed
Fix TestProcessAPI.py to only allocate sys.maxsize buffer
I hardcoded nearly a UINT64_MAX number in this test case, and python is not able to convert it to a long on some platforms. Use sys.maxsize instead; this also would have failed if the testsuite was run on a 32-bit system.
1 parent 8cbf041 commit 4a8cc28

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lldb/test/API/python_api/process/TestProcessAPI.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import lldb
6+
import sys
67
from lldbsuite.test.decorators import *
78
from lldbsuite.test.lldbtest import *
89
from lldbsuite.test.lldbutil import get_stopped_thread, state_type_to_str
@@ -76,15 +77,16 @@ def test_read_memory(self):
7677
# will try to malloc it and fail, we should get an error
7778
# result.
7879
error = lldb.SBError()
80+
bigsize = sys.maxsize - 8;
7981
content = process.ReadMemory(
8082
val.AddressOf().GetValueAsUnsigned(),
81-
0xffffffffffffffe8, error)
83+
bigsize, error)
8284
if error.Success():
8385
self.assertFalse(error.Success(), "SBProcessReadMemory claims to have "
84-
"successfully read 0xffffffffffffffe8 bytes")
86+
"successfully read 0x%x bytes" % bigsize)
8587
if self.TraceOn():
86-
print("Tried to read 0xffffffffffffffe8 bytes, got error message: ",
87-
error.GetCString())
88+
print("Tried to read 0x%x bytes, got error message: %s" %
89+
(bigsize, error.GetCString()))
8890

8991
# Read (char *)my_char_ptr.
9092
val = frame.FindValue("my_char_ptr", lldb.eValueTypeVariableGlobal)

0 commit comments

Comments
 (0)