4
* Copyright 2006 Vladimir Prus <ghost@cs.msu.su>
5
* Copyright 2007 Hamish Rodda <rodda@kde.org>
6
* Copyright 2009 Andreas Pakulat <apaku@gmx.de>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as
10
* published by the Free Software Foundation; either version 2 of the
11
* License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public
19
* License along with this program; if not, write to the
20
* Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
#include "gdblaunchconfig.h"
27
#include <kconfiggroup.h>
31
#include <kmessagebox.h>
32
#include <kparts/mainwindow.h>
34
#include <outputview/outputmodel.h>
35
#include <interfaces/ilaunchconfiguration.h>
36
#include <util/environmentgrouplist.h>
37
#include <interfaces/iproject.h>
38
#include <project/interfaces/iprojectbuilder.h>
39
#include <project/builderjob.h>
40
#include <interfaces/iuicontroller.h>
41
#include <project/interfaces/ibuildsystemmanager.h>
42
#include <util/executecompositejob.h>
43
#include <execute/iexecuteplugin.h>
45
#include "debugsession.h"
46
#include "debuggerplugin.h"
48
#include "ui_debuggerconfigwidget.h"
49
#include <interfaces/iplugincontroller.h>
50
#include <interfaces/icore.h>
53
using namespace KDevelop;
55
GdbConfigPage::GdbConfigPage( QWidget* parent )
56
: LaunchConfigurationPage(parent), ui( new Ui::DebuggerConfigWidget )
59
ui->kcfg_gdbPath->setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly);
60
connect(ui->kcfg_asmDemangle, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
61
connect(ui->kcfg_breakOnLoadingLibrary, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
62
connect(ui->kcfg_configGdbScript, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
63
//connect(ui->kcfg_dbgTerminal, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
64
connect(ui->kcfg_debuggingShell, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
65
connect(ui->kcfg_displayStaticMembers, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
66
connect(ui->kcfg_gdbPath, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
67
connect(ui->kcfg_runGdbScript, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
68
connect(ui->kcfg_runShellScript, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
71
KIcon GdbConfigPage::icon() const
76
void GdbConfigPage::loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProject* )
78
bool block = blockSignals( true );
79
ui->kcfg_gdbPath->setUrl( cfg.readEntry( GDBDebugger::gdbPathEntry, KUrl() ) );
80
ui->kcfg_debuggingShell->setUrl( cfg.readEntry( GDBDebugger::debuggerShellEntry, KUrl() ) );
81
ui->kcfg_configGdbScript->setUrl( cfg.readEntry( GDBDebugger::remoteGdbConfigEntry, KUrl() ) );
82
ui->kcfg_runShellScript->setUrl( cfg.readEntry( GDBDebugger::remoteGdbShellEntry, KUrl() ) );
83
ui->kcfg_runGdbScript->setUrl( cfg.readEntry( GDBDebugger::remoteGdbRunEntry, KUrl() ) );
84
ui->kcfg_displayStaticMembers->setChecked( cfg.readEntry(GDBDebugger::staticMembersEntry, false) );
85
ui->kcfg_asmDemangle->setChecked( cfg.readEntry( GDBDebugger::demangleNamesEntry, true) );
86
//TODO: add ui for this
87
//ui->kcfg_allowForceBP->setChecked( cfg.readEtnry( GDBDebugger::allowForcedBPEntry, true ) );
88
ui->kcfg_breakOnLoadingLibrary->setChecked( cfg.readEntry( GDBDebugger::breakOnLibLoadEntry, true) );
89
//ui->kcfg_dbgTerminal->setChecked( cfg.readEntry( GDBDebugger::separateTerminalEntry, false) );
90
blockSignals( block );
93
void GdbConfigPage::saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* ) const
95
cfg.writeEntry(GDBDebugger::gdbPathEntry, ui->kcfg_gdbPath->url() );
96
cfg.writeEntry(GDBDebugger::debuggerShellEntry, ui->kcfg_debuggingShell->url() );
97
cfg.writeEntry(GDBDebugger::remoteGdbConfigEntry, ui->kcfg_configGdbScript->url() );
98
cfg.writeEntry(GDBDebugger::remoteGdbShellEntry, ui->kcfg_runShellScript->url() );
99
cfg.writeEntry(GDBDebugger::remoteGdbRunEntry, ui->kcfg_runGdbScript->url() );
100
cfg.writeEntry(GDBDebugger::staticMembersEntry, ui->kcfg_displayStaticMembers->isChecked() );
101
cfg.writeEntry(GDBDebugger::demangleNamesEntry, ui->kcfg_asmDemangle->isChecked() );
102
cfg.writeEntry(GDBDebugger::breakOnLibLoadEntry, ui->kcfg_breakOnLoadingLibrary->isChecked() );
103
//cfg.writeEntry(GDBDebugger::separateTerminalEntry, ui->kcfg_dbgTerminal->isChecked() );
106
QString GdbConfigPage::title() const
108
return i18n( "GDB Configuration" );
112
GdbLauncher::GdbLauncher( GDBDebugger::CppDebuggerPlugin* p ) : m_plugin( p )
114
factoryList << new GdbConfigPageFactory();
117
QList< KDevelop::LaunchConfigurationPageFactory* > GdbLauncher::configPages() const
122
QString GdbLauncher::id()
127
QString GdbLauncher::name() const
132
KJob* GdbLauncher::start(const QString& launchMode, KDevelop::ILaunchConfiguration* cfg)
139
if( launchMode == "debug" )
141
IExecutePlugin* iface = KDevelop::ICore::self()->pluginController()->pluginForExtension("org.kdevelop.IExecutePlugin")->extension<IExecutePlugin>();
144
KJob* depjob = iface->dependecyJob(cfg);
149
l << new GDBDebugger::DebugJob( m_plugin, cfg );
150
return new KDevelop::ExecuteCompositeJob( KDevelop::ICore::self()->runController(), l );
152
kWarning() << "Unknown launch mode" << launchMode << "for config:" << cfg->name();
156
QStringList GdbLauncher::supportedModes() const
158
return QStringList() << "debug";
161
QString GdbLauncher::description() const
163
return i18n("Executes a Native application in GDB");
166
KDevelop::LaunchConfigurationPage* GdbConfigPageFactory::createWidget( QWidget* parent )
168
return new GdbConfigPage( parent );
173
#include "gdblaunchconfig.moc"