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
9f7e9dc0
Commit
9f7e9dc0
authored
Jun 14, 2010
by
hjk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugger: refactoring of output channeling
parent
254a51bf
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
225 additions
and
234 deletions
+225
-234
src/plugins/debugger/cdb/cdbdebugoutput.cpp
src/plugins/debugger/cdb/cdbdebugoutput.cpp
+11
-27
src/plugins/debugger/cdb/cdbdebugoutput.h
src/plugins/debugger/cdb/cdbdebugoutput.h
+2
-0
src/plugins/debugger/debuggeragents.cpp
src/plugins/debugger/debuggeragents.cpp
+1
-1
src/plugins/debugger/debuggerconstants.h
src/plugins/debugger/debuggerconstants.h
+5
-1
src/plugins/debugger/debuggermanager.cpp
src/plugins/debugger/debuggermanager.cpp
+10
-7
src/plugins/debugger/debuggermanager.h
src/plugins/debugger/debuggermanager.h
+1
-1
src/plugins/debugger/debuggerrunner.cpp
src/plugins/debugger/debuggerrunner.cpp
+27
-15
src/plugins/debugger/debuggerrunner.h
src/plugins/debugger/debuggerrunner.h
+1
-5
src/plugins/debugger/gdb/abstractgdbadapter.h
src/plugins/debugger/gdb/abstractgdbadapter.h
+2
-4
src/plugins/debugger/gdb/abstractplaingdbadapter.cpp
src/plugins/debugger/gdb/abstractplaingdbadapter.cpp
+2
-2
src/plugins/debugger/gdb/attachgdbadapter.cpp
src/plugins/debugger/gdb/attachgdbadapter.cpp
+4
-4
src/plugins/debugger/gdb/classicgdbengine.cpp
src/plugins/debugger/gdb/classicgdbengine.cpp
+9
-9
src/plugins/debugger/gdb/coregdbadapter.cpp
src/plugins/debugger/gdb/coregdbadapter.cpp
+4
-4
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.cpp
+79
-84
src/plugins/debugger/gdb/gdbengine.h
src/plugins/debugger/gdb/gdbengine.h
+0
-1
src/plugins/debugger/gdb/localplaingdbadapter.cpp
src/plugins/debugger/gdb/localplaingdbadapter.cpp
+4
-4
src/plugins/debugger/gdb/pythongdbengine.cpp
src/plugins/debugger/gdb/pythongdbengine.cpp
+2
-2
src/plugins/debugger/gdb/remotegdbserveradapter.cpp
src/plugins/debugger/gdb/remotegdbserveradapter.cpp
+14
-10
src/plugins/debugger/gdb/remoteplaingdbadapter.cpp
src/plugins/debugger/gdb/remoteplaingdbadapter.cpp
+3
-3
src/plugins/debugger/gdb/termgdbadapter.cpp
src/plugins/debugger/gdb/termgdbadapter.cpp
+4
-4
src/plugins/debugger/gdb/trkgdbadapter.cpp
src/plugins/debugger/gdb/trkgdbadapter.cpp
+10
-10
src/plugins/debugger/idebuggerengine.cpp
src/plugins/debugger/idebuggerengine.cpp
+2
-8
src/plugins/debugger/idebuggerengine.h
src/plugins/debugger/idebuggerengine.h
+3
-3
src/plugins/debugger/pdb/pdbengine.cpp
src/plugins/debugger/pdb/pdbengine.cpp
+11
-11
src/plugins/debugger/qml/qmlengine.cpp
src/plugins/debugger/qml/qmlengine.cpp
+2
-2
src/plugins/debugger/script/scriptengine.cpp
src/plugins/debugger/script/scriptengine.cpp
+8
-8
src/plugins/debugger/tcf/tcfengine.cpp
src/plugins/debugger/tcf/tcfengine.cpp
+4
-4
No files found.
src/plugins/debugger/cdb/cdbdebugoutput.cpp
View file @
9f7e9dc0
...
...
@@ -33,6 +33,8 @@
#include "cdbcom.h"
#include "debuggerrunner.h"
#include <utils/qtcassert.h>
namespace
Debugger
{
namespace
Internal
{
...
...
@@ -47,20 +49,16 @@ static int logChannel(ULONG mask)
return
LogWarning
;
if
(
mask
&
(
DEBUG_OUTPUT_ERROR
))
return
LogError
;
return
LogMisc
;
}
enum
OutputKind
{
DebuggerOutput
,
DebuggerPromptOutput
,
DebuggeeOutput
,
DebuggeePromptOutput
};
static
inline
OutputKind
outputKind
(
ULONG
mask
)
{
if
(
mask
&
DEBUG_OUTPUT_DEBUGGEE
)
return
DebuggeeOutput
;
//return DebuggeeOutput;
return
AppOut
;
if
(
mask
&
DEBUG_OUTPUT_DEBUGGEE_PROMPT
)
return
DebuggeePromptOutput
;
//return DebuggeePromptOutput;
return
AppErr
;
if
(
mask
&
DEBUG_OUTPUT_PROMPT
)
return
DebuggerPromptOutput
;
return
DebuggerOutput
;
//return DebuggerPromptOutput;
return
AppErr
;
return
LogMisc
;
}
CdbDebugOutput
::
CdbDebugOutput
(
CdbDebugEngine
*
engine
)
...
...
@@ -71,24 +69,10 @@ CdbDebugOutput::CdbDebugOutput(CdbDebugEngine *engine)
void
CdbDebugOutput
::
output
(
ULONG
mask
,
const
QString
&
msg
)
{
DebuggerRunControl
*
runControl
=
m_engine
->
runControl
();
QTC_ASSER
(
runControl
,
return
);
QTC_ASSER
T
(
runControl
,
return
);
if
(
debugCDB
>
1
)
qDebug
()
<<
Q_FUNC_INFO
<<
"
\n
"
<<
msg
;
switch
(
outputKind
(
mask
))
{
case
DebuggerOutput
:
runControl
->
showDebuggerOutput
(
msg
,
logChannel
(
mask
));
break
;
case
DebuggerPromptOutput
:
runControl
->
showDebuggerInput
(
msg
,
logChannel
(
mask
));
break
;
case
DebuggeeOutput
:
runControl
->
showApplicationOutput
(
msg
,
true
);
break
;
case
DebuggeePromptOutput
:
runControl
->
showApplicationOutput
(
msg
,
false
);
break
;
}
runControl
->
showMessage
(
msg
,
logChannel
(
mask
));
}
}
// namespace Internal
...
...
src/plugins/debugger/cdb/cdbdebugoutput.h
View file @
9f7e9dc0
...
...
@@ -37,6 +37,8 @@
namespace
Debugger
{
namespace
Internal
{
class
CdbDebugEngine
;
// Standard CDB output handler
class
CdbDebugOutput
:
public
CdbCore
::
DebugOutputBase
{
...
...
src/plugins/debugger/debuggeragents.cpp
View file @
9f7e9dc0
...
...
@@ -263,7 +263,7 @@ void DisassemblerViewAgent::setFrame(const StackFrame &frame, bool tryMixed)
.
arg
(
frame
.
function
).
arg
(
frame
.
file
);
QTC_ASSERT
(
d
->
manager
->
runControl
(),
/**/
);
if
(
d
->
manager
->
runControl
())
d
->
manager
->
runControl
()
->
show
DebuggerOutput
(
msg
);
d
->
manager
->
runControl
()
->
show
Message
(
msg
);
setContents
(
*
it
);
return
;
}
...
...
src/plugins/debugger/debuggerconstants.h
View file @
9f7e9dc0
...
...
@@ -139,13 +139,17 @@ enum DebuggerCapabilities
enum
LogChannel
{
LogInput
,
// Used for user input
LogMiscInput
,
// Used for misc stuff in the input pane
LogOutput
,
LogWarning
,
LogError
,
LogStatus
,
// Used for status changed messages
LogTime
,
// Used for time stamp messages
LogDebug
,
LogMisc
LogMisc
,
AppOutput
,
AppError
,
StatusBar
// LogStatus and also put to the status bar
};
}
// namespace Debugger
...
...
src/plugins/debugger/debuggermanager.cpp
View file @
9f7e9dc0
...
...
@@ -107,7 +107,7 @@
// use Q_FUNC_INFO?
# define STATE_DEBUG(s) \
do { QString msg; QTextStream ts(&msg); ts << s; \
show
DebuggerOutput
(msg, LogDebug); } while (0)
show
Message
(msg, LogDebug); } while (0)
#else
# define STATE_DEBUG(s)
#endif
...
...
@@ -830,7 +830,7 @@ void DebuggerManager::clearStatusMessage()
void
DebuggerManager
::
showStatusMessage
(
const
QString
&
msg0
,
int
timeout
)
{
Q_UNUSED
(
timeout
)
show
DebuggerOutput
(
msg0
,
LogStatus
);
show
Message
(
msg0
,
LogStatus
);
QString
msg
=
msg0
;
msg
.
replace
(
QLatin1Char
(
'\n'
),
QString
());
d
->
m_statusLabel
->
setText
(
msg
);
...
...
@@ -1060,8 +1060,9 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
ProjectExplorer
::
ToolChain
::
ToolChainType
(
sp
->
toolChainType
));
d
->
m_plugin
->
activateDebugMode
();
showDebuggerOutput
(
tr
(
"Starting debugger for tool chain '%1'..."
).
arg
(
toolChainName
),
LogStatus
);
showDebuggerOutput
(
DebuggerSettings
::
instance
()
->
dump
(),
LogDebug
);
showMessage
(
tr
(
"Starting debugger for tool chain '%1'..."
).
arg
(
toolChainName
),
LogStatus
);
showMessage
(
DebuggerSettings
::
instance
()
->
dump
(),
LogDebug
);
QString
errorMessage
;
QString
settingsIdHint
;
...
...
@@ -1571,10 +1572,10 @@ void DebuggerManager::modulesDockToggled(bool on)
reloadModules
();
}
void
DebuggerManager
::
show
DebuggerOutput
(
const
QString
&
msg
,
int
channel
)
void
DebuggerManager
::
show
Message
(
const
QString
&
msg
,
int
channel
)
{
if
(
runControl
())
runControl
()
->
show
DebuggerOutput
(
msg
,
channel
);
runControl
()
->
show
Message
(
msg
,
channel
);
else
qDebug
()
<<
"OUTPUT: "
<<
channel
<<
msg
;
}
...
...
@@ -1776,7 +1777,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
if
(
!
forced
&&
!
isAllowedTransition
(
d
->
m_state
,
state
))
qDebug
()
<<
"UNEXPECTED STATE TRANSITION: "
<<
msg
;
show
DebuggerOutput
(
msg
,
LogDebug
);
show
Message
(
msg
,
LogDebug
);
//resetLocation();
if
(
state
==
d
->
m_state
)
...
...
@@ -2015,10 +2016,12 @@ DebuggerOutputWindow *DebuggerManager::debuggerOutputWindow() const
//
//////////////////////////////////////////////////////////////////////
/*
void IDebuggerEngine::showStatusMessage(const QString &msg, int timeout)
{
m_manager->showStatusMessage(msg, timeout);
}
*/
DebuggerState
IDebuggerEngine
::
state
()
const
{
...
...
src/plugins/debugger/debuggermanager.h
View file @
9f7e9dc0
...
...
@@ -315,7 +315,7 @@ signals:
private:
void
init
();
// void runTest(const QString &fileName);
void
show
DebuggerOutput
(
const
QString
&
msg
,
int
channel
);
void
show
Message
(
const
QString
&
msg
,
int
channel
);
Q_SLOT
void
createNewDock
(
QWidget
*
widget
);
void
aboutToShutdown
();
...
...
src/plugins/debugger/debuggerrunner.cpp
View file @
9f7e9dc0
...
...
@@ -196,9 +196,34 @@ void DebuggerRunControl::start()
}
}
void
DebuggerRunControl
::
showApplicationOutput
(
const
QString
&
data
,
bool
onStdErr
)
void
DebuggerRunControl
::
showMessage
(
const
QString
&
msg
,
int
channel
,
int
timeout
)
{
emit
addToOutputWindowInline
(
this
,
data
,
onStdErr
);
DebuggerOutputWindow
*
ow
=
m_manager
->
debuggerOutputWindow
();
QTC_ASSERT
(
ow
,
return
);
switch
(
channel
)
{
case
StatusBar
:
m_manager
->
showStatusMessage
(
msg
,
timeout
);
ow
->
showOutput
(
LogStatus
,
msg
);
break
;
case
AppOutput
:
emit
addToOutputWindowInline
(
this
,
msg
,
false
);
break
;
case
AppError
:
emit
addToOutputWindowInline
(
this
,
msg
,
true
);
break
;
case
LogMiscInput
:
ow
->
showInput
(
LogMisc
,
msg
);
ow
->
showOutput
(
LogMisc
,
msg
);
break
;
case
LogInput
:
ow
->
showInput
(
channel
,
msg
);
ow
->
showOutput
(
channel
,
msg
);
break
;
default:
ow
->
showOutput
(
channel
,
msg
);
break
;
}
}
void
DebuggerRunControl
::
slotMessageAvailable
(
const
QString
&
data
,
bool
isError
)
...
...
@@ -206,19 +231,6 @@ void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError)
emit
appendMessage
(
this
,
data
,
isError
);
}
void
DebuggerRunControl
::
showDebuggerOutput
(
const
QString
&
output
,
int
channel
)
{
DebuggerOutputWindow
*
ow
=
m_manager
->
debuggerOutputWindow
();
QTC_ASSERT
(
ow
,
return
);
ow
->
showOutput
(
channel
,
output
);
}
void
DebuggerRunControl
::
showDebuggerInput
(
const
QString
&
input
,
int
channel
)
{
DebuggerOutputWindow
*
ow
=
m_manager
->
debuggerOutputWindow
();
QTC_ASSERT
(
ow
,
return
);
ow
->
showInput
(
channel
,
input
);
}
void
DebuggerRunControl
::
stop
()
{
...
...
src/plugins/debugger/debuggerrunner.h
View file @
9f7e9dc0
...
...
@@ -130,11 +130,7 @@ signals:
void
stopRequested
();
public
slots
:
void
showDebuggerOutput
(
const
QString
&
msg
)
{
showDebuggerOutput
(
msg
,
LogDebug
);
}
void
showApplicationOutput
(
const
QString
&
output
,
bool
onStdErr
);
void
showDebuggerOutput
(
const
QString
&
output
,
int
channel
);
void
showDebuggerInput
(
const
QString
&
input
,
int
channel
);
void
showMessage
(
const
QString
&
output
,
int
channel
=
LogDebug
,
int
timeout
=
-
1
);
private
slots
:
void
slotMessageAvailable
(
const
QString
&
data
,
bool
isError
);
...
...
src/plugins/debugger/gdb/abstractgdbadapter.h
View file @
9f7e9dc0
...
...
@@ -109,10 +109,8 @@ protected:
{
return
m_engine
->
startParameters
();
}
DebuggerRunControl
*
runControl
()
const
{
return
m_engine
->
runControl
();
}
void
debugMessage
(
const
QString
&
msg
)
const
{
m_engine
->
debugMessage
(
msg
);
}
void
showStatusMessage
(
const
QString
&
msg
)
const
{
m_engine
->
showStatusMessage
(
msg
);
}
void
showMessage
(
const
QString
&
msg
,
int
channel
=
LogDebug
,
int
timeout
=
1
)
{
runControl
()
->
showMessage
(
msg
,
channel
,
timeout
);
}
void
showMessageBox
(
int
icon
,
const
QString
&
title
,
const
QString
&
text
)
const
{
m_engine
->
showMessageBox
(
icon
,
title
,
text
);
}
...
...
src/plugins/debugger/gdb/abstractplaingdbadapter.cpp
View file @
9f7e9dc0
...
...
@@ -91,8 +91,8 @@ void AbstractPlainGdbAdapter::handleExecRun(const GdbResponse &response)
{
if
(
response
.
resultClass
==
GdbResultRunning
)
{
QTC_ASSERT
(
state
()
==
InferiorRunning
,
qDebug
()
<<
state
());
debug
Message
(
_
(
"INFERIOR STARTED"
));
show
Status
Message
(
msgInferiorStarted
());
show
Message
(
_
(
"INFERIOR STARTED"
));
showMessage
(
msgInferiorStarted
()
,
StatusBar
);
// FIXME: That's the wrong place for it.
if
(
theDebuggerBoolSetting
(
EnableReverseDebugging
))
m_engine
->
postCommand
(
"target record"
);
...
...
src/plugins/debugger/gdb/attachgdbadapter.cpp
View file @
9f7e9dc0
...
...
@@ -58,7 +58,7 @@ void AttachGdbAdapter::startAdapter()
{
QTC_ASSERT
(
state
()
==
EngineStarting
,
qDebug
()
<<
state
());
setState
(
AdapterStarting
);
debug
Message
(
_
(
"TRYING TO START ADAPTER"
));
show
Message
(
_
(
"TRYING TO START ADAPTER"
));
if
(
!
m_engine
->
startGdb
())
return
;
...
...
@@ -80,8 +80,8 @@ void AttachGdbAdapter::handleAttach(const GdbResponse &response)
QTC_ASSERT
(
state
()
==
InferiorStarting
,
qDebug
()
<<
state
());
if
(
response
.
resultClass
==
GdbResultDone
)
{
setState
(
InferiorStopped
);
debug
Message
(
_
(
"INFERIOR ATTACHED"
));
show
Status
Message
(
msgAttachedToStoppedInferior
());
show
Message
(
_
(
"INFERIOR ATTACHED"
));
showMessage
(
msgAttachedToStoppedInferior
()
,
StatusBar
);
emit
inferiorPrepared
();
m_engine
->
updateAll
();
}
else
{
...
...
@@ -95,7 +95,7 @@ void AttachGdbAdapter::interruptInferior()
const
qint64
pid
=
startParameters
().
attachPID
;
QTC_ASSERT
(
pid
>
0
,
return
);
if
(
!
interruptProcess
(
pid
))
debug
Message
(
_
(
"CANNOT INTERRUPT %1"
).
arg
(
pid
));
show
Message
(
_
(
"CANNOT INTERRUPT %1"
).
arg
(
pid
));
}
}
// namespace Internal
...
...
src/plugins/debugger/gdb/classicgdbengine.cpp
View file @
9f7e9dc0
...
...
@@ -160,8 +160,8 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
// Avoid endless loops created by faulty dumpers.
QByteArray
processedName
=
QByteArray
::
number
(
dumpChildren
)
+
'-'
+
data
.
iname
;
if
(
m_processedNames
.
contains
(
processedName
))
{
show
DebuggerInput
(
_
(
"<Breaking endless loop for "
+
data
.
iname
+
'>'
),
Log
Status
);
show
Message
(
_
(
"<Breaking endless loop for "
+
data
.
iname
+
'>'
),
Log
MiscInput
);
data
.
setAllUnneeded
();
data
.
setValue
(
_
(
"<unavailable>"
));
data
.
setHasChildren
(
false
);
...
...
@@ -395,7 +395,7 @@ void GdbEngine::handleDebuggingHelperValue2Classic(const GdbResponse &response)
// Remove traces of the question, too.
if
(
m_cookieForToken
.
contains
(
response
.
token
-
1
))
{
m_cookieForToken
.
remove
(
response
.
token
-
1
);
debug
Message
(
_
(
"DETECTING LOST COMMAND %1"
).
arg
(
response
.
token
-
1
));
show
Message
(
_
(
"DETECTING LOST COMMAND %1"
).
arg
(
response
.
token
-
1
));
--
m_pendingWatchRequests
;
data
.
setError
(
WatchData
::
msgNotInScope
());
insertData
(
data
);
...
...
@@ -591,12 +591,12 @@ void GdbEngine::setDebugDebuggingHelpersClassic(const QVariant &on)
{
PRECONDITION
;
if
(
on
.
toBool
())
{
debug
Message
(
_
(
"SWITCHING ON DUMPER DEBUGGING"
));
show
Message
(
_
(
"SWITCHING ON DUMPER DEBUGGING"
));
postCommand
(
"set unwindonsignal off"
);
m_manager
->
breakByFunction
(
_
(
"qDumpObjectData440"
));
//updateLocals();
}
else
{
debug
Message
(
_
(
"SWITCHING OFF DUMPER DEBUGGING"
));
show
Message
(
_
(
"SWITCHING OFF DUMPER DEBUGGING"
));
postCommand
(
"set unwindonsignal on"
);
}
}
...
...
@@ -641,7 +641,7 @@ void GdbEngine::handleStackListArgumentsClassic(const GdbResponse &response)
}
else
{
// Seems to occur on "RedHat 4 based Linux" gdb 7.0.1:
// ^error,msg="Cannot access memory at address 0x0"
debug
Message
(
_
(
"UNEXPECTED RESPONSE: "
)
+
response
.
toString
());
show
Message
(
_
(
"UNEXPECTED RESPONSE: "
)
+
response
.
toString
());
}
}
...
...
@@ -698,7 +698,7 @@ bool GdbEngine::checkDebuggingHelpersClassic()
const
QStringList
&
locations
=
manager
()
->
qtDumperLibraryLocations
();
const
QString
loc
=
locations
.
join
(
QLatin1String
(
", "
));
const
QString
msg
=
tr
(
"The debugging helper library was not found at %1."
).
arg
(
loc
);
debug
Message
(
msg
);
show
Message
(
msg
);
manager
()
->
showQtDumperLibraryWarning
(
msg
);
return
false
;
}
...
...
@@ -757,11 +757,11 @@ void GdbEngine::handleDebuggingHelperVersionCheckClassic(const GdbResponse &resp
"application (%2).
\n
This might yield incorrect results."
)
.
arg
(
dumperQtVersion
).
arg
(
debuggeeQtVersion
));
}
else
{
debug
Message
(
_
(
"DUMPER VERSION CHECK SUCCESSFUL: "
)
show
Message
(
_
(
"DUMPER VERSION CHECK SUCCESSFUL: "
)
+
dumperQtVersion
);
}
}
else
{
debug
Message
(
"DUMPER VERSION CHECK NOT COMPLETED"
);
show
Message
(
"DUMPER VERSION CHECK NOT COMPLETED"
);
}
}
...
...
src/plugins/debugger/gdb/coregdbadapter.cpp
View file @
9f7e9dc0
...
...
@@ -61,7 +61,7 @@ void CoreGdbAdapter::startAdapter()
{
QTC_ASSERT
(
state
()
==
EngineStarting
,
qDebug
()
<<
state
());
setState
(
AdapterStarting
);
debug
Message
(
_
(
"TRYING TO START ADAPTER"
));
show
Message
(
_
(
"TRYING TO START ADAPTER"
));
if
(
!
m_engine
->
startGdb
())
return
;
...
...
@@ -106,7 +106,7 @@ void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
{
QTC_ASSERT
(
state
()
==
InferiorStarting
,
qDebug
()
<<
state
());
if
(
response
.
resultClass
==
GdbResultDone
)
{
show
Status
Message
(
tr
(
"Symbols found."
));
showMessage
(
tr
(
"Symbols found."
)
,
StatusBar
);
}
else
{
QString
msg
=
tr
(
"Loading symbols from
\"
%1
\"
failed:
\n
"
).
arg
(
m_executable
)
+
QString
::
fromLocal8Bit
(
response
.
data
.
findChild
(
"msg"
).
data
());
...
...
@@ -144,7 +144,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
.
absoluteFilePath
(
m_executable
);
if
(
QFile
::
exists
(
m_executable
))
{
// Finish extra round ...
show
Status
Message
(
tr
(
"Attached to core temporarily."
));
showMessage
(
tr
(
"Attached to core temporarily."
)
,
StatusBar
);
m_engine
->
postCommand
(
"detach"
);
// ... and retry.
loadExeAndSyms
();
...
...
@@ -156,7 +156,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
tr
(
"Unable to determine executable from core file."
));
}
#endif
show
Status
Message
(
tr
(
"Attached to core."
));
showMessage
(
tr
(
"Attached to core."
)
,
StatusBar
);
setState
(
InferiorUnrunnable
);
m_engine
->
updateAll
();
}
else
{
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
9f7e9dc0
...
...
@@ -341,18 +341,13 @@ void GdbEngine::readDebugeeOutput(const QByteArray &data)
data
.
constData
(),
data
.
length
(),
&
m_outputCodecState
),
true
);
}
void
GdbEngine
::
debugMessage
(
const
QString
&
msg
)
{
showDebuggerOutput
(
msg
,
LogDebug
);
}
void
GdbEngine
::
handleResponse
(
const
QByteArray
&
buff
)
{
static
QTime
lastTime
;
if
(
theDebuggerBoolSetting
(
LogTimeStamps
))
show
DebuggerOutput
(
currentTime
(),
LogTime
);
show
DebuggerOutput
(
QString
::
fromLocal8Bit
(
buff
,
buff
.
length
()),
LogOutput
);
show
Message
(
currentTime
(),
LogTime
);
show
Message
(
QString
::
fromLocal8Bit
(
buff
,
buff
.
length
()),
LogOutput
);
#if 0
qDebug() // << "#### start response handling #### "
...
...
@@ -624,7 +619,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
void
GdbEngine
::
readGdbStandardError
()
{
QByteArray
err
=
gdbProc
()
->
readAllStandardError
();
debug
Message
(
_
(
"UNEXPECTED GDB STDERR: "
+
err
));
show
Message
(
_
(
"UNEXPECTED GDB STDERR: "
+
err
));
if
(
err
==
"Undefined command:
\"
bb
\"
. Try
\"
help
\"
.
\n
"
)
return
;
if
(
err
.
startsWith
(
"BFD: reopening"
))
...
...
@@ -678,7 +673,7 @@ void GdbEngine::interruptInferior()
setState
(
InferiorStopping
);
showStatusMessage
(
tr
(
"Stop requested..."
),
5000
);
debug
Message
(
_
(
"TRYING TO INTERRUPT INFERIOR"
));
show
Message
(
_
(
"TRYING TO INTERRUPT INFERIOR"
));
m_gdbAdapter
->
interruptInferior
();
}
...
...
@@ -696,12 +691,12 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0)
{
const
qint64
pid
=
pid0
.
toLongLong
();
if
(
pid
==
0
)
{
debug
Message
(
_
(
"Cannot parse PID from %1"
).
arg
(
pid0
));
show
Message
(
_
(
"Cannot parse PID from %1"
).
arg
(
pid0
));
return
;
}
if
(
pid
==
inferiorPid
())
return
;
debug
Message
(
_
(
"FOUND PID %1"
).
arg
(
pid
));
show
Message
(
_
(
"FOUND PID %1"
).
arg
(
pid
));
handleInferiorPidChanged
(
pid
);
}
...
...
@@ -748,7 +743,7 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
{
if
(
!
stateAcceptsGdbCommands
(
state
()))
{
PENDING_DEBUG
(
_
(
"NO GDB PROCESS RUNNING, CMD IGNORED: "
+
cmd
.
command
));
debug
Message
(
_
(
"NO GDB PROCESS RUNNING, CMD IGNORED: %1 %2"
)
show
Message
(
_
(
"NO GDB PROCESS RUNNING, CMD IGNORED: %1 %2"
)
.
arg
(
_
(
cmd
.
command
)).
arg
(
state
()));
return
;
}
...
...
@@ -779,24 +774,24 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
flushCommand
(
cmd
);
}
else
{
// Queue the commands that we cannot send at once.
debug
Message
(
_
(
"QUEUING COMMAND "
+
cmd
.
command
));
show
Message
(
_
(
"QUEUING COMMAND "
+
cmd
.
command
));
m_commandsToRunOnTemporaryBreak
.
append
(
cmd
);
if
(
state
()
==
InferiorStopping
)
{
if
(
cmd
.
flags
&
LosesChild
)
setState
(
InferiorStopping_Kill
);
debug
Message
(
_
(
"CHILD ALREADY BEING INTERRUPTED. STILL HOPING."
));
show
Message
(
_
(
"CHILD ALREADY BEING INTERRUPTED. STILL HOPING."
));
// Calling shutdown() here breaks all situations where two
// NeedsStop commands are issued in quick succession.
}
else
if
(
state
()
==
InferiorStopping_Kill
)
{
debug
Message
(
_
(
"CHILD ALREADY BEING INTERRUPTED (KILL PENDING)"
));
show
Message
(
_
(
"CHILD ALREADY BEING INTERRUPTED (KILL PENDING)"
));
// FIXME
shutdown
();
}
else
if
(
state
()
==
InferiorRunningRequested
)
{
if
(
cmd
.
flags
&
LosesChild
)
setState
(
InferiorRunningRequested_Kill
);
debug
Message
(
_
(
"RUNNING REQUESTED; POSTPONING INTERRUPT"
));
show
Message
(
_
(
"RUNNING REQUESTED; POSTPONING INTERRUPT"
));
}
else
if
(
state
()
==
InferiorRunningRequested_Kill
)
{
debug
Message
(
_
(
"RUNNING REQUESTED; POSTPONING INTERRUPT (KILL PENDING)"
));
show
Message
(
_
(
"RUNNING REQUESTED; POSTPONING INTERRUPT (KILL PENDING)"
));
}
else
if
(
state
()
==
InferiorRunning
)
{
showStatusMessage
(
tr
(
"Stopping temporarily"
),
1000
);
interruptInferiorTemporarily
();
...
...
@@ -814,7 +809,7 @@ void GdbEngine::flushQueuedCommands()
showStatusMessage
(
tr
(
"Processing queued commands"
),
1000
);
while
(
!
m_commandsToRunOnTemporaryBreak
.
isEmpty
())
{
GdbCommand
cmd
=
m_commandsToRunOnTemporaryBreak
.
takeFirst
();
debug
Message
(
_
(
"RUNNING QUEUED COMMAND "
+
cmd
.
command
+
' '
show
Message
(
_
(
"RUNNING QUEUED COMMAND "
+
cmd
.
command
+
' '
+
cmd
.
callbackName
));
flushCommand
(
cmd
);
}
...
...
@@ -824,8 +819,8 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
{
GdbCommand
cmd
=
cmd0
;
if
(
state
()
==
DebuggerNotReady
)
{
show
DebuggerInput
(
_
(
cmd
.
command
),
LogInput
);
debug
Message
(
_
(
"GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: "
+
cmd
.
command
));
show
Message
(
_
(
cmd
.
command
),
LogInput
);
show
Message
(
_
(
"GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: "
+
cmd
.
command
));
return
;
}
...
...
@@ -833,7 +828,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
cmd
.
postTime
=
QTime
::
currentTime
();
m_cookieForToken
[
currentToken
()]
=
cmd
;
cmd
.
command
=
QByteArray
::
number
(
currentToken
())
+
cmd
.
command
;
show
DebuggerInput
(
_
(
cmd
.
command
),
LogInput
);
show
Message
(
_
(
cmd
.
command
),
LogInput
);
m_gdbAdapter
->
write
(
cmd
.
command
+
"
\r\n
"
);
...
...
@@ -862,10 +857,10 @@ void GdbEngine::commandTimeout()
msg
+=
": "
+
cmd
.
command
+
" => "
;
QTC_ASSERT
(
cmd
.
callbackName
,
/**/
);
msg
+=
cmd
.
callbackName
;
debug
Message
(
_
(
msg
));
show
Message
(
_
(
msg
));
}
if
(
killIt
)
{
debug
Message
(
_
(
"TIMED OUT WAITING FOR GDB REPLY. COMMANDS STILL IN PROGRESS:"
));
show
Message
(
_
(
"TIMED OUT WAITING FOR GDB REPLY. COMMANDS STILL IN PROGRESS:"
));
int
timeOut
=
m_commandTimer
->
interval
();
//m_commandTimer->stop();
const
QString
msg
=
tr
(
"The gdb process has not responded "
...
...
@@ -879,15 +874,15 @@ void GdbEngine::commandTimeout()
mb
->
button
(
QMessageBox
::
Cancel
)
->
setText
(
tr
(
"Give gdb more time"
));
mb
->
button
(
QMessageBox
::
Ok
)
->
setText
(
tr
(
"Stop debugging"
));
if
(
mb
->
exec
()
==
QMessageBox
::
Ok
)
{
debug
Message
(
_
(
"KILLING DEBUGGER AS REQUESTED BY USER"
));
show
Message
(
_
(
"KILLING DEBUGGER AS REQUESTED BY USER"
));
// This is an undefined state, so we just pull the emergency brake.
manager
()
->
watchHandler
()
->
endCycle
();
gdbProc
()
->
kill
();
}
else
{
debug
Message
(
_
(
"CONTINUE DEBUGGER AS REQUESTED BY USER"
));
show
Message
(
_
(
"CONTINUE DEBUGGER AS REQUESTED BY USER"
));
}
}
else
{
debug
Message
(
_
(
"
\n
NON-CRITICAL TIMEOUT
\n
"
));
show
Message
(
_
(
"
\n
NON-CRITICAL TIMEOUT
\n
"
));
}
}
...
...
@@ -906,7 +901,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// reported in the "first" response to the command) in practice it
// does. We try to handle a few situations we are aware of gracefully.
// Ideally, this code should not be present at all.
debug
Message
(
_
(
"COOKIE FOR TOKEN %1 ALREADY EATEN. "
show
Message
(
_
(
"COOKIE FOR TOKEN %1 ALREADY EATEN. "
"TWO RESPONSES FOR ONE COMMAND?"
).
arg
(
token
));
if
(
response
->
resultClass
==
GdbResultError
)
{
QByteArray
msg
=
response
->
data
.
findChild
(
"msg"
).
data
();
...
...
@@ -914,7 +909,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc
// with helpers enabled. In this case we get a second response with
// msg="Cannot find new threads: generic error"
debug
Message
(
_
(
"APPLYING WORKAROUND #1"
));
show
Message
(
_
(
"APPLYING WORKAROUND #1"
));
showMessageBox
(
QMessageBox
::
Critical
,
tr
(
"Executable failed"
),
QString
::
fromLocal8Bit
(
msg
));
showStatusMessage
(
tr
(
"Process failed to start"
));
...
...
@@ -922,13 +917,13 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
}
else
if
(
msg
==
"
\"
finish
\"
not meaningful in the outermost frame."
)
{
// Handle a case known to appear on gdb 6.4 symbianelf when
// the stack is cut due to access to protected memory.
debug
Message
(
_
(
"APPLYING WORKAROUND #2"
));
show
Message
(
_
(
"APPLYING WORKAROUND #2"
));
setState
(
InferiorStopping
);
setState
(
InferiorStopped
);
}
else
if
(
msg
.
startsWith
(
"Cannot find bounds of current function"
))
{
// Happens when running "-exec-next" in a function for which
// there is no debug information. Divert to "-exec-next-step"
debug
Message
(
_
(
"APPLYING WORKAROUND #3"
));
show
Message
(
_
(
"APPLYING WORKAROUND #3"
));
setState
(
InferiorStopping
);
setState
(
InferiorStopped
);
executeNextI
();
...
...
@@ -936,7 +931,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// Happens on archer-tromey-python 6.8.50.20090910-cvs
// There might to be a race between a process shutting down
// and library load messages.
debug
Message
(
_
(
"APPLYING WORKAROUND #4"
));
show
Message
(
_
(
"APPLYING WORKAROUND #4"
));
setState
(
InferiorStopping
);
setState
(
InferiorStopped
);
setState
(
InferiorShuttingDown
);
...
...
@@ -958,14 +953,14 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
GdbCommand
cmd
=
m_cookieForToken
.
take
(
token
);