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
471d31ac
Commit
471d31ac
authored
Apr 21, 2009
by
Friedemann Kleint
Browse files
CDB refactoring, introduce typedefs to remove version numbers.
Log exceptions with stacktrace.
parent
6e9a237c
Changes
19
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/cdb/cdb.pri
View file @
471d31ac
...
...
@@ -27,6 +27,7 @@ INCLUDEPATH*=$$PWD
CDB_LIBPATH=$$CDB_PATH/lib/$$CDB_PLATFORM
HEADERS += \
$$PWD/cdbcom.h \
$$PWD/cdbdebugengine.h \
$$PWD/cdbdebugengine_p.h \
$$PWD/cdbdebugeventcallback.h \
...
...
src/plugins/debugger/cdb/cdbassembler.cpp
View file @
471d31ac
...
...
@@ -42,8 +42,8 @@ namespace Internal {
typedef
QList
<
DisassemblerLine
>
DisassemblerLineList
;
bool
getRegisters
(
IDebugControl
4
*
ctl
,
IDebugRegisters
2
*
ireg
,
bool
getRegisters
(
C
IDebugControl
*
ctl
,
C
IDebugRegisters
*
ireg
,
QList
<
Register
>
*
registers
,
QString
*
errorMessage
,
int
base
)
{
...
...
@@ -194,8 +194,8 @@ void DisassemblerOutputParser::parse(const QStringList &l)
}
}
bool
dissassemble
(
IDebugClient
5
*
client
,
IDebugControl
4
*
ctl
,
bool
dissassemble
(
C
IDebugClient
*
client
,
C
IDebugControl
*
ctl
,
ULONG64
offset
,
unsigned
long
beforeLines
,
unsigned
long
afterLines
,
...
...
src/plugins/debugger/cdb/cdbassembler.h
View file @
471d31ac
...
...
@@ -33,8 +33,7 @@
#include
<QtCore/QList>
#include
<QtCore/QString>
#include
<windows.h>
#include
<inc/dbgeng.h>
#include
"cdbcom.h"
namespace
Debugger
{
namespace
Internal
{
...
...
@@ -44,14 +43,14 @@ class DisassemblerLine;
// Utilities related to assembler code.
class
Register
;
bool
getRegisters
(
IDebugControl
4
*
ctl
,
IDebugRegisters
2
*
ireg
,
bool
getRegisters
(
C
IDebugControl
*
ctl
,
C
IDebugRegisters
*
ireg
,
QList
<
Register
>
*
registers
,
QString
*
errorMessage
,
int
base
=
10
/* 16 for hex, etc */
);
bool
dissassemble
(
IDebugClient
5
*
client
,
IDebugControl
4
*
ctl
,
bool
dissassemble
(
C
IDebugClient
*
client
,
C
IDebugControl
*
ctl
,
ULONG64
offset
,
unsigned
long
beforeLines
,
unsigned
long
afterLines
,
...
...
src/plugins/debugger/cdb/cdbbreakpoint.cpp
View file @
471d31ac
...
...
@@ -131,7 +131,7 @@ QString CDBBreakPoint::expression() const
return
rc
;
}
bool
CDBBreakPoint
::
apply
(
IDebugBreakpoint
2
*
ibp
,
QString
*
errorMessage
)
const
bool
CDBBreakPoint
::
apply
(
C
IDebugBreakpoint
*
ibp
,
QString
*
errorMessage
)
const
{
const
QString
expr
=
expression
();
if
(
debugCDB
)
...
...
@@ -148,7 +148,7 @@ bool CDBBreakPoint::apply(IDebugBreakpoint2 *ibp, QString *errorMessage) const
return
true
;
}
bool
CDBBreakPoint
::
add
(
IDebugControl
4
*
debugControl
,
QString
*
errorMessage
)
const
bool
CDBBreakPoint
::
add
(
C
IDebugControl
*
debugControl
,
QString
*
errorMessage
)
const
{
IDebugBreakpoint2
*
ibp
=
0
;
const
HRESULT
hr
=
debugControl
->
AddBreakpoint2
(
DEBUG_BREAKPOINT_CODE
,
DEBUG_ANY_ID
,
&
ibp
);
...
...
@@ -176,7 +176,7 @@ QString CDBBreakPoint::canonicalSourceFile(const QString &f)
return
rc
;
}
bool
CDBBreakPoint
::
retrieve
(
IDebugBreakpoint
2
*
ibp
,
QString
*
errorMessage
)
bool
CDBBreakPoint
::
retrieve
(
C
IDebugBreakpoint
*
ibp
,
QString
*
errorMessage
)
{
clear
();
WCHAR
wszBuf
[
MAX_PATH
];
...
...
@@ -245,7 +245,7 @@ bool CDBBreakPoint::parseExpression(const QString &expr)
return
true
;
}
bool
CDBBreakPoint
::
getBreakPointCount
(
IDebugControl
4
*
debugControl
,
ULONG
*
count
,
QString
*
errorMessage
/* = 0*/
)
bool
CDBBreakPoint
::
getBreakPointCount
(
C
IDebugControl
*
debugControl
,
ULONG
*
count
,
QString
*
errorMessage
/* = 0*/
)
{
const
HRESULT
hr
=
debugControl
->
GetNumberBreakpoints
(
count
);
if
(
FAILED
(
hr
))
{
...
...
@@ -257,7 +257,7 @@ bool CDBBreakPoint::getBreakPointCount(IDebugControl4* debugControl, ULONG *coun
return
true
;
}
bool
CDBBreakPoint
::
getBreakPoints
(
IDebugControl
4
*
debugControl
,
QList
<
CDBBreakPoint
>
*
bps
,
QString
*
errorMessage
)
bool
CDBBreakPoint
::
getBreakPoints
(
C
IDebugControl
*
debugControl
,
QList
<
CDBBreakPoint
>
*
bps
,
QString
*
errorMessage
)
{
ULONG
count
=
0
;
bps
->
clear
();
...
...
src/plugins/debugger/cdb/cdbbreakpoint.h
View file @
471d31ac
...
...
@@ -30,8 +30,7 @@
#ifndef CDBBREAKPOINTS_H
#define CDBBREAKPOINTS_H
#include
<windows.h>
#include
<inc/dbgeng.h>
#include
"cdbcom.h"
#include
<QtCore/QString>
#include
<QtCore/QList>
...
...
@@ -64,16 +63,16 @@ struct CDBBreakPoint
// Apply parameters
bool
apply
(
IDebugBreakpoint2
*
ibp
,
QString
*
errorMessage
)
const
;
// Convenience to add to a IDebugControl4
bool
add
(
IDebugControl
4
*
debugControl
,
QString
*
errorMessage
)
const
;
bool
add
(
C
IDebugControl
*
debugControl
,
QString
*
errorMessage
)
const
;
// Retrieve/parse breakpoints from the interfaces
bool
retrieve
(
IDebugBreakpoint2
*
ibp
,
QString
*
errorMessage
);
bool
parseExpression
(
const
QString
&
expr
);
// Retrieve all breakpoints from the engine
static
bool
getBreakPointCount
(
IDebugControl
4
*
debugControl
,
ULONG
*
count
,
QString
*
errorMessage
=
0
);
static
bool
getBreakPoints
(
IDebugControl
4
*
debugControl
,
QList
<
CDBBreakPoint
>
*
bps
,
QString
*
errorMessage
);
static
bool
getBreakPointCount
(
C
IDebugControl
*
debugControl
,
ULONG
*
count
,
QString
*
errorMessage
=
0
);
static
bool
getBreakPoints
(
C
IDebugControl
*
debugControl
,
QList
<
CDBBreakPoint
>
*
bps
,
QString
*
errorMessage
);
// Synchronize (halted) engine with BreakHandler.
static
bool
synchronizeBreakPoints
(
IDebugControl
4
*
ctl
,
IDebugSymbols
3
*
syms
,
static
bool
synchronizeBreakPoints
(
C
IDebugControl
*
ctl
,
C
IDebugSymbols
*
syms
,
BreakHandler
*
bh
,
QString
*
errorMessage
);
// Return a 'canonical' file (using '/' and capitalized drive letter)
...
...
src/plugins/debugger/cdb/cdbcom.h
0 → 100644
View file @
471d31ac
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef CDBCOM_H
#define CDBCOM_H
#include
<windows.h>
#include
<inc/dbgeng.h>
// typedef out the version numbers
typedef
IDebugClient5
CIDebugClient
;
typedef
IDebugControl4
CIDebugControl
;
typedef
IDebugSystemObjects4
CIDebugSystemObjects
;
typedef
IDebugSymbols3
CIDebugSymbols
;
typedef
IDebugRegisters2
CIDebugRegisters
;
typedef
IDebugDataSpaces4
CIDebugDataSpaces
;
typedef
IDebugSymbolGroup2
CIDebugSymbolGroup
;
typedef
IDebugBreakpoint2
CIDebugBreakpoint
;
#endif // CDBCOM_H
src/plugins/debugger/cdb/cdbdebugengine.cpp
View file @
471d31ac
...
...
@@ -125,25 +125,74 @@ static inline QString msgLibLoadFailed(const QString &lib, const QString &why)
// ----- Engine helpers
static
inline
ULONG
getInterruptTimeOutSecs
(
IDebugControl
4
*
ctl
)
static
inline
ULONG
getInterruptTimeOutSecs
(
C
IDebugControl
*
ctl
)
{
ULONG
rc
=
0
;
ctl
->
GetInterruptTimeout
(
&
rc
);
return
rc
;
}
static
inline
bool
getExecutionStatus
(
IDebugControl
4
*
ctl
,
ULONG
*
executionStatus
,
QString
*
errorMessage
)
bool
getExecutionStatus
(
C
IDebugControl
*
ctl
,
ULONG
*
executionStatus
,
QString
*
errorMessage
/* = 0 */
)
{
const
HRESULT
hr
=
ctl
->
GetExecutionStatus
(
executionStatus
);
if
(
FAILED
(
hr
))
{
*
errorMessage
=
msgComFailed
(
"GetExecutionStatus"
,
hr
);
if
(
errorMessage
)
*
errorMessage
=
msgComFailed
(
"GetExecutionStatus"
,
hr
);
return
false
;
}
return
true
;
}
const
char
*
executionStatusString
(
ULONG
executionStatus
)
{
switch
(
executionStatus
)
{
case
DEBUG_STATUS_NO_CHANGE
:
return
"DEBUG_STATUS_NO_CHANGE"
;
case
DEBUG_STATUS_GO
:
return
"DEBUG_STATUS_GO"
;
case
DEBUG_STATUS_GO_HANDLED
:
return
"DEBUG_STATUS_GO_HANDLED"
;
case
DEBUG_STATUS_GO_NOT_HANDLED
:
return
"DEBUG_STATUS_GO_NOT_HANDLED"
;
case
DEBUG_STATUS_STEP_OVER
:
return
"DEBUG_STATUS_STEP_OVER"
;
case
DEBUG_STATUS_STEP_INTO
:
return
"DEBUG_STATUS_STEP_INTO"
;
case
DEBUG_STATUS_BREAK
:
return
"DEBUG_STATUS_BREAK"
;
case
DEBUG_STATUS_NO_DEBUGGEE
:
return
"DEBUG_STATUS_NO_DEBUGGEE"
;
case
DEBUG_STATUS_STEP_BRANCH
:
return
"DEBUG_STATUS_STEP_BRANCH"
;
case
DEBUG_STATUS_IGNORE_EVENT
:
return
"DEBUG_STATUS_IGNORE_EVENT"
;
case
DEBUG_STATUS_RESTART_REQUESTED
:
return
"DEBUG_STATUS_RESTART_REQUESTED"
;
case
DEBUG_STATUS_REVERSE_GO
:
return
"DEBUG_STATUS_REVERSE_GO"
;
case
DEBUG_STATUS_REVERSE_STEP_BRANCH
:
return
"DEBUG_STATUS_REVERSE_STEP_BRANCH"
;
case
DEBUG_STATUS_REVERSE_STEP_OVER
:
return
"DEBUG_STATUS_REVERSE_STEP_OVER"
;
case
DEBUG_STATUS_REVERSE_STEP_INTO
:
return
"DEBUG_STATUS_REVERSE_STEP_INTO"
;
default:
break
;
}
return
"<Unknown execution status>"
;
}
// Debug convenience
const
char
*
executionStatusString
(
CIDebugControl
*
ctl
)
{
ULONG
executionStatus
;
if
(
getExecutionStatus
(
ctl
,
&
executionStatus
))
return
executionStatusString
(
executionStatus
);
return
"<failed>"
;
}
// --------- DebuggerEngineLibrary
DebuggerEngineLibrary
::
DebuggerEngineLibrary
()
:
m_debugCreate
(
0
)
...
...
@@ -189,7 +238,7 @@ bool DebuggerEngineLibrary::init(const QString &path, QString *errorMessage)
}
// ----- SyntaxSetter
SyntaxSetter
::
SyntaxSetter
(
IDebugControl
4
*
ctl
,
ULONG
desiredSyntax
)
:
SyntaxSetter
::
SyntaxSetter
(
C
IDebugControl
*
ctl
,
ULONG
desiredSyntax
)
:
m_desiredSyntax
(
desiredSyntax
),
m_ctl
(
ctl
)
{
...
...
@@ -385,8 +434,10 @@ void CdbDebugEngine::shutdown()
exitDebugger
();
}
void
CdbDebugEngine
::
setToolTipExpression
(
const
QPoint
&
/*
pos
*/
,
const
QString
&
/*
exp
*/
)
void
CdbDebugEngine
::
setToolTipExpression
(
const
QPoint
&
pos
,
const
QString
&
exp
)
{
if
(
debugCDB
)
qDebug
()
<<
Q_FUNC_INFO
<<
'\n'
<<
pos
<<
exp
;
}
void
CdbDebugEnginePrivate
::
clearDisplay
()
...
...
@@ -939,7 +990,7 @@ void CdbDebugEngine::executeDebuggerCommand(const QString &command)
qWarning
(
"%s
\n
"
,
qPrintable
(
errorMessage
));
}
bool
CdbDebugEnginePrivate
::
executeDebuggerCommand
(
IDebugControl
4
*
ctrl
,
const
QString
&
command
,
QString
*
errorMessage
)
bool
CdbDebugEnginePrivate
::
executeDebuggerCommand
(
C
IDebugControl
*
ctrl
,
const
QString
&
command
,
QString
*
errorMessage
)
{
if
(
debugCDB
)
qDebug
()
<<
Q_FUNC_INFO
<<
command
;
...
...
@@ -1186,6 +1237,10 @@ void CdbDebugEngine::reloadRegisters()
void
CdbDebugEngine
::
timerEvent
(
QTimerEvent
*
te
)
{
// Fetch away the debug events and notify if debuggee
// stops. Note that IDebugEventCallback does not
// cover all cases of a debuggee stopping execution
// (such as step over,etc).
if
(
te
->
timerId
()
!=
m_d
->
m_watchTimer
)
return
;
...
...
@@ -1319,8 +1374,7 @@ void CdbDebugEnginePrivate::updateStackTrace()
QString
errorMessage
;
m_engine
->
reloadRegisters
();
m_currentStackTrace
=
CdbStackTraceContext
::
create
(
m_cif
.
debugControl
,
m_cif
.
debugSystemObjects
,
m_cif
.
debugSymbols
,
m_currentThreadId
,
&
errorMessage
);
CdbStackTraceContext
::
create
(
&
m_cif
,
m_currentThreadId
,
&
errorMessage
);
if
(
!
m_currentStackTrace
)
{
qWarning
(
"%s: failed to create trace context: %s"
,
Q_FUNC_INFO
,
qPrintable
(
errorMessage
));
return
;
...
...
src/plugins/debugger/cdb/cdbdebugengine_p.h
View file @
471d31ac
...
...
@@ -73,11 +73,11 @@ private:
class
SyntaxSetter
{
Q_DISABLE_COPY
(
SyntaxSetter
)
public:
explicit
inline
SyntaxSetter
(
IDebugControl
4
*
ctl
,
ULONG
desiredSyntax
);
explicit
inline
SyntaxSetter
(
C
IDebugControl
*
ctl
,
ULONG
desiredSyntax
);
inline
~
SyntaxSetter
();
private:
const
ULONG
m_desiredSyntax
;
IDebugControl
4
*
m_ctl
;
C
IDebugControl
*
m_ctl
;
ULONG
m_oldSyntax
;
};
...
...
@@ -85,12 +85,12 @@ private:
struct
CdbComInterfaces
{
CdbComInterfaces
();
IDebugClient
5
*
debugClient
;
IDebugControl
4
*
debugControl
;
IDebugSystemObjects
4
*
debugSystemObjects
;
IDebugSymbols
3
*
debugSymbols
;
IDebugRegisters
2
*
debugRegisters
;
IDebugDataSpaces
4
*
debugDataSpaces
;
C
IDebugClient
*
debugClient
;
C
IDebugControl
*
debugControl
;
C
IDebugSystemObjects
*
debugSystemObjects
;
C
IDebugSymbols
*
debugSymbols
;
C
IDebugRegisters
*
debugRegisters
;
C
IDebugDataSpaces
*
debugDataSpaces
;
};
struct
CdbDebugEnginePrivate
...
...
@@ -130,7 +130,7 @@ struct CdbDebugEnginePrivate
bool
attemptBreakpointSynchronization
(
QString
*
errorMessage
);
static
bool
executeDebuggerCommand
(
IDebugControl
4
*
ctrl
,
const
QString
&
command
,
QString
*
errorMessage
);
static
bool
executeDebuggerCommand
(
C
IDebugControl
*
ctrl
,
const
QString
&
command
,
QString
*
errorMessage
);
const
QSharedPointer
<
CdbOptions
>
m_options
;
HANDLE
m_hDebuggeeProcess
;
...
...
@@ -154,6 +154,12 @@ struct CdbDebugEnginePrivate
Core
::
Utils
::
ConsoleProcess
m_consoleStubProc
;
};
// helper functions
bool
getExecutionStatus
(
CIDebugControl
*
ctl
,
ULONG
*
executionStatus
,
QString
*
errorMessage
=
0
);
const
char
*
executionStatusString
(
ULONG
executionStatus
);
const
char
*
executionStatusString
(
CIDebugControl
*
ctl
);
// Message
QString
msgDebugEngineComResult
(
HRESULT
hr
);
QString
msgComFailed
(
const
char
*
func
,
HRESULT
hr
);
...
...
src/plugins/debugger/cdb/cdbdebugeventcallback.cpp
View file @
471d31ac
...
...
@@ -32,8 +32,12 @@
#include
"cdbdebugengine_p.h"
#include
"debuggermanager.h"
#include
"breakhandler.h"
#include
"cdbstacktracecontext.h"
enum
{
cppExceptionCode
=
0xe06d7363
};
#include
<QtCore/QDebug>
#include
<QtCore/QTextStream>
namespace
Debugger
{
namespace
Internal
{
...
...
@@ -198,7 +202,7 @@ STDMETHODIMP CdbDebugEventCallbackBase::ChangeSymbolState(
return
S_OK
;
}
IDebugEventCallbacksWide
*
CdbDebugEventCallbackBase
::
getEventCallback
(
IDebugClient
5
*
clnt
)
IDebugEventCallbacksWide
*
CdbDebugEventCallbackBase
::
getEventCallback
(
C
IDebugClient
*
clnt
)
{
IDebugEventCallbacksWide
*
rc
=
0
;
if
(
SUCCEEDED
(
clnt
->
GetEventCallbacksWide
(
&
rc
)))
...
...
@@ -231,26 +235,116 @@ STDMETHODIMP CdbDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT2 Bp)
return
S_OK
;
}
static
inline
QString
msgException
(
const
EXCEPTION_RECORD64
*
Exception
,
ULONG
FirstChance
)
// Simple exception formatting
void
formatException
(
const
EXCEPTION_RECORD64
*
e
,
QTextStream
&
str
)
{
str
.
setIntegerBase
(
16
);
str
<<
"
\n
Exception at 0x"
<<
e
->
ExceptionAddress
<<
", code: 0x"
<<
e
->
ExceptionCode
<<
": "
;
switch
(
e
->
ExceptionCode
)
{
case
cppExceptionCode
:
str
<<
"C++ exception"
;
break
;
case
EXCEPTION_ACCESS_VIOLATION
:
{
const
bool
writeOperation
=
e
->
ExceptionInformation
[
0
];
str
<<
(
writeOperation
?
"write access violation"
:
"read access violation"
);
}
break
;
case
EXCEPTION_ARRAY_BOUNDS_EXCEEDED
:
str
<<
"arrary bounds exceeded"
;
break
;
case
EXCEPTION_BREAKPOINT
:
str
<<
"breakpoint"
;
break
;
case
EXCEPTION_DATATYPE_MISALIGNMENT
:
str
<<
"datatype misalignment"
;
break
;
case
EXCEPTION_FLT_DENORMAL_OPERAND
:
str
<<
"floating point exception"
;
break
;
case
EXCEPTION_FLT_DIVIDE_BY_ZERO
:
str
<<
"division by zero"
;
break
;
case
EXCEPTION_FLT_INEXACT_RESULT
:
str
<<
" floating-point operation cannot be represented exactly as a decimal fraction"
;
break
;
case
EXCEPTION_FLT_INVALID_OPERATION
:
str
<<
"invalid floating-point operation"
;
break
;
case
EXCEPTION_FLT_OVERFLOW
:
str
<<
"floating-point overflow"
;
break
;
case
EXCEPTION_FLT_STACK_CHECK
:
str
<<
"floating-point operation stack over/underflow"
;
break
;
case
EXCEPTION_FLT_UNDERFLOW
:
str
<<
"floating-point UNDERFLOW"
;
break
;
case
EXCEPTION_ILLEGAL_INSTRUCTION
:
str
<<
"invalid instruction"
;
break
;
case
EXCEPTION_IN_PAGE_ERROR
:
str
<<
"page in error"
;
break
;
case
EXCEPTION_INT_DIVIDE_BY_ZERO
:
str
<<
"integer division by zero"
;
break
;
case
EXCEPTION_INT_OVERFLOW
:
str
<<
"integer overflow"
;
break
;
case
EXCEPTION_INVALID_DISPOSITION
:
str
<<
"invalid disposition to exception dispatcher"
;
break
;
case
EXCEPTION_NONCONTINUABLE_EXCEPTION
:
str
<<
"attempt to continue execution after noncontinuable exception"
;
break
;
case
EXCEPTION_PRIV_INSTRUCTION
:
str
<<
"priviledged instruction"
;
break
;
case
EXCEPTION_SINGLE_STEP
:
str
<<
"single step"
;
break
;
case
EXCEPTION_STACK_OVERFLOW
:
str
<<
"stack_overflow"
;
break
;
}
str
<<
", flags=0x"
<<
e
->
ExceptionFlags
;
if
(
e
->
ExceptionFlags
==
EXCEPTION_NONCONTINUABLE
)
{
str
<<
" (execution cannot be continued)"
;
}
str
<<
"
\n\n
"
;
str
.
setIntegerBase
(
10
);
}
// Format exception with stacktrace in case of C++ exception
void
formatException
(
const
EXCEPTION_RECORD64
*
e
,
CdbComInterfaces
&
cif
,
QTextStream
&
str
)
{
return
QString
::
fromLatin1
(
"An exception occurred: Code=0x%1 FirstChance=%2"
).
arg
(
QString
::
number
(
Exception
->
ExceptionCode
,
16
)).
arg
(
FirstChance
);
formatException
(
e
,
str
);
if
(
e
->
ExceptionCode
==
cppExceptionCode
)
{
QString
errorMessage
;
ULONG
currentThreadId
=
0
;
cif
.
debugSystemObjects
->
GetCurrentThreadId
(
&
currentThreadId
);
if
(
CdbStackTraceContext
*
stc
=
CdbStackTraceContext
::
create
(
&
cif
,
currentThreadId
,
&
errorMessage
))
{
str
<<
"at:
\n
"
;
stc
->
format
(
str
);
str
<<
'\n'
;
delete
stc
;
}
}
}
STDMETHODIMP
CdbDebugEventCallback
::
Exception
(
THIS_
__in
PEXCEPTION_RECORD64
Exception
,
__in
ULONG
FirstChance
__in
ULONG
/*
FirstChance
*/
)
{
Q_UNUSED
(
Exception
)
if
(
debugCDB
)
qDebug
()
<<
Q_FUNC_INFO
<<
msgException
(
Exception
,
FirstChance
);
// First chance are harmless
if
(
!
FirstChance
)
qWarning
(
"%s"
,
qPrintable
(
msgException
(
Exception
,
FirstChance
)));
QString
msg
;
{
QTextStream
str
(
&
msg
);
formatException
(
Exception
,
m_pEngine
->
m_d
->
m_cif
,
str
);
}
m_pEngine
->
m_d
->
m_debuggerManagerAccess
->
showApplicationOutput
(
msg
);
return
S_OK
;
}
...
...
@@ -395,7 +489,7 @@ STDMETHODIMP IgnoreDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask)
}
// --------- EventCallbackRedirector
EventCallbackRedirector
::
EventCallbackRedirector
(
IDebugClient
5
*
client
,
IDebugEventCallbacksWide
*
cb
)
:
EventCallbackRedirector
::
EventCallbackRedirector
(
C
IDebugClient
*
client
,
IDebugEventCallbacksWide
*
cb
)
:
m_client
(
client
),
m_oldCb
(
CdbDebugEventCallbackBase
::
getEventCallback
(
client
))
{
...
...
src/plugins/debugger/cdb/cdbdebugeventcallback.h
View file @
471d31ac
...
...
@@ -30,8 +30,8 @@
#ifndef DEBUGGER_CDBDEBUGEVENTCALLBACK_H
#define DEBUGGER_CDBDEBUGEVENTCALLBACK_H
#include
<windows
.h
>
#include
<inc/dbgeng.h>
#include
"cdbcom
.h
"
#include
<QtCore/QtGlobal>
namespace
Debugger
{
...
...
@@ -151,7 +151,7 @@ public:
);
static
IDebugEventCallbacksWide
*
getEventCallback
(
IDebugClient
5
*
clnt
);
static
IDebugEventCallbacksWide
*
getEventCallback
(
C
IDebugClient
*
clnt
);
};
class
CdbDebugEventCallback
:
public
CdbDebugEventCallbackBase
...
...
@@ -252,10 +252,10 @@ public:
class
EventCallbackRedirector
{
Q_DISABLE_COPY
(
EventCallbackRedirector
)
public:
explicit
EventCallbackRedirector
(
IDebugClient
5
*
client
,
IDebugEventCallbacksWide
*
cb
);
explicit
EventCallbackRedirector
(
C
IDebugClient
*
client
,
IDebugEventCallbacksWide
*
cb
);
~
EventCallbackRedirector
();
private:
IDebugClient
5
*
m_client
;
C
IDebugClient
*
m_client
;
IDebugEventCallbacksWide
*
m_oldCb
;
};
...
...
src/plugins/debugger/cdb/cdbdebugoutput.cpp
View file @
471d31ac
...
...
@@ -84,7 +84,7 @@ STDMETHODIMP CdbDebugOutputBase::Output(
return
S_OK
;
}
IDebugOutputCallbacksWide
*
CdbDebugOutputBase
::
getOutputCallback
(
IDebugClient
5
*
client
)
IDebugOutputCallbacksWide
*
CdbDebugOutputBase
::
getOutputCallback
(
C
IDebugClient
*
client
)
{
IDebugOutputCallbacksWide
*
rc
;
if
(
FAILED
(
client
->
GetOutputCallbacksWide
(
&
rc
)))
...
...
@@ -157,7 +157,7 @@ void CdbDebugOutput::output(ULONG mask, const QString &msg)
// Utility class to temporarily redirect output to another handler
// as long as in scope
OutputRedirector
::
OutputRedirector
(
IDebugClient
5
*
client
,
IDebugOutputCallbacksWide
*
newHandler
)
:
OutputRedirector
::
OutputRedirector
(
C
IDebugClient
*
client
,
IDebugOutputCallbacksWide
*
newHandler
)
:
m_client
(
client
),
m_oldHandler
(
CdbDebugOutputBase
::
getOutputCallback
(
client
))
{
...
...
src/plugins/debugger/cdb/cdbdebugoutput.h
View file @
471d31ac
...
...
@@ -30,8 +30,7 @@
#ifndef DEBUGGER_CDBOUTPUT_H
#define DEBUGGER_CDBOUTPUT_H
#include
<windows.h>
#include
<inc/dbgeng.h>
#include
"cdbcom.h"
#include
<QtCore/QObject>
...
...
@@ -65,7 +64,7 @@ public:
);
// Helpers to retrieve the output callbacks IF
static
IDebugOutputCallbacksWide
*
getOutputCallback
(
IDebugClient
5
*
client
);
static
IDebugOutputCallbacksWide
*
getOutputCallback
(
C
IDebugClient
*
client
);
protected:
CdbDebugOutputBase
();
...
...
@@ -110,10 +109,10 @@ private:
class
OutputRedirector
{
Q_DISABLE_COPY
(
OutputRedirector
)
public:
explicit
OutputRedirector
(
IDebugClient
5
*
client
,
IDebugOutputCallbacksWide
*
newHandler
);
explicit
OutputRedirector
(
C
IDebugClient
*
client
,
IDebugOutputCallbacksWide
*
newHandler
);
~
OutputRedirector
();
private:
IDebugClient
5
*
m_client
;