Android: Fix lldb connection for devices with uppercase "serial number"

The host name in the remote channel url needs to match the Android
device serial number case-sensitively. Otherwise, the lldb connection
fails.

When constructing a remote channel url via QUrl, the host name gets
forced to be lowercase. The url for serialnumber "MYPHONE12346" would
become "adb://myphone12346:<port>" and the lldb connection fails.

Use the DebuggerRunTool::setRemoteChannel(const QString &host, int port)
overload for lldb to avoid the issue.

Task-number: QTCREATORBUG-26709
Change-Id: I0e61d981c4b80a9d251ba1f7626fc2be9625a831
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2021-12-15 20:13:33 +01:00
parent 464e12f5e1
commit 44407e404b

View File

@@ -154,13 +154,12 @@ void AndroidDebugSupport::start()
QString devicePreferredAbi = AndroidManager::apkDevicePreferredAbi(target);
setAbi(AndroidManager::androidAbi2Abi(devicePreferredAbi));
QUrl debugServer;
debugServer.setPort(m_runner->debugServerPort().number());
if (cppEngineType() == LldbEngineType) {
debugServer.setScheme("adb");
debugServer.setHost(AndroidManager::deviceSerialNumber(target));
setRemoteChannel(debugServer.toString());
setRemoteChannel("adb://" + AndroidManager::deviceSerialNumber(target),
m_runner->debugServerPort().number());
} else {
QUrl debugServer;
debugServer.setPort(m_runner->debugServerPort().number());
debugServer.setHost(QHostAddress(QHostAddress::LocalHost).toString());
setRemoteChannel(debugServer);
}