mirror of https://github.com/x64dbg/GleeBug
renaming fest started...
This commit is contained in:
parent
1a15ff13ea
commit
3c1f141949
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_BREAKPOINT_H
|
#ifndef DEBUGGER_BREAKPOINT_H
|
||||||
#define _DEBUGGER_BREAKPOINT_H
|
#define DEBUGGER_BREAKPOINT_H
|
||||||
|
|
||||||
#include "Debugger.Global.h"
|
#include "Debugger.Global.h"
|
||||||
|
|
||||||
|
|
@ -12,12 +12,12 @@ namespace GleeBug
|
||||||
Memory
|
Memory
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SoftwareBreakpointType
|
enum class SoftwareType
|
||||||
{
|
{
|
||||||
ShortInt3
|
ShortInt3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class HardwareBreakpointSlot
|
enum class HardwareSlot
|
||||||
{
|
{
|
||||||
Dr0 = 0,
|
Dr0 = 0,
|
||||||
Dr1 = 1,
|
Dr1 = 1,
|
||||||
|
|
@ -25,14 +25,14 @@ namespace GleeBug
|
||||||
Dr3 = 3
|
Dr3 = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class HardwareBreakpointType
|
enum class HardwareType
|
||||||
{
|
{
|
||||||
Access,
|
Access,
|
||||||
Write,
|
Write,
|
||||||
Execute
|
Execute
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class HardwareBreakpointSize
|
enum class HardwareSize
|
||||||
{
|
{
|
||||||
SizeByte = 1,
|
SizeByte = 1,
|
||||||
SizeWord = 2,
|
SizeWord = 2,
|
||||||
|
|
@ -42,7 +42,7 @@ namespace GleeBug
|
||||||
#endif //_WIN64
|
#endif //_WIN64
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class MemoryBreakpointType
|
enum class MemoryType
|
||||||
{
|
{
|
||||||
Acess,
|
Acess,
|
||||||
Write,
|
Write,
|
||||||
|
|
@ -58,20 +58,20 @@ namespace GleeBug
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
SoftwareBreakpointType type;
|
SoftwareType type;
|
||||||
ptr size;
|
ptr size;
|
||||||
uint8 newbytes[2];
|
uint8 newbytes[2];
|
||||||
uint8 oldbytes[2];
|
uint8 oldbytes[2];
|
||||||
} software;
|
} software;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
HardwareBreakpointSlot slot;
|
HardwareSlot slot;
|
||||||
HardwareBreakpointType type;
|
HardwareType type;
|
||||||
HardwareBreakpointSize size;
|
HardwareSize size;
|
||||||
} hardware;
|
} hardware;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
MemoryBreakpointType type;
|
MemoryType type;
|
||||||
ptr size;
|
ptr size;
|
||||||
} memory;
|
} memory;
|
||||||
};
|
};
|
||||||
|
|
@ -90,4 +90,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_BREAKPOINT_H
|
#endif //DEBUGGER_BREAKPOINT_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_DLL_H
|
#ifndef DEBUGGER_DLL_H
|
||||||
#define _DEBUGGER_DLL_H
|
#define DEBUGGER_DLL_H
|
||||||
|
|
||||||
#include "Debugger.Global.h"
|
#include "Debugger.Global.h"
|
||||||
|
|
||||||
|
|
@ -25,4 +25,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_DLL_H
|
#endif //DEBUGGER_DLL_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_GLOBAL_H
|
#ifndef DEBUGGER_GLOBAL_H
|
||||||
#define _DEBUGGER_GLOBAL_H
|
#define DEBUGGER_GLOBAL_H
|
||||||
|
|
||||||
#include "GleeBug.h"
|
#include "GleeBug.h"
|
||||||
|
|
||||||
|
|
@ -38,4 +38,4 @@ namespace GleeBug
|
||||||
typedef std::vector<StepCallback> StepCallbackVector;
|
typedef std::vector<StepCallback> StepCallbackVector;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_GLOBAL_H
|
#endif //DEBUGGER_GLOBAL_H
|
||||||
|
|
@ -86,27 +86,27 @@ namespace GleeBug
|
||||||
{
|
{
|
||||||
//determine the hardware breakpoint triggered
|
//determine the hardware breakpoint triggered
|
||||||
ptr dr6 = _registers->Dr6();
|
ptr dr6 = _registers->Dr6();
|
||||||
HardwareBreakpointSlot breakpointSlot;
|
HardwareSlot breakpointSlot;
|
||||||
ptr breakpointAddress;
|
ptr breakpointAddress;
|
||||||
if (exceptionAddress == _registers->Dr0() || dr6 & 0x1)
|
if (exceptionAddress == _registers->Dr0() || dr6 & 0x1)
|
||||||
{
|
{
|
||||||
breakpointAddress = _registers->Dr0();
|
breakpointAddress = _registers->Dr0();
|
||||||
breakpointSlot = HardwareBreakpointSlot::Dr0;
|
breakpointSlot = HardwareSlot::Dr0;
|
||||||
}
|
}
|
||||||
else if (exceptionAddress == _registers->Dr1() || dr6 & 0x2)
|
else if (exceptionAddress == _registers->Dr1() || dr6 & 0x2)
|
||||||
{
|
{
|
||||||
breakpointAddress = _registers->Dr1();
|
breakpointAddress = _registers->Dr1();
|
||||||
breakpointSlot = HardwareBreakpointSlot::Dr1;
|
breakpointSlot = HardwareSlot::Dr1;
|
||||||
}
|
}
|
||||||
else if (exceptionAddress == _registers->Dr2() || dr6 & 0x4)
|
else if (exceptionAddress == _registers->Dr2() || dr6 & 0x4)
|
||||||
{
|
{
|
||||||
breakpointAddress = _registers->Dr2();
|
breakpointAddress = _registers->Dr2();
|
||||||
breakpointSlot = HardwareBreakpointSlot::Dr2;
|
breakpointSlot = HardwareSlot::Dr2;
|
||||||
}
|
}
|
||||||
else if (exceptionAddress == _registers->Dr3() || dr6 & 0x8)
|
else if (exceptionAddress == _registers->Dr3() || dr6 & 0x8)
|
||||||
{
|
{
|
||||||
breakpointAddress = _registers->Dr3();
|
breakpointAddress = _registers->Dr3();
|
||||||
breakpointSlot = HardwareBreakpointSlot::Dr3;
|
breakpointSlot = HardwareSlot::Dr3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return; //not a hardware breakpoint
|
return; //not a hardware breakpoint
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace GleeBug
|
namespace GleeBug
|
||||||
{
|
{
|
||||||
bool ProcessInfo::SetBreakpoint(ptr address, bool singleshoot, SoftwareBreakpointType type)
|
bool ProcessInfo::SetBreakpoint(ptr address, bool singleshoot, SoftwareType type)
|
||||||
{
|
{
|
||||||
//check the address
|
//check the address
|
||||||
if (!MemIsValidPtr(address) ||
|
if (!MemIsValidPtr(address) ||
|
||||||
|
|
@ -19,7 +19,7 @@ namespace GleeBug
|
||||||
//determine breakpoint byte and size from the type
|
//determine breakpoint byte and size from the type
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SoftwareBreakpointType::ShortInt3:
|
case SoftwareType::ShortInt3:
|
||||||
info.internal.software.newbytes[0] = 0xCC;
|
info.internal.software.newbytes[0] = 0xCC;
|
||||||
info.internal.software.size = 1;
|
info.internal.software.size = 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -43,7 +43,7 @@ namespace GleeBug
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessInfo::SetBreakpoint(ptr address, const BreakpointCallback & cbBreakpoint, bool singleshoot, SoftwareBreakpointType type)
|
bool ProcessInfo::SetBreakpoint(ptr address, const BreakpointCallback & cbBreakpoint, bool singleshoot, SoftwareType type)
|
||||||
{
|
{
|
||||||
//check if a callback on this address was already found
|
//check if a callback on this address was already found
|
||||||
if (breakpointCallbacks.find({ BreakpointType::Software, address }) != breakpointCallbacks.end())
|
if (breakpointCallbacks.find({ BreakpointType::Software, address }) != breakpointCallbacks.end())
|
||||||
|
|
@ -79,21 +79,21 @@ namespace GleeBug
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessInfo::GetFreeHardwareBreakpointSlot(HardwareBreakpointSlot & slot) const
|
bool ProcessInfo::GetFreeHardwareBreakpointSlot(HardwareSlot & slot) const
|
||||||
{
|
{
|
||||||
//find a free hardware breakpoint slot
|
//find a free hardware breakpoint slot
|
||||||
for (int i = 0; i < HWBP_COUNT; i++)
|
for (int i = 0; i < HWBP_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (!hardwareBreakpoints[i].enabled)
|
if (!hardwareBreakpoints[i].enabled)
|
||||||
{
|
{
|
||||||
slot = HardwareBreakpointSlot(i);
|
slot = HardwareSlot(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessInfo::SetHardwareBreakpoint(ptr address, HardwareBreakpointSlot slot, HardwareBreakpointType type, HardwareBreakpointSize size, bool singleshoot)
|
bool ProcessInfo::SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type, HardwareSize size, bool singleshoot)
|
||||||
{
|
{
|
||||||
//check the address
|
//check the address
|
||||||
if (!MemIsValidPtr(address) ||
|
if (!MemIsValidPtr(address) ||
|
||||||
|
|
@ -138,7 +138,7 @@ namespace GleeBug
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessInfo::SetHardwareBreakpoint(ptr address, HardwareBreakpointSlot slot, const BreakpointCallback & cbBreakpoint, HardwareBreakpointType type, HardwareBreakpointSize size, bool singleshoot)
|
bool ProcessInfo::SetHardwareBreakpoint(ptr address, HardwareSlot slot, const BreakpointCallback & cbBreakpoint, HardwareType type, HardwareSize size, bool singleshoot)
|
||||||
{
|
{
|
||||||
//check if a callback on this address was already found
|
//check if a callback on this address was already found
|
||||||
if (breakpointCallbacks.find({ BreakpointType::Hardware, address }) != breakpointCallbacks.end())
|
if (breakpointCallbacks.find({ BreakpointType::Hardware, address }) != breakpointCallbacks.end())
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_PROCESS_H
|
#ifndef DEBUGGER_PROCESS_H
|
||||||
#define _DEBUGGER_PROCESS_H
|
#define DEBUGGER_PROCESS_H
|
||||||
|
|
||||||
#include "Debugger.Global.h"
|
#include "Debugger.Global.h"
|
||||||
#include "Debugger.Thread.h"
|
#include "Debugger.Thread.h"
|
||||||
|
|
@ -90,7 +90,7 @@ namespace GleeBug
|
||||||
\param type (Optional) The software breakpoint type.
|
\param type (Optional) The software breakpoint type.
|
||||||
\return true if the breakpoint was set, false otherwise.
|
\return true if the breakpoint was set, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SetBreakpoint(ptr address, bool singleshoot = false, SoftwareBreakpointType type = SoftwareBreakpointType::ShortInt3);
|
bool SetBreakpoint(ptr address, bool singleshoot = false, SoftwareType type = SoftwareType::ShortInt3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Sets a software breakpoint.
|
\brief Sets a software breakpoint.
|
||||||
|
|
@ -100,7 +100,7 @@ namespace GleeBug
|
||||||
\param type (Optional) The software breakpoint type.
|
\param type (Optional) The software breakpoint type.
|
||||||
\return true if the breakpoint was set, false otherwise.
|
\return true if the breakpoint was set, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SetBreakpoint(ptr address, const BreakpointCallback & cbBreakpoint, bool singleshoot = false, SoftwareBreakpointType type = SoftwareBreakpointType::ShortInt3);
|
bool SetBreakpoint(ptr address, const BreakpointCallback & cbBreakpoint, bool singleshoot = false, SoftwareType type = SoftwareType::ShortInt3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Sets a software breakpoint.
|
\brief Sets a software breakpoint.
|
||||||
|
|
@ -113,7 +113,7 @@ namespace GleeBug
|
||||||
\return true if the breakpoint was set, false otherwise.
|
\return true if the breakpoint was set, false otherwise.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool SetBreakpoint(ptr address, T* debugger, void(T::*callback)(const BreakpointInfo & info), bool singleshoot = false, SoftwareBreakpointType type = SoftwareBreakpointType::ShortInt3)
|
bool SetBreakpoint(ptr address, T* debugger, void(T::*callback)(const BreakpointInfo & info), bool singleshoot = false, SoftwareType type = SoftwareType::ShortInt3)
|
||||||
{
|
{
|
||||||
static_cast<void>(static_cast<Debugger*>(debugger));
|
static_cast<void>(static_cast<Debugger*>(debugger));
|
||||||
return SetBreakpoint(address, std::bind(callback, debugger, std::placeholders::_1), singleshoot, type);
|
return SetBreakpoint(address, std::bind(callback, debugger, std::placeholders::_1), singleshoot, type);
|
||||||
|
|
@ -131,7 +131,7 @@ namespace GleeBug
|
||||||
\param [out] slot First free slot found, has no meaning when the function fails.
|
\param [out] slot First free slot found, has no meaning when the function fails.
|
||||||
\return true if a free slot was found, false otherwise.
|
\return true if a free slot was found, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool GetFreeHardwareBreakpointSlot(HardwareBreakpointSlot & slot) const;
|
bool GetFreeHardwareBreakpointSlot(HardwareSlot & slot) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Sets a hardware breakpoint.
|
\brief Sets a hardware breakpoint.
|
||||||
|
|
@ -142,7 +142,7 @@ namespace GleeBug
|
||||||
\param singleshoot (Optional) True to remove the breakpoint after the first hit.
|
\param singleshoot (Optional) True to remove the breakpoint after the first hit.
|
||||||
\return true if the hardware breakpoint was set, false otherwise.
|
\return true if the hardware breakpoint was set, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SetHardwareBreakpoint(ptr address, HardwareBreakpointSlot slot, HardwareBreakpointType type = HardwareBreakpointType::Execute, HardwareBreakpointSize size = HardwareBreakpointSize::SizeByte, bool singleshoot = false);
|
bool SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type = HardwareType::Execute, HardwareSize size = HardwareSize::SizeByte, bool singleshoot = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Sets a hardware breakpoint.
|
\brief Sets a hardware breakpoint.
|
||||||
|
|
@ -154,7 +154,7 @@ namespace GleeBug
|
||||||
\param singleshoot (Optional) True to remove the breakpoint after the first hit.
|
\param singleshoot (Optional) True to remove the breakpoint after the first hit.
|
||||||
\return true if the hardware breakpoint was set, false otherwise.
|
\return true if the hardware breakpoint was set, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SetHardwareBreakpoint(ptr address, HardwareBreakpointSlot slot, const BreakpointCallback & cbBreakpoint, HardwareBreakpointType type = HardwareBreakpointType::Execute, HardwareBreakpointSize size = HardwareBreakpointSize::SizeByte, bool singleshoot = false);
|
bool SetHardwareBreakpoint(ptr address, HardwareSlot slot, const BreakpointCallback & cbBreakpoint, HardwareType type = HardwareType::Execute, HardwareSize size = HardwareSize::SizeByte, bool singleshoot = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Sets a hardware breakpoint.
|
\brief Sets a hardware breakpoint.
|
||||||
|
|
@ -169,7 +169,7 @@ namespace GleeBug
|
||||||
\return true if the hardware breakpoint was set, false otherwise.
|
\return true if the hardware breakpoint was set, false otherwise.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool SetHardwareBreakpoint(ptr address, HardwareBreakpointSlot slot, T* debugger, void(T::*callback)(const BreakpointInfo & info), HardwareBreakpointType type = HardwareBreakpointType::Execute, HardwareBreakpointSize size = HardwareBreakpointSize::SizeByte, bool singleshoot = false)
|
bool SetHardwareBreakpoint(ptr address, HardwareSlot slot, T* debugger, void(T::*callback)(const BreakpointInfo & info), HardwareType type = HardwareType::Execute, HardwareSize size = HardwareSize::SizeByte, bool singleshoot = false)
|
||||||
{
|
{
|
||||||
static_cast<void>(static_cast<Debugger*>(debugger));
|
static_cast<void>(static_cast<Debugger*>(debugger));
|
||||||
return SetHardwareBreakpoint(address, slot, std::bind(callback, debugger, std::placeholders::_1), type, size, singleshoot);
|
return SetHardwareBreakpoint(address, slot, std::bind(callback, debugger, std::placeholders::_1), type, size, singleshoot);
|
||||||
|
|
@ -191,4 +191,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_PROCESS_H
|
#endif //DEBUGGER_PROCESS_H
|
||||||
|
|
@ -146,18 +146,18 @@ namespace GleeBug
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DR7_SIZE size_dr7(HardwareBreakpointSize size)
|
static inline DR7_SIZE size_dr7(HardwareSize size)
|
||||||
{
|
{
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
case HardwareBreakpointSize::SizeByte:
|
case HardwareSize::SizeByte:
|
||||||
return SIZE_1;
|
return SIZE_1;
|
||||||
case HardwareBreakpointSize::SizeWord:
|
case HardwareSize::SizeWord:
|
||||||
return SIZE_2;
|
return SIZE_2;
|
||||||
case HardwareBreakpointSize::SizeDword:
|
case HardwareSize::SizeDword:
|
||||||
return SIZE_4;
|
return SIZE_4;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
case HardwareBreakpointSize::SizeQword:
|
case HardwareSize::SizeQword:
|
||||||
return SIZE_8;
|
return SIZE_8;
|
||||||
#endif //_WIN64
|
#endif //_WIN64
|
||||||
default:
|
default:
|
||||||
|
|
@ -165,22 +165,22 @@ namespace GleeBug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DR7_TYPE type_dr7(HardwareBreakpointType type)
|
static inline DR7_TYPE type_dr7(HardwareType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case HardwareBreakpointType::Access:
|
case HardwareType::Access:
|
||||||
return TYPE_READWRITE;
|
return TYPE_READWRITE;
|
||||||
case HardwareBreakpointType::Write:
|
case HardwareType::Write:
|
||||||
return TYPE_WRITE;
|
return TYPE_WRITE;
|
||||||
case HardwareBreakpointType::Execute:
|
case HardwareType::Execute:
|
||||||
return TYPE_EXECUTE;
|
return TYPE_EXECUTE;
|
||||||
default:
|
default:
|
||||||
return TYPE_EXECUTE;
|
return TYPE_EXECUTE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThreadInfo::SetHardwareBreakpoint(ptr address, HardwareBreakpointSlot slot, HardwareBreakpointType type, HardwareBreakpointSize size)
|
bool ThreadInfo::SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type, HardwareSize size)
|
||||||
{
|
{
|
||||||
//check if the alignment is correct
|
//check if the alignment is correct
|
||||||
if ((address % int(size) != 0))
|
if ((address % int(size) != 0))
|
||||||
|
|
@ -189,16 +189,16 @@ namespace GleeBug
|
||||||
//set the address register
|
//set the address register
|
||||||
switch (slot)
|
switch (slot)
|
||||||
{
|
{
|
||||||
case HardwareBreakpointSlot::Dr0:
|
case HardwareSlot::Dr0:
|
||||||
registers.Dr0 = address;
|
registers.Dr0 = address;
|
||||||
break;
|
break;
|
||||||
case HardwareBreakpointSlot::Dr1:
|
case HardwareSlot::Dr1:
|
||||||
registers.Dr1 = address;
|
registers.Dr1 = address;
|
||||||
break;
|
break;
|
||||||
case HardwareBreakpointSlot::Dr2:
|
case HardwareSlot::Dr2:
|
||||||
registers.Dr2 = address;
|
registers.Dr2 = address;
|
||||||
break;
|
break;
|
||||||
case HardwareBreakpointSlot::Dr3:
|
case HardwareSlot::Dr3:
|
||||||
registers.Dr3 = address;
|
registers.Dr3 = address;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -216,21 +216,21 @@ namespace GleeBug
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThreadInfo::DeleteHardwareBreakpoint(HardwareBreakpointSlot slot)
|
bool ThreadInfo::DeleteHardwareBreakpoint(HardwareSlot slot)
|
||||||
{
|
{
|
||||||
//zero the address register
|
//zero the address register
|
||||||
switch (slot)
|
switch (slot)
|
||||||
{
|
{
|
||||||
case HardwareBreakpointSlot::Dr0:
|
case HardwareSlot::Dr0:
|
||||||
registers.Dr0 = 0;
|
registers.Dr0 = 0;
|
||||||
break;
|
break;
|
||||||
case HardwareBreakpointSlot::Dr1:
|
case HardwareSlot::Dr1:
|
||||||
registers.Dr1 = 0;
|
registers.Dr1 = 0;
|
||||||
break;
|
break;
|
||||||
case HardwareBreakpointSlot::Dr2:
|
case HardwareSlot::Dr2:
|
||||||
registers.Dr2 = 0;
|
registers.Dr2 = 0;
|
||||||
break;
|
break;
|
||||||
case HardwareBreakpointSlot::Dr3:
|
case HardwareSlot::Dr3:
|
||||||
registers.Dr3 = 0;
|
registers.Dr3 = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_THREAD_REGISTERS_FLAG_H
|
#ifndef DEBUGGER_THREAD_REGISTERS_FLAG_H
|
||||||
#define _DEBUGGER_THREAD_REGISTERS_FLAG_H
|
#define DEBUGGER_THREAD_REGISTERS_FLAG_H
|
||||||
|
|
||||||
#include "Debugger.Thread.Registers.h"
|
#include "Debugger.Thread.Registers.h"
|
||||||
|
|
||||||
|
|
@ -111,4 +111,4 @@ private:
|
||||||
Registers* _registers;
|
Registers* _registers;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_THREAD_REGISTERS_FLAG_H
|
#endif //DEBUGGER_THREAD_REGISTERS_FLAG_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_THREAD_REGISTERS_REGISTER_H
|
#ifndef DEBUGGER_THREAD_REGISTERS_REGISTER_H
|
||||||
#define _DEBUGGER_THREAD_REGISTERS_REGISTER_H
|
#define DEBUGGER_THREAD_REGISTERS_REGISTER_H
|
||||||
|
|
||||||
#include "Debugger.Thread.Registers.h"
|
#include "Debugger.Thread.Registers.h"
|
||||||
|
|
||||||
|
|
@ -288,4 +288,4 @@ private:
|
||||||
Registers* _registers;
|
Registers* _registers;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_THREAD_REGISTERS_REGISTER_H
|
#endif //DEBUGGER_THREAD_REGISTERS_REGISTER_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_THREAD_REGISTERS_H
|
#ifndef DEBUGGER_THREAD_REGISTERS_H
|
||||||
#define _DEBUGGER_THREAD_REGISTERS_H
|
#define DEBUGGER_THREAD_REGISTERS_H
|
||||||
|
|
||||||
#include "Debugger.Global.h"
|
#include "Debugger.Global.h"
|
||||||
|
|
||||||
|
|
@ -160,4 +160,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_THREAD_REGISTERS_H
|
#endif //DEBUGGER_THREAD_REGISTERS_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_THREAD_H
|
#ifndef DEBUGGER_THREAD_H
|
||||||
#define _DEBUGGER_THREAD_H
|
#define DEBUGGER_THREAD_H
|
||||||
|
|
||||||
#include "Debugger.Global.h"
|
#include "Debugger.Global.h"
|
||||||
#include "Debugger.Thread.Registers.h"
|
#include "Debugger.Thread.Registers.h"
|
||||||
|
|
@ -108,18 +108,18 @@ namespace GleeBug
|
||||||
\param size The hardware breakpoint size.
|
\param size The hardware breakpoint size.
|
||||||
\return true if the hardware breakpoint was set, false otherwise.
|
\return true if the hardware breakpoint was set, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SetHardwareBreakpoint(ptr address, HardwareBreakpointSlot slot, HardwareBreakpointType type, HardwareBreakpointSize size);
|
bool SetHardwareBreakpoint(ptr address, HardwareSlot slot, HardwareType type, HardwareSize size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Deletes a hardware breakpoint.
|
\brief Deletes a hardware breakpoint.
|
||||||
\param slot The slot to remove the hardware breakpoint from.
|
\param slot The slot to remove the hardware breakpoint from.
|
||||||
\return true if the hardware breakpoint was deleted, false otherwise.
|
\return true if the hardware breakpoint was deleted, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool DeleteHardwareBreakpoint(HardwareBreakpointSlot slot);
|
bool DeleteHardwareBreakpoint(HardwareSlot slot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CONTEXT _oldContext;
|
CONTEXT _oldContext;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_THREADS_H
|
#endif //DEBUGGER_THREADS_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DEBUGGER_H
|
#ifndef DEBUGGER_H
|
||||||
#define _DEBUGGER_H
|
#define DEBUGGER_H
|
||||||
|
|
||||||
#include "Debugger.Global.h"
|
#include "Debugger.Global.h"
|
||||||
#include "Debugger.Process.h"
|
#include "Debugger.Process.h"
|
||||||
|
|
@ -268,4 +268,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEBUGGER_H
|
#endif //DEBUGGER_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _GLEEBUG_H
|
#ifndef GLEEBUG_H
|
||||||
#define _GLEEBUG_H
|
#define GLEEBUG_H
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -54,4 +54,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //_GLEEBUG_H
|
#endif //GLEEBUG_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _STATIC_BUFFERFILE_H
|
#ifndef STATIC_BUFFERFILE_H
|
||||||
#define _STATIC_BUFFERFILE_H
|
#define STATIC_BUFFERFILE_H
|
||||||
|
|
||||||
#include "Static.File.h"
|
#include "Static.File.h"
|
||||||
|
|
||||||
|
|
@ -64,4 +64,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_STATIC_BUFFERFILE_H
|
#endif //STATIC_BUFFERFILE_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _STATIC_FILE_H
|
#ifndef STATIC_FILE_H
|
||||||
#define _STATIC_FILE_H
|
#define STATIC_FILE_H
|
||||||
|
|
||||||
#include "Static.Global.h"
|
#include "Static.Global.h"
|
||||||
|
|
||||||
|
|
@ -89,4 +89,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_STATIC_FILE_H
|
#endif //STATIC_FILE_H
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _STATIC_GLOBAL_H
|
#ifndef STATIC_GLOBAL_H
|
||||||
#define _STATIC_GLOBAL_H
|
#define STATIC_GLOBAL_H
|
||||||
|
|
||||||
#include "GleeBug.h"
|
#include "GleeBug.h"
|
||||||
|
|
||||||
|
|
@ -11,4 +11,4 @@ namespace GleeBug
|
||||||
const uint32 INVALID_VALUE = GLEEBUG_INVALID_VALUE;
|
const uint32 INVALID_VALUE = GLEEBUG_INVALID_VALUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_STATIC_GLOBAL_H
|
#endif //STATIC_GLOBAL_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _STATIC_PE_H
|
#ifndef STATIC_PE_H
|
||||||
#define _STATIC_PE_H
|
#define STATIC_PE_H
|
||||||
|
|
||||||
#include "Static.File.h"
|
#include "Static.File.h"
|
||||||
#include "Static.Region.h"
|
#include "Static.Region.h"
|
||||||
|
|
@ -68,4 +68,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_STATIC_PE_H
|
#endif //STATIC_PE_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _STATIC_REGION_H
|
#ifndef STATIC_REGION_H
|
||||||
#define _STATIC_REGION_H
|
#define STATIC_REGION_H
|
||||||
|
|
||||||
#include "Static.Global.h"
|
#include "Static.Global.h"
|
||||||
|
|
||||||
|
|
@ -116,4 +116,4 @@ namespace GleeBug
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_STATIC_REGION_H
|
#endif //STATIC_REGION_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _MYDEBUGGER_H
|
#ifndef MYDEBUGGER_H
|
||||||
#define _MYDEBUGGER_H
|
#define MYDEBUGGER_H
|
||||||
|
|
||||||
#include <GleeBug/Debugger.h>
|
#include <GleeBug/Debugger.h>
|
||||||
|
|
||||||
|
|
@ -50,10 +50,10 @@ protected:
|
||||||
printf("Process %d created with entry 0x%p\n",
|
printf("Process %d created with entry 0x%p\n",
|
||||||
_debugEvent.dwProcessId,
|
_debugEvent.dwProcessId,
|
||||||
entry);
|
entry);
|
||||||
/*HardwareBreakpointSlot slot;
|
/*HardwareSlot slot;
|
||||||
if (_process->GetFreeHardwareBreakpointSlot(slot))
|
if (_process->GetFreeHardwareBreakpointSlot(slot))
|
||||||
{
|
{
|
||||||
if (_process->SetHardwareBreakpoint(entry, slot, this, &MyDebugger::cbEntryHardwareBreakpoint, HardwareBreakpointType::Execute, HardwareBreakpointSize::SizeByte))
|
if (_process->SetHardwareBreakpoint(entry, slot, this, &MyDebugger::cbEntryHardwareBreakpoint, HardwareType::Execute, HardwareSize::SizeByte))
|
||||||
printf("Hardware breakpoint set at 0x%p!\n", entry);
|
printf("Hardware breakpoint set at 0x%p!\n", entry);
|
||||||
else
|
else
|
||||||
printf("Failed to set hardware breakpoint at 0x%p\n", entry);
|
printf("Failed to set hardware breakpoint at 0x%p\n", entry);
|
||||||
|
|
@ -164,4 +164,4 @@ protected:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_MYDEBUGGER_H
|
#endif //MYDEBUGGER_H
|
||||||
|
|
@ -417,7 +417,7 @@ public:
|
||||||
if (!_process)
|
if (!_process)
|
||||||
return false;
|
return false;
|
||||||
return _process->SetHardwareBreakpoint(bpxAddress,
|
return _process->SetHardwareBreakpoint(bpxAddress,
|
||||||
(HardwareBreakpointSlot)IndexOfRegister, [bpxCallBack](const BreakpointInfo & info)
|
(HardwareSlot)IndexOfRegister, [bpxCallBack](const BreakpointInfo & info)
|
||||||
{
|
{
|
||||||
(HWBPCALLBACK(bpxCallBack))((const void*)info.address);
|
(HWBPCALLBACK(bpxCallBack))((const void*)info.address);
|
||||||
}, hwtypeFromTitan(bpxType), hwsizeFromTitan(bpxSize));
|
}, hwtypeFromTitan(bpxType), hwsizeFromTitan(bpxSize));
|
||||||
|
|
@ -435,7 +435,7 @@ public:
|
||||||
{
|
{
|
||||||
if (!_process || !RegisterIndex)
|
if (!_process || !RegisterIndex)
|
||||||
return false;
|
return false;
|
||||||
HardwareBreakpointSlot slot;
|
HardwareSlot slot;
|
||||||
bool result = _process->GetFreeHardwareBreakpointSlot(slot);
|
bool result = _process->GetFreeHardwareBreakpointSlot(slot);
|
||||||
if (result)
|
if (result)
|
||||||
*RegisterIndex = (DWORD)slot;
|
*RegisterIndex = (DWORD)slot;
|
||||||
|
|
@ -583,37 +583,37 @@ private: //functions
|
||||||
return _process;
|
return _process;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline HardwareBreakpointType hwtypeFromTitan(DWORD type)
|
static inline HardwareType hwtypeFromTitan(DWORD type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case UE_HARDWARE_EXECUTE:
|
case UE_HARDWARE_EXECUTE:
|
||||||
return HardwareBreakpointType::Execute;
|
return HardwareType::Execute;
|
||||||
case UE_HARDWARE_WRITE:
|
case UE_HARDWARE_WRITE:
|
||||||
return HardwareBreakpointType::Write;
|
return HardwareType::Write;
|
||||||
case UE_HARDWARE_READWRITE:
|
case UE_HARDWARE_READWRITE:
|
||||||
return HardwareBreakpointType::Access;
|
return HardwareType::Access;
|
||||||
default:
|
default:
|
||||||
return HardwareBreakpointType::Access;
|
return HardwareType::Access;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline HardwareBreakpointSize hwsizeFromTitan(DWORD size)
|
static inline HardwareSize hwsizeFromTitan(DWORD size)
|
||||||
{
|
{
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
case UE_HARDWARE_SIZE_1:
|
case UE_HARDWARE_SIZE_1:
|
||||||
return HardwareBreakpointSize::SizeByte;
|
return HardwareSize::SizeByte;
|
||||||
case UE_HARDWARE_SIZE_2:
|
case UE_HARDWARE_SIZE_2:
|
||||||
return HardwareBreakpointSize::SizeWord;
|
return HardwareSize::SizeWord;
|
||||||
case UE_HARDWARE_SIZE_4:
|
case UE_HARDWARE_SIZE_4:
|
||||||
return HardwareBreakpointSize::SizeDword;
|
return HardwareSize::SizeDword;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
case UE_HARDWARE_SIZE_8:
|
case UE_HARDWARE_SIZE_8:
|
||||||
return HardwareBreakpointSize::SizeQword;
|
return HardwareSize::SizeQword;
|
||||||
#endif //_WIN64
|
#endif //_WIN64
|
||||||
default:
|
default:
|
||||||
return HardwareBreakpointSize::SizeByte;
|
return HardwareSize::SizeByte;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,25 +62,25 @@
|
||||||
#define UE_OPTION_REMOVEALLDISABLED 3
|
#define UE_OPTION_REMOVEALLDISABLED 3
|
||||||
#define UE_OPTION_REMOVEALLENABLED 4
|
#define UE_OPTION_REMOVEALLENABLED 4
|
||||||
|
|
||||||
#define UE_STATIC_DECRYPTOR_XOR 1
|
#define UESTATIC_DECRYPTOR_XOR 1
|
||||||
#define UE_STATIC_DECRYPTOR_SUB 2
|
#define UESTATIC_DECRYPTOR_SUB 2
|
||||||
#define UE_STATIC_DECRYPTOR_ADD 3
|
#define UESTATIC_DECRYPTOR_ADD 3
|
||||||
|
|
||||||
#define UE_STATIC_DECRYPTOR_FOREWARD 1
|
#define UESTATIC_DECRYPTOR_FOREWARD 1
|
||||||
#define UE_STATIC_DECRYPTOR_BACKWARD 2
|
#define UESTATIC_DECRYPTOR_BACKWARD 2
|
||||||
|
|
||||||
#define UE_STATIC_KEY_SIZE_1 1
|
#define UESTATIC_KEY_SIZE_1 1
|
||||||
#define UE_STATIC_KEY_SIZE_2 2
|
#define UESTATIC_KEY_SIZE_2 2
|
||||||
#define UE_STATIC_KEY_SIZE_4 4
|
#define UESTATIC_KEY_SIZE_4 4
|
||||||
#define UE_STATIC_KEY_SIZE_8 8
|
#define UESTATIC_KEY_SIZE_8 8
|
||||||
|
|
||||||
#define UE_STATIC_APLIB 1
|
#define UESTATIC_APLIB 1
|
||||||
#define UE_STATIC_APLIB_DEPACK 2
|
#define UESTATIC_APLIB_DEPACK 2
|
||||||
#define UE_STATIC_LZMA 3
|
#define UESTATIC_LZMA 3
|
||||||
|
|
||||||
#define UE_STATIC_HASH_MD5 1
|
#define UESTATIC_HASH_MD5 1
|
||||||
#define UE_STATIC_HASH_SHA1 2
|
#define UESTATIC_HASH_SHA1 2
|
||||||
#define UE_STATIC_HASH_CRC32 3
|
#define UESTATIC_HASH_CRC32 3
|
||||||
|
|
||||||
#define UE_RESOURCE_LANGUAGE_ANY -1
|
#define UE_RESOURCE_LANGUAGE_ANY -1
|
||||||
|
|
||||||
|
|
@ -504,7 +504,7 @@ typedef struct HOOK_ENTRY
|
||||||
#define UE_FIELD_OK 0
|
#define UE_FIELD_OK 0
|
||||||
#define UE_FIELD_BROKEN_NON_FIXABLE 1
|
#define UE_FIELD_BROKEN_NON_FIXABLE 1
|
||||||
#define UE_FIELD_BROKEN_NON_CRITICAL 2
|
#define UE_FIELD_BROKEN_NON_CRITICAL 2
|
||||||
#define UE_FIELD_BROKEN_FIXABLE_FOR_STATIC_USE 3
|
#define UE_FIELD_BROKEN_FIXABLE_FORSTATIC_USE 3
|
||||||
#define UE_FIELD_BROKEN_BUT_CAN_BE_EMULATED 4
|
#define UE_FIELD_BROKEN_BUT_CAN_BE_EMULATED 4
|
||||||
#define UE_FIELD_FIXABLE_NON_CRITICAL 5
|
#define UE_FIELD_FIXABLE_NON_CRITICAL 5
|
||||||
#define UE_FIELD_FIXABLE_CRITICAL 6
|
#define UE_FIELD_FIXABLE_CRITICAL 6
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue