- fixed hardware breakpoints (DR7 has to be set first on x64)

- completely rewrote the hardware breakpoints engine
- optimize for speed
This commit is contained in:
mr.exodia 2013-11-18 20:44:22 +01:00
parent 964e15ae8c
commit 36eb6d9bc1
11 changed files with 380 additions and 592 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -152,9 +152,9 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>false</IntrinsicFunctions> <IntrinsicFunctions>false</IntrinsicFunctions>
<WholeProgramOptimization>false</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UNPACKERENGINE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;UNPACKERENGINE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment> <StructMemberAlignment>1Byte</StructMemberAlignment>
@ -164,6 +164,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CallingConvention>Cdecl</CallingConvention> <CallingConvention>Cdecl</CallingConvention>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>$(ProjectDir)distorm_x86.lib;Imagehlp.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(ProjectDir)distorm_x86.lib;Imagehlp.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -188,6 +189,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>$(ProjectDir)distorm_x64.lib;Imagehlp.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(ProjectDir)distorm_x64.lib;Imagehlp.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>

View File

@ -131,14 +131,48 @@ typedef struct
typedef struct typedef struct
{ {
bool DrxEnabled;
bool DrxExecution;
DWORD DrxBreakPointType;
DWORD DrxBreakPointSize;
ULONG_PTR DrxBreakAddress; ULONG_PTR DrxBreakAddress;
ULONG_PTR DrxCallBack; ULONG_PTR DrxCallBack;
DWORD DrxBreakPointType;
DWORD DrxBreakPointSize;
bool DrxEnabled;
bool DrxExecution;
} HARDWARE_DATA, *PHARDWARE_DATA; } HARDWARE_DATA, *PHARDWARE_DATA;
enum HWBP_MODE
{
MODE_DISABLED=0, //00
MODE_LOCAL=1, //01
MODE_GLOBAL=2 //10
};
enum HWBP_TYPE
{
TYPE_EXECUTE=0, //00
TYPE_WRITE=1, //01
TYPE_READWRITE=3 //11
};
enum HWBP_SIZE
{
SIZE_1=0, //00
SIZE_2=1, //01
SIZE_8=2, //10
SIZE_4=3 //11
};
struct DR7
{
BYTE HWBP_MODE[4];
BYTE HWBP_TYPE[4];
BYTE HWBP_SIZE[4];
};
#define BITSET(a,x) (a|=1<<x)
#define BITCLEAR(a,x) (a&=~(1<<x))
#define BITTOGGLE(a,x) (a^=1<<x)
#define BITGET(a,x) (a&(1<<x))
typedef struct typedef struct
{ {
ULONG_PTR chBreakPoint; ULONG_PTR chBreakPoint;