#include "lldb/Utility/UriParser.h"
#include "Plugins/Process/Utility/GDBRemoteSignals.h"
+#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
using namespace lldb;
using namespace lldb_private;
/// Default Constructor
PlatformRemoteGDBServer::PlatformRemoteGDBServer()
: Platform(false), // This is a remote platform
- m_gdb_client() {}
+ m_gdb_client() {
+ m_gdb_client.SetPacketTimeout(
+ process_gdb_remote::ProcessGDBRemote::GetPacketTimeout());
+}
/// Destructor.
///
@expectedFailureAll(hostoslist=["windows"], triple='.*-android')
@skipIfWindows # lldb-server does not terminate correctly
@skipIfDarwin # lldb-server not found correctly
- @skipIf(oslist=["linux"], archs=["arm", "aarch64"]) # Fails randomly
@add_test_categories(["lldb-server"])
def test_platform_process_connect(self):
self.build()
import lldb
import binascii
import os
+import time
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from gdbclientutils import *
substrs=["error: no processes were found on the \"remote-linux\" platform"])
finally:
self.dbg.GetSelectedPlatform().DisconnectRemote()
+
+ class TimeoutResponder(MockGDBServerResponder):
+ """A mock server, which takes a very long time to compute the working
+ directory."""
+ def __init__(self):
+ MockGDBServerResponder.__init__(self)
+
+ def qGetWorkingDir(self):
+ time.sleep(10)
+ return hexlify("/foo/bar")
+
+ def test_no_timeout(self):
+ """Test that we honor the timeout setting. With a large enough timeout,
+ we should get the CWD successfully."""
+
+ self.server.responder = TestPlatformClient.TimeoutResponder()
+ self.runCmd("settings set plugin.process.gdb-remote.packet-timeout 30")
+ plat = lldb.SBPlatform("remote-linux")
+ try:
+ self.assertSuccess(plat.ConnectRemote(lldb.SBPlatformConnectOptions("connect://"
+ + self.server.get_connect_address())))
+ self.assertEqual(plat.GetWorkingDirectory(), "/foo/bar")
+ finally:
+ plat.DisconnectRemote()
+
+ def test_timeout(self):
+ """Test that we honor the timeout setting. With a small timeout, CWD
+ retrieval should fail."""
+
+ self.server.responder = TestPlatformClient.TimeoutResponder()
+ self.runCmd("settings set plugin.process.gdb-remote.packet-timeout 3")
+ plat = lldb.SBPlatform("remote-linux")
+ try:
+ self.assertSuccess(plat.ConnectRemote(lldb.SBPlatformConnectOptions("connect://"
+ + self.server.get_connect_address())))
+ self.assertIsNone(plat.GetWorkingDirectory())
+ finally:
+ plat.DisconnectRemote()