From 258dc5d2e4967fbcbbd62497e2c4b8fbff7a66a8 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sun, 4 Sep 2016 19:12:16 +0300 Subject: [PATCH] Fix debug on Android 6+ with NDK r11+ Task-number: QTCREATORBUG-16721 Change-Id: Ic65f13076794b75d6e4551b68d26fd3752f82098 Reviewed-by: hjk --- src/plugins/android/androiddebugsupport.cpp | 12 ++++++++++++ src/plugins/debugger/debuggerengine.h | 1 - src/plugins/debugger/debuggerruncontrol.cpp | 3 ++- src/plugins/debugger/debuggerstartparameters.h | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index e52b233e561..6c1b8f48213 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -86,6 +86,15 @@ static QStringList uniquePaths(const QStringList &files) return paths.toList(); } +static QString toNdkArch(const QString &arch) +{ + if (arch == QLatin1String("armeabi-v7a") || arch == QLatin1String("armeabi")) + return QLatin1String("arch-arm"); + if (arch == QLatin1String("arm64-v8a")) + return QLatin1String("arch-arm64"); + return QLatin1String("arch-") + arch; +} + RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *runConfig, QString *errorMessage) { Target *target = runConfig->target(); @@ -109,6 +118,9 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration * QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit); params.solibSearchPath.append(qtSoPaths(version)); params.solibSearchPath.append(uniquePaths(AndroidManager::androidQtSupport(target)->androidExtraLibs(target))); + params.sysRoot = AndroidConfigurations::currentConfig().ndkLocation().appendPath(QLatin1String("platforms")) + .appendPath(QLatin1String("android-") + QString::number(AndroidManager::minimumSDK(target))) + .appendPath(toNdkArch(AndroidManager::targetArch(target))).toString(); } if (aspect->useQmlDebugger()) { QTcpServer server; diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 9fab50b0631..84020f443b4 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -97,7 +97,6 @@ public: QStringList debugSourceLocation; // Gdb "directory" QString serverStartScript; ProjectExplorer::IDevice::ConstPtr device; - QString sysRoot; bool isSnapshot = false; // Set if created internally. ProjectExplorer::Abi toolChainAbi; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 6ee90639aee..f6267785a63 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -384,7 +384,8 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration * rp.nativeMixedEnabled = bool(nativeMixedOverride); rp.cppEngineType = DebuggerKitInformation::engineType(kit); - rp.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); + if (rp.sysRoot.isEmpty()) + rp.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); rp.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString(); rp.device = DeviceKitInformation::device(kit); diff --git a/src/plugins/debugger/debuggerstartparameters.h b/src/plugins/debugger/debuggerstartparameters.h index 7416cf59672..7090ce82724 100644 --- a/src/plugins/debugger/debuggerstartparameters.h +++ b/src/plugins/debugger/debuggerstartparameters.h @@ -110,6 +110,7 @@ public: QString platform; QString deviceSymbolsRoot; bool continueAfterAttach = false; + QString sysRoot; }; } // namespace Debugger