From 75bdaf25d044750af44cb8cc491f53f4af7ac01f Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 23 Mar 2023 11:43:23 +0100 Subject: Debugger: enable dependency action only if we can find depends Change-Id: I1f8c8d4108a1e3c6a03b93c9cf280c005806fc44 Reviewed-by: hjk --- src/plugins/debugger/moduleshandler.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index 9ae6b068af..6e7496bd37 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -140,6 +140,12 @@ public: DebuggerEngine *engine; }; +static bool dependsCanBeFound() +{ + static bool dependsInPath = Environment::systemEnvironment().searchInPath("depends").isEmpty(); + return dependsInPath; +} + bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev) { ModuleItem *item = itemForIndexAtLevel<1>(ev.sourceModelIndex()); @@ -163,11 +169,13 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev) moduleNameValid && enabled && canReload, [this, modulePath] { engine->loadSymbols(modulePath); }); - // FIXME: Dependencies only available on Windows, when "depends" is installed. addAction(this, menu, Tr::tr("Show Dependencies of \"%1\"").arg(moduleName), Tr::tr("Show Dependencies"), - moduleNameValid && !moduleName.isEmpty() && HostOsInfo::isWindowsHost(), - [modulePath] { QtcProcess::startDetached({{"depends"}, {modulePath.toString()}}); }); + moduleNameValid && !modulePath.needsDevice() && modulePath.exists() + && dependsCanBeFound(), + [modulePath] { + QtcProcess::startDetached({{"depends"}, {modulePath.toString()}}); + }); addAction(this, menu, Tr::tr("Load Symbols for All Modules"), enabled && canLoadSymbols, -- cgit v1.2.1