Commit 39bf8a49 authored by ussrhero's avatar ussrhero

added getDebugOptions / changeDebugOptions routines

parent 3eb0e2e7
......@@ -38,6 +38,9 @@ bool isKernelDebugging();
std::wstring debugCommand(const std::wstring &command, bool suppressOutput=false);
NumVariant evaluate( const std::wstring &expression, bool cplusplus=false );
DebugOptionsSet getDebugOptions();
void changeDebugOptions(DebugOptionsSet &addOptions, DebugOptionsSet &removeOptions);
// system properties
size_t ptrSize();
bool is64bitSystem();
......
......@@ -189,6 +189,16 @@ struct LiveProcessInfo {
std::wstring commandLine;
};
enum DebugOptions {
InitialBreak = 0x00000020,
FinalBreak = 0x00000040,
PreferDml = 0x00040000
};
typedef unsigned long DebugOptionsSet;
///////////////////////////////////////////////////////////////////////////////
} // kdlib namespace end
......
......@@ -156,37 +156,59 @@ std::string DbgWideException::getCStrDesc( const std::wstring &desc )
///////////////////////////////////////////////////////////////////////////////
static void setEngBreakOption(const ProcessDebugFlags& flags)
DebugOptionsSet getDebugOptions()
{
ULONG opt;
HRESULT hres = g_dbgMgr->control->GetEngineOptions(&opt);
if (FAILED(hres))
throw DbgEngException(L"IDebugControl::GetEngineOptions", hres);
return static_cast<DebugOptionsSet>(opt);
}
///////////////////////////////////////////////////////////////////////////////
void changeDebugOptions(DebugOptionsSet &addOptions, DebugOptionsSet &removeOptions)
{
HRESULT hres = g_dbgMgr->control->AddEngineOptions(static_cast<ULONG>(addOptions) );
if (FAILED(hres))
throw DbgEngException(L"IDebugControl::AddEngineOptions", hres);
hres = g_dbgMgr->control->RemoveEngineOptions(static_cast<ULONG>(removeOptions) );
if (FAILED(hres))
throw DbgEngException(L"IDebugControl::RemoveEngineOptions", hres);
}
///////////////////////////////////////////////////////////////////////////////
static void setEngBreakOption(const ProcessDebugFlags& flags)
{
DebugOptionsSet addOptions = 0;
DebugOptionsSet removeOptions = 0;
if ((flags & ProcessBreakOnStart) != 0)
{
opt |= DEBUG_ENGOPT_INITIAL_BREAK;
addOptions |= InitialBreak;
}
else
{
opt &= ~DEBUG_ENGOPT_INITIAL_BREAK;
removeOptions |= InitialBreak;
}
if ((flags & ProcessBreakOnStop) != 0)
{
opt |= DEBUG_ENGOPT_FINAL_BREAK;
addOptions |= FinalBreak;
}
else
{
opt &= ~DEBUG_ENGOPT_FINAL_BREAK;
removeOptions |= FinalBreak;
}
hres = g_dbgMgr->control->SetEngineOptions(opt);
if (FAILED(hres))
throw DbgEngException(L"IDebugControl::SetEngineOptions", hres);
changeDebugOptions(addOptions, removeOptions);
}
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
PROCESS_DEBUG_ID startProcess(const std::wstring &processName, const ProcessDebugFlags& flags)
{
......
......@@ -668,3 +668,17 @@ TEST_F(TypedVarTest, FieldZeroLenArray)
std::wstring desc;
EXPECT_NO_THROW( desc = loadTypedVar(L"g_testStructZeroArray")->deref()->str() );
}
TEST_F(TypedVarTest, InvalidAddress)
{
TypeInfoPtr structType;
ASSERT_NO_THROW( structType = loadType(L"structTest") );
TypedVarPtr var;
ASSERT_NO_THROW(var = loadTypedVar(structType, 0x0) );
EXPECT_EQ( structType->getSize(), var->getSize() );
EXPECT_EQ( 0x0, var->asULongLong() );
EXPECT_NO_THROW( var->str() );
EXPECT_NO_THROW( var->getElement(0) );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment