mirror of https://github.com/x64dbg/GleeBug
renamed some shit
This commit is contained in:
parent
fcc69d311b
commit
da7988c71f
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace GleeBug
|
||||
{
|
||||
DllInfo::DllInfo(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint) :
|
||||
Dll::Dll(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint) :
|
||||
lpBaseOfDll(ptr(lpBaseOfDll)),
|
||||
sizeOfImage(sizeOfImage),
|
||||
entryPoint(ptr(entryPoint))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace GleeBug
|
|||
/**
|
||||
\brief DLL information structure.
|
||||
*/
|
||||
class DllInfo
|
||||
class Dll
|
||||
{
|
||||
public:
|
||||
ptr lpBaseOfDll;
|
||||
|
|
@ -21,7 +21,7 @@ namespace GleeBug
|
|||
\param sizeOfImage Size of the image.
|
||||
\param entryPoint The entry point.
|
||||
*/
|
||||
explicit DllInfo(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint);
|
||||
explicit Dll(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ namespace GleeBug
|
|||
{
|
||||
//forward declarations
|
||||
class Debugger;
|
||||
class ProcessInfo;
|
||||
class DllInfo;
|
||||
class ThreadInfo;
|
||||
class Process;
|
||||
class Dll;
|
||||
class Thread;
|
||||
enum class BreakpointType;
|
||||
struct BreakpointInfo;
|
||||
|
||||
|
|
@ -27,9 +27,9 @@ namespace GleeBug
|
|||
typedef std::function<void(const BreakpointInfo & info)> BreakpointCallback;
|
||||
|
||||
//map typedefs
|
||||
typedef std::map<uint32, ProcessInfo> ProcessMap;
|
||||
typedef std::map<Range, DllInfo, RangeCompare> DllMap;
|
||||
typedef std::map<uint32, ThreadInfo> ThreadMap;
|
||||
typedef std::map<uint32, Process> ProcessMap;
|
||||
typedef std::map<Range, Dll, RangeCompare> DllMap;
|
||||
typedef std::map<uint32, Thread> ThreadMap;
|
||||
typedef std::map<BreakpointKey, BreakpointInfo> BreakpointMap;
|
||||
typedef std::map<BreakpointKey, BreakpointCallback> BreakpointCallbackMap;
|
||||
typedef std::unordered_map<ptr, BreakpointMap::iterator> SoftwareBreakpointMap;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace GleeBug
|
|||
HMODULE(loadDll.lpBaseOfDll),
|
||||
&modinfo,
|
||||
sizeof(MODULEINFO));
|
||||
DllInfo dll(loadDll.lpBaseOfDll, modinfo.SizeOfImage, modinfo.EntryPoint);
|
||||
Dll dll(loadDll.lpBaseOfDll, modinfo.SizeOfImage, modinfo.EntryPoint);
|
||||
mProcess->dlls.insert({ Range(dll.lpBaseOfDll, dll.lpBaseOfDll + dll.sizeOfImage - 1), dll });
|
||||
|
||||
//call the debug event callback
|
||||
|
|
@ -29,7 +29,7 @@ namespace GleeBug
|
|||
if (dll != mProcess->dlls.end())
|
||||
cbUnloadDllEvent(unloadDll, dll->second);
|
||||
else
|
||||
cbUnloadDllEvent(unloadDll, DllInfo(unloadDll.lpBaseOfDll, 0, nullptr));
|
||||
cbUnloadDllEvent(unloadDll, Dll(unloadDll.lpBaseOfDll, 0, nullptr));
|
||||
|
||||
//DLL housekeeping
|
||||
if (dll != mProcess->dlls.end())
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ namespace GleeBug
|
|||
{
|
||||
//process housekeeping
|
||||
mProcesses.insert({ mDebugEvent.dwProcessId,
|
||||
ProcessInfo(createProcess.hProcess,
|
||||
Process(createProcess.hProcess,
|
||||
mDebugEvent.dwProcessId,
|
||||
mDebugEvent.dwThreadId) });
|
||||
mProcess = &mProcesses.find(mDebugEvent.dwProcessId)->second;
|
||||
|
||||
//thread housekeeping (main thread is created implicitly)
|
||||
mProcess->threads.insert({ mDebugEvent.dwThreadId,
|
||||
ThreadInfo(createProcess.hThread,
|
||||
Thread(createProcess.hThread,
|
||||
mDebugEvent.dwThreadId,
|
||||
createProcess.lpThreadLocalBase,
|
||||
createProcess.lpStartAddress) });
|
||||
|
|
@ -22,7 +22,7 @@ namespace GleeBug
|
|||
|
||||
//read thread context from main thread
|
||||
if (!mThread->RegReadContext())
|
||||
cbInternalError("ThreadInfo::RegReadContext() failed!");
|
||||
cbInternalError("Thread::RegReadContext() failed!");
|
||||
|
||||
//call the debug event callback
|
||||
cbCreateProcessEvent(createProcess, *mProcess);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace GleeBug
|
|||
{
|
||||
//thread housekeeping
|
||||
mProcess->threads.insert({ mDebugEvent.dwThreadId,
|
||||
ThreadInfo(createThread.hThread,
|
||||
Thread(createThread.hThread,
|
||||
mDebugEvent.dwThreadId,
|
||||
createThread.lpThreadLocalBase,
|
||||
createThread.lpStartAddress) });
|
||||
|
|
@ -15,7 +15,7 @@ namespace GleeBug
|
|||
mThread = mProcess->thread = &mProcess->threads.find(mDebugEvent.dwThreadId)->second;
|
||||
mRegisters = &mThread->registers;
|
||||
if (!mThread->RegReadContext())
|
||||
cbInternalError("ThreadInfo::RegReadContext() failed!");
|
||||
cbInternalError("Thread::RegReadContext() failed!");
|
||||
|
||||
//call the debug event callback
|
||||
cbCreateThreadEvent(createThread, *mThread);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace GleeBug
|
||||
{
|
||||
bool ProcessInfo::SetBreakpoint(ptr address, bool singleshoot, SoftwareType type)
|
||||
bool Process::SetBreakpoint(ptr address, bool singleshoot, SoftwareType type)
|
||||
{
|
||||
//check the address
|
||||
if (!MemIsValidPtr(address) ||
|
||||
|
|
@ -43,7 +43,7 @@ namespace GleeBug
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ProcessInfo::SetBreakpoint(ptr address, const BreakpointCallback & cbBreakpoint, bool singleshoot, SoftwareType type)
|
||||
bool Process::SetBreakpoint(ptr address, const BreakpointCallback & cbBreakpoint, bool singleshoot, SoftwareType type)
|
||||
{
|
||||
//check if a callback on this address was already found
|
||||
if (breakpointCallbacks.find({ BreakpointType::Software, address }) != breakpointCallbacks.end())
|
||||
|
|
@ -56,7 +56,7 @@ namespace GleeBug
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ProcessInfo::DeleteBreakpoint(ptr address)
|
||||
bool Process::DeleteBreakpoint(ptr address)
|
||||
{
|
||||
//find the breakpoint
|
||||
auto found = breakpoints.find({ BreakpointType::Software, address });
|
||||
|
|
@ -79,7 +79,7 @@ namespace GleeBug
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ProcessInfo::GetFreeHardwareBreakpointSlot(HardwareSlot & slot) const
|
||||
bool Process::GetFreeHardwareBreakpointSlot(HardwareSlot & slot) const
|
||||
{
|
||||
//find a free hardware breakpoint slot
|
||||
for (int i = 0; i < HWBP_COUNT; i++)
|
||||
|
|
@ -93,7 +93,7 @@ namespace GleeBug
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ProcessInfo::SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type, HardwareSize size, bool singleshoot)
|
||||
bool Process::SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type, HardwareSize size, bool singleshoot)
|
||||
{
|
||||
//check the address
|
||||
if (!MemIsValidPtr(address) ||
|
||||
|
|
@ -138,7 +138,7 @@ namespace GleeBug
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ProcessInfo::SetHardwareBreakpoint(ptr address, HardwareSlot slot, const BreakpointCallback & cbBreakpoint, HardwareType type, HardwareSize size, bool singleshoot)
|
||||
bool Process::SetHardwareBreakpoint(ptr address, HardwareSlot slot, const BreakpointCallback & cbBreakpoint, HardwareType type, HardwareSize size, bool singleshoot)
|
||||
{
|
||||
//check if a callback on this address was already found
|
||||
if (breakpointCallbacks.find({ BreakpointType::Hardware, address }) != breakpointCallbacks.end())
|
||||
|
|
@ -151,7 +151,7 @@ namespace GleeBug
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ProcessInfo::DeleteHardwareBreakpoint(ptr address)
|
||||
bool Process::DeleteHardwareBreakpoint(ptr address)
|
||||
{
|
||||
//find the hardware breakpoint
|
||||
auto found = breakpoints.find({ BreakpointType::Hardware, address });
|
||||
|
|
@ -176,7 +176,7 @@ namespace GleeBug
|
|||
return success;
|
||||
}
|
||||
|
||||
bool ProcessInfo::DeleteGenericBreakpoint(const BreakpointInfo & info)
|
||||
bool Process::DeleteGenericBreakpoint(const BreakpointInfo & info)
|
||||
{
|
||||
switch (info.type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace GleeBug
|
||||
{
|
||||
bool ProcessInfo::MemRead(ptr address, void* buffer, ptr size, ptr* bytesRead) const
|
||||
bool Process::MemRead(ptr address, void* buffer, ptr size, ptr* bytesRead) const
|
||||
{
|
||||
ptr read;
|
||||
if (!bytesRead)
|
||||
|
|
@ -10,7 +10,7 @@ namespace GleeBug
|
|||
return !!ReadProcessMemory(this->hProcess, reinterpret_cast<const void*>(address), buffer, size, (SIZE_T*)bytesRead);
|
||||
}
|
||||
|
||||
bool ProcessInfo::MemReadSafe(ptr address, void* buffer, ptr size, ptr* bytesRead) const
|
||||
bool Process::MemReadSafe(ptr address, void* buffer, ptr size, ptr* bytesRead) const
|
||||
{
|
||||
if (!MemRead(address, buffer, size, bytesRead))
|
||||
return false;
|
||||
|
|
@ -54,7 +54,7 @@ namespace GleeBug
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ProcessInfo::MemWrite(ptr address, const void* buffer, ptr size, ptr* bytesWritten)
|
||||
bool Process::MemWrite(ptr address, const void* buffer, ptr size, ptr* bytesWritten)
|
||||
{
|
||||
ptr written;
|
||||
if (!bytesWritten)
|
||||
|
|
@ -62,12 +62,12 @@ namespace GleeBug
|
|||
return !!WriteProcessMemory(this->hProcess, reinterpret_cast<void*>(address), buffer, size, (SIZE_T*)bytesWritten);
|
||||
}
|
||||
|
||||
bool ProcessInfo::MemWriteSafe(ptr address, const void* buffer, ptr size, ptr* bytesWritten)
|
||||
bool Process::MemWriteSafe(ptr address, const void* buffer, ptr size, ptr* bytesWritten)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ProcessInfo::MemIsValidPtr(ptr address) const
|
||||
bool Process::MemIsValidPtr(ptr address) const
|
||||
{
|
||||
uint8 byte;
|
||||
return MemRead(address, &byte, sizeof(byte));
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace GleeBug
|
||||
{
|
||||
ProcessInfo::ProcessInfo(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId) :
|
||||
Process::Process(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId) :
|
||||
hProcess(hProcess),
|
||||
dwProcessId(dwProcessId),
|
||||
dwMainThreadId(dwMainThreadId),
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ namespace GleeBug
|
|||
/**
|
||||
\brief Process information structure.
|
||||
*/
|
||||
class ProcessInfo
|
||||
class Process
|
||||
{
|
||||
public:
|
||||
HANDLE hProcess;
|
||||
uint32 dwProcessId;
|
||||
uint32 dwMainThreadId;
|
||||
|
||||
ThreadInfo* thread;
|
||||
Thread* thread;
|
||||
bool systemBreakpoint;
|
||||
|
||||
ThreadMap threads; //DO NOT COPY THESE OBJECTS!
|
||||
|
|
@ -34,7 +34,7 @@ namespace GleeBug
|
|||
\param dwProcessId Identifier for the process.
|
||||
\param dwMainThreadId Identifier for the main thread.
|
||||
*/
|
||||
explicit ProcessInfo(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId);
|
||||
explicit Process(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId);
|
||||
|
||||
/**
|
||||
\brief Read memory from the process.
|
||||
|
|
@ -136,7 +136,7 @@ namespace GleeBug
|
|||
/**
|
||||
\brief Sets a hardware breakpoint.
|
||||
\param address The address to set the hardware breakpoint on.
|
||||
\param slot The hardware breakpoint register slot. Use ProcessInfo::GetFreeHardwareBreakpointSlot.
|
||||
\param slot The hardware breakpoint register slot. Use Process::GetFreeHardwareBreakpointSlot.
|
||||
\param type (Optional) The hardware breakpoint type.
|
||||
\param size (Optional) The hardware breakpoint size.
|
||||
\param singleshoot (Optional) True to remove the breakpoint after the first hit.
|
||||
|
|
@ -147,7 +147,7 @@ namespace GleeBug
|
|||
/**
|
||||
\brief Sets a hardware breakpoint.
|
||||
\param address The address to set the hardware breakpoint on.
|
||||
\param slot The hardware breakpoint register slot. Use ProcessInfo::GetFreeHardwareBreakpointSlot.
|
||||
\param slot The hardware breakpoint register slot. Use Process::GetFreeHardwareBreakpointSlot.
|
||||
\param cbBreakpoint The breakpoint callback. Can be written using BIND1(this, MyDebugger::cb).
|
||||
\param type (Optional) The hardware breakpoint type.
|
||||
\param size (Optional) The hardware breakpoint size.
|
||||
|
|
@ -160,7 +160,7 @@ namespace GleeBug
|
|||
\brief Sets a hardware breakpoint.
|
||||
\tparam T Generic type parameter. Must be a subclass of Debugger.
|
||||
\param address The address to set the hardware breakpoint on.
|
||||
\param slot The hardware breakpoint register slot. Use ProcessInfo::GetFreeHardwareBreakpointSlot.
|
||||
\param slot The hardware breakpoint register slot. Use Process::GetFreeHardwareBreakpointSlot.
|
||||
\param debugger This pointer to a subclass of Debugger.
|
||||
\param callback Pointer to the callback. Written like: &MyDebugger::cb
|
||||
\param type (Optional) The hardware breakpoint type.
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ namespace GleeBug
|
|||
}
|
||||
}
|
||||
|
||||
bool ThreadInfo::SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type, HardwareSize size)
|
||||
bool Thread::SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type, HardwareSize size)
|
||||
{
|
||||
//check if the alignment is correct
|
||||
if ((address % int(size) != 0))
|
||||
|
|
@ -216,7 +216,7 @@ namespace GleeBug
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ThreadInfo::DeleteHardwareBreakpoint(HardwareSlot slot)
|
||||
bool Thread::DeleteHardwareBreakpoint(HardwareSlot slot)
|
||||
{
|
||||
//zero the address register
|
||||
switch (slot)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace GleeBug
|
||||
{
|
||||
ThreadInfo::ThreadInfo(HANDLE hThread, uint32 dwThreadId, LPVOID lpThreadLocalBase, LPVOID lpStartAddress) :
|
||||
Thread::Thread(HANDLE hThread, uint32 dwThreadId, LPVOID lpThreadLocalBase, LPVOID lpStartAddress) :
|
||||
hThread(hThread),
|
||||
dwThreadId(dwThreadId),
|
||||
lpThreadLocalBase(ptr(lpThreadLocalBase)),
|
||||
|
|
@ -13,7 +13,7 @@ namespace GleeBug
|
|||
{
|
||||
}
|
||||
|
||||
ThreadInfo::ThreadInfo(const ThreadInfo & other) :
|
||||
Thread::Thread(const Thread & other) :
|
||||
hThread(other.hThread),
|
||||
dwThreadId(other.dwThreadId),
|
||||
lpThreadLocalBase(other.lpThreadLocalBase),
|
||||
|
|
@ -26,7 +26,7 @@ namespace GleeBug
|
|||
{
|
||||
}
|
||||
|
||||
ThreadInfo & ThreadInfo::operator=(const ThreadInfo& other)
|
||||
Thread & Thread::operator=(const Thread& other)
|
||||
{
|
||||
hThread = other.hThread;
|
||||
dwThreadId = other.dwThreadId;
|
||||
|
|
@ -40,7 +40,7 @@ namespace GleeBug
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool ThreadInfo::RegReadContext()
|
||||
bool Thread::RegReadContext()
|
||||
{
|
||||
SuspendThread(this->hThread);
|
||||
memset(&this->mOldContext, 0, sizeof(CONTEXT));
|
||||
|
|
@ -55,7 +55,7 @@ namespace GleeBug
|
|||
return bReturn;
|
||||
}
|
||||
|
||||
bool ThreadInfo::RegWriteContext() const
|
||||
bool Thread::RegWriteContext() const
|
||||
{
|
||||
//check if something actually changed
|
||||
if (memcmp(&this->mOldContext, this->registers.GetContext(), sizeof(CONTEXT)) == 0)
|
||||
|
|
@ -67,13 +67,13 @@ namespace GleeBug
|
|||
return bReturn;
|
||||
}
|
||||
|
||||
void ThreadInfo::StepInto()
|
||||
void Thread::StepInto()
|
||||
{
|
||||
registers.TrapFlag.Set();
|
||||
isSingleStepping = true;
|
||||
}
|
||||
|
||||
void ThreadInfo::StepInto(const StepCallback & cbStep)
|
||||
void Thread::StepInto(const StepCallback & cbStep)
|
||||
{
|
||||
StepInto();
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ namespace GleeBug
|
|||
stepCallbacks.push_back(cbStep);
|
||||
}
|
||||
|
||||
void ThreadInfo::StepInternal(const StepCallback & cbStep)
|
||||
void Thread::StepInternal(const StepCallback & cbStep)
|
||||
{
|
||||
registers.TrapFlag.Set();
|
||||
isInternalStepping = true;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace GleeBug
|
|||
/**
|
||||
\brief Thread information structure.
|
||||
*/
|
||||
class ThreadInfo
|
||||
class Thread
|
||||
{
|
||||
public:
|
||||
HANDLE hThread;
|
||||
|
|
@ -31,19 +31,19 @@ namespace GleeBug
|
|||
\param lpThreadLocalBase The thread local base.
|
||||
\param lpStartAddress The start address.
|
||||
*/
|
||||
explicit ThreadInfo(HANDLE hThread, uint32 dwThreadId, LPVOID lpThreadLocalBase, LPVOID lpStartAddress);
|
||||
explicit Thread(HANDLE hThread, uint32 dwThreadId, LPVOID lpThreadLocalBase, LPVOID lpStartAddress);
|
||||
|
||||
/**
|
||||
\brief Copy constructor.
|
||||
*/
|
||||
ThreadInfo(const ThreadInfo & other);
|
||||
Thread(const Thread & other);
|
||||
|
||||
/**
|
||||
\brief Assignment operator.
|
||||
\param other The other object.
|
||||
\return A shallow copy of this object.
|
||||
*/
|
||||
ThreadInfo & operator=(const ThreadInfo & other);
|
||||
Thread & operator=(const Thread & other);
|
||||
|
||||
/**
|
||||
\brief Read the register context from the thread. This fills the RegistersInfo member.
|
||||
|
|
@ -103,7 +103,7 @@ namespace GleeBug
|
|||
/**
|
||||
\brief Sets a hardware breakpoint.
|
||||
\param address The address to set the hardware breakpoint on.
|
||||
\param slot The hardware breakpoint register slot. Use ProcessInfo::GetFreeHardwareBreakpointSlot.
|
||||
\param slot The hardware breakpoint register slot. Use Process::GetFreeHardwareBreakpointSlot.
|
||||
\param type The hardware breakpoint type.
|
||||
\param size The hardware breakpoint size.
|
||||
\return true if the hardware breakpoint was set, false otherwise.
|
||||
|
|
|
|||
|
|
@ -67,44 +67,44 @@ namespace GleeBug
|
|||
/**
|
||||
\brief Process creation debug event callback. Called after the event is internally processed. Provide an implementation to use this callback.
|
||||
\param createProcess Information about the process created.
|
||||
\param process ProcessInfo of the created process.
|
||||
\param process Process of the created process.
|
||||
*/
|
||||
virtual void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const ProcessInfo & process) {};
|
||||
virtual void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const Process & process) {};
|
||||
|
||||
/**
|
||||
\brief Process termination debug event callback. Called before the event is internally processed. Provide an implementation to use this callback.
|
||||
\param exitProcess Information about the process terminated.
|
||||
\param process ProcessInfo of the terminated process.
|
||||
\param process Process of the terminated process.
|
||||
*/
|
||||
virtual void cbExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO & exitProcess, const ProcessInfo & process) {};
|
||||
virtual void cbExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO & exitProcess, const Process & process) {};
|
||||
|
||||
/**
|
||||
\brief Thread creation debug event callback. Called after the event is internally processed. Provide an implementation to use this callback.
|
||||
\param createThread Information about the thread created.
|
||||
\param thread ThreadInfo of the created thread.
|
||||
\param thread Thread of the created thread.
|
||||
*/
|
||||
virtual void cbCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO & createThread, const ThreadInfo & thread) {};
|
||||
virtual void cbCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO & createThread, const Thread & thread) {};
|
||||
|
||||
/**
|
||||
\brief Thread termination debug event callback. Called before the event is internally processed. Provide an implementation to use this callback.
|
||||
\param exitThread Information about the thread terminated.
|
||||
\param thread ThreadInfo of the terminated thread.
|
||||
\param thread Thread of the terminated thread.
|
||||
*/
|
||||
virtual void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO & exitThread, const ThreadInfo & thread) {};
|
||||
virtual void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO & exitThread, const Thread & thread) {};
|
||||
|
||||
/**
|
||||
\brief DLL load debug event callback. Called after event is internally processed. Provide an implementation to use this callback.
|
||||
\param loadDll Information about the DLL loaded.
|
||||
\param dll DllInfo of the loaded DLL.
|
||||
\param dll Dll of the loaded DLL.
|
||||
*/
|
||||
virtual void cbLoadDllEvent(const LOAD_DLL_DEBUG_INFO & loadDll, const DllInfo & dll) {};
|
||||
virtual void cbLoadDllEvent(const LOAD_DLL_DEBUG_INFO & loadDll, const Dll & dll) {};
|
||||
|
||||
/**
|
||||
\brief DLL unload debug event callback. Called before event is internally processed. Provide an implementation to use this callback.
|
||||
\param unloadDll Information about the DLL unloaded.
|
||||
\param dll DllInfo of the unloaded DLL.
|
||||
\param dll Dll of the unloaded DLL.
|
||||
*/
|
||||
virtual void cbUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO & unloadDll, const DllInfo & dll) {};
|
||||
virtual void cbUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO & unloadDll, const Dll & dll) {};
|
||||
|
||||
/**
|
||||
\brief Exception debug event callback. Called before the event is internally processed. Provide an implementation to use this callback.
|
||||
|
|
@ -254,12 +254,12 @@ namespace GleeBug
|
|||
/**
|
||||
\brief The current process (can be null in some cases).
|
||||
*/
|
||||
ProcessInfo* mProcess = nullptr;
|
||||
Process* mProcess = nullptr;
|
||||
|
||||
/**
|
||||
\brief The current thread (can be null in some cases). Should be a copy of mProcess->thread.
|
||||
*/
|
||||
ThreadInfo* mThread = nullptr;
|
||||
Thread* mThread = nullptr;
|
||||
|
||||
/**
|
||||
\brief The current thread registers (can be null in some cases). Should be a copy of mThread->registers.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ protected:
|
|||
mRegisters->Gip());
|
||||
}
|
||||
|
||||
void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const ProcessInfo & process) override
|
||||
void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const Process & process) override
|
||||
{
|
||||
ptr entry = ptr(createProcess.lpStartAddress);
|
||||
printf("Process %d created with entry 0x%p\n",
|
||||
|
|
@ -79,34 +79,34 @@ protected:
|
|||
puts("");
|
||||
}
|
||||
|
||||
void cbExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO & exitProcess, const ProcessInfo & process) override
|
||||
void cbExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO & exitProcess, const Process & process) override
|
||||
{
|
||||
printf("Process %u terminated with exit code 0x%08X\n",
|
||||
mDebugEvent.dwProcessId,
|
||||
exitProcess.dwExitCode);
|
||||
}
|
||||
|
||||
void cbCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO & createThread, const ThreadInfo & thread) override
|
||||
void cbCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO & createThread, const Thread & thread) override
|
||||
{
|
||||
printf("Thread %u created with entry 0x%p\n",
|
||||
mDebugEvent.dwThreadId,
|
||||
createThread.lpStartAddress);
|
||||
}
|
||||
|
||||
void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO & exitThread, const ThreadInfo & thread) override
|
||||
void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO & exitThread, const Thread & thread) override
|
||||
{
|
||||
printf("Thread %u terminated with exit code 0x%08X\n",
|
||||
mDebugEvent.dwThreadId,
|
||||
exitThread.dwExitCode);
|
||||
}
|
||||
|
||||
void cbLoadDllEvent(const LOAD_DLL_DEBUG_INFO & loadDll, const DllInfo & dll) override
|
||||
void cbLoadDllEvent(const LOAD_DLL_DEBUG_INFO & loadDll, const Dll & dll) override
|
||||
{
|
||||
printf("DLL loaded at 0x%p\n",
|
||||
loadDll.lpBaseOfDll);
|
||||
}
|
||||
|
||||
void cbUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO & unloadDll, const DllInfo & dll) override
|
||||
void cbUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO & unloadDll, const Dll & dll) override
|
||||
{
|
||||
printf("DLL 0x%p unloaded\n",
|
||||
unloadDll.lpBaseOfDll);
|
||||
|
|
|
|||
|
|
@ -463,37 +463,37 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const ProcessInfo & process) override
|
||||
void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const Process & process) override
|
||||
{
|
||||
if (mCbCREATEPROCESS)
|
||||
mCbCREATEPROCESS(&createProcess);
|
||||
}
|
||||
|
||||
void cbExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO & exitProcess, const ProcessInfo & process) override
|
||||
void cbExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO & exitProcess, const Process & process) override
|
||||
{
|
||||
if (mCbEXITPROCESS)
|
||||
mCbEXITPROCESS(&exitProcess);
|
||||
}
|
||||
|
||||
void cbCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO & createThread, const ThreadInfo & thread) override
|
||||
void cbCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO & createThread, const Thread & thread) override
|
||||
{
|
||||
if (mCbCREATETHREAD)
|
||||
mCbCREATETHREAD(&createThread);
|
||||
}
|
||||
|
||||
void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO & exitThread, const ThreadInfo & thread) override
|
||||
void cbExitThreadEvent(const EXIT_THREAD_DEBUG_INFO & exitThread, const Thread & thread) override
|
||||
{
|
||||
if (mCbEXITTHREAD)
|
||||
mCbEXITTHREAD(&exitThread);
|
||||
}
|
||||
|
||||
void cbLoadDllEvent(const LOAD_DLL_DEBUG_INFO & loadDll, const DllInfo & dll) override
|
||||
void cbLoadDllEvent(const LOAD_DLL_DEBUG_INFO & loadDll, const Dll & dll) override
|
||||
{
|
||||
if (mCbLOADDLL)
|
||||
mCbLOADDLL(&loadDll);
|
||||
}
|
||||
|
||||
void cbUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO & unloadDll, const DllInfo & dll) override
|
||||
void cbUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO & unloadDll, const Dll & dll) override
|
||||
{
|
||||
if (mCbUNLOADDLL)
|
||||
mCbUNLOADDLL(&unloadDll);
|
||||
|
|
@ -571,13 +571,13 @@ private: //functions
|
|||
}
|
||||
}
|
||||
|
||||
ThreadInfo* threadFromHandle(HANDLE hThread) const
|
||||
Thread* threadFromHandle(HANDLE hThread) const
|
||||
{
|
||||
//TODO: properly implement this
|
||||
return mThread;
|
||||
}
|
||||
|
||||
ProcessInfo* processFromHandle(HANDLE hProcess) const
|
||||
Process* processFromHandle(HANDLE hProcess) const
|
||||
{
|
||||
//TODO: properly implement this
|
||||
return mProcess;
|
||||
|
|
|
|||
Loading…
Reference in New Issue