Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
89861828
Commit
89861828
authored
Sep 23, 2009
by
hjk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugger: merge gdb engine and symbian engine.
The trk parts are an 'adapter' in the gdb engine.
parent
e8be2acd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
179 additions
and
103 deletions
+179
-103
src/plugins/debugger/debuggermanager.cpp
src/plugins/debugger/debuggermanager.cpp
+23
-14
src/plugins/debugger/debuggermanager.h
src/plugins/debugger/debuggermanager.h
+3
-2
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.cpp
+131
-84
src/plugins/debugger/gdb/gdbengine.h
src/plugins/debugger/gdb/gdbengine.h
+14
-2
src/plugins/debugger/gdb/trkgdbadapter.cpp
src/plugins/debugger/gdb/trkgdbadapter.cpp
+1
-1
src/plugins/debugger/gdb/trkgdbadapter.h
src/plugins/debugger/gdb/trkgdbadapter.h
+1
-0
src/plugins/debugger/idebuggerengine.h
src/plugins/debugger/idebuggerengine.h
+6
-0
No files found.
src/plugins/debugger/debuggermanager.cpp
View file @
89861828
...
...
@@ -101,9 +101,8 @@ IDebuggerEngine *createTcfEngine(DebuggerManager *parent, QList<Core::IOptionsPa
namespace
Debugger
{
namespace
Internal
{
IDebuggerEngine
*
createGdbEngine
(
DebuggerManager
*
parent
,
QList
<
Core
::
IOptionsPage
*>
*
);
IDebuggerEngine
*
createGdbEngine
(
DebuggerManager
*
parent
);
IDebuggerEngine
*
createSymbianEngine
(
DebuggerManager
*
parent
,
QList
<
Core
::
IOptionsPage
*>
*
);
QDebug
operator
<<
(
QDebug
str
,
const
DebuggerStartParameters
&
p
)
{
...
...
@@ -185,7 +184,6 @@ void DebuggerStartParameters::clear()
static
IDebuggerEngine
*
gdbEngine
=
0
;
static
IDebuggerEngine
*
scriptEngine
=
0
;
static
IDebuggerEngine
*
symbianEngine
=
0
;
static
IDebuggerEngine
*
tcfEngine
=
0
;
static
IDebuggerEngine
*
winEngine
=
0
;
...
...
@@ -201,7 +199,6 @@ DebuggerManager::~DebuggerManager()
#define doDelete(ptr) delete ptr; ptr = 0
doDelete
(
gdbEngine
);
doDelete
(
scriptEngine
);
doDelete
(
symbianEngine
);
doDelete
(
tcfEngine
);
doDelete
(
winEngine
);
#undef doDelete
...
...
@@ -446,10 +443,10 @@ void DebuggerManager::init()
QList
<
Core
::
IOptionsPage
*>
DebuggerManager
::
initializeEngines
(
unsigned
enabledTypeFlags
)
{
QList
<
Core
::
IOptionsPage
*>
rc
;
if
(
enabledTypeFlags
&
GdbEngineType
)
gdbEngine
=
createGdbEngine
(
this
,
&
rc
);
if
(
enabledTypeFlags
&
SymbianEngineType
)
symbianEngine
=
createSymbianEngine
(
this
,
&
rc
);
if
(
enabledTypeFlags
&
GdbEngineType
)
{
gdbEngine
=
createGdbEngine
(
this
);
gdbEngine
->
addOptionPages
(
&
rc
);
}
winEngine
=
createWinEngine
(
this
,
(
enabledTypeFlags
&
CdbEngineType
),
&
rc
);
if
(
enabledTypeFlags
&
ScriptEngineType
)
scriptEngine
=
createScriptEngine
(
this
,
&
rc
);
...
...
@@ -565,7 +562,7 @@ void DebuggerManager::notifyInferiorRunning()
void
DebuggerManager
::
notifyInferiorExited
()
{
setStatus
(
DebuggerProcessNotReady
);
showStatusMessage
(
tr
(
"
Stopp
ed."
),
5000
);
showStatusMessage
(
tr
(
"
Exit
ed."
),
5000
);
}
void
DebuggerManager
::
notifyInferiorPidChanged
(
qint64
pid
)
...
...
@@ -744,13 +741,15 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable,
return
scriptEngine
;
}
/*
if (executable.endsWith(_(".sym"))) {
if
(
!
symbian
Engine
)
{
*
errorMessage
=
msgEngineNotAvailable
(
"
Symbian
Engine"
);
if (!
gdb
Engine) {
*errorMessage = msgEngineNotAvailable("
Gdb
Engine");
return 0;
}
return
symbian
Engine
;
return
gdb
Engine;
}
*/
if
(
IDebuggerEngine
*
tce
=
debuggerEngineForToolChain
(
static_cast
<
ProjectExplorer
::
ToolChain
::
ToolChainType
>
(
toolChainType
)))
...
...
@@ -1114,7 +1113,7 @@ void DebuggerManager::setStatus(int status)
if
(
status
==
m_status
)
return
;
if
(
0
&&
!
isAllowedTransition
(
m_status
,
status
))
{
if
(
1
&&
!
isAllowedTransition
(
m_status
,
status
))
{
const
QString
msg
=
QString
::
fromLatin1
(
"%1: UNEXPECTED TRANSITION: %2 -> %3"
)
.
arg
(
_
(
Q_FUNC_INFO
),
_
(
stateName
(
m_status
)),
_
(
stateName
(
status
)));
qWarning
(
"%s"
,
qPrintable
(
msg
));
...
...
@@ -1155,7 +1154,8 @@ void DebuggerManager::setStatus(int status)
m_runToFunctionAction
->
setEnabled
(
ready
);
m_jumpToLineAction
->
setEnabled
(
ready
);
m_nextAction
->
setEnabled
(
ready
);
//showStatusMessage(QString("started: %1, running: %2").arg(started).arg(running));
//showStatusMessage(QString("started: %1, running: %2")
// .arg(started).arg(running));
emit
statusChanged
(
m_status
);
const
bool
notbusy
=
ready
||
status
==
DebuggerProcessNotReady
;
setBusyCursor
(
!
notbusy
);
...
...
@@ -1467,6 +1467,15 @@ void DebuggerManager::setSessionValue(const QString &name, const QVariant &value
emit
setSessionValueRequested
(
name
,
value
);
}
void
DebuggerManager
::
showMessageBox
(
int
icon
,
const
QString
&
title
,
const
QString
&
text
)
{
QMessageBox
*
mb
=
new
QMessageBox
(
QMessageBox
::
Icon
(
icon
),
title
,
text
,
QMessageBox
::
NoButton
,
mainWindow
());
mb
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
mb
->
show
();
}
//////////////////////////////////////////////////////////////////////
//
// Testing
...
...
src/plugins/debugger/debuggermanager.h
View file @
89861828
...
...
@@ -43,6 +43,7 @@ class QAction;
class
QAbstractItemModel
;
class
QDockWidget
;
class
QLabel
;
class
QMessageBox
;
class
QModelIndex
;
class
QPoint
;
class
QTimer
;
...
...
@@ -183,12 +184,10 @@ enum DebuggerEngineTypeFlags
ScriptEngineType
=
0x02
,
CdbEngineType
=
0x04
,
TcfEngineType
=
0x08
,
SymbianEngineType
=
0x10
,
AllEngineTypes
=
GdbEngineType
|
ScriptEngineType
|
CdbEngineType
|
TcfEngineType
|
SymbianEngineType
};
// The construct below is not nice but enforces a bit of order. The
...
...
@@ -279,6 +278,8 @@ public:
virtual
DebuggerStartParametersPtr
startParameters
()
const
;
virtual
qint64
inferiorPid
()
const
;
void
showMessageBox
(
int
icon
,
const
QString
&
title
,
const
QString
&
text
);
public
slots
:
void
startNewDebugger
(
const
DebuggerStartParametersPtr
&
sp
);
void
exitDebugger
();
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
89861828
...
...
@@ -35,6 +35,7 @@
#include "trkoptionspage.h"
#include "plaingdbadapter.h"
#include "trkgdbadapter.h"
#include "remotegdbadapter.h"
#include "watchutils.h"
#include "debuggeractions.h"
...
...
@@ -173,6 +174,33 @@ GdbEngine::GdbEngine(DebuggerManager *parent) :
qq
(
parent
->
engineInterface
())
{
m_gdbAdapter
=
0
;
QSharedPointer
<
TrkOptions
>
options
(
new
TrkOptions
);
options
->
fromSettings
(
Core
::
ICore
::
instance
()
->
settings
());
m_plainAdapter
=
new
PlainGdbAdapter
(
this
);
m_trkAdapter
=
new
TrkGdbAdapter
(
this
,
options
);
m_remoteAdapter
=
0
;
// FIXME
// Output
connect
(
&
m_outputCollector
,
SIGNAL
(
byteDelivery
(
QByteArray
)),
this
,
SLOT
(
readDebugeeOutput
(
QByteArray
)));
connect
(
this
,
SIGNAL
(
gdbOutputAvailable
(
int
,
QString
)),
m_manager
,
SLOT
(
showDebuggerOutput
(
int
,
QString
)),
Qt
::
QueuedConnection
);
connect
(
this
,
SIGNAL
(
gdbInputAvailable
(
int
,
QString
)),
m_manager
,
SLOT
(
showDebuggerInput
(
int
,
QString
)),
Qt
::
QueuedConnection
);
connect
(
this
,
SIGNAL
(
applicationOutputAvailable
(
QString
)),
m_manager
,
SLOT
(
showApplicationOutput
(
QString
)),
Qt
::
QueuedConnection
);
// FIXME: These trigger even if the engine is not active
connect
(
theDebuggerAction
(
UseDebuggingHelpers
),
SIGNAL
(
valueChanged
(
QVariant
)),
this
,
SLOT
(
setUseDebuggingHelpers
(
QVariant
)));
connect
(
theDebuggerAction
(
DebugDebuggingHelpers
),
SIGNAL
(
valueChanged
(
QVariant
)),
this
,
SLOT
(
setDebugDebuggingHelpers
(
QVariant
)));
connect
(
theDebuggerAction
(
RecheckDebuggingHelpers
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
recheckDebuggingHelperAvailability
()));
}
GdbEngine
::~
GdbEngine
()
...
...
@@ -180,19 +208,15 @@ GdbEngine::~GdbEngine()
// prevent sending error messages afterwards
if
(
m_gdbAdapter
)
{
m_gdbAdapter
->
disconnect
(
this
);
delete
m_gdbAdapter
;
//
delete m_gdbAdapter;
m_gdbAdapter
=
0
;
}
delete
m_plainAdapter
;
delete
m_trkAdapter
;
delete
m_remoteAdapter
;
}
void
GdbEngine
::
setGdbAdapter
(
AbstractGdbAdapter
*
gdbAdapter
)
{
m_gdbAdapter
=
gdbAdapter
;
initializeVariables
();
initializeConnections
();
}
void
GdbEngine
::
initializeConnections
()
void
GdbEngine
::
connectAdapter
()
{
// Gdb Process interaction
connect
(
m_gdbAdapter
,
SIGNAL
(
error
(
QProcess
::
ProcessError
)),
...
...
@@ -227,28 +251,44 @@ void GdbEngine::initializeConnections()
connect
(
m_gdbAdapter
,
SIGNAL
(
adapterCrashed
()),
m_manager
,
SLOT
(
exitDebugger
()));
}
// Output
connect
(
&
m_outputCollector
,
SIGNAL
(
byteDelivery
(
QByteArray
)),
this
,
SLOT
(
readDebugeeOutput
(
QByteArray
)));
connect
(
this
,
SIGNAL
(
gdbOutputAvailable
(
int
,
QString
)),
m_manager
,
SLOT
(
showDebuggerOutput
(
int
,
QString
)),
Qt
::
QueuedConne
ction
);
connect
(
this
,
SIGNAL
(
gdbInputAvailable
(
int
,
QString
)),
m_manager
,
SLOT
(
showDebuggerInput
(
int
,
QString
))
,
Qt
::
QueuedConnection
);
connect
(
this
,
SIGNAL
(
applicationOutputAvailable
(
QString
))
,
m_manager
,
SLOT
(
showApplicationOutput
(
QString
)),
Qt
::
QueuedConnection
);
void
GdbEngine
::
disconnectAdapter
()
{
// Gdb Process intera
ction
dis
connect
(
m_gdbAdapter
,
SIGNAL
(
error
(
QProcess
::
ProcessError
)),
this
,
SLOT
(
gdbProcError
(
QProcess
::
ProcessError
)
))
;
disconnect
(
m_gdbAdapter
,
SIGNAL
(
readyReadStandardOutput
()),
this
,
SLOT
(
readGdbStandardOutput
()
))
;
disconnect
(
m_gdbAdapter
,
SIGNAL
(
readyReadStandardError
(
)),
this
,
SLOT
(
readGdbStandardError
())
);
// FIXME: These trigger even if the engine is not active
connect
(
theDebuggerAction
(
UseDebuggingHelpers
),
SIGNAL
(
valueChanged
(
QVariant
)),
this
,
SLOT
(
setUseDebuggingHelpers
(
QVariant
)));
connect
(
theDebuggerAction
(
DebugDebuggingHelpers
),
SIGNAL
(
valueChanged
(
QVariant
)),
this
,
SLOT
(
setDebugDebuggingHelpers
(
QVariant
)));
connect
(
theDebuggerAction
(
RecheckDebuggingHelpers
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
recheckDebuggingHelperAvailability
()));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
adapterStarted
()),
this
,
SLOT
(
handleAdapterStarted
()));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
adapterStartFailed
(
QString
)),
this
,
SLOT
(
handleAdapterStartFailed
(
QString
)));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
adapterShutDown
()),
this
,
SLOT
(
handleAdapterShutDown
()));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
adapterShutdownFailed
(
QString
)),
this
,
SLOT
(
handleAdapterShutdownFailed
(
QString
)));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
inferiorPrepared
()),
this
,
SLOT
(
handleInferiorPrepared
()));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
inferiorPreparationFailed
(
QString
)),
this
,
SLOT
(
handleInferiorPreparationFailed
(
QString
)));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
inferiorStarted
()),
this
,
SLOT
(
handleInferiorStarted
()));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
inferiorStartFailed
(
QString
)),
this
,
SLOT
(
handleInferiorStartFailed
(
QString
)));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
inferiorShutDown
()),
this
,
SLOT
(
handleInferiorShutDown
()));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
inferiorShutdownFailed
(
QString
)),
this
,
SLOT
(
handleInferiorShutdownFailed
(
QString
)));
disconnect
(
m_gdbAdapter
,
SIGNAL
(
adapterCrashed
()),
m_manager
,
SLOT
(
exitDebugger
()));
}
void
GdbEngine
::
initializeVariables
()
...
...
@@ -292,13 +332,13 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
bool
kill
=
true
;
switch
(
error
)
{
case
QProcess
::
FailedToStart
:
kill
=
false
;
//
kill = false;
msg
=
tr
(
"The Gdb process failed to start. Either the "
"invoked program '%1' is missing, or you may have insufficient "
"permissions to invoke the program."
)
.
arg
(
theDebuggerStringSetting
(
GdbLocation
));
emit
startFailed
();
shutdown
();
//
emit startFailed();
//
shutdown();
break
;
case
QProcess
::
Crashed
:
kill
=
false
;
...
...
@@ -325,9 +365,9 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
}
showStatusMessage
(
msg
);
QMessageBox
::
c
ritical
(
mainWindow
()
,
tr
(
"Error"
),
msg
);
showMessageBox
(
QMessageBox
::
C
ritical
,
tr
(
"Error"
),
msg
);
// act as if it was closed by the core
if
(
kill
)
//
if (kill)
m_manager
->
exitDebugger
();
}
...
...
@@ -756,8 +796,8 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
// msg="Cannot find new threads: generic error"
if
(
record
.
resultClass
==
GdbResultError
)
{
QByteArray
msg
=
record
.
data
.
findChild
(
"msg"
).
data
();
QMessageBox
::
c
ritical
(
mainWindow
(),
tr
(
"Error"
)
,
tr
(
"Executable failed
:
\n
"
)
+
QString
::
fromLocal8Bit
(
msg
));
showMessageBox
(
QMessageBox
::
C
ritical
,
tr
(
"Executable failed
"
),
QString
::
fromLocal8Bit
(
msg
));
showStatusMessage
(
tr
(
"Process failed to start."
));
exitDebugger
();
//qq->notifyInferiorStopped();
...
...
@@ -775,7 +815,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
if
(
record
.
token
<
m_oldestAcceptableToken
&&
(
cmd
.
flags
&
Discardable
))
{
//qDebug() << "### SKIPPING OLD RESULT" << record.toString();
//QMessageBox::
i
nformation(
mainWindow(),
tr("Skipped"), "xxx");
//
showMessageBox(
QMessageBox::
I
nformation(tr("Skipped"), "xxx")
)
;
return
;
}
...
...
@@ -1253,11 +1293,8 @@ void GdbEngine::handleStop1(const GdbResultRecord &, const QVariant &cookie)
"<tr><td>Signal meaning : </td><td>%2</td></tr></table>"
)
.
arg
(
name
.
isEmpty
()
?
tr
(
" <Unknown> "
)
:
_
(
name
))
.
arg
(
meaning
.
isEmpty
()
?
tr
(
" <Unknown> "
)
:
_
(
meaning
));
QMessageBox
*
mb
=
new
QMessageBox
(
QMessageBox
::
Information
,
tr
(
"Signal received"
),
msg
,
QMessageBox
::
NoButton
,
mainWindow
());
mb
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
mb
->
show
();
showMessageBox
(
QMessageBox
::
Information
,
tr
(
"Signal received"
),
msg
);
}
}
...
...
@@ -1344,7 +1381,7 @@ void GdbEngine::handleShowVersion(const GdbResultRecord &response, const QVarian
err->setMinimumSize(400, 300);
err->showMessage(msg);
#else
//QMessageBox::
i
nformation
(mainWindow()
, tr("Warning"), msg);
//
showMessageBox(
QMessageBox::
I
nformation, tr("Warning"), msg);
#endif
}
else
{
m_gdbVersion
=
10000
*
supported
.
cap
(
2
).
toInt
()
...
...
@@ -1364,8 +1401,7 @@ void GdbEngine::handleFileExecAndSymbols(const GdbResultRecord &response, const
//m_breakHandler->clearBreakMarkers();
}
else
if
(
response
.
resultClass
==
GdbResultError
)
{
QString
msg
=
__
(
response
.
data
.
findChild
(
"msg"
).
data
());
QMessageBox
::
critical
(
mainWindow
(),
tr
(
"Error"
),
tr
(
"Starting executable failed:
\n
"
)
+
msg
);
showMessageBox
(
QMessageBox
::
Critical
,
tr
(
"Starting executable failed"
),
msg
);
QTC_ASSERT
(
status
()
==
DebuggerInferiorRunning
,
/**/
);
//interruptInferior();
qq
->
notifyInferiorExited
();
...
...
@@ -1380,8 +1416,8 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response, const QVariant &)
} else {
QTC_ASSERT(response.resultClass == GdbResultError, /**/);
const QByteArray &msg = response.data.findChild("msg").data();
QMessageBox::
c
ritical
(mainWindow(), tr("Error")
,
tr("Starting executable failed:\n") +
QString::fromLocal8Bit(msg));
showMessageBox(
QMessageBox::
C
ritical
, tr("Starting executable failed"
,
QString::fromLocal8Bit(msg))
)
;
QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
//interruptInferior();
qq->notifyInferiorExited();
...
...
@@ -1402,8 +1438,8 @@ void GdbEngine::handleExecContinue(const GdbResultRecord &response, const QVaria
// "Leaving function..."));
//stepOutExec();
}
else
{
QMessageBox
::
c
ritical
(
mainWindow
(),
tr
(
"Error
"
),
tr
(
"Starting executable failed:
\n
"
)
+
QString
::
fromLocal8Bit
(
msg
));
showMessageBox
(
QMessageBox
::
C
ritical
,
tr
(
"Starting executable failed
"
),
QString
::
fromLocal8Bit
(
msg
));
QTC_ASSERT
(
status
()
==
DebuggerInferiorRunning
,
/**/
);
//interruptInferior();
qq
->
notifyInferiorExited
();
...
...
@@ -1481,10 +1517,23 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
{
// This should be set by the constructor or in exitDebugger()
// via initializeVariables()
QTC_ASSERT
(
m_debuggingHelperState
==
DebuggingHelperUninitialized
,
initializeVariables
());
//QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized,
// initializeVariables());
//QTC_ASSERT(m_gdbAdapter == 0, delete m_gdbAdapter; m_gdbAdapter = 0);
if
(
m_gdbAdapter
)
disconnectAdapter
();
if
(
sp
->
executable
.
endsWith
(
_
(
".sym"
)))
m_gdbAdapter
=
m_trkAdapter
;
else
m_gdbAdapter
=
m_plainAdapter
;
initializeVariables
();
connectAdapter
();
m_startParameters
=
sp
;
m_gdbAdapter
->
startAdapter
(
sp
);
/*
...
...
@@ -1508,7 +1557,7 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
}
} else {
if (!m_outputCollector.listen()) {
QMessageBox::
c
ritical
(mainWindow()
, tr("Debugger Startup Failure"),
showMessageBox(
QMessageBox::
C
ritical, tr("Debugger Startup Failure"),
tr("Cannot set up communication with child process: %1")
.arg(m_outputCollector.errorString()));
emitStartFailed();
...
...
@@ -1587,7 +1636,7 @@ void GdbEngine::handleTargetRemote(const GdbResultRecord &record, const QVariant
QString msg = __(record.data.findChild("msg").data());
QString msg1 = tr("Connecting to remote server failed:");
showStatusMessage(msg1 + _c(' ') + msg);
QMessageBox::
c
ritical
(mainWindow()
, tr("Error"), msg1 + _c('\n') + msg);
showMessageBox(
QMessageBox::
C
ritical, tr("Error"), msg1 + _c('\n') + msg);
postCommand(_("-gdb-exit"), CB(handleExit));
}
}
...
...
@@ -4025,10 +4074,9 @@ void GdbEngine::gotoLocation(const StackFrame &frame, bool setMarker)
void
GdbEngine
::
handleAdapterStartFailed
(
const
QString
&
msg
)
{
debugMessage
(
_
(
"ADAPTER START FAILED"
));
m_outputCollector
.
shutdown
();
QMessageBox
::
critical
(
mainWindow
(),
tr
(
"Error"
),
msg
);
QTC_ASSERT
(
status
()
==
DebuggerInferiorRunning
,
/**/
);
//interruptInferior();
showMessageBox
(
QMessageBox
::
Critical
,
tr
(
"Adapter start failed"
),
msg
);
qq
->
notifyInferiorExited
();
m_manager
->
exitDebugger
();
}
void
GdbEngine
::
handleAdapterStarted
()
...
...
@@ -4040,9 +4088,11 @@ void GdbEngine::handleAdapterStarted()
void
GdbEngine
::
handleInferiorPreparationFailed
(
const
QString
&
msg
)
{
debugMessage
(
_
(
"INFERIOR PREPARATION FAILD"
));
m_outputCollector
.
shutdown
();
QMessageBox
::
critical
(
mainWindow
(),
tr
(
"Error"
),
tr
(
"Inferior start preparation failed:
\n
"
)
+
msg
);
showMessageBox
(
QMessageBox
::
Critical
,
tr
(
"Inferior start preparation failed"
),
msg
);
shutdown
();
qq
->
notifyInferiorExited
();
m_manager
->
exitDebugger
();
}
void
GdbEngine
::
handleInferiorPrepared
()
...
...
@@ -4119,7 +4169,7 @@ void GdbEngine::handleInferiorPrepared()
if
(
QFileInfo
(
scriptFileName
).
isReadable
())
{
postCommand
(
_
(
"source "
)
+
scriptFileName
);
}
else
{
QMessageBox
::
w
arning
(
mainWindow
()
,
showMessageBox
(
QMessageBox
::
W
arning
,
tr
(
"Cannot find debugger initialization script"
),
tr
(
"The debugger settings point to a script file at '%1' "
"which is not accessible. If a script file is not needed, "
...
...
@@ -4182,9 +4232,10 @@ void GdbEngine::handleInitialBreakpointsSet()
void
GdbEngine
::
handleInferiorStartFailed
(
const
QString
&
msg
)
{
debugMessage
(
_
(
"INFERIOR START FAILED"
));
QMessageBox
::
c
ritical
(
mainWindow
()
,
tr
(
"Error"
),
showMessageBox
(
QMessageBox
::
C
ritical
,
tr
(
"Error"
),
tr
(
"Inferior start failed:
\n
"
)
+
msg
);
qq
->
notifyInferiorExited
();
m_manager
->
exitDebugger
();
}
void
GdbEngine
::
handleInferiorStarted
()
...
...
@@ -4195,54 +4246,50 @@ void GdbEngine::handleInferiorStarted()
void
GdbEngine
::
handleInferiorShutDown
()
{
debugMessage
(
_
(
"INFERIOR SUCCESSFULLY SHUT DOWN"
));
qq
->
notifyInferiorExited
();
}
void
GdbEngine
::
handleInferiorShutdownFailed
(
const
QString
&
msg
)
{
debugMessage
(
_
(
"INFERIOR SHUTDOWN FAILED"
));
QMessageBox
::
c
ritical
(
mainWindow
()
,
tr
(
"Error"
),
showMessageBox
(
QMessageBox
::
C
ritical
,
tr
(
"Error"
),
tr
(
"Inferior shutdown failed:
\n
"
)
+
msg
);
qq
->
notifyInferiorExited
();
m_manager
->
exitDebugger
();
}
void
GdbEngine
::
handleAdapterShutDown
()
{
debugMessage
(
_
(
"ADAPTER SUCCESSFULLY SHUT DOWN"
));
qq
->
notifyInferiorExited
();
}
void
GdbEngine
::
handleAdapterShutdownFailed
(
const
QString
&
msg
)
{
debugMessage
(
_
(
"ADAPTER SHUTDOWN FAILED"
));
QMessageBox
::
c
ritical
(
mainWindow
()
,
tr
(
"Error"
),
showMessageBox
(
QMessageBox
::
C
ritical
,
tr
(
"Error"
),
tr
(
"Inferior shutdown failed:
\n
"
)
+
msg
);
qq
->
notifyInferiorExited
();
}
//
// Factory
//
IDebuggerEngine
*
createGdbEngine
(
DebuggerManager
*
parent
,
QList
<
Core
::
IOptionsPage
*>
*
opts
)
void
GdbEngine
::
addOptionPages
(
QList
<
Core
::
IOptionsPage
*>
*
opts
)
const
{
opts
->
push_back
(
new
GdbOptionsPage
);
GdbEngine
*
engine
=
new
GdbEngine
(
parent
);
PlainGdbAdapter
*
adapter
=
new
PlainGdbAdapter
(
engine
);
engine
->
setGdbAdapter
(
adapter
);
return
engine
;
if
(
!
qgetenv
(
"QTCREATOR_WITH_S60"
).
isEmpty
())
opts
->
push_back
(
new
TrkOptionsPage
(
m_trkAdapter
->
options
()));
}
IDebuggerEngine
*
createSymbianEngine
(
DebuggerManager
*
parent
,
QList
<
Core
::
IOptionsPage
*>
*
opts
)
void
GdbEngine
::
showMessageBox
(
int
icon
,
const
QString
&
title
,
const
QString
&
text
)
{
QSharedPointer
<
TrkOptions
>
options
(
new
TrkOptions
);
options
->
fromSettings
(
Core
::
ICore
::
instance
()
->
settings
());
m_manager
->
showMessageBox
(
icon
,
title
,
text
);
}
if
(
!
qgetenv
(
"QTCREATOR_WITH_S60"
).
isEmpty
())
opts
->
push_back
(
new
TrkOptionsPage
(
options
));
GdbEngine
*
engine
=
new
GdbEngine
(
parent
);
TrkGdbAdapter
*
adapter
=
new
TrkGdbAdapter
(
engine
,
options
);
engine
->
setGdbAdapter
(
adapter
);
return
engine
;
//
// Factory
//
IDebuggerEngine
*
createGdbEngine
(
DebuggerManager
*
parent
)
{
return
new
GdbEngine
(
parent
);
}
}
// namespace Internal
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
89861828
...
...
@@ -65,6 +65,10 @@ class GdbMi;
class
WatchData
;
class
BreakpointData
;
class
PlainGdbAdapter
;
class
TrkGdbAdapter
;
class
RemoteGdbAdapter
;
enum
DebuggingHelperState
{
DebuggingHelperUninitialized
,
...
...
@@ -80,7 +84,6 @@ class GdbEngine : public IDebuggerEngine
public:
explicit
GdbEngine
(
DebuggerManager
*
parent
);
~
GdbEngine
();
void
setGdbAdapter
(
AbstractGdbAdapter
*
adapter
);
signals:
void
gdbInputAvailable
(
int
channel
,
const
QString
&
msg
);
...
...
@@ -155,7 +158,8 @@ private:
bool
supportsThreads
()
const
;
void
gotoLocation
(
const
StackFrame
&
frame
,
bool
setLocationMarker
);
void
initializeConnections
();
void
connectAdapter
();
void
disconnectAdapter
();
void
initializeVariables
();
QString
fullName
(
const
QString
&
fileName
);
// get one usable name out of these, try full names first
...
...
@@ -439,8 +443,16 @@ private:
DebuggerStartParametersPtr
m_startParameters
;
// make sure to re-initialize new members in initializeVariables();
// only one of those is active at a given time
PlainGdbAdapter
*
m_plainAdapter
;
TrkGdbAdapter
*
m_trkAdapter
;
RemoteGdbAdapter
*
m_remoteAdapter
;
public:
void
showMessageBox
(
int
icon
,
const
QString
&
title
,
const
QString
&
text
);
void
debugMessage
(
const
QString
&
msg
);
void
addOptionPages
(
QList
<
Core
::
IOptionsPage
*>
*
opts
)
const
;
OutputCollector
m_outputCollector
;
};
...
...
src/plugins/debugger/gdb/trkgdbadapter.cpp
View file @
89861828
...
...
@@ -240,7 +240,7 @@ void TrkGdbAdapter::startInferiorEarly()
if
(
!
m_trkDevice
.
open
(
device
,
&
errorMessage
))
{
logMessage
(
QString
::
fromLatin1
(
"Waiting on %1 (%2)"
).
arg
(
device
,
errorMessage
));
// Do not loop forever
if
(
m_waitCount
++
<
(
m_options
->
mode
==
TrkOptions
::
BlueTooth
?
60
:
5
))
{
if
(
m_waitCount
++
<
(
m_options
->
mode
==
TrkOptions
::
BlueTooth
?
3
:
5
))
{
QTimer
::
singleShot
(
1000
,
this
,
SLOT
(
startInferiorEarly
()));
}
else
{
QString
msg
=
QString
::
fromLatin1
(
"Failed to connect to %1 after "
...
...
src/plugins/debugger/gdb/trkgdbadapter.h
View file @
89861828
...
...
@@ -85,6 +85,7 @@ public:
// Set a device (from the project) to override the settings.
QString
overrideTrkDevice
()
const
;
void
setOverrideTrkDevice
(
const
QString
&
);
const
TrkOptionsPtr
options
()
const
{
return
m_options
;
}
signals:
void
output
(
const
QString
&
msg
);
...
...
src/plugins/debugger/idebuggerengine.h
View file @
89861828
...
...
@@ -43,6 +43,10 @@ namespace TextEditor {
class
ITextEditor
;
}
namespace
Core
{
class
IOptionsPage
;
}
namespace
Debugger
{
namespace
Internal
{
...
...
@@ -105,6 +109,8 @@ public:
virtual
void
setRegisterValue
(
int
regnr
,
const
QString
&
value
)
{
Q_UNUSED
(
regnr
);
Q_UNUSED
(
value
);
}