mirror of
https://github.com/x64dbg/x64dbg.git
synced 2025-02-22 22:11:55 +00:00
BRIDGE: compatibility with MSVC compiler
DBG: compatibility with MSVC compiler DBG: added BeaEngine DBG: added disasm_helper
This commit is contained in:
parent
77ad30f100
commit
df3c3df6bc
@ -370,7 +370,7 @@ BRIDGE_IMPEXP FUNCTYPE DbgGetFunctionTypeAt(duint addr)
|
||||
//NOTE: test code for 'function.exe'
|
||||
if(addr==0x0040132A)
|
||||
return FUNC_BEGIN;
|
||||
else if(addr>0x0040132A and addr<0x004013BA)
|
||||
else if(addr>0x0040132A && addr<0x004013BA)
|
||||
return FUNC_MIDDLE;
|
||||
else if(addr==0x004013BA)
|
||||
return FUNC_END;
|
||||
@ -384,7 +384,7 @@ BRIDGE_IMPEXP LOOPTYPE DbgGetLoopTypeAt(duint addr, int depth)
|
||||
{
|
||||
if(addr==0x00401348)
|
||||
return LOOP_BEGIN;
|
||||
else if(addr>0x00401348 and addr<0x004013B3)
|
||||
else if(addr>0x00401348 && addr<0x004013B3)
|
||||
return LOOP_MIDDLE;
|
||||
else if(addr==0x004013B3)
|
||||
return LOOP_END;
|
||||
@ -393,7 +393,7 @@ BRIDGE_IMPEXP LOOPTYPE DbgGetLoopTypeAt(duint addr, int depth)
|
||||
{
|
||||
if(addr==0x00401351)
|
||||
return LOOP_BEGIN;
|
||||
else if(addr>0x00401351 and addr<0x004013A3)
|
||||
else if(addr>0x00401351 && addr<0x004013A3)
|
||||
return LOOP_MIDDLE;
|
||||
else if(addr==0x004013A3)
|
||||
return LOOP_END;
|
||||
@ -402,7 +402,7 @@ BRIDGE_IMPEXP LOOPTYPE DbgGetLoopTypeAt(duint addr, int depth)
|
||||
{
|
||||
if(addr==0x0040135A)
|
||||
return LOOP_BEGIN;
|
||||
else if(addr>0x0040135A and addr<0x00401393)
|
||||
else if(addr>0x0040135A && addr<0x00401393)
|
||||
return LOOP_MIDDLE;
|
||||
else if(addr==0x00401393)
|
||||
return LOOP_END;
|
||||
|
392
x64_dbg_dbg/BeaEngine/BeaEngine.h
Normal file
392
x64_dbg_dbg/BeaEngine/BeaEngine.h
Normal file
@ -0,0 +1,392 @@
|
||||
#ifndef _BEA_ENGINE_
|
||||
#define _BEA_ENGINE_
|
||||
#if defined(__cplusplus) && defined(__BORLANDC__)
|
||||
namespace BeaEngine
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "macros.h"
|
||||
#include "export.h"
|
||||
#include "basic_types.h"
|
||||
|
||||
#if !defined(BEA_ENGINE_STATIC)
|
||||
#if defined(BUILD_BEA_ENGINE_DLL)
|
||||
#define BEA_API bea__api_export__
|
||||
#else
|
||||
#define BEA_API bea__api_import__
|
||||
#endif
|
||||
#else
|
||||
#define BEA_API
|
||||
#endif
|
||||
|
||||
|
||||
#define INSTRUCT_LENGTH 64
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
UInt8 W_;
|
||||
UInt8 R_;
|
||||
UInt8 X_;
|
||||
UInt8 B_;
|
||||
UInt8 state;
|
||||
} REX_Struct ;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
int Number;
|
||||
int NbUndefined;
|
||||
UInt8 LockPrefix;
|
||||
UInt8 OperandSize;
|
||||
UInt8 AddressSize;
|
||||
UInt8 RepnePrefix;
|
||||
UInt8 RepPrefix;
|
||||
UInt8 FSPrefix;
|
||||
UInt8 SSPrefix;
|
||||
UInt8 GSPrefix;
|
||||
UInt8 ESPrefix;
|
||||
UInt8 CSPrefix;
|
||||
UInt8 DSPrefix;
|
||||
UInt8 BranchTaken;
|
||||
UInt8 BranchNotTaken;
|
||||
REX_Struct REX;
|
||||
char alignment[2];
|
||||
} PREFIXINFO ;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
UInt8 OF_;
|
||||
UInt8 SF_;
|
||||
UInt8 ZF_;
|
||||
UInt8 AF_;
|
||||
UInt8 PF_;
|
||||
UInt8 CF_;
|
||||
UInt8 TF_;
|
||||
UInt8 IF_;
|
||||
UInt8 DF_;
|
||||
UInt8 NT_;
|
||||
UInt8 RF_;
|
||||
UInt8 alignment;
|
||||
} EFLStruct ;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(4)
|
||||
typedef struct
|
||||
{
|
||||
Int32 BaseRegister;
|
||||
Int32 IndexRegister;
|
||||
Int32 Scale;
|
||||
Int64 Displacement;
|
||||
} MEMORYTYPE ;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
Int32 Category; //INSTRUCTION_TYPE
|
||||
Int32 Opcode;
|
||||
char Mnemonic[16];
|
||||
Int32 BranchType; //BRANCH_TYPE
|
||||
EFLStruct Flags;
|
||||
UInt64 AddrValue;
|
||||
Int64 Immediat;
|
||||
UInt32 ImplicitModifiedRegs;
|
||||
} INSTRTYPE;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
char ArgMnemonic[64];
|
||||
Int32 ArgType; //ARGUMENTS_TYPE
|
||||
Int32 ArgSize;
|
||||
Int32 ArgPosition;
|
||||
UInt32 AccessMode;
|
||||
MEMORYTYPE Memory;
|
||||
UInt32 SegmentReg;
|
||||
} ARGTYPE;
|
||||
#pragma pack()
|
||||
|
||||
/* reserved structure used for thread-safety */
|
||||
/* unusable by customer */
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
UIntPtr EIP_;
|
||||
UInt64 EIP_VA;
|
||||
UIntPtr EIP_REAL;
|
||||
Int32 OriginalOperandSize;
|
||||
Int32 OperandSize;
|
||||
Int32 MemDecoration;
|
||||
Int32 AddressSize;
|
||||
Int32 MOD_;
|
||||
Int32 RM_;
|
||||
Int32 INDEX_;
|
||||
Int32 SCALE_;
|
||||
Int32 BASE_;
|
||||
Int32 MMX_;
|
||||
Int32 SSE_;
|
||||
Int32 CR_;
|
||||
Int32 DR_;
|
||||
Int32 SEG_;
|
||||
Int32 REGOPCODE;
|
||||
UInt32 DECALAGE_EIP;
|
||||
Int32 FORMATNUMBER;
|
||||
Int32 SYNTAX_;
|
||||
UInt64 EndOfBlock;
|
||||
Int32 RelativeAddress;
|
||||
UInt32 Architecture;
|
||||
Int32 ImmediatSize;
|
||||
Int32 NB_PREFIX;
|
||||
Int32 PrefRepe;
|
||||
Int32 PrefRepne;
|
||||
UInt32 SEGMENTREGS;
|
||||
UInt32 SEGMENTFS;
|
||||
Int32 third_arg;
|
||||
Int32 TAB_;
|
||||
Int32 ERROR_OPCODE;
|
||||
REX_Struct REX;
|
||||
Int32 OutOfBlock;
|
||||
} InternalDatas;
|
||||
#pragma pack()
|
||||
|
||||
/* ************** main structure ************ */
|
||||
#pragma pack(1)
|
||||
typedef struct _Disasm
|
||||
{
|
||||
UIntPtr EIP;
|
||||
UInt64 VirtualAddr;
|
||||
UInt32 SecurityBlock;
|
||||
char CompleteInstr[INSTRUCT_LENGTH];
|
||||
UInt32 Archi;
|
||||
UInt64 Options;
|
||||
INSTRTYPE Instruction;
|
||||
ARGTYPE Argument1;
|
||||
ARGTYPE Argument2;
|
||||
ARGTYPE Argument3;
|
||||
PREFIXINFO Prefix;
|
||||
InternalDatas Reserved_;
|
||||
} DISASM, *PDISASM, *LPDISASM;
|
||||
#pragma pack()
|
||||
|
||||
#define ESReg 1
|
||||
#define DSReg 2
|
||||
#define FSReg 3
|
||||
#define GSReg 4
|
||||
#define CSReg 5
|
||||
#define SSReg 6
|
||||
|
||||
#define InvalidPrefix 4
|
||||
#define SuperfluousPrefix 2
|
||||
#define NotUsedPrefix 0
|
||||
#define MandatoryPrefix 8
|
||||
#define InUsePrefix 1
|
||||
|
||||
#define LowPosition 0
|
||||
#define HighPosition 1
|
||||
|
||||
enum INSTRUCTION_TYPE
|
||||
{
|
||||
GENERAL_PURPOSE_INSTRUCTION = 0x10000,
|
||||
FPU_INSTRUCTION = 0x20000,
|
||||
MMX_INSTRUCTION = 0x40000,
|
||||
SSE_INSTRUCTION = 0x80000,
|
||||
SSE2_INSTRUCTION = 0x100000,
|
||||
SSE3_INSTRUCTION = 0x200000,
|
||||
SSSE3_INSTRUCTION = 0x400000,
|
||||
SSE41_INSTRUCTION = 0x800000,
|
||||
SSE42_INSTRUCTION = 0x1000000,
|
||||
SYSTEM_INSTRUCTION = 0x2000000,
|
||||
VM_INSTRUCTION = 0x4000000,
|
||||
UNDOCUMENTED_INSTRUCTION = 0x8000000,
|
||||
AMD_INSTRUCTION = 0x10000000,
|
||||
ILLEGAL_INSTRUCTION = 0x20000000,
|
||||
AES_INSTRUCTION = 0x40000000,
|
||||
CLMUL_INSTRUCTION = (int)0x80000000,
|
||||
|
||||
|
||||
DATA_TRANSFER = 0x1,
|
||||
ARITHMETIC_INSTRUCTION,
|
||||
LOGICAL_INSTRUCTION,
|
||||
SHIFT_ROTATE,
|
||||
BIT_UInt8,
|
||||
CONTROL_TRANSFER,
|
||||
STRING_INSTRUCTION,
|
||||
InOutINSTRUCTION,
|
||||
ENTER_LEAVE_INSTRUCTION,
|
||||
FLAG_CONTROL_INSTRUCTION,
|
||||
SEGMENT_REGISTER,
|
||||
MISCELLANEOUS_INSTRUCTION,
|
||||
COMPARISON_INSTRUCTION,
|
||||
LOGARITHMIC_INSTRUCTION,
|
||||
TRIGONOMETRIC_INSTRUCTION,
|
||||
UNSUPPORTED_INSTRUCTION,
|
||||
LOAD_CONSTANTS,
|
||||
FPUCONTROL,
|
||||
STATE_MANAGEMENT,
|
||||
CONVERSION_INSTRUCTION,
|
||||
SHUFFLE_UNPACK,
|
||||
PACKED_SINGLE_PRECISION,
|
||||
SIMD128bits,
|
||||
SIMD64bits,
|
||||
CACHEABILITY_CONTROL,
|
||||
FP_INTEGER_CONVERSION,
|
||||
SPECIALIZED_128bits,
|
||||
SIMD_FP_PACKED,
|
||||
SIMD_FP_HORIZONTAL ,
|
||||
AGENT_SYNCHRONISATION,
|
||||
PACKED_ALIGN_RIGHT ,
|
||||
PACKED_SIGN,
|
||||
PACKED_BLENDING_INSTRUCTION,
|
||||
PACKED_TEST,
|
||||
PACKED_MINMAX,
|
||||
HORIZONTAL_SEARCH,
|
||||
PACKED_EQUALITY,
|
||||
STREAMING_LOAD,
|
||||
INSERTION_EXTRACTION,
|
||||
DOT_PRODUCT,
|
||||
SAD_INSTRUCTION,
|
||||
ACCELERATOR_INSTRUCTION, /* crc32, popcnt (sse4.2) */
|
||||
ROUND_INSTRUCTION
|
||||
};
|
||||
|
||||
enum EFLAGS_STATES
|
||||
{
|
||||
TE_ = 1,
|
||||
MO_ = 2,
|
||||
RE_ = 4,
|
||||
SE_ = 8,
|
||||
UN_ = 0x10,
|
||||
PR_ = 0x20
|
||||
};
|
||||
|
||||
enum BRANCH_TYPE
|
||||
{
|
||||
//JO vs JNO
|
||||
JO = 1,
|
||||
JNO = -1,
|
||||
//JC=JB=JNAE vs JNC=JNB=JAE
|
||||
JC = 2,
|
||||
JB = 2,
|
||||
JNAE = 2,
|
||||
JNC = -2,
|
||||
JNB = -2,
|
||||
JAE = -2,
|
||||
//JE=JZ vs JNE=JNZ
|
||||
JE = 3,
|
||||
JZ = 3,
|
||||
JNE = -3,
|
||||
JNZ = -3,
|
||||
//JA=JNBE vs JNA=JBE
|
||||
JA = 4,
|
||||
JNBE = 4,
|
||||
JNA = -4,
|
||||
JBE = -4,
|
||||
//JS vs JNS
|
||||
JS = 5,
|
||||
JNS = -5,
|
||||
//JP=JPE vs JNP=JPO
|
||||
JP = 6,
|
||||
JPE = 6,
|
||||
JNP = -6,
|
||||
JPO = -6,
|
||||
//JL=JNGE vs JNL=JGE
|
||||
JL = 7,
|
||||
JNGE = 7,
|
||||
JNL = -7,
|
||||
JGE = -7,
|
||||
//JG=JNLE vs JNG=JLE
|
||||
JG = 8,
|
||||
JNLE = 8,
|
||||
JNG = -8,
|
||||
JLE = -8,
|
||||
//others
|
||||
JECXZ = 9,
|
||||
JmpType = 10,
|
||||
CallType = 11,
|
||||
RetType = 12,
|
||||
};
|
||||
|
||||
enum ARGUMENTS_TYPE
|
||||
{
|
||||
NO_ARGUMENT = 0x10000000,
|
||||
REGISTER_TYPE = 0x20000000,
|
||||
MEMORY_TYPE = 0x40000000,
|
||||
CONSTANT_TYPE = (int)0x80000000,
|
||||
|
||||
MMX_REG = 0x10000,
|
||||
GENERAL_REG = 0x20000,
|
||||
FPU_REG = 0x40000,
|
||||
SSE_REG = 0x80000,
|
||||
CR_REG = 0x100000,
|
||||
DR_REG = 0x200000,
|
||||
SPECIAL_REG = 0x400000,
|
||||
MEMORY_MANAGEMENT_REG = 0x800000,
|
||||
SEGMENT_REG = 0x1000000,
|
||||
|
||||
RELATIVE_ = 0x4000000,
|
||||
ABSOLUTE_ = 0x8000000,
|
||||
|
||||
READ = 0x1,
|
||||
WRITE = 0x2,
|
||||
|
||||
REG0 = 0x1,
|
||||
REG1 = 0x2,
|
||||
REG2 = 0x4,
|
||||
REG3 = 0x8,
|
||||
REG4 = 0x10,
|
||||
REG5 = 0x20,
|
||||
REG6 = 0x40,
|
||||
REG7 = 0x80,
|
||||
REG8 = 0x100,
|
||||
REG9 = 0x200,
|
||||
REG10 = 0x400,
|
||||
REG11 = 0x800,
|
||||
REG12 = 0x1000,
|
||||
REG13 = 0x2000,
|
||||
REG14 = 0x4000,
|
||||
REG15 = 0x8000
|
||||
};
|
||||
|
||||
enum SPECIAL_INFO
|
||||
{
|
||||
UNKNOWN_OPCODE = -1,
|
||||
OUT_OF_BLOCK = 0,
|
||||
|
||||
/* === mask = 0xff */
|
||||
NoTabulation = 0x00000000,
|
||||
Tabulation = 0x00000001,
|
||||
|
||||
/* === mask = 0xff00 */
|
||||
MasmSyntax = 0x00000000,
|
||||
GoAsmSyntax = 0x00000100,
|
||||
NasmSyntax = 0x00000200,
|
||||
ATSyntax = 0x00000400,
|
||||
|
||||
/* === mask = 0xff0000 */
|
||||
PrefixedNumeral = 0x00010000,
|
||||
SuffixedNumeral = 0x00020000,
|
||||
NoformatNumeral = 0x00030000,
|
||||
CleanNumeral = 0x00000000,
|
||||
|
||||
/* === mask = 0xff000000 */
|
||||
ShowSegmentRegs = 0x01000000
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
|
||||
BEA_API int __bea_callspec__ Disasm (LPDISASM pDisAsm);
|
||||
BEA_API const__ char* __bea_callspec__ BeaEngineVersion (void);
|
||||
BEA_API const__ char* __bea_callspec__ BeaEngineRevision (void);
|
||||
#if defined(__cplusplus) && defined(__BORLANDC__)
|
||||
};
|
||||
using namespace BeaEngine;
|
||||
#endif
|
||||
#endif
|
BIN
x64_dbg_dbg/BeaEngine/BeaEngine.lib
Normal file
BIN
x64_dbg_dbg/BeaEngine/BeaEngine.lib
Normal file
Binary file not shown.
BIN
x64_dbg_dbg/BeaEngine/BeaEngine_64.lib
Normal file
BIN
x64_dbg_dbg/BeaEngine/BeaEngine_64.lib
Normal file
Binary file not shown.
272
x64_dbg_dbg/BeaEngine/basic_types.h
Normal file
272
x64_dbg_dbg/BeaEngine/basic_types.h
Normal file
@ -0,0 +1,272 @@
|
||||
/**
|
||||
* @file basic_types.h
|
||||
* @author <igor.gutnik@gmail.com>
|
||||
* @date Thu Dec 24 19:31:22 2009
|
||||
*
|
||||
* @brief Definitions of fixed-size integer types for various platforms
|
||||
*
|
||||
* This file is part of BeaEngine.
|
||||
*
|
||||
* BeaEngine is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BeaEngine is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef __BEA_BASIC_TYPES_HPP__
|
||||
#define __BEA_BASIC_TYPES_HPP__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) || defined(__POCC__)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__BORLANDC__)
|
||||
/*
|
||||
* Windows/Visual C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed __int64 Int64;
|
||||
typedef unsigned __int64 UInt64;
|
||||
#if defined(_WIN64)
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
typedef signed __int64 IntPtr;
|
||||
typedef unsigned __int64 UIntPtr;
|
||||
#else
|
||||
typedef signed long IntPtr;
|
||||
typedef size_t UIntPtr;
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__POCC__)
|
||||
/*
|
||||
* PellesC
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed long long Int64;
|
||||
typedef unsigned long long UInt64;
|
||||
#if defined(_WIN64)
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
typedef signed long long IntPtr;
|
||||
typedef unsigned long long UIntPtr;
|
||||
#else
|
||||
typedef signed long IntPtr;
|
||||
typedef size_t UIntPtr;
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__GNUC__) || defined(__LCC__)
|
||||
/*
|
||||
* Unix/GCC
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef intptr_t IntPtr;
|
||||
typedef uintptr_t UIntPtr;
|
||||
#if defined(__LP64__)
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
#define BEA_LONG_IS_64_BIT 1
|
||||
typedef signed long Int64;
|
||||
typedef unsigned long UInt64;
|
||||
#else
|
||||
#if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC)
|
||||
typedef __int64 Int64;
|
||||
typedef unsigned __int64 UInt64;
|
||||
#else
|
||||
typedef signed long long Int64;
|
||||
typedef unsigned long long UInt64;
|
||||
#endif
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__DECCXX)
|
||||
/*
|
||||
* Compaq C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed __int64 Int64;
|
||||
typedef unsigned __int64 UInt64;
|
||||
#if defined(__VMS)
|
||||
#if defined(__32BITS)
|
||||
typedef signed long IntPtr;
|
||||
typedef unsigned long UIntPtr;
|
||||
#else
|
||||
typedef Int64 IntPtr;
|
||||
typedef UInt64 UIntPtr;
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
#endif
|
||||
#else
|
||||
typedef signed long IntPtr;
|
||||
typedef unsigned long UIntPtr;
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
#define BEA_LONG_IS_64_BIT 1
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__HP_aCC)
|
||||
/*
|
||||
* HP Ansi C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed long IntPtr;
|
||||
typedef unsigned long UIntPtr;
|
||||
#if defined(__LP64__)
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
#define BEA_LONG_IS_64_BIT 1
|
||||
typedef signed long Int64;
|
||||
typedef unsigned long UInt64;
|
||||
#else
|
||||
typedef signed long long Int64;
|
||||
typedef unsigned long long UInt64;
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
|
||||
/*
|
||||
* SUN Forte C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed long IntPtr;
|
||||
typedef unsigned long UIntPtr;
|
||||
#if defined(__sparcv9)
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
#define BEA_LONG_IS_64_BIT 1
|
||||
typedef signed long Int64;
|
||||
typedef unsigned long UInt64;
|
||||
#else
|
||||
typedef signed long long Int64;
|
||||
typedef unsigned long long UInt64;
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__IBMCPP__)
|
||||
/*
|
||||
* IBM XL C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed long IntPtr;
|
||||
typedef unsigned long UIntPtr;
|
||||
#if defined(__64BIT__)
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
#define BEA_LONG_IS_64_BIT 1
|
||||
typedef signed long Int64;
|
||||
typedef unsigned long UInt64;
|
||||
#else
|
||||
typedef signed long long Int64;
|
||||
typedef unsigned long long UInt64;
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__BORLANDC__)
|
||||
/*
|
||||
* Borland C/C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef unsigned __int64 Int64;
|
||||
typedef signed __int64 UInt64;
|
||||
typedef signed long IntPtr;
|
||||
typedef unsigned long UIntPtr;
|
||||
#define BEA_HAVE_INT64 1
|
||||
#elif defined(__WATCOMC__)
|
||||
/*
|
||||
* Watcom C/C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef unsigned __int64 Int64;
|
||||
typedef signed __int64 UInt64;
|
||||
#define BEA_HAVE_INT64 1
|
||||
typedef size_t UIntPtr;
|
||||
#elif defined(__sgi)
|
||||
/*
|
||||
* MIPSpro C++
|
||||
*/
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed long IntPtr;
|
||||
typedef unsigned long UIntPtr;
|
||||
#if _MIPS_SZLONG == 64
|
||||
#define BEA_PTR_IS_64_BIT 1
|
||||
#define BEA_LONG_IS_64_BIT 1
|
||||
typedef signed long Int64;
|
||||
typedef unsigned long UInt64;
|
||||
#else
|
||||
typedef signed long long Int64;
|
||||
typedef unsigned long long UInt64;
|
||||
#endif
|
||||
#define BEA_HAVE_INT64 1
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
#define W64LIT(x) x##ui64
|
||||
#else
|
||||
#define W64LIT(x) x##ULL
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef C_STATIC_ASSERT
|
||||
#define C_STATIC_ASSERT(tag_name, x) \
|
||||
typedef int cache_static_assert_ ## tag_name[(x) * 2-1]
|
||||
#endif
|
||||
|
||||
C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1));
|
||||
C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1));
|
||||
|
||||
C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2));
|
||||
C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2));
|
||||
|
||||
C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4));
|
||||
C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4));
|
||||
|
||||
C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8));
|
||||
C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8));
|
||||
|
||||
#endif
|
173
x64_dbg_dbg/BeaEngine/export.h
Normal file
173
x64_dbg_dbg/BeaEngine/export.h
Normal file
@ -0,0 +1,173 @@
|
||||
/**
|
||||
* @file export.h
|
||||
* @author igor.gutnik@gmail.com
|
||||
* @date Mon Sep 22 09:28:54 2008
|
||||
*
|
||||
* @brief This file sets things up for C dynamic library function definitions and
|
||||
* static inlined functions
|
||||
*
|
||||
* This file is part of BeaEngine.
|
||||
*
|
||||
* BeaEngine is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* BeaEngine is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef __BEA_EXPORT_H__
|
||||
#define __BEA_EXPORT_H__
|
||||
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define CPP_VISIBLE_BEGIN extern "C" {
|
||||
#define CPP_VISIBLE_END }
|
||||
#else
|
||||
#define CPP_VISIBLE_BEGIN
|
||||
#define CPP_VISIBLE_END
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable: 4251 )
|
||||
#endif
|
||||
|
||||
/* Some compilers use a special export keyword */
|
||||
#ifndef bea__api_export__
|
||||
# if defined(__BEOS__)
|
||||
# if defined(__GNUC__)
|
||||
# define bea__api_export__ __declspec(dllexport)
|
||||
# else
|
||||
# define bea__api_export__ __declspec(export)
|
||||
# endif
|
||||
# elif defined(_WIN32) || defined(_WIN64)
|
||||
# ifdef __BORLANDC__
|
||||
# define bea__api_export__ __declspec(dllexport)
|
||||
# define bea__api_import__ __declspec(dllimport)
|
||||
# elif defined(__WATCOMC__)
|
||||
# define bea__api_export__ __declspec(dllexport)
|
||||
# define bea__api_import__
|
||||
# else
|
||||
# define bea__api_export__ __declspec(dllexport)
|
||||
# define bea__api_import__ __declspec(dllimport)
|
||||
# endif
|
||||
# elif defined(__OS2__)
|
||||
# ifdef __WATCOMC__
|
||||
# define bea__api_export__ __declspec(dllexport)
|
||||
# define bea__api_import__
|
||||
# else
|
||||
# define bea__api_export__
|
||||
# define bea__api_import__
|
||||
# endif
|
||||
# else
|
||||
# if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define bea__api_export__ __attribubea__ ((visibility("default")))
|
||||
# define bea__api_import__ __attribubea__ ((visibility("default")))
|
||||
# else
|
||||
# define bea__api_export__
|
||||
# define bea__api_import__
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Use C calling convention by default*/
|
||||
|
||||
#ifndef __bea_callspec__
|
||||
#if defined(BEA_USE_STDCALL)
|
||||
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64)
|
||||
#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__)
|
||||
#define __bea_callspec__ __stdcall
|
||||
#else
|
||||
#define __bea_callspec__
|
||||
#endif
|
||||
#else
|
||||
#ifdef __OS2__
|
||||
#define __bea_callspec__ _System
|
||||
#else
|
||||
#define __bea_callspec__
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define __bea_callspec__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
# ifndef EKA2
|
||||
# undef bea__api_export__
|
||||
# undef bea__api_import__
|
||||
# define bea__api_export__
|
||||
# define bea__api_import__
|
||||
# elif !defined(__WINS__)
|
||||
# undef bea__api_export__
|
||||
# undef bea__api_import__
|
||||
# define bea__api_export__ __declspec(dllexport)
|
||||
# define bea__api_import__ __declspec(dllexport)
|
||||
# endif /* !EKA2 */
|
||||
#endif /* __SYMBIAN32__ */
|
||||
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2)
|
||||
#define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1))
|
||||
#define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0))
|
||||
#else
|
||||
#define BEA_EXPECT_CONDITIONAL(c) (c)
|
||||
#define BEA_UNEXPECT_CONDITIONAL(c) (c)
|
||||
#endif
|
||||
|
||||
|
||||
/* Set up compiler-specific options for inlining functions */
|
||||
#ifndef BEA_HAS_INLINE
|
||||
#if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C)
|
||||
#define BEA_HAS_INLINE
|
||||
#else
|
||||
/* Add any special compiler-specific cases here */
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
|
||||
defined(__DMC__) || defined(__SC__) || \
|
||||
defined(__WATCOMC__) || defined(__LCC__) || \
|
||||
defined(__DECC) || defined(__EABI__)
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
#define BEA_HAS_INLINE
|
||||
#else
|
||||
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
|
||||
#ifndef __inline__
|
||||
#define __inline__ inline
|
||||
#endif
|
||||
#define BEA_HAS_INLINE
|
||||
#endif /* Not a funky compiler */
|
||||
#endif /* Visual C++ */
|
||||
#endif /* GNU C */
|
||||
#endif /* CACHE_HAS_INLINE */
|
||||
|
||||
/* If inlining isn't supported, remove "__inline__", turning static
|
||||
inlined functions into static functions (resulting in code bloat
|
||||
in all files which include the offending header files)
|
||||
*/
|
||||
#ifndef BEA_HAS_INLINE
|
||||
#define __inline__
|
||||
#endif
|
||||
|
||||
/* fix a bug with gcc under windows */
|
||||
|
||||
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64)
|
||||
#if defined(__MINGW32__)
|
||||
#define const__
|
||||
#else
|
||||
#define const__ const
|
||||
#endif
|
||||
#else
|
||||
#define const__ const
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
BIN
x64_dbg_dbg/BeaEngine/libBeaEngine.a
Normal file
BIN
x64_dbg_dbg/BeaEngine/libBeaEngine.a
Normal file
Binary file not shown.
BIN
x64_dbg_dbg/BeaEngine/libBeaEngine_64.a
Normal file
BIN
x64_dbg_dbg/BeaEngine/libBeaEngine_64.a
Normal file
Binary file not shown.
41
x64_dbg_dbg/BeaEngine/macros.h
Normal file
41
x64_dbg_dbg/BeaEngine/macros.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef __BEAENGINE_MACROS_H__
|
||||
#define __BEAENGINE_MACROS_H__
|
||||
/*
|
||||
============================================================================
|
||||
Compiler Silencing macros
|
||||
|
||||
Some compilers complain about parameters that are not used. This macro
|
||||
should keep them quiet.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
# if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)))
|
||||
# define BEA_UNUSED_ARG(a) (void) (a)
|
||||
#elif defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (BEA__RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || defined(__BORLANDC__)
|
||||
/*
|
||||
Some compilers complain about "statement with no effect" with (a).
|
||||
This eliminates the warnings, and no code is generated for the null
|
||||
conditional statement. Note, that may only be true if -O is enabled,
|
||||
such as with GreenHills (ghs) 1.8.8.
|
||||
*/
|
||||
|
||||
# define BEA_UNUSED_ARG(a) do {/* null */} while (&a == 0)
|
||||
#elif defined (__DMC__)
|
||||
#if defined(__cplusplus)
|
||||
#define BEA_UNUSED_ID(identifier)
|
||||
template <class T>
|
||||
inline void BEA_UNUSED_ARG(const T& BEA_UNUSED_ID(t)) { }
|
||||
#else
|
||||
#define BEA_UNUSED_ARG(a)
|
||||
#endif
|
||||
#else /* ghs || __GNUC__ || ..... */
|
||||
# define BEA_UNUSED_ARG(a) (a)
|
||||
#endif /* ghs || __GNUC__ || ..... */
|
||||
|
||||
#if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (BEA_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500))
|
||||
# define BEA_NOTREACHED(a)
|
||||
#else /* __sgi || ghs || ..... */
|
||||
# define BEA_NOTREACHED(a) a
|
||||
#endif /* __sgi || ghs || ..... */
|
||||
|
||||
#endif /* __BEAENGINE_MACROS_H__ */
|
@ -143,6 +143,10 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
|
||||
retval=true;
|
||||
//TODO: auto-comments
|
||||
if(!retval)
|
||||
{
|
||||
//TODO: print disasm argument values
|
||||
}
|
||||
if(!retval)
|
||||
{
|
||||
DWORD dwDisplacement;
|
||||
IMAGEHLP_LINE64 line;
|
||||
|
@ -4,17 +4,17 @@ char nasmpath[deflen]="";
|
||||
|
||||
static bool issegment(const char* str)
|
||||
{
|
||||
if(!strncasecmp(str, "gs", 2))
|
||||
if(!_strnicmp(str, "gs", 2))
|
||||
return true;
|
||||
if(!strncasecmp(str, "fs", 2))
|
||||
if(!_strnicmp(str, "fs", 2))
|
||||
return true;
|
||||
if(!strncasecmp(str, "es", 2))
|
||||
if(!_strnicmp(str, "es", 2))
|
||||
return true;
|
||||
if(!strncasecmp(str, "ds", 2))
|
||||
if(!_strnicmp(str, "ds", 2))
|
||||
return true;
|
||||
if(!strncasecmp(str, "cs", 2))
|
||||
if(!_strnicmp(str, "cs", 2))
|
||||
return true;
|
||||
if(!strncasecmp(str, "ss", 2))
|
||||
if(!_strnicmp(str, "ss", 2))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -26,14 +26,14 @@ void intel2nasm(const char* intel, char* nasm)
|
||||
int len=strlen(intel);
|
||||
for(int i=0,j=0; i<len; i++) //fix basic differences and problems
|
||||
{
|
||||
if(!strncasecmp(intel+i, "ptr", 3)) //remove "ptr"
|
||||
if(!_strnicmp(intel+i, "ptr", 3)) //remove "ptr"
|
||||
{
|
||||
i+=2;
|
||||
if(intel[i+1]==' ')
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
else if(!strncasecmp(intel+i, " ", 2)) //remove double spaces
|
||||
else if(!_strnicmp(intel+i, " ", 2)) //remove double spaces
|
||||
continue;
|
||||
else if(intel[i]=='\t') //tab=space
|
||||
{
|
||||
|
@ -1365,14 +1365,11 @@ CMDRESULT cbBenchmark(int argc, char* argv[])
|
||||
if(!valfromstring(arg1, &addr, 0, 0, false, 0))
|
||||
return STATUS_ERROR;
|
||||
uint ticks=GetTickCount();
|
||||
char comment[MAX_COMMENT_SIZE]="";
|
||||
commentset(addr, "benchmark");
|
||||
for(int i=0; i<100000; i++)
|
||||
for(int i=0; i<10000; i++)
|
||||
{
|
||||
commentget(addr, comment);
|
||||
DbgValFromString("eax");
|
||||
}
|
||||
commentdel(addr);
|
||||
dprintf("%ums\n", GetTickCount()-ticks);
|
||||
dprintf("%d:%ums\n", 1000, GetTickCount()-ticks);
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
2
x64_dbg_dbg/disasm_helper.cpp
Normal file
2
x64_dbg_dbg/disasm_helper.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "disasm_helper.h"
|
||||
#include "BeaEngine\BeaEngine.h"
|
6
x64_dbg_dbg/disasm_helper.h
Normal file
6
x64_dbg_dbg/disasm_helper.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _DISASM_HELPER_H
|
||||
#define _DISASM_HELPER_H
|
||||
|
||||
#include "_global.h"
|
||||
|
||||
#endif // _DISASM_HELPER_H
|
@ -1233,6 +1233,7 @@ bool valfromstring(const char* string, uint* value, int* value_size, bool* isvar
|
||||
*isvar=true;
|
||||
return true;
|
||||
}
|
||||
dprintf("invalid value: \"%s\"!\n", string);
|
||||
return false; //nothing was OK
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,10 @@
|
||||
<Add library="shlwapi" />
|
||||
<Add library="psapi" />
|
||||
</Linker>
|
||||
<Unit filename="BeaEngine/BeaEngine.h" />
|
||||
<Unit filename="BeaEngine/basic_types.h" />
|
||||
<Unit filename="BeaEngine/export.h" />
|
||||
<Unit filename="BeaEngine/macros.h" />
|
||||
<Unit filename="TitanEngine/TitanEngine.h" />
|
||||
<Unit filename="_exports.cpp" />
|
||||
<Unit filename="_exports.h" />
|
||||
@ -86,6 +90,8 @@
|
||||
<Unit filename="dbghelp/dbghelp.h" />
|
||||
<Unit filename="debugger.cpp" />
|
||||
<Unit filename="debugger.h" />
|
||||
<Unit filename="disasm_helper.cpp" />
|
||||
<Unit filename="disasm_helper.h" />
|
||||
<Unit filename="instruction.cpp" />
|
||||
<Unit filename="instruction.h" />
|
||||
<Unit filename="main.cpp" />
|
||||
|
@ -18,6 +18,7 @@
|
||||
<ClCompile Include="command.cpp" />
|
||||
<ClCompile Include="console.cpp" />
|
||||
<ClCompile Include="debugger.cpp" />
|
||||
<ClCompile Include="disasm_helper.cpp" />
|
||||
<ClCompile Include="instruction.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="math.cpp" />
|
||||
@ -44,6 +45,7 @@
|
||||
<ClInclude Include="data.h" />
|
||||
<ClInclude Include="dbg.h" />
|
||||
<ClInclude Include="debugger.h" />
|
||||
<ClInclude Include="disasm_helper.h" />
|
||||
<ClInclude Include="instruction.h" />
|
||||
<ClInclude Include="math.h" />
|
||||
<ClInclude Include="memory.h" />
|
||||
|
@ -81,6 +81,9 @@
|
||||
<ClCompile Include="assemble.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="disasm_helper.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="_exports.h">
|
||||
@ -155,5 +158,8 @@
|
||||
<ClInclude Include="assemble.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="disasm_helper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user