Skip to content

Commit 157e886

Browse files
[lldb][test] Prevent TestqOffsets.py picking up host binaries (#157432)
Due to a fallback in GDBRemoteCommunicationClient.cpp, on Linux we will assume a PID of 1 if the remote does not respond in some way that tells us the real PID. So if PID 1 happened to be a process that the current user could read, we would try to debug that instead. On my current machine, PID 1 was sshd run by root so we would ignore it. If I changed the fallback to some process ID run by my user, the test would fail. To prevent this, select the remote-linux platform before creating the target. This means we won't attempt any host lookups. Fixes #155895
1 parent db8cad0 commit 157e886

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def qOffsets(self):
1212

1313
def test(self):
1414
self.server.responder = TestqOffsets.Responder()
15+
# This ensures that we do not pick up any binaries on the host.
16+
self.runCmd("platform select remote-linux")
1517
target = self.createTarget("qOffsets.yaml")
1618
text = target.modules[0].FindSection(".text")
1719
self.assertEqual(text.GetLoadAddress(target), lldb.LLDB_INVALID_ADDRESS)

0 commit comments

Comments
 (0)