Skip to content

[lldb-dap][test] Fix readMemory test #109057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

vogelsgesang
Copy link
Member

So far, the test case was also testing the offset -1. This test cases failed if the string is immediately at the beginning of the memory region, though, and the offset -1 hence belonged to a different memory region.

The fix is rather straightforward:
Passing an offset of -1 is not used by any actual clients of lldb-dap, anyway. As such, this commit simply removes the corresponding test case.

So far, the test case was also testing the offset -1. This test cases
failed if the string is immediately at the beginning of the memory
region, though, and the offset -1 hence belonged to a different memory
region.

The fix is rather straightforward:
Passing an offset of -1 is not used by any actual clients of lldb-dap,
anyway. As such, this commit simply removes the corresponding test case.
@llvmbot
Copy link
Member

llvmbot commented Sep 17, 2024

@llvm/pr-subscribers-lldb

Author: Adrian Vogelsgesang (vogelsgesang)

Changes

So far, the test case was also testing the offset -1. This test cases failed if the string is immediately at the beginning of the memory region, though, and the offset -1 hence belonged to a different memory region.

The fix is rather straightforward:
Passing an offset of -1 is not used by any actual clients of lldb-dap, anyway. As such, this commit simply removes the corresponding test case.


Full diff: https://github.com/llvm/llvm-project/pull/109057.diff

1 Files Affected:

  • (modified) lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py (-8)
diff --git a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py
index 3d8aaeda7f4b85..1082541aebcf7c 100644
--- a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py
+++ b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py
@@ -74,10 +74,6 @@ def test_memory_refs_set_variable(self):
             ].keys(),
         )
 
-    # lldb-dap assumes that all reads will be within the same region. On Windows
-    # the target string is at the very start of a region so the -1 offset causes
-    # the read to only read from the previous region and only return 1 byte.
-    @skipIfWindows
     def test_readMemory(self):
         """
         Tests the 'readMemory' request
@@ -104,10 +100,6 @@ def test_readMemory(self):
         mem = self.dap_server.request_readMemory(memref, 2, 3)["body"]
         self.assertEqual(b64decode(mem["data"]), b"ad\0")
 
-        # Use a negative offset
-        mem = self.dap_server.request_readMemory(memref, -1, 6)["body"]
-        self.assertEqual(b64decode(mem["data"])[1:], b"dead\0")
-
         # Reads of size 0 are successful
         # VS-Code sends those in order to check if a `memoryReference` can actually be dereferenced.
         mem = self.dap_server.request_readMemory(memref, 0, 0)

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming all read memory requests are generated from variables, this makes sense. They wouldn't be split across regions.

@vogelsgesang vogelsgesang merged commit 620738e into llvm:main Sep 18, 2024
9 checks passed
tmsri pushed a commit to tmsri/llvm-project that referenced this pull request Sep 19, 2024
So far, the test case was also testing the offset -1. This test cases
failed if the string is immediately at the beginning of the memory
region, though, and the offset -1 hence belonged to a different memory
region.

The fix is rather straightforward:
Passing an offset of -1 is not used by any actual clients of lldb-dap,
anyway. As such, this commit simply removes the corresponding test case.
adrian-prantl pushed a commit to adrian-prantl/llvm-project that referenced this pull request Dec 20, 2024
So far, the test case was also testing the offset -1. This test cases
failed if the string is immediately at the beginning of the memory
region, though, and the offset -1 hence belonged to a different memory
region.

The fix is rather straightforward:
Passing an offset of -1 is not used by any actual clients of lldb-dap,
anyway. As such, this commit simply removes the corresponding test case.

(cherry picked from commit 620738e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants