mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.3.x] added : module class tests
git-svn-id: https://pykd.svn.codeplex.com/svn@83752 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
df525b6973
commit
3399391903
57
pykd/dbgexcept.cpp
Normal file
57
pykd/dbgexcept.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "kdlib/dbgio.h"
|
||||
|
||||
#include "dbgexcept.h"
|
||||
|
||||
namespace pykd {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
python::handle<> exceptPyType<python::detail::not_specified>::pyExceptType;
|
||||
python::handle<> exceptPyType<kdlib::DbgException>::pyExceptType;
|
||||
python::handle<> exceptPyType<kdlib::MemoryException>::pyExceptType;
|
||||
//python::handle<> exceptPyType<WaitEventException>::pyExceptType;
|
||||
//python::handle<> exceptPyType<SymbolException>::pyExceptType;
|
||||
////python::handle<> exceptPyType<pyDia::Exception>::pyExceptType;
|
||||
//python::handle<> exceptPyType<TypeException>::pyExceptType;
|
||||
//python::handle<> exceptPyType<AddSyntheticSymbolException>::pyExceptType;
|
||||
//python::handle<> exceptPyType<WrongEventTypeException>::pyExceptType;
|
||||
//python::handle<> exceptPyType<ImplementException>::pyExceptType;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void printException()
|
||||
{
|
||||
// îøèáêà â ñêðèïòå
|
||||
PyObject *errtype = NULL, *errvalue = NULL, *traceback = NULL;
|
||||
|
||||
PyErr_Fetch( &errtype, &errvalue, &traceback );
|
||||
|
||||
PyErr_NormalizeException( &errtype, &errvalue, &traceback );
|
||||
|
||||
if ( errtype == PyExc_SystemExit )
|
||||
return;
|
||||
|
||||
python::object tracebackModule = python::import("traceback");
|
||||
|
||||
std::wstringstream sstr;
|
||||
|
||||
python::object lst =
|
||||
python::object( tracebackModule.attr("format_exception" ) )(
|
||||
python::handle<>( errtype ),
|
||||
python::handle<>( python::allow_null( errvalue ) ),
|
||||
python::handle<>( python::allow_null( traceback ) ) );
|
||||
|
||||
sstr << std::endl << std::endl;
|
||||
|
||||
for ( long i = 0; i < python::len(lst); ++i )
|
||||
sstr << std::wstring( python::extract<std::wstring>(lst[i]) ) << std::endl;
|
||||
|
||||
kdlib::eprintln( sstr.str() );
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}; // end namespace pykd
|
256
pykd/dbgexcept.h
Normal file
256
pykd/dbgexcept.h
Normal file
@ -0,0 +1,256 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
#include "kdlib/exceptions.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace pykd {
|
||||
|
||||
template< class TExcept >
|
||||
struct exceptPyType{
|
||||
static python::handle<> pyExceptType;
|
||||
};
|
||||
|
||||
template< class TExcept, class TBaseExcept = python::detail::not_specified >
|
||||
class exception {
|
||||
|
||||
public:
|
||||
|
||||
exception( const std::string& className, const std::string& classDesc )
|
||||
{
|
||||
python::handle<> basedtype;
|
||||
|
||||
if ( boost::is_same<TBaseExcept, python::detail::not_specified>::value )
|
||||
{
|
||||
basedtype = python::handle<>(PyExc_Exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
basedtype = exceptPyType<TBaseExcept>::pyExceptType;
|
||||
}
|
||||
|
||||
python::dict ob_dict;
|
||||
|
||||
ob_dict["__doc__"] = classDesc;
|
||||
|
||||
python::tuple ob_bases = python::make_tuple( basedtype );
|
||||
|
||||
python::object ob = python::object( python::handle<>(Py_TYPE(basedtype.get()) ) )( className, ob_bases, ob_dict );
|
||||
|
||||
python::scope().attr( className.c_str() ) = ob;
|
||||
|
||||
exceptPyType<TExcept>::pyExceptType = python::handle<>( ob.ptr() );
|
||||
|
||||
python::register_exception_translator<TExcept>( &exceptionTranslate );
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
exceptionTranslate(const TExcept &e ) {
|
||||
|
||||
python::object exceptObj = python::object( exceptPyType<TExcept>::pyExceptType )( e.what() );
|
||||
|
||||
PyErr_SetObject( exceptPyType<TExcept>::pyExceptType.get(), exceptObj.ptr());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class PyException : public std::exception
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// PyException( PyObject* pyObj, const std::string &desc ) :
|
||||
// std::exception( desc.c_str() ),
|
||||
// m_typeObj( pyObj )
|
||||
// {}
|
||||
//
|
||||
// static
|
||||
// void
|
||||
// exceptionTranslate(const PyException &e ) {
|
||||
// PyErr_SetString( e.m_typeObj, e.what() );
|
||||
// }
|
||||
//
|
||||
//private:
|
||||
//
|
||||
// PyObject* m_typeObj;
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class DbgException : public std::exception
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// DbgException( const std::string &desc ) :
|
||||
// std::exception( desc.c_str() )
|
||||
// {}
|
||||
//
|
||||
// DbgException( const std::string &methodName, HRESULT hres ) :
|
||||
// std::exception( buildHresultDesc( methodName, hres ).c_str() )
|
||||
// {}
|
||||
//
|
||||
// const char* getDesc() const {
|
||||
// return what();
|
||||
// }
|
||||
//
|
||||
//private:
|
||||
//
|
||||
// std::string buildHresultDesc( const std::string &methodName, HRESULT hres )
|
||||
// {
|
||||
// std::stringstream sstream;
|
||||
// sstream << "Call " << methodName << " failed\n";
|
||||
// sstream << "HRESULT 0x" << std::hex << hres;
|
||||
// return sstream.str();
|
||||
// }
|
||||
//
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class SymbolException : public DbgException
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// SymbolException( const std::string &desc ) :
|
||||
// DbgException( desc.c_str() )
|
||||
// {}
|
||||
//
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class WaitEventException : public DbgException
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// WaitEventException()
|
||||
// : DbgException( "None of the targets could generate events" )
|
||||
// {}
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class TypeException : public SymbolException
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// TypeException( const std::string &typeName, const std::string &errorStr )
|
||||
// : SymbolException( buildDesc( typeName, errorStr ) )
|
||||
// {}
|
||||
//
|
||||
//private:
|
||||
//
|
||||
// static std::string buildDesc( const std::string &typeName, const std::string &errorStr )
|
||||
// {
|
||||
// std::stringstream sstr;
|
||||
// sstr << typeName << " : " << errorStr;
|
||||
// return sstr.str();
|
||||
// }
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class MemoryException : public DbgException
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// MemoryException( ULONG64 targetAddr, bool phyAddr = false ) :
|
||||
// m_targetAddress( targetAddr ),
|
||||
// DbgException( buildDesc( targetAddr, phyAddr ) )
|
||||
// {}
|
||||
//
|
||||
// ULONG64
|
||||
// getAddress() const {
|
||||
// return m_targetAddress;
|
||||
// }
|
||||
//
|
||||
//private:
|
||||
//
|
||||
// ULONG64 m_targetAddress;
|
||||
//
|
||||
// static std::string buildDesc( ULONG64 addr, bool phyAddr )
|
||||
// {
|
||||
// std::stringstream sstr;
|
||||
// if ( phyAddr )
|
||||
// sstr << "Memory exception at 0x" << std::hex << addr << " target physical address";
|
||||
// else
|
||||
// sstr << "Memory exception at 0x" << std::hex << addr << " target virtual address";
|
||||
//
|
||||
// return sstr.str();
|
||||
// }
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class AddSyntheticSymbolException : public DbgException
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// AddSyntheticSymbolException(HRESULT hres)
|
||||
// : DbgException( buildDesc(hres) )
|
||||
// {
|
||||
// }
|
||||
//
|
||||
//private:
|
||||
// static std::string buildDesc(HRESULT hres) {
|
||||
// std::stringstream sstream;
|
||||
// sstream << "Add synthetic symbol faield\n";
|
||||
// sstream << "HRESULT 0x" << std::hex << hres;
|
||||
// return sstream.str();
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class WrongEventTypeException : public DbgException
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// WrongEventTypeException(ULONG eventType)
|
||||
// : DbgException( buildDesc(eventType) )
|
||||
// {}
|
||||
//
|
||||
//private:
|
||||
// static std::string buildDesc(ULONG eventType) {
|
||||
// std::stringstream sstream;
|
||||
// sstream << "Unknown/not compatible debug event type: 0x";
|
||||
// sstream << std::hex << eventType;
|
||||
// return sstream.str();
|
||||
// }
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//class ImplementException : public DbgException
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// ImplementException( const std::string &file, int line, const std::string &msg ) :
|
||||
// DbgException( buildDesc(file,line, msg) )
|
||||
// {}
|
||||
//
|
||||
//private:
|
||||
//
|
||||
// static std::string buildDesc( const std::string &file, int line, const std::string &msg )
|
||||
// {
|
||||
// std::stringstream sstream;
|
||||
// sstream << "File: " << file << " Line: " << line << " " << msg;
|
||||
// return sstream.str();
|
||||
// }
|
||||
//
|
||||
//};
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void printException();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}; // namespace pykd
|
||||
|
@ -123,14 +123,18 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="dbgexcept.h" />
|
||||
<ClInclude Include="memaccess.h" />
|
||||
<ClInclude Include="module.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="stladaptor.h" />
|
||||
<ClInclude Include="target.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="variant.h" />
|
||||
<ClInclude Include="windbgext.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dbgexcept.cpp" />
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">false</CompileAsManaged>
|
||||
|
@ -33,6 +33,15 @@
|
||||
<ClInclude Include="target.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dbgexcept.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stladaptor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="memaccess.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@ -50,6 +59,9 @@
|
||||
<ClCompile Include="target.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dbgexcept.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="pykd.def">
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "variant.h"
|
||||
#include "module.h"
|
||||
#include "target.h"
|
||||
#include "dbgexcept.h"
|
||||
#include "memaccess.h"
|
||||
|
||||
using namespace pykd;
|
||||
|
||||
@ -55,17 +57,17 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( dprintln_, kdlib::dprintln, 1, 2 );
|
||||
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadChars_, kdlib::loadChars, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadWChars_, kdlib::loadWChars, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadBytes_, kdlib::loadBytes, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadWords_, kdlib::loadWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadDWords_, kdlib::loadDWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadQWords_, kdlib::loadQWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignBytes_, kdlib::loadSignBytes, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignWords_, kdlib::loadSignWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignDWords_, kdlib::loadSignDWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignQWords_, kdlib::loadSignQWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadFloats_, kdlib::loadFloats, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadDoubles_, kdlib::loadDoubles, 2, 3 );
|
||||
//BOOST_PYTHON_FUNCTION_OVERLOADS( compareMemory_, compareMemory, 3, 4 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadBytes_, loadBytes, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadWords_, loadWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadDWords_, loadDWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadQWords_, loadQWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignBytes_, loadSignBytes, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignWords_, loadSignWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignDWords_, loadSignDWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadSignQWords_, loadSignQWords, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadFloats_, loadFloats, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadDoubles_, loadDoubles, 2, 3 );
|
||||
BOOST_PYTHON_FUNCTION_OVERLOADS( compareMemory_, kdlib::compareMemory, 3, 4 );
|
||||
//
|
||||
//BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceLine_, getSourceLine, 0, 1 );
|
||||
//BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceFile_, getSourceFile, 0, 1 );
|
||||
@ -156,17 +158,16 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
// python::def("getSystemVersion", &getSystemVersion,
|
||||
// "Return systemVersion");
|
||||
|
||||
// // Manage target memory access
|
||||
// python::def( "addr64", &addr64,
|
||||
// "Extend address to 64 bits formats" );
|
||||
// python::def( "isValid", &isVaValid,
|
||||
// "Check if the virtual address is valid" );
|
||||
// python::def( "compareMemory", &compareMemory, compareMemory_( python::args( "offset1", "offset2", "length", "phyAddr" ),
|
||||
// "Compare two memory buffers by virtual or physical addresses" ) );
|
||||
|
||||
// python::def( "findMemoryRegion", &findMemoryRegionPy,
|
||||
// Manage target memory access
|
||||
python::def( "addr64", &kdlib::addr64,
|
||||
"Extend address to 64 bits formats" );
|
||||
python::def( "isValid", &kdlib::isVaValid,
|
||||
"Check if the virtual address is valid" );
|
||||
python::def( "compareMemory", &kdlib::compareMemory, compareMemory_( python::args( "offset1", "offset2", "length", "phyAddr" ),
|
||||
"Compare two memory buffers by virtual or physical addresses" ) );
|
||||
//python::def( "findMemoryRegion", &kdlib::findMemoryRegion,
|
||||
// "Return address of begining valid memory region nearest to offset" );
|
||||
// python::def( "getVaProtect", &getVaProtect,
|
||||
//python::def( "getVaProtect", &kdlib::getVaProtect,
|
||||
// "Return memory attributes" );
|
||||
|
||||
python::def( "ptrByte", &kdlib::ptrByte,
|
||||
@ -196,21 +197,21 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
python::def( "ptrDouble", &kdlib::ptrDoubleFloat,
|
||||
"Read a float with single precision from the target memory" );
|
||||
|
||||
python::def( "loadBytes", &kdlib::loadBytes, loadBytes_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadBytes", &loadBytes, loadBytes_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of unsigned bytes" ) );
|
||||
python::def( "loadWords", &kdlib::loadWords, loadWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadWords", &loadWords, loadWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of unsigned shorts" ) );
|
||||
python::def( "loadDWords", &kdlib::loadDWords, loadDWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadDWords", &loadDWords, loadDWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of unsigned long ( double word )" ) );
|
||||
python::def( "loadQWords", &kdlib::loadQWords, loadQWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadQWords", &loadQWords, loadQWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of unsigned long long ( quad word )" ) );
|
||||
python::def( "loadSignBytes", &kdlib::loadSignBytes, loadSignBytes_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadSignBytes", &loadSignBytes, loadSignBytes_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of signed bytes" ) );
|
||||
python::def( "loadSignWords", &kdlib::loadSignWords, loadSignWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadSignWords", &loadSignWords, loadSignWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of signed words" ) );
|
||||
python::def( "loadSignDWords", &kdlib::loadSignDWords, loadSignDWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadSignDWords", &loadSignDWords, loadSignDWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of signed longs" ) );
|
||||
python::def( "loadSignQWords", &kdlib::loadSignQWords, loadSignQWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadSignQWords", &loadSignQWords, loadSignQWords_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of signed long longs" ) );
|
||||
python::def( "loadChars", &kdlib::loadChars, loadChars_( python::args( "address", "count", "phyAddr" ),
|
||||
"Load string from target memory" ) );
|
||||
@ -228,9 +229,9 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
// "Return list of pointers, each points to next" );
|
||||
//python::def( "loadPtrs", &loadPtrArray,
|
||||
// "Read the block of the target's memory and return it as a list of pointers" );
|
||||
python::def( "loadFloats", &kdlib::loadFloats, loadFloats_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadFloats", &loadFloats, loadFloats_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of floats" ) );
|
||||
python::def( "loadDoubles", &kdlib::loadDoubles, loadDoubles_( python::args( "offset", "count", "phyAddr" ),
|
||||
python::def( "loadDoubles", &loadDoubles, loadDoubles_( python::args( "offset", "count", "phyAddr" ),
|
||||
"Read the block of the target's memory and return it as list of doubles" ) );
|
||||
|
||||
// // types and vaiables
|
||||
@ -380,8 +381,8 @@ python::class_<kdlib::NumBehavior, boost::noncopyable>( "numVariant", "numVarian
|
||||
"Return name of the module" )
|
||||
.def("reload", &kdlib::Module::reloadSymbols,
|
||||
"(Re)load symbols for the module" )
|
||||
//.def("image", &Module::getImageName,
|
||||
// "Return name of the image of the module" )
|
||||
.def("image", &kdlib::Module::getImageName,
|
||||
"Return name of the image of the module" )
|
||||
//.def("symfile", &Module::getSymFile,
|
||||
// "Return the full path to the module's symbol information" )
|
||||
//.def("offset", &Module::getSymbolOffset,
|
||||
@ -664,8 +665,8 @@ python::class_<kdlib::NumBehavior, boost::noncopyable>( "numVariant", "numVarian
|
||||
// // wrapper for standart python exceptions
|
||||
// python::register_exception_translator<PyException>( &PyException::exceptionTranslate );
|
||||
|
||||
// pykd::exception<DbgException>( "BaseException", "Pykd base exception class" );
|
||||
// pykd::exception<MemoryException,DbgException>( "MemoryException", "Target memory access exception class" );
|
||||
pykd::exception<kdlib::DbgException>( "DbgException", "Pykd base exception class" );
|
||||
pykd::exception<kdlib::MemoryException,kdlib::DbgException>( "MemoryException", "Target memory access exception class" );
|
||||
// pykd::exception<WaitEventException,DbgException>( "WaitEventException", "None of the targets could generate events" );
|
||||
// pykd::exception<WrongEventTypeException,DbgException>( "WrongEventTypeException", "Unknown last event type" );
|
||||
// pykd::exception<SymbolException,DbgException>( "SymbolException", "Symbol exception" );
|
||||
|
@ -111,13 +111,13 @@ class MemoryTest( unittest.TestCase ):
|
||||
self.assertTrue( math.fabs( pykd.ptrDouble( target.module.g_double) - 5.1234567891 ) < 0.0000001 )
|
||||
|
||||
def testLoadFloats(self):
|
||||
testArray = [ 1.0, 2.001, -3.0004 ];
|
||||
readArray = pykd.loadFloats( target.module.floatArray, 3 );
|
||||
for i in range(0,3):
|
||||
testArray = [ 1.0, 0.001, -199.999, 20000.01, 0.111111 ];
|
||||
readArray = pykd.loadFloats( target.module.floatArray, 5 );
|
||||
for i in range(5):
|
||||
self.assertTrue( math.fabs( testArray[i] - readArray[i] ) < 0.001 )
|
||||
|
||||
def testLoadDoubles(self):
|
||||
testArray = [ 1.0, 2.0000001, -3.0000004 ];
|
||||
readArray = pykd.loadDoubles( target.module.doubleArray, 3 );
|
||||
for i in range(0,3):
|
||||
testArray = [ 1.0000000, 0.0000000001, -199.99999999998, 200000.00000001, 0.3333333333 ];
|
||||
readArray = pykd.loadDoubles( target.module.doubleArray, 5 );
|
||||
for i in range(5):
|
||||
self.assertTrue( math.fabs( testArray[i] - readArray[i] ) < 0.0000001 )
|
||||
|
@ -40,13 +40,13 @@ class ModuleTest( unittest.TestCase ):
|
||||
self.assertEqual( target.module.name() + ".exe", target.module.image() )
|
||||
|
||||
def testFindModule( self ):
|
||||
self.assertRaises( pykd.BaseException, pykd.module, target.module.begin() - 0x10 )
|
||||
self.assertRaises( pykd.DbgException, pykd.module, target.module.begin() - 0x10 )
|
||||
|
||||
self.assertNotEqual( None, pykd.module( target.module.begin() ) )
|
||||
self.assertNotEqual( None, pykd.module( target.module.begin() + 0x10) )
|
||||
|
||||
self.assertRaises( pykd.BaseException, pykd.module, target.module.end() )
|
||||
self.assertRaises( pykd.BaseException, pykd.module, target.module.end() + 0x10 )
|
||||
self.assertRaises( pykd.DbgException, pykd.module, target.module.end() )
|
||||
self.assertRaises( pykd.DbgException, pykd.module, target.module.end() + 0x10 )
|
||||
|
||||
def testSymbol( self ):
|
||||
self.assertEqual( target.module.rva("FuncWithName0"), target.module.offset("FuncWithName0") - target.module.begin() )
|
||||
|
@ -15,7 +15,7 @@ import target
|
||||
|
||||
import intbase
|
||||
import memtest
|
||||
#import moduletest
|
||||
import moduletest
|
||||
#import typeinfo
|
||||
#import typedvar
|
||||
#import regtest
|
||||
@ -47,7 +47,7 @@ def getTestSuite( singleName = "" ):
|
||||
|
||||
unittest.TestLoader().loadTestsFromTestCase( StartProcessWithoutParamsTest ),
|
||||
# *** Test without start/kill new processes
|
||||
#unittest.TestLoader().loadTestsFromTestCase( moduletest.ModuleTest ),
|
||||
unittest.TestLoader().loadTestsFromTestCase( moduletest.ModuleTest ),
|
||||
unittest.TestLoader().loadTestsFromTestCase( memtest.MemoryTest ),
|
||||
#unittest.TestLoader().loadTestsFromTestCase( typeinfo.TypeInfoTest ),
|
||||
#unittest.TestLoader().loadTestsFromTestCase( typedvar.TypedVarTest ),
|
||||
|
Loading…
Reference in New Issue
Block a user