mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.3.x] fixed : issue #13945 ([0.3.x] feature-request: write memory)
kdlib commit (functions + tests) git-svn-id: https://pykd.svn.codeplex.com/svn@91016 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
0d0648873b
commit
8c1df769ad
@ -136,7 +136,6 @@
|
|||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.5|x64'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.5|x64'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
||||||
<PropertyGroup Label="UserMacros">
|
<PropertyGroup Label="UserMacros">
|
||||||
<NuGetPackageImportStamp>4bf1ae88</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>4bf1ae88</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -200,7 +199,6 @@
|
|||||||
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
|
||||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
@ -312,7 +310,6 @@
|
|||||||
<Command>copy $(OutDir)..\Release\targetapp.exe $(OutDir)</Command>
|
<Command>copy $(OutDir)..\Release\targetapp.exe $(OutDir)</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.5|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_3.5|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
@ -412,7 +409,16 @@
|
|||||||
<ClCompile Include="pydbgeng.cpp" />
|
<ClCompile Include="pydbgeng.cpp" />
|
||||||
<ClCompile Include="pyeventhandler.cpp" />
|
<ClCompile Include="pyeventhandler.cpp" />
|
||||||
<ClCompile Include="pymemaccess.cpp" />
|
<ClCompile Include="pymemaccess.cpp" />
|
||||||
<ClCompile Include="pymod.cpp" />
|
<ClCompile Include="pymod.cpp">
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release_3.5|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release_2.7|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug_3.5|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release_3.5|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release_2.7|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug_3.5|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="pymodule.cpp" />
|
<ClCompile Include="pymodule.cpp" />
|
||||||
<ClCompile Include="pyprocess.cpp" />
|
<ClCompile Include="pyprocess.cpp" />
|
||||||
<ClCompile Include="pytypedvar.cpp" />
|
<ClCompile Include="pytypedvar.cpp" />
|
||||||
|
@ -170,6 +170,116 @@ python::list loadDoubles( kdlib::MEMOFFSET_64 offset, unsigned long count, bool
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeBytes(kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr)
|
||||||
|
{
|
||||||
|
auto values = listToVector<unsigned char>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeBytes(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<unsigned short>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeWords(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeDWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<unsigned long>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeDWords(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeQWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<unsigned long long>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeQWords(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeSignBytes( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<char, signed char>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeSignBytes(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeSignWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<short>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeSignWords(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeSignDWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<long>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeSignDWords(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeSignQWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<long long>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeSignQWords(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeFloats( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<float>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeFloats(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void writeDoubles( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr )
|
||||||
|
{
|
||||||
|
auto values = listToVector<double>(list);
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
kdlib::writeDoubles(offset, values, phyAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
python::list loadPtrList( kdlib::MEMOFFSET_64 offset )
|
python::list loadPtrList( kdlib::MEMOFFSET_64 offset )
|
||||||
{
|
{
|
||||||
std::vector<kdlib::MEMOFFSET_64> lst;
|
std::vector<kdlib::MEMOFFSET_64> lst;
|
||||||
|
@ -101,6 +101,67 @@ inline double ptrDoubleFloat( kdlib::MEMOFFSET_64 offset )
|
|||||||
return kdlib::ptrDoubleFloat(offset);
|
return kdlib::ptrDoubleFloat(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void setByte( kdlib::MEMOFFSET_64 offset, unsigned char value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setByte(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setWord( kdlib::MEMOFFSET_64 offset, unsigned short value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setWord(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setDWord( kdlib::MEMOFFSET_64 offset, unsigned long value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setDWord(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setQWord( kdlib::MEMOFFSET_64 offset, unsigned long long value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setQWord(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setSignByte( kdlib::MEMOFFSET_64 offset, int value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setSignByte(offset, char(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setSignWord( kdlib::MEMOFFSET_64 offset, short value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setSignWord(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setSignDWord( kdlib::MEMOFFSET_64 offset, long value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setSignDWord(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setSignQWord( kdlib::MEMOFFSET_64 offset, long long value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setSignQWord(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setSingleFloat( kdlib::MEMOFFSET_64 offset, float value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setSingleFloat(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setDoubleFloat( kdlib::MEMOFFSET_64 offset, double value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setDoubleFloat(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
python::list loadBytes( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
python::list loadBytes( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
||||||
python::list loadWords( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
python::list loadWords( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
||||||
python::list loadDWords( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
python::list loadDWords( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
||||||
@ -113,6 +174,18 @@ python::list loadFloats( kdlib::MEMOFFSET_64 offset, unsigned long count, bool p
|
|||||||
python::list loadDoubles( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
python::list loadDoubles( kdlib::MEMOFFSET_64 offset, unsigned long count, bool phyAddr = false );
|
||||||
|
|
||||||
|
|
||||||
|
void writeBytes( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeDWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeQWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeSignBytes( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeSignWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeSignDWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeSignQWords( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeFloats( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
void writeDoubles( kdlib::MEMOFFSET_64 offset, const python::list &list, bool phyAddr = false );
|
||||||
|
|
||||||
|
|
||||||
inline std::string loadChars( kdlib::MEMOFFSET_64 offset, unsigned long number, bool phyAddr = false )
|
inline std::string loadChars( kdlib::MEMOFFSET_64 offset, unsigned long number, bool phyAddr = false )
|
||||||
{
|
{
|
||||||
AutoRestorePyState pystate;
|
AutoRestorePyState pystate;
|
||||||
@ -146,6 +219,12 @@ inline kdlib::MEMOFFSET_64 ptrPtr( kdlib::MEMOFFSET_64 offset )
|
|||||||
return kdlib::ptrPtr(offset);
|
return kdlib::ptrPtr(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void setPtr( kdlib::MEMOFFSET_64 offset, kdlib::MEMOFFSET_64 value )
|
||||||
|
{
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
return kdlib::setPtr(offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
python::list loadPtrList( kdlib::MEMOFFSET_64 offset );
|
python::list loadPtrList( kdlib::MEMOFFSET_64 offset );
|
||||||
python::list loadPtrArray( kdlib::MEMOFFSET_64 offset, unsigned long count );
|
python::list loadPtrArray( kdlib::MEMOFFSET_64 offset, unsigned long count );
|
||||||
|
|
||||||
|
@ -63,6 +63,17 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( loadFloats_, pykd::loadFloats, 2, 3 );
|
|||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( loadDoubles_, pykd::loadDoubles, 2, 3 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( loadDoubles_, pykd::loadDoubles, 2, 3 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( compareMemory_, pykd::compareMemory, 3, 4 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( compareMemory_, pykd::compareMemory, 3, 4 );
|
||||||
|
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeBytes_, pykd::writeBytes, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeWords_, pykd::writeWords, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeDWords_, pykd::writeDWords, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeQWords_, pykd::writeQWords, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeSignBytes_, pykd::writeSignBytes, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeSignWords_, pykd::writeSignWords, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeSignDWords_, pykd::writeSignDWords, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeSignQWords_, pykd::writeSignQWords, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeFloats_, pykd::writeFloats, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( writeDoubles_, pykd::writeDoubles, 2, 3 );
|
||||||
|
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceFile_, pykd::getSourceFile, 0, 1 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceFile_, pykd::getSourceFile, 0, 1 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceFileFromSrcSrv_, pykd::getSourceFileFromSrcSrv, 0, 1 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceFileFromSrcSrv_, pykd::getSourceFileFromSrcSrv, 0, 1 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceLine_, pykd::getSourceLine, 0, 1 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceLine_, pykd::getSourceLine, 0, 1 );
|
||||||
@ -275,6 +286,27 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
python::def( "ptrDouble", pykd::ptrDoubleFloat,
|
python::def( "ptrDouble", pykd::ptrDoubleFloat,
|
||||||
"Read a float with single precision from the target memory" );
|
"Read a float with single precision from the target memory" );
|
||||||
|
|
||||||
|
python::def( "setByte", pykd::setByte,
|
||||||
|
"Write an unsigned 1-byte integer to the target memory" );
|
||||||
|
python::def( "setWord", pykd::setWord,
|
||||||
|
"Write an unsigned 2-byte integer to the target memory" );
|
||||||
|
python::def( "setDWord", pykd::setDWord,
|
||||||
|
"Write an unsigned 4-byte integer to the target memory" );
|
||||||
|
python::def( "setQWord", pykd::setQWord,
|
||||||
|
"Write an unsigned 8-byte integer to the target memory" );
|
||||||
|
python::def( "setSignByte", pykd::setSignByte,
|
||||||
|
"Write an signed 1-byte integer to the target memory" );
|
||||||
|
python::def( "setSignWord", pykd::setSignWord,
|
||||||
|
"Write an signed 2-byte integer to the target memory" );
|
||||||
|
python::def( "setSignDWord", pykd::setSignDWord,
|
||||||
|
"Write an signed 4-byte integer to the target memory" );
|
||||||
|
python::def( "setSignQWord", pykd::setSignQWord,
|
||||||
|
"Write an signed 8-byte integer to the target memory" );
|
||||||
|
python::def( "setFloat", pykd::setSingleFloat,
|
||||||
|
"Write a float with single precision to the target memory" );
|
||||||
|
python::def( "setDouble", pykd::setDoubleFloat,
|
||||||
|
"Write a float with single precision to the target memory" );
|
||||||
|
|
||||||
python::def( "loadBytes", pykd::loadBytes, loadBytes_( python::args( "offset", "count", "phyAddr" ),
|
python::def( "loadBytes", pykd::loadBytes, loadBytes_( python::args( "offset", "count", "phyAddr" ),
|
||||||
"Read the block of the target's memory and return it as list of unsigned bytes" ) );
|
"Read the block of the target's memory and return it as list of unsigned bytes" ) );
|
||||||
python::def( "loadWords", pykd::loadWords, loadWords_( python::args( "offset", "count", "phyAddr" ),
|
python::def( "loadWords", pykd::loadWords, loadWords_( python::args( "offset", "count", "phyAddr" ),
|
||||||
@ -308,6 +340,27 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
python::def( "loadDoubles", pykd::loadDoubles, loadDoubles_( python::args( "offset", "count", "phyAddr" ),
|
python::def( "loadDoubles", pykd::loadDoubles, loadDoubles_( python::args( "offset", "count", "phyAddr" ),
|
||||||
"Read the block of the target's memory and return it as list of doubles" ) );
|
"Read the block of the target's memory and return it as list of doubles" ) );
|
||||||
|
|
||||||
|
python::def( "writeBytes", pykd::writeBytes, writeBytes_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of unsigned bytes to target memeory" ) );
|
||||||
|
python::def( "writeWords", pykd::writeWords, writeWords_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of unsigned shorts to target memeory" ) );
|
||||||
|
python::def( "writeDWords", pykd::writeDWords, writeDWords_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of unsigned long ( double word ) to target memeory" ) );
|
||||||
|
python::def( "writeQWords", pykd::writeQWords, writeQWords_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of unsigned long long ( quad word ) to target memeory" ) );
|
||||||
|
python::def( "writeSignBytes", pykd::writeSignBytes, writeSignBytes_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of signed bytes to target memeory" ) );
|
||||||
|
python::def( "writeSignWords", pykd::writeSignWords, writeSignWords_( python::args( "offset", "count", "phyAddr" ),
|
||||||
|
"Writing a list of signed words to target memeory" ) );
|
||||||
|
python::def( "writeSignDWords", pykd::writeSignDWords, writeSignDWords_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of signed longs to target memeory" ) );
|
||||||
|
python::def( "writeSignQWords", pykd::writeSignQWords, writeSignQWords_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of signed long longs to target memeory" ) );
|
||||||
|
python::def( "writeFloats", pykd::writeFloats, writeFloats_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of floats to target memeory" ) );
|
||||||
|
python::def( "writeDoubles", pykd::writeDoubles, writeDoubles_( python::args( "offset", "values", "phyAddr" ),
|
||||||
|
"Writing a list of doubles to target memeory" ) );
|
||||||
|
|
||||||
python::def( "ptrPtr", pykd::ptrPtr,
|
python::def( "ptrPtr", pykd::ptrPtr,
|
||||||
"Read an pointer value from the target memory" );
|
"Read an pointer value from the target memory" );
|
||||||
python::def( "loadPtrList", pykd::loadPtrList,
|
python::def( "loadPtrList", pykd::loadPtrList,
|
||||||
@ -315,6 +368,9 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
python::def( "loadPtrs", pykd::loadPtrArray,
|
python::def( "loadPtrs", pykd::loadPtrArray,
|
||||||
"Read the block of the target's memory and return it as a list of pointers" );
|
"Read the block of the target's memory and return it as a list of pointers" );
|
||||||
|
|
||||||
|
python::def( "setPtr", pykd::setPtr,
|
||||||
|
"Write an pointer value to the target memory" );
|
||||||
|
|
||||||
// types and vaiables
|
// types and vaiables
|
||||||
python::def( "getSourceFile", pykd::getSourceFile, getSourceFile_( python::args( "offset"),
|
python::def( "getSourceFile", pykd::getSourceFile, getSourceFile_( python::args( "offset"),
|
||||||
"Return source file by the specified offset" ) );
|
"Return source file by the specified offset" ) );
|
||||||
|
@ -26,7 +26,7 @@ python::list vectorToList<char>( const std::vector<char> &v ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T, typename TExtract=T>
|
||||||
inline
|
inline
|
||||||
std::vector<T> listToVector( const python::list &lst )
|
std::vector<T> listToVector( const python::list &lst )
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ std::vector<T> listToVector( const python::list &lst )
|
|||||||
|
|
||||||
for ( long i = 0; i < python::len(lst); ++i )
|
for ( long i = 0; i < python::len(lst); ++i )
|
||||||
{
|
{
|
||||||
T v = python::extract<T>(lst[i]);
|
T v = python::extract<TExtract>(lst[i]);
|
||||||
vec[i] =v;
|
vec[i] =v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,66 @@ class MemoryTest( unittest.TestCase ):
|
|||||||
self.assertEqual( len(testArray), len(loadArray) )
|
self.assertEqual( len(testArray), len(loadArray) )
|
||||||
self.assertEqual( 0, len( [ loadArray[i] for i in range(len(testArray)) if loadArray[i] != testArray[i] ] ) )
|
self.assertEqual( 0, len( [ loadArray[i] for i in range(len(testArray)) if loadArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteBytes( self ):
|
||||||
|
testArray = pykd.loadBytes( target.module.ucharArray, 5 )
|
||||||
|
pykd.writeBytes( target.module.ucharArrayPlace, testArray )
|
||||||
|
ucharArray = pykd.loadBytes( target.module.ucharArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ ucharArray[i] for i in range(5) if ucharArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteWords( self ):
|
||||||
|
testArray = pykd.loadWords( target.module.ushortArray, 5 )
|
||||||
|
pykd.writeWords( target.module.ushortArrayPlace, testArray )
|
||||||
|
ushortArray = pykd.loadWords( target.module.ushortArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ ushortArray[i] for i in range(5) if ushortArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteDWords( self ):
|
||||||
|
testArray = pykd.loadDWords( target.module.ulongArray, 5 )
|
||||||
|
pykd.writeDWords( target.module.ulongArrayPlace, testArray )
|
||||||
|
ulongArray = pykd.loadDWords( target.module.ulongArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ ulongArray[i] for i in range(5) if ulongArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteQWords( self ):
|
||||||
|
testArray = pykd.loadQWords( target.module.ulonglongArray, 5 )
|
||||||
|
pykd.writeQWords( target.module.ulonglongArrayPlace, testArray )
|
||||||
|
ulonglongArray = pykd.loadQWords( target.module.ulonglongArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ ulonglongArray[i] for i in range(5) if ulonglongArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteSignBytes( self ):
|
||||||
|
testArray = pykd.loadSignBytes( target.module.charArray, 5 )
|
||||||
|
pykd.writeSignBytes( target.module.charArrayPlace, testArray )
|
||||||
|
charArray = pykd.loadSignBytes( target.module.charArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ charArray[i] for i in range(5) if charArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteSignWords( self ):
|
||||||
|
testArray = pykd.loadSignWords( target.module.shortArray, 5 )
|
||||||
|
pykd.writeSignWords( target.module.shortArrayPlace, testArray )
|
||||||
|
shortArray = pykd.loadSignWords( target.module.shortArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ shortArray[i] for i in range(5) if shortArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteSignDWords( self ):
|
||||||
|
testArray = pykd.loadSignDWords( target.module.longArray, 5 )
|
||||||
|
pykd.writeSignDWords( target.module.longArrayPlace, testArray )
|
||||||
|
longArray = pykd.loadSignDWords( target.module.longArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ longArray[i] for i in range(5) if longArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteSignQWords( self ):
|
||||||
|
testArray = pykd.loadSignQWords( target.module.longlongArray, 5 )
|
||||||
|
pykd.writeSignQWords( target.module.longlongArrayPlace, testArray )
|
||||||
|
longlongArray = pykd.loadSignQWords( target.module.longlongArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ longlongArray[i] for i in range(5) if longlongArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteFloats( self ):
|
||||||
|
testArray = pykd.loadFloats( target.module.floatArray, 5 )
|
||||||
|
pykd.writeFloats( target.module.floatArrayPlace, testArray )
|
||||||
|
floatArray = pykd.loadFloats( target.module.floatArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ floatArray[i] for i in range(5) if floatArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
|
def testWriteDoubles( self ):
|
||||||
|
testArray = pykd.loadDoubles( target.module.doubleArray, 5 )
|
||||||
|
pykd.writeDoubles( target.module.doubleArrayPlace, testArray )
|
||||||
|
doubleArray = pykd.loadDoubles( target.module.doubleArrayPlace, 5 )
|
||||||
|
self.assertEqual( 0, len( [ doubleArray[i] for i in range(5) if doubleArray[i] != testArray[i] ] ) )
|
||||||
|
|
||||||
def testPtrRead( self ):
|
def testPtrRead( self ):
|
||||||
self.assertEqual( 0x80, pykd.ptrByte( target.module.bigValue ) )
|
self.assertEqual( 0x80, pykd.ptrByte( target.module.bigValue ) )
|
||||||
self.assertEqual( 0x8080, pykd.ptrWord( target.module.bigValue ) )
|
self.assertEqual( 0x8080, pykd.ptrWord( target.module.bigValue ) )
|
||||||
@ -75,6 +135,37 @@ class MemoryTest( unittest.TestCase ):
|
|||||||
self.assertEqual( -2139062144, pykd.ptrSignDWord( target.module.bigValue ) )
|
self.assertEqual( -2139062144, pykd.ptrSignDWord( target.module.bigValue ) )
|
||||||
self.assertEqual( -9187201950435737472, pykd.ptrSignQWord( target.module.bigValue ) )
|
self.assertEqual( -9187201950435737472, pykd.ptrSignQWord( target.module.bigValue ) )
|
||||||
|
|
||||||
|
def testSetValue( self ):
|
||||||
|
pykd.setByte( target.module.ullValuePlace, pykd.ptrByte( target.module.bigValue ) )
|
||||||
|
self.assertEqual( pykd.ptrByte( target.module.bigValue ), pykd.ptrByte( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setWord( target.module.ullValuePlace, pykd.ptrWord( target.module.bigValue ) )
|
||||||
|
self.assertEqual( pykd.ptrWord( target.module.bigValue ), pykd.ptrWord( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setDWord( target.module.ullValuePlace, pykd.ptrDWord( target.module.bigValue ) )
|
||||||
|
self.assertEqual( pykd.ptrDWord( target.module.bigValue ), pykd.ptrDWord( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setQWord( target.module.ullValuePlace, pykd.ptrQWord( target.module.bigValue ) )
|
||||||
|
self.assertEqual( pykd.ptrQWord( target.module.bigValue ), pykd.ptrQWord( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setSignByte( target.module.ullValuePlace, -128 )
|
||||||
|
self.assertEqual( -128, pykd.ptrSignByte( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setSignWord( target.module.ullValuePlace, pykd.ptrSignWord( target.module.bigValue ) )
|
||||||
|
self.assertEqual( pykd.ptrSignWord( target.module.bigValue ), pykd.ptrSignWord( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setSignDWord( target.module.ullValuePlace, pykd.ptrSignDWord( target.module.bigValue ) )
|
||||||
|
self.assertEqual( pykd.ptrSignDWord( target.module.bigValue ), pykd.ptrSignDWord( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setSignQWord( target.module.ullValuePlace, pykd.ptrSignQWord( target.module.bigValue ) )
|
||||||
|
self.assertEqual( pykd.ptrSignQWord( target.module.bigValue ), pykd.ptrSignQWord( target.module.ullValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setFloat( target.module.floatValuePlace, pykd.ptrFloat( target.module.floatValue ) )
|
||||||
|
self.assertEqual( pykd.ptrFloat( target.module.floatValue ), pykd.ptrFloat( target.module.floatValuePlace ) )
|
||||||
|
|
||||||
|
pykd.setDouble( target.module.doubleValuePlace, pykd.ptrDouble( target.module.doubleValue ) )
|
||||||
|
self.assertEqual( pykd.ptrDouble( target.module.doubleValue ), pykd.ptrDouble( target.module.doubleValuePlace ) )
|
||||||
|
|
||||||
def testCompare( self ):
|
def testCompare( self ):
|
||||||
self.assertTrue( pykd.compareMemory( target.module.helloStr, pykd.ptrPtr(target.module.strArray), 5 ) )
|
self.assertTrue( pykd.compareMemory( target.module.helloStr, pykd.ptrPtr(target.module.strArray), 5 ) )
|
||||||
self.assertFalse( pykd.compareMemory( target.module.helloStr, target.module.helloWStr, 5 ) )
|
self.assertFalse( pykd.compareMemory( target.module.helloStr, target.module.helloWStr, 5 ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user