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
9aa4b1ce
Commit
9aa4b1ce
authored
Mar 14, 2020
by
ussrhero
Browse files
added additional parameter mask for debugCommad function
parent
3625e55d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
12 deletions
+48
-12
kdlib/include/kdlib/dbgengine.h
kdlib/include/kdlib/dbgengine.h
+1
-1
kdlib/source/win/dbgeng.cpp
kdlib/source/win/dbgeng.cpp
+9
-5
kdlib/source/win/dbgmgr.cpp
kdlib/source/win/dbgmgr.cpp
+2
-3
kdlib/source/win/dbgmgr.h
kdlib/source/win/dbgmgr.h
+7
-2
kdlib/tests/kdlibtest/dbgenginetest.cpp
kdlib/tests/kdlibtest/dbgenginetest.cpp
+24
-0
kdlib/tests/kdlibtest/eventhandlertest.cpp
kdlib/tests/kdlibtest/eventhandlertest.cpp
+1
-1
kdlib/tests/kdlibtest/kdlibtest.vcxproj
kdlib/tests/kdlibtest/kdlibtest.vcxproj
+1
-0
kdlib/tests/kdlibtest/kdlibtest.vcxproj.filters
kdlib/tests/kdlibtest/kdlibtest.vcxproj.filters
+3
-0
No files found.
kdlib/include/kdlib/dbgengine.h
View file @
9aa4b1ce
...
...
@@ -35,7 +35,7 @@ PROCESS_DEBUG_ID attachKernel( const std::wstring &connectOptions = L"" );
bool
isDumpAnalyzing
();
bool
isKernelDebugging
();
std
::
wstring
debugCommand
(
const
std
::
wstring
&
command
,
bool
suppressOutput
=
false
);
std
::
wstring
debugCommand
(
const
std
::
wstring
&
command
,
bool
suppressOutput
=
false
,
const
OutputFlagsSet
&
captureFlags
=
OutputFlag
::
Normal
);
NumVariant
evaluate
(
const
std
::
wstring
&
expression
,
bool
cplusplus
=
false
);
DebugOptionsSet
getDebugOptions
();
...
...
kdlib/source/win/dbgeng.cpp
View file @
9aa4b1ce
...
...
@@ -39,6 +39,8 @@ bool initialize()
ClrDebugManager
::
init
();
g_dbgMgr
->
control
->
ExecuteWide
(
DEBUG_OUTCTL_THIS_CLIENT
,
L".echo"
,
0
);
return
true
;
}
...
...
@@ -55,6 +57,8 @@ bool remote_initialize( const std::wstring& remoteOptions )
ClrDebugManager
::
init
();
g_dbgMgr
->
control
->
ExecuteWide
(
DEBUG_OUTCTL_THIS_CLIENT
,
L".echo"
,
0
);
return
true
;
}
...
...
@@ -525,18 +529,18 @@ bool isKernelDebugging()
///////////////////////////////////////////////////////////////////////////////////
std
::
wstring
debugCommand
(
const
std
::
wstring
&
command
,
bool
suppressOutput
)
std
::
wstring
debugCommand
(
const
std
::
wstring
&
command
,
bool
suppressOutput
,
const
OutputFlagsSet
&
captureFlags
)
{
HRESULT
hres
;
if
(
suppressOutput
)
{
OutputReader
outReader
(
g_dbgMgr
->
client
);
OutputReader
outReader
(
g_dbgMgr
->
client
,
static_cast
<
ULONG
>
(
captureFlags
)
);
hres
=
g_dbgMgr
->
control
->
ExecuteWide
(
DEBUG_OUTCTL_THIS_CLIENT
,
command
.
c_str
(),
0
);
hres
=
g_dbgMgr
->
control
->
ExecuteWide
(
DEBUG_OUTCTL_THIS_CLIENT
,
command
.
c_str
(),
0
);
if
(
FAILED
(
hres
)
)
throw
DbgEngException
(
L"IDebugControl::ExecuteWide"
,
hres
);
throw
DbgEngException
(
L"IDebugControl::ExecuteWide"
,
hres
);
waitForEvent
();
...
...
@@ -546,7 +550,7 @@ std::wstring debugCommand( const std::wstring &command, bool suppressOutput )
hres
=
g_dbgMgr
->
control
->
ExecuteWide
(
DEBUG_OUTCTL_ALL_CLIENTS
,
command
.
c_str
(),
0
);
if
(
FAILED
(
hres
)
)
throw
DbgEngException
(
L"IDebugControl::ExecuteWide"
,
hres
);
throw
DbgEngException
(
L"IDebugControl::ExecuteWide"
,
hres
);
waitForEvent
();
...
...
kdlib/source/win/dbgmgr.cpp
View file @
9aa4b1ce
...
...
@@ -461,13 +461,12 @@ HRESULT STDMETHODCALLTYPE OutputReader::Output(
__in
ULONG
Mask
,
__in
PCSTR
Text
)
{
m_readLine
+=
_bstr_t
(
Text
);
if
(
(
Mask
&
m_mask
)
!=
0
)
m_readLine
+=
_bstr_t
(
Text
);
return
S_OK
;
}
///////////////////////////////////////////////////////////////////
}
//kdlib namespace end
kdlib/source/win/dbgmgr.h
View file @
9aa4b1ce
...
...
@@ -238,20 +238,23 @@ class OutputReader : public IDebugOutputCallbacks, private boost::noncopyable {
public:
explicit
OutputReader
(
IDebugClient5
*
client
)
explicit
OutputReader
(
IDebugClient5
*
client
,
ULONG
outputMask
=
DEBUG_OUTPUT_NORMAL
)
{
HRESULT
hres
;
m_callbacks
=
NULL
;
m_client
=
client
;
m_mask
=
outputMask
;
hres
=
m_client
->
GetOutputCallbacks
(
&
m_callbacks
);
if
(
FAILED
(
hres
)
)
throw
DbgEngException
(
L"IDebugClient::GetOutputCallbacks"
,
hres
);
hres
=
m_client
->
SetOutputCallbacks
(
this
);
hres
=
m_client
->
SetOutputCallbacks
(
this
);
if
(
FAILED
(
hres
)
)
throw
DbgEngException
(
L"IDebugClient::SetOutputCallbacks"
,
hres
);
m_client
->
FlushCallbacks
();
}
~
OutputReader
()
...
...
@@ -297,6 +300,8 @@ private:
CComPtr
<
IDebugClient5
>
m_client
;
PDEBUG_OUTPUT_CALLBACKS
m_callbacks
;
ULONG
m_mask
;
};
///////////////////////////////////////////////////////////////////////////////
...
...
kdlib/tests/kdlibtest/dbgenginetest.cpp
0 → 100644
View file @
9aa4b1ce
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/dbgengine.h"
using
namespace
kdlib
;
using
namespace
testing
;
class
DbgEngineTest
:
public
ProcessFixture
{
};
TEST_F
(
DbgEngineTest
,
DbgCommandSuppress
)
{
EXPECT_EQ
(
L""
,
kdlib
::
debugCommand
(
kdlib
::
debugCommand
(
L".printf /ow
\"
warning
\"
"
),
true
));
EXPECT_EQ
(
L"normal"
,
kdlib
::
debugCommand
(
L".printf /on
\"
normal
\"
"
,
true
,
OutputFlag
::
Normal
));
EXPECT_EQ
(
L""
,
kdlib
::
debugCommand
(
L".printf /oe
\"
error
\"
"
,
true
,
OutputFlag
::
Normal
));
EXPECT_EQ
(
L""
,
kdlib
::
debugCommand
(
L".printf /on
\"
normal
\"
"
,
true
,
OutputFlag
::
Error
));
EXPECT_EQ
(
L"error"
,
kdlib
::
debugCommand
(
L".printf /oe
\"
error
\"
"
,
true
,
OutputFlag
::
Error
));
EXPECT_EQ
(
L""
,
kdlib
::
debugCommand
(
L".printf /os
\"
symbols
\"
"
,
true
,
OutputFlag
::
Normal
|
OutputFlag
::
Warning
));
}
kdlib/tests/kdlibtest/eventhandlertest.cpp
View file @
9aa4b1ce
...
...
@@ -222,4 +222,4 @@ TEST_F(EventHandlerTest, DebugOutput)
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/kdlibtest.vcxproj
View file @
9aa4b1ce
...
...
@@ -196,6 +196,7 @@
<ClCompile
Include=
"clangtest.cpp"
/>
<ClCompile
Include=
"cputest.cpp"
/>
<ClCompile
Include=
"crttest.cpp"
/>
<ClCompile
Include=
"dbgenginetest.cpp"
/>
<ClCompile
Include=
"disasmtest.cpp"
/>
<ClCompile
Include=
"eventhandlertest.cpp"
/>
<ClCompile
Include=
"exprevaltest.cpp"
/>
...
...
kdlib/tests/kdlibtest/kdlibtest.vcxproj.filters
View file @
9aa4b1ce
...
...
@@ -80,6 +80,9 @@
<ClCompile
Include=
"syntest.cpp"
>
<Filter>
testcases
</Filter>
</ClCompile>
<ClCompile
Include=
"dbgenginetest.cpp"
>
<Filter>
testcases
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"stdafx.h"
/>
...
...
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