Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
kdlibcpp
kdlibcpp
Commits
acedc5a2
Commit
acedc5a2
authored
Feb 02, 2019
by
ussrhero
Browse files
Fixed onDebugOutput method
parent
dae69fd5
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
30 deletions
+71
-30
kdlib/include/kdlib/dbgcallbacks.h
kdlib/include/kdlib/dbgcallbacks.h
+1
-1
kdlib/include/kdlib/dbgtypedef.h
kdlib/include/kdlib/dbgtypedef.h
+16
-0
kdlib/include/kdlib/eventhandler.h
kdlib/include/kdlib/eventhandler.h
+1
-1
kdlib/source/processmon.cpp
kdlib/source/processmon.cpp
+5
-5
kdlib/source/processmon.h
kdlib/source/processmon.h
+1
-1
kdlib/source/win/dbgmgr.cpp
kdlib/source/win/dbgmgr.cpp
+2
-3
kdlib/tests/kdlibtest/eventhandlermock.h
kdlib/tests/kdlibtest/eventhandlermock.h
+4
-1
kdlib/tests/kdlibtest/eventhandlertest.cpp
kdlib/tests/kdlibtest/eventhandlertest.cpp
+20
-0
kdlib/tests/kdlibtest/typeevaltest.cpp
kdlib/tests/kdlibtest/typeevaltest.cpp
+21
-18
No files found.
kdlib/include/kdlib/dbgcallbacks.h
View file @
acedc5a2
...
...
@@ -23,7 +23,7 @@ struct DebugEventsCallback {
virtual
void
onChangeLocalScope
()
=
0
;
virtual
void
onChangeSymbolPaths
()
=
0
;
virtual
void
onChangeBreakpoints
()
=
0
;
virtual
void
onDebugOutput
(
const
std
::
wstring
&
text
)
=
0
;
virtual
void
onDebugOutput
(
const
std
::
wstring
&
text
,
OutputFlag
flag
)
=
0
;
virtual
void
onStartInput
()
=
0
;
virtual
void
onStopInput
()
=
0
;
...
...
kdlib/include/kdlib/dbgtypedef.h
View file @
acedc5a2
...
...
@@ -211,6 +211,22 @@ enum BreakpointAccess {
};
enum
OutputFlag
{
Normal
=
0x00000001
,
Error
=
0x00000002
,
Warning
=
0x00000004
,
Verbose
=
0x00000008
,
Prompt
=
0x00000010
,
PromptRegister
=
0x00000020
,
ExtensionWarning
=
0x00000040
,
Debuggee
=
0x00000080
,
DebuggeePrompt
=
0x00000100
,
Symbols
=
0x00000200
,
Status
=
0x00000400
,
All
=
0x000007FF
};
///////////////////////////////////////////////////////////////////////////////
}
// kdlib namespace end
...
...
kdlib/include/kdlib/eventhandler.h
View file @
acedc5a2
...
...
@@ -57,7 +57,7 @@ public:
virtual
void
onChangeBreakpoints
()
{}
virtual
void
onDebugOutput
(
const
std
::
wstring
&
text
)
virtual
void
onDebugOutput
(
const
std
::
wstring
&
text
,
OutputFlag
flag
)
{}
virtual
void
onStartInput
()
...
...
kdlib/source/processmon.cpp
View file @
acedc5a2
...
...
@@ -79,7 +79,7 @@ public:
void
changeSymbolPaths
();
void
breakpointsChange
(
PROCESS_DEBUG_ID
id
);
DebugCallbackResult
exceptionHit
(
const
ExceptionInfo
&
excinfo
);
void
debugOutput
(
const
std
::
wstring
&
text
);
void
debugOutput
(
const
std
::
wstring
&
text
,
OutputFlag
flag
);
void
startInput
();
void
stopInput
();
...
...
@@ -298,9 +298,9 @@ DebugCallbackResult ProcessMonitor::exceptionHit(const ExceptionInfo& excinfo)
///////////////////////////////////////////////////////////////////////////////
void
ProcessMonitor
::
debugOutput
(
const
std
::
wstring
&
text
)
void
ProcessMonitor
::
debugOutput
(
const
std
::
wstring
&
text
,
OutputFlag
flag
)
{
g_procmon
->
debugOutput
(
text
);
g_procmon
->
debugOutput
(
text
,
flag
);
}
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -660,14 +660,14 @@ DebugCallbackResult ProcessMonitorImpl::exceptionHit(const ExceptionInfo& excin
///////////////////////////////////////////////////////////////////////////////
void
ProcessMonitorImpl
::
debugOutput
(
const
std
::
wstring
&
text
)
void
ProcessMonitorImpl
::
debugOutput
(
const
std
::
wstring
&
text
,
OutputFlag
flag
)
{
boost
::
recursive_mutex
::
scoped_lock
l
(
m_callbacksLock
);
EventsCallbackList
::
iterator
it
;
for
(
it
=
m_callbacks
.
begin
();
it
!=
m_callbacks
.
end
();
++
it
)
{
(
*
it
)
->
onDebugOutput
(
text
);
(
*
it
)
->
onDebugOutput
(
text
,
flag
);
}
}
...
...
kdlib/source/processmon.h
View file @
acedc5a2
...
...
@@ -32,7 +32,7 @@ public: // notification
static
void
localScopeChange
();
static
void
changeSymbolPaths
();
static
DebugCallbackResult
exceptionHit
(
const
ExceptionInfo
&
excinfo
);
static
void
debugOutput
(
const
std
::
wstring
&
text
);
static
void
debugOutput
(
const
std
::
wstring
&
text
,
OutputFlag
flag
);
static
void
startInput
();
static
void
stopInput
();
...
...
kdlib/source/win/dbgmgr.cpp
View file @
acedc5a2
...
...
@@ -40,7 +40,7 @@ DebugManager::DebugManager()
client
->
SetOutputCallbacksWide
(
this
);
client
->
SetInputCallbacks
(
this
);
client
->
SetOutputMask
(
DEBUG_OUTPUT_NORMAL
);
client
->
SetOutputMask
(
0xFFFFFFFF
);
//
DEBUG_OUTPUT_NORMAL);
}
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -426,8 +426,7 @@ HRESULT STDMETHODCALLTYPE DebugManager::Output(
{
try
{
if
(
(
Mask
&
(
DEBUG_OUTPUT_NORMAL
|
DEBUG_OUTPUT_ERROR
|
DEBUG_OUTPUT_WARNING
)
)
!=
0
)
ProcessMonitor
::
debugOutput
(
std
::
wstring
(
Text
));
ProcessMonitor
::
debugOutput
(
std
::
wstring
(
Text
),
OutputFlag
(
Mask
));
}
catch
(
kdlib
::
DbgException
&
)
...
...
kdlib/tests/kdlibtest/eventhandlermock.h
View file @
acedc5a2
...
...
@@ -17,5 +17,8 @@ public:
MOCK_METHOD0
(
onChangeSymbolPaths
,
void
(
void
)
);
MOCK_METHOD1
(
onProcessStart
,
kdlib
::
DebugCallbackResult
(
kdlib
::
PROCESS_DEBUG_ID
processId
));
MOCK_METHOD3
(
onProcessExit
,
kdlib
::
DebugCallbackResult
(
kdlib
::
PROCESS_DEBUG_ID
processid
,
kdlib
::
ProcessExitReason
reason
,
unsigned
long
exitCode
));
MOCK_METHOD3
(
onProcessExit
,
kdlib
::
DebugCallbackResult
(
kdlib
::
PROCESS_DEBUG_ID
processid
,
kdlib
::
ProcessExitReason
reason
,
unsigned
long
exitCode
));
MOCK_METHOD2
(
onDebugOutput
,
void
(
const
std
::
wstring
&
text
,
kdlib
::
OutputFlag
flag
));
};
kdlib/tests/kdlibtest/eventhandlertest.cpp
View file @
acedc5a2
...
...
@@ -2,6 +2,7 @@
#include "basefixture.h"
#include "eventhandlermock.h"
#include "kdlib\dbgio.h"
using
namespace
kdlib
;
using
namespace
testing
;
...
...
@@ -196,3 +197,22 @@ TEST_F(EventHandlerTest, SymbolPathChange)
EXPECT_NO_THROW
(
appendSymbolPath
(
L"C:
\\
temp2"
));
EXPECT_NO_THROW
(
setSymbolPath
(
L"C:
\\
temp2"
));
}
TEST_F
(
EventHandlerTest
,
DebugOutput
)
{
ASSERT_NO_THROW
(
startProcess
(
L"targetapp.exe"
));
NiceMock
<
EventHandlerMock
>
eventHandler
;
EXPECT_CALL
(
eventHandler
,
onDebugOutput
(
_
,
_
)).
WillRepeatedly
(
Return
());
kdlib
::
debugCommand
(
L".printf /od
\"
debugee
\"
"
);
kdlib
::
debugCommand
(
L".printf /oD
\"
debugee prompt
\"
"
);
kdlib
::
debugCommand
(
L".printf /oe
\"
error
\"
"
);
kdlib
::
debugCommand
(
L".printf /on
\"
normal
\"
"
);
kdlib
::
debugCommand
(
L".printf /op
\"
prompt
\"
"
);
kdlib
::
debugCommand
(
L".printf /oP
\"
prompt registers
\"
"
);
kdlib
::
debugCommand
(
L".printf /os
\"
symbols
\"
"
);
kdlib
::
debugCommand
(
L".printf /ov
\"
verbose
\"
"
);
kdlib
::
debugCommand
(
L".printf /ow
\"
warning
\"
"
);
}
\ No newline at end of file
kdlib/tests/kdlibtest/typeevaltest.cpp
View file @
acedc5a2
...
...
@@ -328,40 +328,43 @@ TEST(TypeEvalTest, TemplateNamespace2)
EXPECT_NO_THROW
(
evalType
(
"testspace::TestStruct<int,testspace::TestStruct<int,int> >::field1"
,
typeProvider
));
}
TEST
(
TypeEvalTest
,
DISABLED_TemplateNamespace3
)
TEST
(
TypeEvalTest
,
TemplateConstExpr
)
{
static
const
char
sourceCode
[]
=
" \
namespace testspace { \
template<typename T1, typename T2> \
template<int> \
struct TestStruct { \
T1 field1; \
T2 field2; \
}; \
TestStruct<int,TestStruct<int,int>> testVal; \
} \
TestStruct<10> testVal1; \
TestStruct<-10> testVal2; \
TestStruct<0> testVal3; \
"
;
TypeInfoProviderPtr
typeProvider
=
getTypeInfoProviderFromSource
(
sourceCode
);
EXPECT_NO_THROW
(
evalType
(
"testspace::TestStruct<int,testspace::TestStruct<int,int> >"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"testspace::TestStruct<int,testspace::TestStruct<int,int>>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<-10>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<+10>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<!1>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<~0xFFFFFFFF>"
,
typeProvider
));
}
TEST
(
TypeEvalTest
,
TemplateC
onstExpr
)
TEST
(
TypeEvalTest
,
TemplateC
lose
)
{
static
const
char
sourceCode
[]
=
" \
template<
int>
\
template<
typename T1, typename T2>
\
struct TestStruct { \
T1 field1; \
T2 field2; \
}; \
TestStruct<10> testVal1; \
TestStruct<-10> testVal2; \
TestStruct<0> testVal3; \
TestStruct<int,TestStruct<int,int>> testVal1; \
TestStruct<int,TestStruct<int, TestStruct<int,int>>> testVal2; \
"
;
TypeInfoProviderPtr
typeProvider
=
getTypeInfoProviderFromSource
(
sourceCode
);
EXPECT_NO_THROW
(
evalType
(
"TestStruct<-10>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<+10>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<!1>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<~0xFFFFFFFF>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<int,TestStruct<int,int> >"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<int,TestStruct<int,int>>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<int,TestStruct<int,TestStruct<int,int> > >"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<int,TestStruct<int,TestStruct<int,int>>>"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<int,TestStruct<int,TestStruct<int,int>> >"
,
typeProvider
));
EXPECT_NO_THROW
(
evalType
(
"TestStruct<int,TestStruct<int,TestStruct<int,int> >>"
,
typeProvider
));
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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