Commit 1d387e77 authored by ussrhero's avatar ussrhero

added StackFrame::switchTo method

parent 65930b33
#pragma once
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>
#include <kdlib/dbgengine.h>
#include <kdlib/typedvar.h>
......@@ -46,6 +45,8 @@ public:
virtual TypedVarPtr getStaticVar(const std::wstring& paramName) = 0;
virtual std::wstring getStaticVarName(unsigned long index) = 0;
virtual bool findStaticVar(const std::wstring& varName) = 0;
virtual void switchTo() = 0;
};
///////////////////////////////////////////////////////////////////////////////
......@@ -68,7 +69,7 @@ public:
StackPtr getStack();
StackFramePtr getCurrentStackFrame();
unsigned long getCurrentStackFrameNumber();
void setCurrentStackFrame(StackFramePtr& stackFrame);
void setCurrentStackFrame(const StackFramePtr& stackFrame);
void setCurrentStackFrameByIndex(unsigned long frameIndex);
void resetCurrentStackFrame();
......
......@@ -2,6 +2,8 @@
#include <kdlib/stack.h>
#include <boost/enable_shared_from_this.hpp>
namespace kdlib {
///////////////////////////////////////////////////////////////////////////////
......@@ -33,7 +35,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
class StackFrameImpl : public StackFrame
class StackFrameImpl : public StackFrame, public boost::enable_shared_from_this<StackFrameImpl>
{
public:
......@@ -93,7 +95,12 @@ public:
virtual TypedVarPtr getStaticVar(const std::wstring& paramName);
virtual std::wstring getStaticVarName(unsigned long index);
virtual bool findStaticVar(const std::wstring& varName);
public:
virtual void switchTo() {
setCurrentStackFrame(shared_from_this());
}
private:
SymbolPtrList getLocalVars();
SymbolPtrList getParams();
......
......@@ -694,7 +694,7 @@ unsigned long getCurrentStackFrameNumber()
///////////////////////////////////////////////////////////////////////////////
void setCurrentStackFrame(StackFramePtr& stackFrame)
void setCurrentStackFrame(const StackFramePtr& stackFrame)
{
HRESULT hres;
......
......@@ -35,7 +35,7 @@ public:
m_dumpId = kdlib::loadDump(MemDumpFixture::getWow64UserDumpName());
break;
default:
default:
assert(false);
}
}
......@@ -62,7 +62,7 @@ public:
}
break;
default:
default:
assert(false);
}
}
......@@ -231,6 +231,17 @@ TEST_P( StackTest, ChangeCurrentFrame )
EXPECT_EQ(3, getCurrentStackFrameNumber());
}
TEST_P(StackTest, SwitchTo)
{
StackPtr stack;
ASSERT_NO_THROW(stack = getStack());
stack->getFrame(3)->switchTo();
EXPECT_EQ(3, getCurrentStackFrameNumber());
}
TEST_P( StackTest, ChangeScopeEvent )
{
EventHandlerMock eventHandler;
......
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