diff options
author | Pavel Labath <labath@google.com> | 2017-12-22 10:26:59 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-12-22 10:26:59 +0000 |
commit | b8318155eb071ae2ad6ba94fd7865395e36c35b4 (patch) | |
tree | 85d744ee2f4e4e057cc4c2cfef3f79b3cc07c0f9 /lldb/packages/Python/lldbsuite/test/python_api/process | |
parent | 57493e29198836bfcdab58c0780c106a4f7f30c8 (diff) | |
download | bcm5719-llvm-b8318155eb071ae2ad6ba94fd7865395e36c35b4.tar.gz bcm5719-llvm-b8318155eb071ae2ad6ba94fd7865395e36c35b4.zip |
Enable TestReadMemCString on non-darwin targets
The test works fine on linux, and I believe other targets should not
have an issue with as well. If they do, we can start blacklisting
instead of whitelisting.
The idea of using "-1" as the value of the pointer on non-apple targets
backfired, as it fails the "address != LLDB_INVALID_ADDRESS" test (-1 is
the value of LLDB_INVALID_ADDRESS). However, it should be safe to use
0x100 for other targets as well. The first page of memory is generally
kept unreadable to catch null pointer dereferences.
llvm-svn: 321353
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/process')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py | 7 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c | 8 |
2 files changed, 4 insertions, 11 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py index e99779a5789..6302711606c 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py @@ -12,13 +12,8 @@ from lldbsuite.test import lldbutil class TestReadMemCString(TestBase): mydir = TestBase.compute_mydir(__file__) + NO_DEBUG_INFO_TESTCASE = True - def setUp(self): - TestBase.setUp(self) - - # Need to have a char* pointer that points to unmapped memory to run - # this test on other platforms -- Darwin only for now. - @skipUnlessDarwin def test_read_memory_c_string(self): """Test corner case behavior of SBProcess::ReadCStringFromMemory""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c b/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c index 94916997ad3..03c66741712 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c +++ b/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c @@ -3,11 +3,9 @@ int main () { const char *empty_string = ""; const char *one_letter_string = "1"; -#if defined (__APPLE__) - const char *invalid_memory_string = (char*)0x100; // lower 4k is always PAGEZERO & unreadable on darwin -#else - const char *invalid_memory_string = -1ULL; // maybe an invalid address on other platforms? -#endif + // This expects that lower 4k of memory will be mapped unreadable, which most + // OSs do (to catch null pointer dereferences). + const char *invalid_memory_string = (char*)0x100; return empty_string[0] + one_letter_string[0]; // breakpoint here } |