aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorJason Molenda <jason@molenda.com>2023-02-07 15:25:51 -0800
committerJason Molenda <jason@molenda.com>2023-02-07 16:05:24 -0800
commit4a8cc285e9f3252ca31941dccfddf8fd10c9911b (patch)
treefb9237a5b9ac032dce3079ea221b103f6dd38e24 /lldb/test/API/python_api
parent8cbf041ecb1c304148cd09987f4bd73a41cb51a9 (diff)
downloadllvm-4a8cc285e9f3252ca31941dccfddf8fd10c9911b.zip
llvm-4a8cc285e9f3252ca31941dccfddf8fd10c9911b.tar.gz
llvm-4a8cc285e9f3252ca31941dccfddf8fd10c9911b.tar.bz2
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.
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/process/TestProcessAPI.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lldb/test/API/python_api/process/TestProcessAPI.py b/lldb/test/API/python_api/process/TestProcessAPI.py
index 36291fc..66f438a 100644
--- a/lldb/test/API/python_api/process/TestProcessAPI.py
+++ b/lldb/test/API/python_api/process/TestProcessAPI.py
@@ -3,6 +3,7 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
"""
import lldb
+import sys
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbutil import get_stopped_thread, state_type_to_str
@@ -76,15 +77,16 @@ class ProcessAPITestCase(TestBase):
# will try to malloc it and fail, we should get an error
# result.
error = lldb.SBError()
+ bigsize = sys.maxsize - 8;
content = process.ReadMemory(
val.AddressOf().GetValueAsUnsigned(),
- 0xffffffffffffffe8, error)
+ bigsize, error)
if error.Success():
self.assertFalse(error.Success(), "SBProcessReadMemory claims to have "
- "successfully read 0xffffffffffffffe8 bytes")
+ "successfully read 0x%x bytes" % bigsize)
if self.TraceOn():
- print("Tried to read 0xffffffffffffffe8 bytes, got error message: ",
- error.GetCString())
+ print("Tried to read 0x%x bytes, got error message: %s" %
+ (bigsize, error.GetCString()))
# Read (char *)my_char_ptr.
val = frame.FindValue("my_char_ptr", lldb.eValueTypeVariableGlobal)