mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[0.1.x] added : getCurrentProcess routine
[0.1.x] added : getImplicitThread routine git-svn-id: https://pykd.svn.codeplex.com/svn@72141 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
adfad183f2
commit
7ec136e150
@ -83,8 +83,12 @@ public:
|
||||
|
||||
std::string findSymbol( ULONG64 offset );
|
||||
|
||||
ULONG64 getCurrentProcess();
|
||||
|
||||
python::tuple getDebuggeeType();
|
||||
|
||||
ULONG64 getImplicitThread();
|
||||
|
||||
ULONG getExecutionStatus();
|
||||
|
||||
template<ULONG status>
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "typedvar.h"
|
||||
#include "dbgmem.h"
|
||||
#include "intbase.h"
|
||||
#include "process.h"
|
||||
|
||||
using namespace pykd;
|
||||
|
||||
@ -132,7 +133,7 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
.def( "__long__", &intBase::long_ )
|
||||
.def( "__int__", &intBase::int_ );
|
||||
|
||||
python::class_<pykd::DebugClient, pykd::DebugClientPtr>("dbgClient", "Class representing a debugging session", python::no_init )
|
||||
python::class_<DebugClient, DebugClientPtr>("dbgClient", "Class representing a debugging session", python::no_init )
|
||||
.def( "addr64", &DebugClient::addr64,
|
||||
"Extend address to 64 bits formats" )
|
||||
.def( "breakin", &DebugClient::breakin,
|
||||
@ -151,8 +152,12 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Evaluate windbg expression" )
|
||||
.def( "findSymbol", &DebugClient::findSymbol,
|
||||
"Find symbol by the target virtual memory offset" )
|
||||
.def( "getCurrentProcess", &DebugClient::getCurrentProcess,
|
||||
"Return pointer to current process's block" )
|
||||
.def( "getDebuggeeType", &DebugClient::getDebuggeeType,
|
||||
"Return type of the debuggee" )
|
||||
.def( "getImplicitThread", &getImplicitThread,
|
||||
"Return implicit thread for current process" )
|
||||
.def( "getExecutionStatus", &DebugClient::getExecutionStatus,
|
||||
"Return information about the execution status of the debugger" )
|
||||
.def( "go", &DebugClient::changeDebuggerStatus<DEBUG_STATUS_GO>,
|
||||
@ -264,8 +269,12 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Evaluate windbg expression" );
|
||||
python::def( "findSymbol", &findSymbol,
|
||||
"Find symbol by the target virtual memory offset" );
|
||||
python::def( "getCurrentProcess", &getCurrentProcess,
|
||||
"Return pointer to current process's block" );
|
||||
python::def( "getDebuggeeType", &getDebuggeeType,
|
||||
"Return type of the debuggee" );
|
||||
python::def( "getImplicitThread", &getImplicitThread,
|
||||
"Return implicit thread for current process" );
|
||||
python::def( "debuggerPath", &getDebuggerImage,
|
||||
"Return full path to the process image that uses pykd" );
|
||||
python::def( "getExecutionStatus", &getExecutionStatus,
|
||||
|
@ -41,6 +41,10 @@ protected:
|
||||
hres = client->QueryInterface( __uuidof(IDebugRegisters2), (void**)&m_registers );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException("QueryInterface IDebugDataSpaces failed");
|
||||
|
||||
hres = client->QueryInterface( __uuidof(IDebugSystemObjects), (void**)&m_system );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException("QueryInterface IDebugSystem2 failed");
|
||||
}
|
||||
|
||||
virtual ~DbgObject() {};
|
||||
@ -52,6 +56,7 @@ protected:
|
||||
CComPtr<IDebugAdvanced2> m_advanced;
|
||||
CComPtr<IDebugDataSpaces4> m_dataSpaces;
|
||||
CComPtr<IDebugRegisters2> m_registers;
|
||||
CComPtr<IDebugSystemObjects2> m_system;
|
||||
};
|
||||
|
||||
|
||||
|
49
pykd/process.cpp
Normal file
49
pykd/process.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include "stdafx.h"
|
||||
#include "dbgclient.h"
|
||||
|
||||
namespace pykd {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ULONG64
|
||||
DebugClient::getCurrentProcess()
|
||||
{
|
||||
HRESULT hres;
|
||||
ULONG64 processAddr = 0;
|
||||
|
||||
hres = m_system->GetImplicitProcessDataOffset( &processAddr );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugSystemObjects2::GetImplicitProcessDataOffset failed" );
|
||||
|
||||
return processAddr;
|
||||
}
|
||||
|
||||
ULONG64
|
||||
getCurrentProcess()
|
||||
{
|
||||
return g_dbgClient->getCurrentProcess();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ULONG64
|
||||
DebugClient::getImplicitThread()
|
||||
{
|
||||
HRESULT hres;
|
||||
ULONG64 threadOffset = -1;
|
||||
|
||||
hres = m_system->GetImplicitThreadDataOffset( &threadOffset );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugSystemObjects2::GetImplicitThreadDataOffset failed" );
|
||||
|
||||
return threadOffset;
|
||||
}
|
||||
|
||||
ULONG64
|
||||
getImplicitThread() {
|
||||
return g_dbgClient->getImplicitThread();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
13
pykd/process.h
Normal file
13
pykd/process.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
namespace pykd {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ULONG64 getCurrentProcess();
|
||||
|
||||
ULONG64 getImplicitThread();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="pykd"
|
||||
ProjectGUID="{FE961905-666F-4908-A212-961465F46F13}"
|
||||
RootNamespace="pykd"
|
||||
@ -409,6 +409,10 @@
|
||||
RelativePath=".\module.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\process.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pykd.def"
|
||||
>
|
||||
@ -531,6 +535,10 @@
|
||||
RelativePath=".\module.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\process.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pyaux.h"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user