QNX: Add support for attaching to a running application

This adds a new menu item to the Debug -> Start Debugging menu,
which shows a processes dialog for the user, listing the processes
on the selected device. Clicking Attach to Application launches
pdebug on the device and then starts the gdb engine to attach
to the selected process.

This adds a DeviceTypeKitChooser class to ProjectExplorer, to
only have the KitChooser show kits configured for a specific
device type.

Change-Id: I1572dc76a6bdc4774dbf2e8cc96ca6bcf0f79a0a
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Tobias Nätterlund
2014-02-12 05:58:56 +01:00
committed by hjk
parent 7ed1576083
commit 8d319ce899
13 changed files with 565 additions and 5 deletions

View File

@@ -39,6 +39,7 @@
#include "blackberrydeploystepfactory.h"
#include "blackberryrunconfigurationfactory.h"
#include "blackberryruncontrolfactory.h"
#include "qnxattachdebugsupport.h"
#include "qnxdeviceconfigurationfactory.h"
#include "qnxruncontrolfactory.h"
#include "qnxdeploystepfactory.h"
@@ -55,19 +56,27 @@
#include "blackberryconfiguration.h"
#include "cascadesimport/cascadesimportwizard.h"
#include "qnxtoolchain.h"
#include "qnxattachdebugsupport.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/kitmanager.h>
#include <QAction>
#include <QtPlugin>
using namespace Qnx::Internal;
QNXPlugin::QNXPlugin()
: m_debugSeparator(0)
, m_attachToQnxApplication(0)
{
}
@@ -130,6 +139,23 @@ void QNXPlugin::extensionsInitialized()
{
ProjectExplorer::TaskHub::addCategory(Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR,
tr("Bar Descriptor"));
// Debug support
QnxAttachDebugSupport *debugSupport = new QnxAttachDebugSupport(this);
m_attachToQnxApplication = new QAction(this);
m_attachToQnxApplication->setText(tr("Attach to Remote QNX Application..."));
connect(m_attachToQnxApplication, SIGNAL(triggered()), debugSupport, SLOT(showProcessesDialog()));
const Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
mstart->appendGroup(Constants::QNX_DEBUGGING_GROUP);
mstart->addSeparator(globalcontext, Constants::QNX_DEBUGGING_GROUP, &m_debugSeparator);
Core::Command *cmd = Core::ActionManager::registerAction(m_attachToQnxApplication, "Debugger.AttachToQnxApplication", globalcontext);
mstart->addAction(cmd, Constants::QNX_DEBUGGING_GROUP);
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsChanged()), this, SLOT(updateDebuggerActions()));
}
ExtensionSystem::IPlugin::ShutdownFlag QNXPlugin::aboutToShutdown()
@@ -137,6 +163,23 @@ ExtensionSystem::IPlugin::ShutdownFlag QNXPlugin::aboutToShutdown()
return SynchronousShutdown;
}
void QNXPlugin::updateDebuggerActions()
{
bool hasValidQnxKit = false;
ProjectExplorer::DeviceTypeMatcher qnxTypeMatcher(Constants::QNX_QNX_OS_TYPE);
const QList<ProjectExplorer::Kit *> qnxKits = ProjectExplorer::KitManager::matchingKits(qnxTypeMatcher);
foreach (ProjectExplorer::Kit *qnxKit, qnxKits) {
if (qnxKit->isValid() && !ProjectExplorer::DeviceKitInformation::device(qnxKit).isNull()) {
hasValidQnxKit = true;
break;
}
}
m_attachToQnxApplication->setVisible(hasValidQnxKit);
m_debugSeparator->setVisible(hasValidQnxKit);
}
#ifdef WITH_TESTS
#include <QTest>