Debugger: Have a generic "GDB in PATH on Build Device" item

This is only checked at run-time, but allows smoother creation of
kits for standard setups as the (possibly remote) full path is
not needed.

Remove the DebuggerKitAspect::fixup() implementation. Too much magic
by now, and worst thing that could happen is a non-matching debugger
that will clearly bark when used.

Change-Id: If2414610d479a5b93c3e6227b8736ddc61f70635
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-03-28 07:40:26 +02:00
parent 5cfc52a92c
commit 463e47bbdd
4 changed files with 44 additions and 81 deletions

View File

@@ -170,6 +170,7 @@ class DebuggerItemModel : public TreeModel<TreeItem, StaticTreeItem, DebuggerTre
{
public:
DebuggerItemModel();
enum { Generic, AutoDetected, Manual };
QModelIndex lastIndex() const;
void setCurrentIndex(const QModelIndex &index);
@@ -202,16 +203,35 @@ const DebuggerItem *findDebugger(const Predicate &pred)
DebuggerItemModel::DebuggerItemModel()
{
setHeader({Tr::tr("Name"), Tr::tr("Path"), Tr::tr("Type")});
rootItem()->appendChild(
new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
{ProjectExplorer::Constants::msgAutoDetectedToolTip()}));
auto generic = new StaticTreeItem(Tr::tr("Generic"));
auto autoDetected = new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
{ProjectExplorer::Constants::msgAutoDetectedToolTip()});
rootItem()->appendChild(generic);
rootItem()->appendChild(autoDetected);
rootItem()->appendChild(new StaticTreeItem(ProjectExplorer::Constants::msgManual()));
DebuggerItem genericGdb(QVariant("gdb"));
genericGdb.setAutoDetected(true);
genericGdb.setEngineType(GdbEngineType);
genericGdb.setAbi(Abi());
genericGdb.setCommand("gdb");
genericGdb.setUnexpandedDisplayName(Tr::tr("%1 from PATH on Build Device").arg("GDB"));
generic->appendChild(new DebuggerTreeItem(genericGdb, false));
DebuggerItem genericLldb(QVariant("lldb"));
genericLldb.setAutoDetected(true);
genericLldb.setEngineType(LldbEngineType);
genericLldb.setAbi(Abi());
genericLldb.setCommand("lldb");
genericLldb.setUnexpandedDisplayName(Tr::tr("%1 from PATH on Build Device").arg("LLDB"));
generic->appendChild(new DebuggerTreeItem(genericLldb, false));
}
void DebuggerItemModel::addDebugger(const DebuggerItem &item, bool changed)
{
QTC_ASSERT(item.id().isValid(), return);
int group = item.isAutoDetected() ? 0 : 1;
int group = item.isAutoDetected() ? AutoDetected : Manual;
rootItem()->childAt(group)->appendChild(new DebuggerTreeItem(item, changed));
}