Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
f88a010a
Commit
f88a010a
authored
Jul 12, 2010
by
Robert Loehning
Committed by
hjk
Jul 14, 2010
Browse files
debugger: state compile fix on Windows
parent
3eef8a43
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/cdb/cdbengine.cpp
View file @
f88a010a
...
...
@@ -437,10 +437,13 @@ void CdbEngine::setupInferior()
void
CdbEngine
::
runEngine
()
{
QTC_ASSERT
(
m_
state
==
Inferior
SetupOk
,
qDebug
()
<<
m_
state
);
QTC_ASSERT
(
state
()
==
Inferior
RunRequested
,
qDebug
()
<<
state
()
);
showStatusMessage
(
"Starting Debugger"
,
messageTimeOut
);
const
DebuggerStartParameters
&
sp
=
startParameters
();
bool
rc
=
false
;
bool
needWatchTimer
=
false
;
QString
errorMessage
;
m_d
->
clearForRun
();
m_d
->
updateCodeLevel
();
m_d
->
m_ignoreInitialBreakPoint
=
false
;
...
...
@@ -504,7 +507,7 @@ bool CdbEngine::startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *e
void
CdbEnginePrivate
::
processCreatedAttached
(
ULONG64
processHandle
,
ULONG64
initialThreadHandle
)
{
m_engine
->
setState
(
InferiorRunRequested
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
notify
InferiorRunRequested
(
);
setDebuggeeHandles
(
reinterpret_cast
<
HANDLE
>
(
processHandle
),
reinterpret_cast
<
HANDLE
>
(
initialThreadHandle
));
ULONG
currentThreadId
;
if
(
SUCCEEDED
(
interfaces
().
debugSystemObjects
->
GetThreadIdByHandle
(
initialThreadHandle
,
&
currentThreadId
)))
{
...
...
@@ -531,7 +534,7 @@ void CdbEnginePrivate::processCreatedAttached(ULONG64 processHandle, ULONG64 ini
m_engine
->
warning
(
QString
::
fromLatin1
(
"Handshake failed on event #%1: %2"
).
arg
(
evtNr
).
arg
(
CdbCore
::
msgComFailed
(
"SetNotifyEventHandle"
,
hr
)));
}
}
m_engine
->
setState
(
InferiorRunOk
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
notify
InferiorRunOk
(
);
if
(
debugCDBExecution
)
qDebug
()
<<
"<processCreatedAttached"
;
}
...
...
@@ -539,21 +542,22 @@ void CdbEnginePrivate::processCreatedAttached(ULONG64 processHandle, ULONG64 ini
void
CdbEngine
::
processTerminated
(
unsigned
long
exitCode
)
{
showMessage
(
tr
(
"The process exited with exit code %1."
).
arg
(
exitCode
));
if
(
state
()
!=
InferiorStopRequested
)
setState
(
InferiorStopRequested
,
Q_FUNC_INFO
,
__LINE__
);
setState
(
InferiorStopOk
,
Q_FUNC_INFO
,
__LINE__
);
setState
(
InferiorShutdownRequested
,
Q_FUNC_INFO
,
__LINE__
);
//
if (state() != InferiorStopRequested)
//
setState(InferiorStopRequested, Q_FUNC_INFO, __LINE__);
//
setState(InferiorStopOk, Q_FUNC_INFO, __LINE__);
//
setState(InferiorShutdownRequested, Q_FUNC_INFO, __LINE__);
m_d
->
setDebuggeeHandles
(
0
,
0
);
m_d
->
clearForRun
();
setState
(
InferiorShutdownOk
,
Q_FUNC_INFO
,
__LINE__
);
//
setState(InferiorShutdownOk, Q_FUNC_INFO, __LINE__);
// Avoid calls from event handler.
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
quitDebugger
()));
//QTimer::singleShot(0, this, SLOT(quitDebugger()));
notifyInferiorExited
();
// FIXME AAA: correnct?
}
bool
CdbEnginePrivate
::
endInferior
(
EndInferiorAction
action
,
QString
*
errorMessage
)
{
// Process must be stopped in order to terminate
m_engine
->
setState
(
InferiorShutdownRequested
,
Q_FUNC_INFO
,
__LINE__
);
// pretend it is shutdown
//
m_engine->setState(InferiorShutdownRequested, Q_FUNC_INFO, __LINE__); // pretend it is shutdown
const
bool
wasRunning
=
isDebuggeeRunning
();
if
(
wasRunning
)
{
interruptInterferiorProcess
(
errorMessage
);
...
...
@@ -582,7 +586,10 @@ bool CdbEnginePrivate::endInferior(EndInferiorAction action, QString *errorMessa
// Perform cleanup even when failed..no point clinging to the process
setDebuggeeHandles
(
0
,
0
);
killWatchTimer
();
m_engine
->
setState
(
success
?
InferiorShutdownOk
:
InferiorShutdownFailed
,
Q_FUNC_INFO
,
__LINE__
);
if
(
success
)
m_engine
->
notifyInferiorShutdownOk
();
else
m_engine
->
notifyInferiorShutdownFailed
();
return
success
;
}
...
...
@@ -623,10 +630,10 @@ void CdbEnginePrivate::endDebugging(EndDebuggingMode em)
errorMessage
.
clear
();
}
// Clean up resources (open files, etc.)
m_engine
->
setState
(
EngineShutdownRequested
,
Q_FUNC_INFO
,
__LINE__
);
//
m_engine->setState(EngineShutdownRequested, Q_FUNC_INFO, __LINE__);
clearForRun
();
const
bool
endedCleanly
=
endSession
(
&
errorMessage
);
m_engine
->
setState
(
DebuggerNotReady
,
Q_FUNC_INFO
,
__LINE__
);
//
m_engine->setState(DebuggerNotReady, Q_FUNC_INFO, __LINE__);
if
(
!
endedCleanly
)
{
errorMessage
=
QString
::
fromLatin1
(
"There were errors trying to end debugging:
\n
%1"
).
arg
(
errorMessage
);
m_engine
->
showMessage
(
errorMessage
,
LogError
);
...
...
@@ -712,15 +719,15 @@ bool CdbEnginePrivate::executeContinueCommand(const QString &command)
qDebug
()
<<
Q_FUNC_INFO
<<
command
;
clearForRun
();
updateCodeLevel
();
// Step by instruction
m_engine
->
setState
(
InferiorRunRequested
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
notify
InferiorRunRequested
(
);
m_engine
->
showMessage
(
CdbEngine
::
tr
(
"Continuing with '%1'..."
).
arg
(
command
));
QString
errorMessage
;
const
bool
success
=
executeDebuggerCommand
(
command
,
&
errorMessage
);
if
(
success
)
{
m_engine
->
setState
(
InferiorRunOk
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
notify
InferiorRunOk
(
);
startWatchTimer
();
}
else
{
m_engine
->
setState
(
InferiorStopOk
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
notifyInferiorRunFailed
(
);
m_engine
->
warning
(
CdbEngine
::
tr
(
"Unable to continue: %1"
).
arg
(
errorMessage
));
}
return
success
;
...
...
@@ -772,7 +779,7 @@ bool CdbEngine::step(unsigned long executionStatus)
||
threadsHandler
()
->
threads
().
size
()
==
1
;
m_d
->
clearForRun
();
// clears thread ids
m_d
->
updateCodeLevel
();
// Step by instruction or source line
setState
(
InferiorRunRequested
,
Q_FUNC_INFO
,
__LINE__
);
notify
InferiorRunRequested
(
);
bool
success
=
false
;
if
(
sameThread
&&
executionStatus
!=
CdbExtendedExecutionStatusStepOut
)
{
// Step event-triggering thread, use fast API
const
HRESULT
hr
=
m_d
->
interfaces
().
debugControl
->
SetExecutionStatus
(
executionStatus
);
...
...
@@ -806,9 +813,9 @@ bool CdbEngine::step(unsigned long executionStatus)
if
(
executionStatus
==
DEBUG_STATUS_STEP_INTO
||
executionStatus
==
DEBUG_STATUS_REVERSE_STEP_INTO
)
m_d
->
m_breakEventMode
=
CdbEnginePrivate
::
BreakEventIgnoreOnce
;
m_d
->
startWatchTimer
();
setState
(
InferiorRunOk
,
Q_FUNC_INFO
,
__LINE__
);
notify
InferiorRunOk
(
);
}
else
{
setState
(
InferiorStopOk
,
Q_FUNC_INFO
,
__LINE__
);
notifyInferiorRunFailed
(
);
}
if
(
debugCDBExecution
)
qDebug
()
<<
"<step samethread"
<<
sameThread
<<
"succeeded"
<<
success
;
...
...
@@ -879,7 +886,7 @@ bool CdbEnginePrivate::continueInferior(QString *errorMessage)
return
true
;
}
// Request continue
m_engine
->
setState
(
InferiorRunRequested
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
notify
InferiorRunRequested
(
);
bool
success
=
false
;
do
{
clearForRun
();
...
...
@@ -895,9 +902,9 @@ bool CdbEnginePrivate::continueInferior(QString *errorMessage)
success
=
true
;
}
while
(
false
);
if
(
success
)
{
m_engine
->
setState
(
InferiorRunOk
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
notify
InferiorRunOk
(
);
}
else
{
m_engine
->
setState
(
InferiorStopOk
,
Q_FUNC_INFO
,
__LINE__
);
// No RunningRequest
Failed
?
m_engine
->
notifyInferiorRun
Failed
();
}
return
true
;
}
...
...
@@ -939,13 +946,13 @@ void CdbEngine::slotBreakAttachToCrashed()
void
CdbEngine
::
interruptInferior
()
{
QTC_ASSERT
(
state
()
==
InferiorStopRequested
,
qDebug
()
<<
state
());
if
(
!
m_d
->
m_hDebuggeeProcess
||
!
m_d
->
isDebuggeeRunning
())
return
;
QString
errorMessage
;
setState
(
InferiorStopRequested
,
Q_FUNC_INFO
,
__LINE__
);
if
(
!
m_d
->
interruptInterferiorProcess
(
&
errorMessage
))
{
setState
(
InferiorStopFailed
,
Q_FUNC_INFO
,
__LINE__
);
notify
InferiorStopFailed
(
);
warning
(
msgFunctionFailed
(
Q_FUNC_INFO
,
errorMessage
));
}
}
...
...
@@ -1331,9 +1338,9 @@ void CdbEnginePrivate::handleDebugEvent()
case
BreakEventHandle
:
{
// If this is triggered by breakpoint/crash: Set state to stopping
// to avoid warnings as opposed to interrupt inferior
if
(
m_engine
->
state
()
!=
InferiorStopRequested
)
m_engine
->
setState
(
InferiorStopRequested
,
Q_FUNC_INFO
,
__LINE__
);
m_engine
->
setState
(
InferiorStopOk
,
Q_FUNC_INFO
,
__LINE__
);
//
if (m_engine->state() != InferiorStopRequested)
FIXME: AAA
//
m_engine->setState(InferiorStopRequested, Q_FUNC_INFO, __LINE__);
m_engine
->
notify
InferiorStopOk
(
);
// Indicate artifical thread that is created when interrupting as such,
// else use stop message with cleaned newlines and blanks.
const
QString
currentThreadState
=
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
f88a010a
...
...
@@ -171,15 +171,16 @@
// +
// (calls *Engine->setupEngine())
// | |
// | |
// {notify- {notify-
// Engine- Engine-
// SetupOk} SetupFailed}
//
|
|
//
|
`
---
> EngineSetupFailed
//
|
+
//
|
[calls RunControl->startFailed]
//
|
+
//
|
Debugger
NotReady
//
+
+
//
+
`
+-+-+
> EngineSetupFailed
//
+
+
//
+
[calls RunControl->startFailed]
//
+
+
//
+
Debugger
Finished
// v
// EngineSetupOk
// +
...
...
@@ -258,6 +259,7 @@
// + +
// (calls *Engine->shutdownEngine()) <+-+-+-+-+-+-+-+-+-+-+-+-+-+'
// | |
// | |
// {notify- {notify-
// Inferior- Inferior-
// ShutdownOk} ShutdownFailed}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment