Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
b373242a
Commit
b373242a
authored
May 05, 2009
by
hjk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugger: use current run configuration to read symbols for gdbserver
parent
bae65259
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
209 additions
and
126 deletions
+209
-126
src/plugins/debugger/commonoptionspage.ui
src/plugins/debugger/commonoptionspage.ui
+1
-1
src/plugins/debugger/debuggermanager.cpp
src/plugins/debugger/debuggermanager.cpp
+50
-74
src/plugins/debugger/debuggermanager.h
src/plugins/debugger/debuggermanager.h
+5
-11
src/plugins/debugger/debuggerplugin.cpp
src/plugins/debugger/debuggerplugin.cpp
+75
-14
src/plugins/debugger/debuggerplugin.h
src/plugins/debugger/debuggerplugin.h
+12
-0
src/plugins/debugger/debuggerrunner.cpp
src/plugins/debugger/debuggerrunner.cpp
+30
-19
src/plugins/debugger/debuggerrunner.h
src/plugins/debugger/debuggerrunner.h
+12
-2
src/plugins/debugger/gdbengine.cpp
src/plugins/debugger/gdbengine.cpp
+23
-5
src/plugins/debugger/gdbengine.h
src/plugins/debugger/gdbengine.h
+1
-0
No files found.
src/plugins/debugger/commonoptionspage.ui
View file @
b373242a
...
...
@@ -33,7 +33,7 @@
<item>
<widget
class=
"QCheckBox"
name=
"checkBoxUseAlternatingRowColors"
>
<property
name=
"text"
>
<string>
Use alternating row colors in debug views
.
</string>
<string>
Use alternating row colors in debug views
</string>
</property>
</widget>
</item>
...
...
src/plugins/debugger/debuggermanager.cpp
View file @
b373242a
...
...
@@ -30,6 +30,7 @@
#include "debuggermanager.h"
#include "debuggeractions.h"
#include "debuggerrunner.h"
#include "debuggerconstants.h"
#include "idebuggerengine.h"
...
...
@@ -172,7 +173,7 @@ void DebuggerManager::init()
m_busy
=
false
;
m_attachedPID
=
0
;
m_
startMode
=
StartInternal
;
m_
runControl
=
0
;
m_disassemblerHandler
=
0
;
m_modulesHandler
=
0
;
...
...
@@ -295,21 +296,6 @@ void DebuggerManager::init()
connect
(
m_watchHandler
,
SIGNAL
(
watchModelUpdateRequested
()),
this
,
SLOT
(
updateWatchModel
()));
m_startExternalAction
=
new
QAction
(
this
);
m_startExternalAction
->
setText
(
tr
(
"Start and Debug External Application..."
));
m_attachExternalAction
=
new
QAction
(
this
);
m_attachExternalAction
->
setText
(
tr
(
"Attach to Running External Application..."
));
m_attachCoreAction
=
new
QAction
(
this
);
m_attachCoreAction
->
setText
(
tr
(
"Attach to Core..."
));
connect
(
m_attachCoreAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachCore
()));
m_attachRemoteAction
=
new
QAction
(
this
);
m_attachRemoteAction
->
setText
(
tr
(
"Attach to Running Remote Application..."
));
connect
(
m_attachRemoteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachRemoteApplication
()));
m_continueAction
=
new
QAction
(
this
);
m_continueAction
->
setText
(
tr
(
"Continue"
));
m_continueAction
->
setIcon
(
QIcon
(
":/gdbdebugger/images/debugger_continue_small.png"
));
...
...
@@ -371,11 +357,6 @@ void DebuggerManager::init()
connect
(
m_continueAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
continueExec
()));
connect
(
m_startExternalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
startExternalApplication
()));
connect
(
m_attachExternalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachExternalApplication
()));
connect
(
m_stopAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
interruptDebuggingRequest
()));
connect
(
m_resetAction
,
SIGNAL
(
triggered
()),
...
...
@@ -798,30 +779,6 @@ void DebuggerManager::setConfigValue(const QString &name, const QVariant &value)
emit
setConfigValueRequested
(
name
,
value
);
}
void
DebuggerManager
::
startExternalApplication
()
{
if
(
!
startNewDebugger
(
StartExternal
))
emit
debuggingFinished
();
}
void
DebuggerManager
::
attachExternalApplication
()
{
if
(
!
startNewDebugger
(
AttachExternal
))
emit
debuggingFinished
();
}
void
DebuggerManager
::
attachCore
()
{
if
(
!
startNewDebugger
(
AttachCore
))
emit
debuggingFinished
();
}
void
DebuggerManager
::
attachRemoteApplication
()
{
if
(
!
startNewDebugger
(
AttachRemote
))
emit
debuggingFinished
();
}
// Figure out the debugger type of an executable
static
bool
determineDebuggerType
(
const
QString
&
executable
,
DebuggerManager
::
DebuggerType
*
dt
,
...
...
@@ -869,12 +826,13 @@ static bool determineDebuggerType(int /* pid */,
return
true
;
}
bool
DebuggerManager
::
startNewDebugger
(
DebuggerStartMode
mode
)
void
DebuggerManager
::
startNewDebugger
(
DebuggerRunControl
*
runControl
)
{
m_runControl
=
runControl
;
if
(
Debugger
::
Constants
::
Internal
::
debug
)
qDebug
()
<<
Q_FUNC_INFO
<<
mode
;
qDebug
()
<<
Q_FUNC_INFO
<<
startMode
()
;
m_startMode
=
mode
;
// FIXME: Clean up
switch
(
startMode
())
{
...
...
@@ -884,8 +842,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
configValue
(
_
(
"LastExternalExecutableFile"
)).
toString
());
dlg
.
setExecutableArguments
(
configValue
(
_
(
"LastExternalExecutableArguments"
)).
toString
());
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
return
false
;
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
{
runControl
->
debuggingFinished
();
return
;
}
setConfigValue
(
_
(
"LastExternalExecutableFile"
),
dlg
.
executableFile
());
setConfigValue
(
_
(
"LastExternalExecutableArguments"
),
...
...
@@ -898,8 +858,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
}
case
AttachExternal
:
{
AttachExternalDialog
dlg
(
mainWindow
());
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
return
false
;
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
{
runControl
->
debuggingFinished
();
return
;
}
m_executable
=
QString
();
m_processArgs
=
QStringList
();
m_workingDir
=
QString
();
...
...
@@ -907,7 +869,8 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
if
(
m_attachedPID
==
0
)
{
QMessageBox
::
warning
(
mainWindow
(),
tr
(
"Warning"
),
tr
(
"Cannot attach to PID 0"
));
return
false
;
runControl
->
debuggingFinished
();
return
;
}
break
;
}
...
...
@@ -924,8 +887,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
}
StartExternalDialog
dlg
(
mainWindow
());
dlg
.
setExecutableFile
(
startDirectory
);
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
return
false
;
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
{
runControl
->
debuggingFinished
();
return
;
}
m_executable
=
dlg
.
executableFile
();
m_processArgs
=
dlg
.
executableArguments
().
split
(
' '
);
m_workingDir
=
QString
();
...
...
@@ -943,8 +908,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
configValue
(
_
(
"LastExternalExecutableFile"
)).
toString
());
dlg
.
setCoreFile
(
configValue
(
_
(
"LastExternalCoreFile"
)).
toString
());
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
return
false
;
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
{
runControl
->
debuggingFinished
();
return
;
}
setConfigValue
(
_
(
"LastExternalExecutableFile"
),
dlg
.
executableFile
());
setConfigValue
(
_
(
"LastExternalCoreFile"
),
...
...
@@ -963,8 +930,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
dlg
.
setRemoteArchitectures
(
arches
);
dlg
.
setRemoteChannel
(
configValue
(
_
(
"LastRemoteChannel"
)).
toString
());
dlg
.
setRemoteArchitecture
(
configValue
(
_
(
"LastRemoteArchtecture"
)).
toString
());
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
return
false
;
if
(
dlg
.
exec
()
!=
QDialog
::
Accepted
)
{
runControl
->
debuggingFinished
();
return
;
}
setConfigValue
(
_
(
"LastRemoteChannel"
),
dlg
.
remoteChannel
());
setConfigValue
(
_
(
"LastRemoteArchitecture"
),
dlg
.
remoteArchitecture
());
m_remoteChannel
=
dlg
.
remoteChannel
();
...
...
@@ -983,8 +952,8 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
if
(
!
hasDebugger
)
{
QMessageBox
::
warning
(
mainWindow
(),
tr
(
"Warning"
),
tr
(
"Cannot debug '%1': %2"
).
arg
(
m_executable
,
errorMessage
));
return
false
;
debuggingFinished
()
;
return
;
}
if
(
Debugger
::
Constants
::
Internal
::
debug
)
qDebug
()
<<
m_executable
<<
type
;
...
...
@@ -994,10 +963,11 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
setStatus
(
DebuggerProcessStartingUp
);
if
(
!
m_engine
->
startDebugger
())
{
setStatus
(
DebuggerProcessNotReady
);
return
false
;
debuggingFinished
();
return
;
}
return
true
;
return
;
}
void
DebuggerManager
::
cleanupViews
()
...
...
@@ -1257,20 +1227,21 @@ void DebuggerManager::setStatus(int status)
||
status
==
DebuggerInferiorStopRequested
||
status
==
DebuggerInferiorStopped
;
const
bool
starting
=
status
==
DebuggerProcessStartingUp
;
//
const bool starting = status == DebuggerProcessStartingUp;
const
bool
running
=
status
==
DebuggerInferiorRunning
;
const
bool
ready
=
status
==
DebuggerInferiorStopped
&&
startMode
()
!=
AttachCore
;
m_startExternalAction
->
setEnabled
(
!
started
&&
!
starting
);
m_attachExternalAction
->
setEnabled
(
!
started
&&
!
starting
);
#ifdef Q_OS_WIN
m_attachCoreAction
->
setEnabled
(
false
);
#else
m_attachCoreAction
->
setEnabled
(
!
started
&&
!
starting
);
#endif
m_attachRemoteAction
->
setEnabled
(
!
started
&&
!
starting
);
// FIXME
// m_startExternalAction->setEnabled(!started && !starting);
// m_attachExternalAction->setEnabled(!started && !starting);
//#ifdef Q_OS_WIN
// m_attachCoreAction->setEnabled(false);
//#else
// m_attachCoreAction->setEnabled(!started && !starting);
//#endif
// m_attachRemoteAction->setEnabled(!started && !starting);
m_watchAction
->
setEnabled
(
ready
);
m_breakAction
->
setEnabled
(
true
);
...
...
@@ -1570,6 +1541,12 @@ void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
}
}
DebuggerStartMode
DebuggerManager
::
startMode
()
const
{
return
m_runControl
->
startMode
();
}
//////////////////////////////////////////////////////////////////////
//
// Testing
...
...
@@ -1581,8 +1558,7 @@ void DebuggerManager::runTest(const QString &fileName)
m_executable
=
fileName
;
m_processArgs
=
QStringList
()
<<
"--run-debuggee"
;
m_workingDir
=
QString
();
if
(
!
startNewDebugger
(
StartInternal
))
emit
debuggingFinished
();
//startNewDebugger(StartInternal);
}
#include "debuggermanager.moc"
src/plugins/debugger/debuggermanager.h
View file @
b373242a
...
...
@@ -56,6 +56,7 @@ namespace Debugger {
namespace
Internal
{
class
DebuggerOutputWindow
;
class
DebuggerRunControl
;
class
DebuggerPlugin
;
class
DebugMode
;
...
...
@@ -204,7 +205,7 @@ public:
enum
DebuggerType
{
GdbDebugger
,
ScriptDebugger
,
WinDebugger
};
public
slots
:
bool
startNewDebugger
(
DebuggerStartMode
mode
);
void
startNewDebugger
(
DebuggerRunControl
*
runControl
);
void
exitDebugger
();
void
setSimpleDockWidgetArrangement
();
...
...
@@ -223,10 +224,6 @@ public slots:
void
resetLocation
();
void
interruptDebuggingRequest
();
void
startExternalApplication
();
void
attachExternalApplication
();
void
attachCore
();
void
attachRemoteApplication
();
void
jumpToLineExec
();
void
runToLineExec
();
...
...
@@ -328,7 +325,8 @@ public:
// one of the interfaces
QAbstractItemModel
*
threadsModel
();
int
status
()
const
{
return
m_status
;
}
DebuggerStartMode
startMode
()
const
{
return
m_startMode
;
}
DebuggerStartMode
startMode
()
const
;
DebuggerRunControl
*
runControl
()
const
{
return
m_runControl
;
}
QList
<
Symbol
>
moduleSymbols
(
const
QString
&
moduleName
);
...
...
@@ -377,7 +375,7 @@ private:
BreakpointData
*
findBreakpoint
(
const
QString
&
fileName
,
int
lineNumber
);
void
setToolTipExpression
(
const
QPoint
&
pos
,
const
QString
&
exp0
);
Debugger
StartMode
m_startMode
;
Debugger
RunControl
*
m_runControl
;
DebuggerType
m_debuggerType
;
/// Views
...
...
@@ -405,10 +403,6 @@ private:
/// Actions
friend
class
DebuggerPlugin
;
QAction
*
m_startExternalAction
;
QAction
*
m_attachExternalAction
;
QAction
*
m_attachCoreAction
;
QAction
*
m_attachRemoteAction
;
QAction
*
m_continueAction
;
QAction
*
m_stopAction
;
QAction
*
m_resetAction
;
// FIXME: Should not be needed in a stable release
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
b373242a
...
...
@@ -463,31 +463,48 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
//Core::ActionContainer *mcppcontext =
// am->actionContainer(CppEditor::Constants::M_CONTEXT);
// External apps
m_startExternalAction
=
new
QAction
(
this
);
m_startExternalAction
->
setText
(
tr
(
"Start and Debug External Application..."
));
connect
(
m_startExternalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
startExternalApplication
()));
m_attachExternalAction
=
new
QAction
(
this
);
m_attachExternalAction
->
setText
(
tr
(
"Attach to Running External Application..."
));
connect
(
m_attachExternalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachExternalApplication
()));
m_attachCoreAction
=
new
QAction
(
this
);
m_attachCoreAction
->
setText
(
tr
(
"Attach to Core..."
));
connect
(
m_attachCoreAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachCore
()));
m_attachRemoteAction
=
new
QAction
(
this
);
m_attachRemoteAction
->
setText
(
tr
(
"Attach to Running Remote Application..."
));
connect
(
m_attachRemoteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
attachRemoteApplication
()));
Core
::
ActionContainer
*
mdebug
=
am
->
actionContainer
(
ProjectExplorer
::
Constants
::
M_DEBUG
);
Core
::
Command
*
cmd
=
0
;
cmd
=
am
->
registerAction
(
m_
manager
->
m_
startExternalAction
,
cmd
=
am
->
registerAction
(
m_startExternalAction
,
Constants
::
STARTEXTERNAL
,
globalcontext
);
mdebug
->
addAction
(
cmd
,
Core
::
Constants
::
G_DEFAULT_ONE
);
cmd
=
am
->
registerAction
(
m_
manager
->
m_
attachExternalAction
,
cmd
=
am
->
registerAction
(
m_attachExternalAction
,
Constants
::
ATTACHEXTERNAL
,
globalcontext
);
mdebug
->
addAction
(
cmd
,
Core
::
Constants
::
G_DEFAULT_ONE
);
if
(
m_manager
->
m_attachCoreAction
)
{
cmd
=
am
->
registerAction
(
m_manager
->
m_attachCoreAction
,
Constants
::
ATTACHCORE
,
globalcontext
);
mdebug
->
addAction
(
cmd
,
Core
::
Constants
::
G_DEFAULT_ONE
);
}
cmd
=
am
->
registerAction
(
m_attachCoreAction
,
Constants
::
ATTACHCORE
,
globalcontext
);
mdebug
->
addAction
(
cmd
,
Core
::
Constants
::
G_DEFAULT_ONE
);
#if
0
#if
1
// FIXME: not yet functional
if (m_manager->m_attachRemoteAction) {
cmd = am->registerAction(m_manager->m_attachRemoteAction,
Constants::ATTACHREMOTE, globalcontext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
}
cmd
=
am
->
registerAction
(
m_attachRemoteAction
,
Constants
::
ATTACHREMOTE
,
globalcontext
);
mdebug
->
addAction
(
cmd
,
Core
::
Constants
::
G_DEFAULT_ONE
);
#endif
cmd
=
am
->
registerAction
(
m_manager
->
m_continueAction
,
...
...
@@ -642,7 +659,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
m_debugMode
=
new
DebugMode
(
this
);
//addAutoReleasedObject(m_debugMode);
addAutoReleasedObject
(
new
DebuggerRunner
(
m_manager
));
// register factory of DebuggerRunControl
m_debuggerRunner
=
new
DebuggerRunner
(
m_manager
);
addAutoReleasedObject
(
m_debuggerRunner
);
QList
<
int
>
context
;
context
.
append
(
uidm
->
uniqueIdentifier
(
Core
::
Constants
::
C_EDITORMANAGER
));
...
...
@@ -1036,6 +1055,48 @@ void DebuggerPlugin::showSettingsDialog()
QLatin1String
(
Debugger
::
Constants
::
DEBUGGER_COMMON_SETTINGS_PAGE
));
}
static
QSharedPointer
<
RunConfiguration
>
activeRunConfiguration
()
{
ProjectExplorer
::
Project
*
project
=
ProjectExplorerPlugin
::
instance
()
->
currentProject
();
if
(
project
)
return
project
->
activeRunConfiguration
();
return
QSharedPointer
<
RunConfiguration
>
();
}
void
DebuggerPlugin
::
startExternalApplication
()
{
QSharedPointer
<
RunConfiguration
>
rc
=
activeRunConfiguration
();
if
(
RunControl
*
runControl
=
m_debuggerRunner
->
run
(
rc
,
ProjectExplorer
::
Constants
::
DEBUGMODE
,
StartExternal
))
runControl
->
start
();
}
void
DebuggerPlugin
::
attachExternalApplication
()
{
QSharedPointer
<
RunConfiguration
>
rc
=
activeRunConfiguration
();
if
(
RunControl
*
runControl
=
m_debuggerRunner
->
run
(
rc
,
ProjectExplorer
::
Constants
::
DEBUGMODE
,
AttachExternal
))
runControl
->
start
();
}
void
DebuggerPlugin
::
attachCore
()
{
QSharedPointer
<
RunConfiguration
>
rc
=
activeRunConfiguration
();
if
(
RunControl
*
runControl
=
m_debuggerRunner
->
run
(
rc
,
ProjectExplorer
::
Constants
::
DEBUGMODE
,
AttachCore
))
runControl
->
start
();
}
void
DebuggerPlugin
::
attachRemoteApplication
()
{
QSharedPointer
<
RunConfiguration
>
rc
=
activeRunConfiguration
();
if
(
RunControl
*
runControl
=
m_debuggerRunner
->
run
(
rc
,
ProjectExplorer
::
Constants
::
DEBUGMODE
,
AttachRemote
))
runControl
->
start
();
}
#include "debuggerplugin.moc"
Q_EXPORT_PLUGIN
(
DebuggerPlugin
)
src/plugins/debugger/debuggerplugin.h
View file @
b373242a
...
...
@@ -56,6 +56,7 @@ namespace Internal {
class
BreakpointData
;
class
DebuggerManager
;
class
DebuggerRunner
;
class
DebugMode
;
class
LocationMark
;
...
...
@@ -96,6 +97,11 @@ private slots:
void
focusCurrentEditor
(
Core
::
IMode
*
mode
);
void
showSettingsDialog
();
void
startExternalApplication
();
void
attachExternalApplication
();
void
attachCore
();
void
attachRemoteApplication
();
private:
void
readSettings
();
void
writeSettings
()
const
;
...
...
@@ -107,12 +113,18 @@ private:
DebuggerManager
*
m_manager
;
DebugMode
*
m_debugMode
;
DebuggerRunner
*
m_debuggerRunner
;
QString
m_previousMode
;
LocationMark
*
m_locationMark
;
int
m_gdbRunningContext
;
QAction
*
m_toggleLockedAction
;
QAction
*
m_startExternalAction
;
QAction
*
m_attachExternalAction
;
QAction
*
m_attachCoreAction
;
QAction
*
m_attachRemoteAction
;
};
}
// namespace Internal
...
...
src/plugins/debugger/debuggerrunner.cpp
View file @
b373242a
...
...
@@ -57,6 +57,7 @@ using ProjectExplorer::ApplicationRunConfiguration;
//
////////////////////////////////////////////////////////////////////////
// A factory to create DebuggerRunControls
DebuggerRunner
::
DebuggerRunner
(
DebuggerManager
*
manager
)
:
m_manager
(
manager
)
{}
...
...
@@ -72,14 +73,23 @@ QString DebuggerRunner::displayName() const
return
tr
(
"Debug"
);
}
RunControl
*
DebuggerRunner
::
run
(
RunConfigurationPtr
runConfiguration
,
const
QString
&
mode
)
RunControl
*
DebuggerRunner
::
run
(
RunConfigurationPtr
runConfiguration
,
const
QString
&
mode
,
DebuggerStartMode
startMode
)
{
QTC_ASSERT
(
mode
==
ProjectExplorer
::
Constants
::
DEBUGMODE
,
return
0
);
ApplicationRunConfigurationPtr
rc
=
qSharedPointerCast
<
ApplicationRunConfiguration
>
(
runConfiguration
);
QTC_ASSERT
(
rc
,
return
0
);
//
QTC_ASSERT(rc, return 0);
//qDebug() << "***** Debugging" << rc->name() << rc->executable();
return
new
DebuggerRunControl
(
m_manager
,
rc
);
DebuggerRunControl
*
runControl
=
new
DebuggerRunControl
(
m_manager
,
rc
);
runControl
->
setStartMode
(
startMode
);
return
runControl
;
}
RunControl
*
DebuggerRunner
::
run
(
RunConfigurationPtr
runConfiguration
,
const
QString
&
mode
)
{
return
run
(
runConfiguration
,
mode
,
StartInternal
);
}
QWidget
*
DebuggerRunner
::
configurationWidget
(
RunConfigurationPtr
runConfiguration
)
...
...
@@ -120,24 +130,25 @@ void DebuggerRunControl::start()
m_running
=
true
;
ApplicationRunConfigurationPtr
rc
=
qSharedPointerCast
<
ApplicationRunConfiguration
>
(
runConfiguration
());
QTC_ASSERT
(
rc
,
return
);
ProjectExplorer
::
Project
*
project
=
rc
->
project
();
QTC_ASSERT
(
project
,
return
);
m_manager
->
m_executable
=
rc
->
executable
();
m_manager
->
m_environment
=
rc
->
environment
().
toStringList
();
m_manager
->
m_workingDir
=
rc
->
workingDirectory
();
m_manager
->
m_processArgs
=
rc
->
commandLineArguments
();
m_manager
->
m_dumperLib
=
rc
->
dumperLibrary
();
m_manager
->
m_buildDir
=
project
->
buildDirectory
(
project
->
activeBuildConfiguration
());
m_manager
->
m_useTerminal
=
rc
->
runMode
()
==
ApplicationRunConfiguration
::
Console
;
if
(
rc
)
{
m_manager
->
m_executable
=
rc
->
executable
();
m_manager
->
m_environment
=
rc
->
environment
().
toStringList
();
m_manager
->
m_workingDir
=
rc
->
workingDirectory
();
m_manager
->
m_processArgs
=
rc
->
commandLineArguments
();
m_manager
->
m_dumperLib
=
rc
->
dumperLibrary
();
ProjectExplorer
::
Project
*
project
=
rc
->
project
();
QTC_ASSERT
(
project
,
/**/
);
if
(
project
)
{
m_manager
->
m_buildDir
=
project
->
buildDirectory
(
project
->
activeBuildConfiguration
());
}
m_manager
->
m_useTerminal
=
rc
->
runMode
()
==
ApplicationRunConfiguration
::
Console
;
}
//emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
if
(
m_manager
->
startNewDebugger
(
StartInternal
))
emit
started
();
else
debuggingFinished
();
m_manager
->
startNewDebugger
(
this
);
emit
started
();
//debuggingFinished();
}
void
DebuggerRunControl
::
slotAddToOutputWindowInline
(
const
QString
&
data
)
...
...
src/plugins/debugger/debuggerrunner.h
View file @
b373242a
...
...
@@ -30,6 +30,8 @@
#ifndef DEBUGGERRUNNER_H
#define DEBUGGERRUNNER_H
#include "debuggermanager.h"
#include <projectexplorer/runconfiguration.h>
namespace
ProjectExplorer
{
...
...
@@ -55,17 +57,20 @@ class DebuggerRunner : public ProjectExplorer::IRunConfigurationRunner
public:
explicit
DebuggerRunner
(
DebuggerManager
*
manager
);
// ProjectExplorer::IRunConfigurationRunner
virtual
bool
canRun
(
RunConfigurationPtr
runConfiguration
,
const
QString
&
mode
);
virtual
QString
displayName
()
const
;
virtual
ProjectExplorer
::
RunControl
*
run
(
RunConfigurationPtr
runConfiguration
,
const
QString
&
mode
);
virtual
QWidget
*
configurationWidget
(
RunConfigurationPtr
runConfiguration
);
virtual
ProjectExplorer
::
RunControl
*
run
(
RunConfigurationPtr
runConfiguration
,
const
QString
&
mode
,
DebuggerStartMode
startMode
);
private:
DebuggerManager
*
m_manager
;
};
// This is a job description
class
DebuggerRunControl
:
public
ProjectExplorer
::
RunControl
{
Q_OBJECT
...
...
@@ -74,20 +79,25 @@ public:
DebuggerRunControl
(
DebuggerManager
*
manager
,
ApplicationRunConfigurationPtr
runConfiguration
);
// ProjectExplorer::RunControl
virtual
void
start
();
virtual
void
stop
();
virtual
bool
isRunning
()
const
;
void
setStartMode
(
DebuggerStartMode
mode
)
{
m_mode
=
mode
;
}
DebuggerStartMode
startMode
()
const
{
return
m_mode
;
}
Q_SLOT
void
debuggingFinished
();
signals:
void
stopRequested
();
private
slots
:
void
debuggingFinished
();
void
slotAddToOutputWindowInline
(
const
QString
&
output
);
private:
DebuggerManager
*
m_manager
;
bool
m_running
;
DebuggerStartMode
m_mode
;
};
}
// namespace Internal
...
...
src/plugins/debugger/gdbengine.cpp
View file @
b373242a
...
...
@@ -1313,7 +1313,7 @@ void GdbEngine::exitDebugger()
qDebug
()
<<
"STATUS ON EXITDEBUGGER: "
<<
q
->
status
());
interruptInferior
();
}
if
(
q
->
startMode
()
==
AttachExternal
)
if
(
q
->
startMode
()
==
AttachExternal
||
q
->
startMode
()
==
AttachRemote
)
execCommand
(
_
(
"detach"
));
else
execCommand
(
_
(
"kill"
));
...
...
@@ -1496,11 +1496,13 @@ bool GdbEngine::startDebugger()
qq
->
breakHandler
()
->
removeAllBreakpoints
();
}
else
if
(
q
->
startMode
()
==
AttachRemote
)
{
execCommand
(
_
(
"set architecture %1"
).
arg
(
q
->
m_remoteArchitecture
));
execCommand
(
_
(
"target remote %1"
).
arg
(
q
->
m_remoteChannel
));
qq
->
breakHandler
()
->
setAllPending
();
//execCommand(_("info target"), handleStart);
qq
->
notifyInferiorRunningRequested
();
execCommand
(
_
(
"-exec-continue"
),
CB
(
handleExecRun
));
//QFileInfo fi(q->m_executable);
//QString fileName = fi.absoluteFileName();
QString
fileName
=
q
->
m_executable
;
execCommand
(
_
(
"-file-exec-and-symbols
\"
%1
\"
"
).
arg
(
fileName
));
// works only for > 6.8
execCommand
(
_
(
"set target-async on"
),
CB
(
handleTargetAsync
));
}
else
if
(
q
->
m_useTerminal
)
{
qq
->
breakHandler
()
->
setAllPending
();
}
else
if
(
q
->
startMode
()
==
StartInternal
||
q
->
startMode
()
==
StartExternal
)
{
...
...
@@ -1595,6 +1597,22 @@ void GdbEngine::handleAttach(const GdbResultRecord &, const QVariant &)
qq
->
reloadRegisters
();
}
void
GdbEngine
::
handleTargetAsync
(
const
GdbResultRecord
&
record
,
const
QVariant
&
)