Commit e0fdc4fc authored by Peifeng Yu's avatar Peifeng Yu
Browse files

More clear seprate between gdb and lldb config entries

parent 44e9a143
......@@ -51,19 +51,28 @@ enum DataType { typeUnknown, typeValue, typePointer, typeReference,
typeName };
// FIXME: find a more appropriate place for these strings. Possibly a place specific to debugger backend
static const char gdbPathEntry[] = "GDB Path";
static const char debuggerShellEntry[] = "Debugger Shell";
static const char remoteGdbConfigEntry[] = "Remote GDB Config Script";
static const char remoteGdbShellEntry[] = "Remote GDB Shell Script";
static const char remoteGdbRunEntry[] = "Remote GDB Run Script";
static const char staticMembersEntry[] = "Display Static Members";
static const char demangleNamesEntry[] = "Display Demangle Names";
static const char allowForcedBPEntry[] = "Allow Forced Breakpoint Set";
static const char startWithEntry[] = "Start With";
static const char breakOnStartEntry[] = "Break on Start";
namespace Config {
static const char StartWithEntry[] = "Start With";
static const char BreakOnStartEntry[] = "Break on Start";
}
static const char lldbPathEntry[] = "LLDB Path";
static const char customLldbConfigEntry[] = "LLDB Config Script";
namespace GDB { namespace Config {
static const char GdbPathEntry[] = "GDB Path";
static const char DebuggerShellEntry[] = "Debugger Shell";
static const char RemoteGdbConfigEntry[] = "Remote GDB Config Script";
static const char RemoteGdbShellEntry[] = "Remote GDB Shell Script";
static const char RemoteGdbRunEntry[] = "Remote GDB Run Script";
static const char StaticMembersEntry[] = "Display Static Members";
static const char DemangleNamesEntry[] = "Display Demangle Names";
static const char AllowForcedBPEntry[] = "Allow Forced Breakpoint Set";
}
}
namespace LLDB { namespace Config {
static const char LldbPathEntry[] = "LLDB Path";
static const char ldbConfigScriptEntry[] = "LLDB Config Script";
}
}
} // end of namespace KDevMI
......
......@@ -113,7 +113,7 @@ void MIDebugJob::start()
setTitle(m_launchcfg->name());
KConfigGroup grp = m_launchcfg->config();
QString startWith = grp.readEntry(startWithEntry, QString("ApplicationOutput"));
QString startWith = grp.readEntry(Config::StartWithEntry, QString("ApplicationOutput"));
if (startWith == "GdbConsole") {
setVerbosity(Silent);
} else if (startWith == "FrameStack") {
......
......@@ -275,7 +275,7 @@ bool MIDebugSession::startDebugging(ILaunchConfiguration* cfg, IExecutePlugin* i
return false;
}
QString config_startWith = cfg->config().readEntry(startWithEntry, QStringLiteral("ApplicationOutput"));
QString config_startWith = cfg->config().readEntry(Config::StartWithEntry, QStringLiteral("ApplicationOutput"));
if (config_startWith == "GdbConsole") {
emit raiseDebuggerConsoleViews();
} else if (config_startWith == "FrameStack") {
......
......@@ -129,9 +129,9 @@ void DebugSession::configure(ILaunchConfiguration *cfg, IExecutePlugin *iexec)
{
// Read Configuration values
KConfigGroup grp = cfg->config();
bool breakOnStart = grp.readEntry(KDevMI::breakOnStartEntry, false);
bool displayStaticMembers = grp.readEntry(KDevMI::staticMembersEntry, false);
bool asmDemangle = grp.readEntry(KDevMI::demangleNamesEntry, true);
bool breakOnStart = grp.readEntry(KDevMI::Config::BreakOnStartEntry, false);
bool displayStaticMembers = grp.readEntry(Config::StaticMembersEntry, false);
bool asmDemangle = grp.readEntry(Config::DemangleNamesEntry, true);
if (breakOnStart) {
BreakpointModel* m = ICore::self()->debugController()->breakpointModel();
......@@ -188,9 +188,9 @@ bool DebugSession::execInferior(ILaunchConfiguration *cfg, IExecutePlugin *iexec
configure(cfg, iexec);
KConfigGroup grp = cfg->config();
QUrl configGdbScript = grp.readEntry(KDevMI::remoteGdbConfigEntry, QUrl());
QUrl runShellScript = grp.readEntry(KDevMI::remoteGdbShellEntry, QUrl());
QUrl runGdbScript = grp.readEntry(KDevMI::remoteGdbRunEntry, QUrl());
QUrl configGdbScript = grp.readEntry(Config::RemoteGdbConfigEntry, QUrl());
QUrl runShellScript = grp.readEntry(Config::RemoteGdbShellEntry, QUrl());
QUrl runGdbScript = grp.readEntry(Config::RemoteGdbRunEntry, QUrl());
// handle remote debug
if (configGdbScript.isValid()) {
......
......@@ -51,7 +51,7 @@ GdbDebugger::~GdbDebugger()
bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments)
{
// FIXME: verify that default value leads to something sensible
QUrl gdbUrl = config.readEntry(gdbPathEntry, QUrl());
QUrl gdbUrl = config.readEntry(Config::GdbPathEntry, QUrl());
if (gdbUrl.isEmpty()) {
debuggerBinary_ = "gdb";
} else {
......@@ -62,7 +62,7 @@ bool GdbDebugger::start(KConfigGroup& config, const QStringList& extraArguments)
QStringList arguments = extraArguments;
arguments << "--interpreter=mi2" << "-quiet";
QUrl shell = config.readEntry(debuggerShellEntry, QUrl());
QUrl shell = config.readEntry(Config::DebuggerShellEntry, QUrl());
if(!shell.isEmpty()) {
qCDebug(DEBUGGERGDB) << "have shell" << shell;
QString shell_without_args = shell.toLocalFile().split(QChar(' ')).first();
......
......@@ -44,6 +44,7 @@
#include <util/executecompositejob.h>
#include <execute/iexecuteplugin.h>
#include "dbgglobal.h"
#include "debugsession.h"
#include "debuggerplugin.h"
#include "midebugjobs.h"
......@@ -53,6 +54,7 @@
#include <interfaces/icore.h>
using namespace KDevelop;
namespace Config = KDevMI::GDB::Config;
GdbConfigPage::GdbConfigPage( QWidget* parent )
: LaunchConfigurationPage(parent), ui( new Ui::GdbConfigPage )
......@@ -88,27 +90,27 @@ QIcon GdbConfigPage::icon() const
void GdbConfigPage::loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProject* )
{
bool block = blockSignals( true );
ui->kcfg_gdbPath->setUrl( cfg.readEntry( KDevMI::gdbPathEntry, QUrl() ) );
ui->kcfg_debuggingShell->setUrl( cfg.readEntry( KDevMI::debuggerShellEntry, QUrl() ) );
ui->kcfg_configGdbScript->setUrl( cfg.readEntry( KDevMI::remoteGdbConfigEntry, QUrl() ) );
ui->kcfg_runShellScript->setUrl( cfg.readEntry( KDevMI::remoteGdbShellEntry, QUrl() ) );
ui->kcfg_runGdbScript->setUrl( cfg.readEntry( KDevMI::remoteGdbRunEntry, QUrl() ) );
ui->kcfg_displayStaticMembers->setChecked( cfg.readEntry(KDevMI::staticMembersEntry, false) );
ui->kcfg_asmDemangle->setChecked( cfg.readEntry( KDevMI::demangleNamesEntry, true) );
ui->kcfg_startWith->setCurrentIndex( ui->kcfg_startWith->findData( cfg.readEntry( KDevMI::startWithEntry, "ApplicationOutput" ) ) );
ui->kcfg_gdbPath->setUrl( cfg.readEntry( Config::GdbPathEntry, QUrl() ) );
ui->kcfg_debuggingShell->setUrl( cfg.readEntry( Config::DebuggerShellEntry, QUrl() ) );
ui->kcfg_configGdbScript->setUrl( cfg.readEntry( Config::RemoteGdbConfigEntry, QUrl() ) );
ui->kcfg_runShellScript->setUrl( cfg.readEntry( Config::RemoteGdbShellEntry, QUrl() ) );
ui->kcfg_runGdbScript->setUrl( cfg.readEntry( Config::RemoteGdbRunEntry, QUrl() ) );
ui->kcfg_displayStaticMembers->setChecked( cfg.readEntry( Config::StaticMembersEntry, false ) );
ui->kcfg_asmDemangle->setChecked( cfg.readEntry( Config::DemangleNamesEntry, true) );
ui->kcfg_startWith->setCurrentIndex( ui->kcfg_startWith->findData( cfg.readEntry( KDevMI::Config::StartWithEntry, "ApplicationOutput" ) ) );
blockSignals( block );
}
void GdbConfigPage::saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* ) const
{
cfg.writeEntry(KDevMI::gdbPathEntry, ui->kcfg_gdbPath->url() );
cfg.writeEntry(KDevMI::debuggerShellEntry, ui->kcfg_debuggingShell->url() );
cfg.writeEntry(KDevMI::remoteGdbConfigEntry, ui->kcfg_configGdbScript->url() );
cfg.writeEntry(KDevMI::remoteGdbShellEntry, ui->kcfg_runShellScript->url() );
cfg.writeEntry(KDevMI::remoteGdbRunEntry, ui->kcfg_runGdbScript->url() );
cfg.writeEntry(KDevMI::staticMembersEntry, ui->kcfg_displayStaticMembers->isChecked() );
cfg.writeEntry(KDevMI::demangleNamesEntry, ui->kcfg_asmDemangle->isChecked() );
cfg.writeEntry(KDevMI::startWithEntry, ui->kcfg_startWith->itemData( ui->kcfg_startWith->currentIndex() ).toString() );
cfg.writeEntry(Config::GdbPathEntry, ui->kcfg_gdbPath->url() );
cfg.writeEntry(Config::DebuggerShellEntry, ui->kcfg_debuggingShell->url() );
cfg.writeEntry(Config::RemoteGdbConfigEntry, ui->kcfg_configGdbScript->url() );
cfg.writeEntry(Config::RemoteGdbShellEntry, ui->kcfg_runShellScript->url() );
cfg.writeEntry(Config::RemoteGdbRunEntry, ui->kcfg_runGdbScript->url() );
cfg.writeEntry(Config::StaticMembersEntry, ui->kcfg_displayStaticMembers->isChecked() );
cfg.writeEntry(Config::DemangleNamesEntry, ui->kcfg_asmDemangle->isChecked() );
cfg.writeEntry(KDevMI::Config::StartWithEntry, ui->kcfg_startWith->itemData( ui->kcfg_startWith->currentIndex() ).toString() );
}
QString GdbConfigPage::title() const
......
......@@ -1031,7 +1031,7 @@ void GdbTest::testManualAttach()
TestDebugSession *session = new TestDebugSession;
TestLaunchConfiguration cfg;
cfg.config().writeEntry(remoteGdbRunEntry, QUrl::fromLocalFile(findSourceFile("gdb_script_empty")));
cfg.config().writeEntry(Config::RemoteGdbRunEntry, QUrl::fromLocalFile(findSourceFile("gdb_script_empty")));
QVERIFY(session->startDebugging(&cfg, m_iface));
session->addCommand(MI::NonMI, QString("attach %0").arg(debugeeProcess.pid()));
......@@ -1520,7 +1520,7 @@ void GdbTest::testPickupManuallyInsertedBreakpointOnlyOnce()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(remoteGdbConfigEntry, QUrl::fromLocalFile(configScript.fileName()));
grp.writeEntry(Config::RemoteGdbConfigEntry, QUrl::fromLocalFile(configScript.fileName()));
breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile("debugee.cpp"), 31);
QVERIFY(session->startDebugging(&cfg, m_iface));
......@@ -1541,7 +1541,7 @@ void GdbTest::testPickupCatchThrowOnlyOnce()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(remoteGdbConfigEntry, QUrl::fromLocalFile(configScript.fileName()));
grp.writeEntry(Config::RemoteGdbConfigEntry, QUrl::fromLocalFile(configScript.fileName()));
for (int i = 0; i < 2; ++i) {
......@@ -1567,7 +1567,7 @@ void GdbTest::testRunGdbScript()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(remoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
grp.writeEntry(Config::RemoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
QVERIFY(session->startDebugging(&cfg, m_iface));
......@@ -1605,8 +1605,8 @@ void GdbTest::testRemoteDebug()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(remoteGdbShellEntry, QUrl::fromLocalFile((shellScript.fileName()+"-copy")));
grp.writeEntry(remoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
grp.writeEntry(Config::RemoteGdbShellEntry, QUrl::fromLocalFile((shellScript.fileName()+"-copy")));
grp.writeEntry(Config::RemoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
QVERIFY(session->startDebugging(&cfg, m_iface));
......@@ -1649,8 +1649,8 @@ void GdbTest::testRemoteDebugInsertBreakpoint()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(remoteGdbShellEntry, QUrl::fromLocalFile(shellScript.fileName()+"-copy"));
grp.writeEntry(remoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
grp.writeEntry(Config::RemoteGdbShellEntry, QUrl::fromLocalFile(shellScript.fileName()+"-copy"));
grp.writeEntry(Config::RemoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
QVERIFY(session->startDebugging(&cfg, m_iface));
......@@ -1700,8 +1700,8 @@ void GdbTest::testRemoteDebugInsertBreakpointPickupOnlyOnce()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(remoteGdbShellEntry, QUrl::fromLocalFile((shellScript.fileName()+"-copy")));
grp.writeEntry(remoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
grp.writeEntry(Config::RemoteGdbShellEntry, QUrl::fromLocalFile((shellScript.fileName()+"-copy")));
grp.writeEntry(Config::RemoteGdbRunEntry, QUrl::fromLocalFile(runScript.fileName()));
QVERIFY(session->startDebugging(&cfg, m_iface));
......
......@@ -125,11 +125,11 @@ void DebugSession::configure(ILaunchConfiguration *cfg, IExecutePlugin *)
{
// Read Configuration values
KConfigGroup grp = cfg->config();
QUrl configLldbScript = grp.readEntry(KDevMI::customLldbConfigEntry, QUrl());
QUrl configLldbScript = grp.readEntry(Config::ldbConfigScriptEntry, QUrl());
// break on start: can't use "-exec-run --start" because in lldb-mi
// the inferior stops without any notification
bool breakOnStart = grp.readEntry(KDevMI::breakOnStartEntry, false);
bool breakOnStart = grp.readEntry(KDevMI::Config::BreakOnStartEntry, false);
if (breakOnStart) {
BreakpointModel* m = ICore::self()->debugController()->breakpointModel();
bool found = false;
......
......@@ -50,7 +50,7 @@ LldbDebugger::~LldbDebugger()
bool LldbDebugger::start(KConfigGroup& config, const QStringList& extraArguments)
{
QUrl lldbUrl = config.readEntry(lldbPathEntry, QUrl());
QUrl lldbUrl = config.readEntry(Config::LldbPathEntry, QUrl());
if (!lldbUrl.isValid() || !lldbUrl.isLocalFile()) {
debuggerBinary_ = "lldb-mi";
} else {
......
......@@ -311,7 +311,7 @@ void LldbTest::testBreakOnStart()
TestDebugSession *session = new TestDebugSession;
TestLaunchConfiguration cfg;
cfg.config().writeEntry(KDevMI::breakOnStartEntry, true);
cfg.config().writeEntry(KDevMI::Config::BreakOnStartEntry, true);
QVERIFY(session->startDebugging(&cfg, m_iface));
WAIT_FOR_STATE(session, DebugSession::PausedState);
......@@ -832,7 +832,7 @@ void LldbTest::testPickupManuallyInsertedBreakpointOnlyOnce()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(KDevMI::customLldbConfigEntry, QUrl::fromLocalFile(configScript.fileName()));
grp.writeEntry(Config::ldbConfigScriptEntry, QUrl::fromLocalFile(configScript.fileName()));
breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile("debugee.cpp"), 31);
......@@ -1736,7 +1736,7 @@ void LldbTest::testRunLldbScript()
TestLaunchConfiguration cfg;
KConfigGroup grp = cfg.config();
grp.writeEntry(customLldbConfigEntry, QUrl::fromLocalFile(runScript.fileName()));
grp.writeEntry(Config::ldbConfigScriptEntry, QUrl::fromLocalFile(runScript.fileName()));
QVERIFY(session->startDebugging(&cfg, m_iface));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment