Merge branch 'performance_improvement'
This commit is contained in:
commit
0338c72229
|
|
@ -4,6 +4,7 @@ del /Q *.sdf
|
|||
del /Q *.layout
|
||||
del /Q /A H *.suo
|
||||
rmdir /S /Q ipch
|
||||
rmdir /S /Q release
|
||||
echo cleaning x64_dbg_bridge...
|
||||
cd x64_dbg_bridge
|
||||
rmdir /S /Q obj
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ window.onafterprint = d_onafterprint;
|
|||
<p><FONT face=Courier>($content$)</FONT></p>
|
||||
<hr>
|
||||
<font face="Courier" color="#808080" size="1"><A
|
||||
href="http://x64dbg.com" target=_blank>x64_dbg</A>, No
|
||||
Copyright</font> </div>
|
||||
href="http://x64dbg.com" target=_blank>x64_dbg</A>, GPLv3</font> </div>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
|||
16
release.bat
16
release.bat
|
|
@ -25,14 +25,16 @@ copy bin\x32\BeaEngine.dll %RELEASEDIR%\bin_base\bin\x32\BeaEngine.dll
|
|||
copy bin\x32\dbghelp.dll %RELEASEDIR%\bin_base\bin\x32\dbghelp.dll
|
||||
copy bin\x32\DeviceNameResolver.dll %RELEASEDIR%\bin_base\bin\x32\DeviceNameResolver.dll
|
||||
copy bin\x32\Scylla.dll %RELEASEDIR%\bin_base\bin\x32\Scylla.dll
|
||||
copy bin\x32\sqlite.dll %RELEASEDIR%\bin_base\bin\x32\sqlite.dll
|
||||
copy bin\x32\jansson.dll %RELEASEDIR%\bin_base\bin\x32\jansson.dll
|
||||
copy bin\x32\lz4.dll %RELEASEDIR%\bin_base\bin\x32\lz4.dll
|
||||
copy bin\x32\TitanEngine.dll %RELEASEDIR%\bin_base\bin\x32\TitanEngine.dll
|
||||
copy bin\x32\XEDParse.dll %RELEASEDIR%\bin_base\bin\x32\XEDParse.dll
|
||||
copy bin\x64\BeaEngine.dll %RELEASEDIR%\bin_base\bin\x64\BeaEngine.dll
|
||||
copy bin\x64\dbghelp.dll %RELEASEDIR%\bin_base\bin\x64\dbghelp.dll
|
||||
copy bin\x64\DeviceNameResolver.dll %RELEASEDIR%\bin_base\bin\x64\DeviceNameResolver.dll
|
||||
copy bin\x64\Scylla.dll %RELEASEDIR%\bin_base\bin\x64\Scylla.dll
|
||||
copy bin\x64\sqlite.dll %RELEASEDIR%\bin_base\bin\x64\sqlite.dll
|
||||
copy bin\x64\jansson.dll %RELEASEDIR%\bin_base\bin\x64\jansson.dll
|
||||
copy bin\x64\lz4.dll %RELEASEDIR%\bin_base\bin\x64\lz4.dll
|
||||
copy bin\x64\TitanEngine.dll %RELEASEDIR%\bin_base\bin\x64\TitanEngine.dll
|
||||
copy bin\x64\XEDParse.dll %RELEASEDIR%\bin_base\bin\x64\XEDParse.dll
|
||||
|
||||
|
|
@ -61,12 +63,22 @@ copy help\x64_dbg.chm %RELEASEDIR%\help
|
|||
echo pluginsdk
|
||||
|
||||
mkdir %RELEASEDIR%\pluginsdk
|
||||
mkdir %RELEASEDIR%\pluginsdk\BeaEngine
|
||||
mkdir %RELEASEDIR%\pluginsdk\dbghelp
|
||||
mkdir %RELEASEDIR%\pluginsdk\DeviceNameResolver
|
||||
mkdir %RELEASEDIR%\pluginsdk\jansson
|
||||
mkdir %RELEASEDIR%\pluginsdk\lz4
|
||||
mkdir %RELEASEDIR%\pluginsdk\TitanEngine
|
||||
mkdir %RELEASEDIR%\pluginsdk\XEDParse
|
||||
|
||||
xcopy x64_dbg_dbg\BeaEngine %RELEASEDIR%\pluginsdk\BeaEngine /S /Y
|
||||
xcopy x64_dbg_dbg\dbghelp %RELEASEDIR%\pluginsdk\dbghelp /S /Y
|
||||
xcopy x64_dbg_dbg\DeviceNameResolver %RELEASEDIR%\pluginsdk\DeviceNameResolver /S /Y
|
||||
xcopy x64_dbg_dbg\jansson %RELEASEDIR%\pluginsdk\jansson /S /Y
|
||||
xcopy x64_dbg_dbg\lz4 %RELEASEDIR%\pluginsdk\lz4 /S /Y
|
||||
xcopy x64_dbg_dbg\TitanEngine %RELEASEDIR%\pluginsdk\TitanEngine /S /Y
|
||||
del %RELEASEDIR%\pluginsdk\TitanEngine\TitanEngine.txt /F /Q
|
||||
xcopy x64_dbg_dbg\XEDParse %RELEASEDIR%\pluginsdk\XEDParse /S /Y
|
||||
copy x64_dbg_dbg\_plugin_types.h %RELEASEDIR%\pluginsdk\_plugin_types.h
|
||||
copy x64_dbg_dbg\_plugins.h %RELEASEDIR%\pluginsdk\_plugins.h
|
||||
copy x64_dbg_bridge\bridgemain.h %RELEASEDIR%\pluginsdk\bridgemain.h
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_workspace_file>
|
||||
<Workspace title="x64_dbg">
|
||||
<Project filename="x64_dbg_bridge/x64_dbg_bridge.cbp" />
|
||||
<Project filename="x64_dbg_dbg/x64_dbg_dbg.cbp" />
|
||||
<Project filename="x64_dbg_exe/x64_dbg_exe.cbp" />
|
||||
</Workspace>
|
||||
</CodeBlocks_workspace_file>
|
||||
|
|
@ -654,6 +654,54 @@ BRIDGE_IMPEXP bool DbgIsBpDisabled(duint addr)
|
|||
return false;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP bool DbgSetAutoCommentAt(duint addr, const char* text)
|
||||
{
|
||||
if(_dbg_sendmessage(DBG_SET_AUTO_COMMENT_AT, (void*)addr, (void*)text))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void DbgClearAutoCommentRange(duint start, duint end)
|
||||
{
|
||||
_dbg_sendmessage(DBG_DELETE_AUTO_COMMENT_RANGE, (void*)start, (void*)end);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP bool DbgSetAutoLabelAt(duint addr, const char* text)
|
||||
{
|
||||
if(_dbg_sendmessage(DBG_SET_AUTO_LABEL_AT, (void*)addr, (void*)text))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void DbgClearAutoLabelRange(duint start, duint end)
|
||||
{
|
||||
_dbg_sendmessage(DBG_DELETE_AUTO_LABEL_RANGE, (void*)start, (void*)end);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP bool DbgSetAutoBookmarkAt(duint addr)
|
||||
{
|
||||
if(_dbg_sendmessage(DBG_SET_AUTO_BOOKMARK_AT, (void*)addr, 0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void DbgClearAutoBookmarkRange(duint start, duint end)
|
||||
{
|
||||
_dbg_sendmessage(DBG_DELETE_AUTO_BOOKMARK_RANGE, (void*)start, (void*)end);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP bool DbgSetAutoFunctionAt(duint start, duint end)
|
||||
{
|
||||
if(_dbg_sendmessage(DBG_SET_AUTO_FUNCTION_AT, (void*)start, (void*)end))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void DbgClearAutoFunctionRange(duint start, duint end)
|
||||
{
|
||||
_dbg_sendmessage(DBG_DELETE_AUTO_FUNCTION_RANGE, (void*)start, (void*)end);
|
||||
}
|
||||
|
||||
//GUI
|
||||
BRIDGE_IMPEXP void GuiDisasmAt(duint addr, duint cip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -145,7 +145,15 @@ enum DBGMSG
|
|||
DBG_LOOP_ADD, // param1=FUNCTION_LOOP_INFO* info, param2=unused
|
||||
DBG_LOOP_DEL, // param1=FUNCTION_LOOP_INFO* info, param2=unused
|
||||
DBG_IS_RUN_LOCKED, // param1=unused, param2=unused
|
||||
DBG_IS_BP_DISABLED // param1=duint addr, param2=unused
|
||||
DBG_IS_BP_DISABLED, // param1=duint addr, param2=unused
|
||||
DBG_SET_AUTO_COMMENT_AT, // param1=duint addr, param2=const char* text
|
||||
DBG_DELETE_AUTO_COMMENT_RANGE, // param1=duint start, param2=duint end
|
||||
DBG_SET_AUTO_LABEL_AT, // param1=duint addr, param2=const char* text
|
||||
DBG_DELETE_AUTO_LABEL_RANGE, // param1=duint start, param2=duint end
|
||||
DBG_SET_AUTO_BOOKMARK_AT, // param1=duint addr, param2=const char* text
|
||||
DBG_DELETE_AUTO_BOOKMARK_RANGE, // param1=duint start, param2=duint end
|
||||
DBG_SET_AUTO_FUNCTION_AT, // param1=duint addr, param2=const char* text
|
||||
DBG_DELETE_AUTO_FUNCTION_RANGE, // param1=duint start, param2=duint end
|
||||
};
|
||||
|
||||
enum SCRIPTLINETYPE
|
||||
|
|
@ -530,6 +538,14 @@ BRIDGE_IMPEXP bool DbgLoopAdd(duint start, duint end);
|
|||
BRIDGE_IMPEXP bool DbgLoopDel(int depth, duint addr);
|
||||
BRIDGE_IMPEXP bool DbgIsRunLocked();
|
||||
BRIDGE_IMPEXP bool DbgIsBpDisabled(duint addr);
|
||||
BRIDGE_IMPEXP bool DbgSetAutoCommentAt(duint addr, const char* text);
|
||||
BRIDGE_IMPEXP void DbgClearAutoCommentRange(duint start, duint end);
|
||||
BRIDGE_IMPEXP bool DbgSetAutoLabelAt(duint addr, const char* text);
|
||||
BRIDGE_IMPEXP void DbgClearAutoLabelRange(duint start, duint end);
|
||||
BRIDGE_IMPEXP bool DbgSetAutoBookmarkAt(duint addr);
|
||||
BRIDGE_IMPEXP void DbgClearAutoBookmarkRange(duint start, duint end);
|
||||
BRIDGE_IMPEXP bool DbgSetAutoFunctionAt(duint start, duint end);
|
||||
BRIDGE_IMPEXP void DbgClearAutoFunctionRange(duint start, duint end);
|
||||
|
||||
//Gui defines
|
||||
#define GUI_PLUGIN_MENU 0
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="x64_dbg_bridge" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="x32">
|
||||
<Option output="../bin/x32/x32_bridge" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x32" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
<Option host_application="../bin/x32/x32_dbg.exe" />
|
||||
<Option run_host_application_in_terminal="0" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="x64">
|
||||
<Option output="../bin/x64/x64_bridge" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x64" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gnu_gcc_compiler_x64" />
|
||||
<Option host_application="../bin/x64/x64_dbg.exe" />
|
||||
<Option run_host_application_in_terminal="0" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions -Wno-format" />
|
||||
<Add option="-DBUILD_BRIDGE" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-static" />
|
||||
</Linker>
|
||||
<Unit filename="_global.cpp" />
|
||||
<Unit filename="_global.h" />
|
||||
<Unit filename="bridgemain.cpp" />
|
||||
<Unit filename="bridgemain.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<DoxyBlocks>
|
||||
<comment_style block="0" line="0" />
|
||||
<doxyfile_project />
|
||||
<doxyfile_build />
|
||||
<doxyfile_warnings />
|
||||
<doxyfile_output />
|
||||
<doxyfile_dot />
|
||||
<general />
|
||||
</DoxyBlocks>
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
|
|
@ -250,6 +250,21 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
|
|||
}
|
||||
}
|
||||
}
|
||||
if(addrinfo->flags&flagbookmark)
|
||||
{
|
||||
addrinfo->isbookmark=bookmarkget(addr);
|
||||
retval=true;
|
||||
}
|
||||
if(addrinfo->flags&flagfunction)
|
||||
{
|
||||
if(functionget(addr, &addrinfo->function.start, &addrinfo->function.end))
|
||||
retval=true;
|
||||
}
|
||||
if(addrinfo->flags&flagloop)
|
||||
{
|
||||
if(loopget(addrinfo->loop.depth, addr, &addrinfo->loop.start, &addrinfo->loop.end))
|
||||
retval=true;
|
||||
}
|
||||
if(addrinfo->flags&flagcomment)
|
||||
{
|
||||
*addrinfo->comment=0;
|
||||
|
|
@ -274,19 +289,23 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
|
|||
}
|
||||
else //no line number
|
||||
{
|
||||
/*
|
||||
DISASM_INSTR instr;
|
||||
std::string temp_string;
|
||||
ADDRINFO newinfo;
|
||||
char ascii[256*2]="";
|
||||
char unicode[256*2]="";
|
||||
|
||||
memset(&instr, 0, sizeof(DISASM_INSTR));
|
||||
disasmget(addr, &instr);
|
||||
int len_left=MAX_COMMENT_SIZE;
|
||||
for(int i=0,j=0; i<instr.argcount; i++)
|
||||
{
|
||||
char temp_string[MAX_COMMENT_SIZE*2]="";
|
||||
ADDRINFO newinfo;
|
||||
memset(&newinfo, 0, sizeof(ADDRINFO));
|
||||
newinfo.flags=flaglabel;
|
||||
char ascii[256]="";
|
||||
char unicode[256]="";
|
||||
|
||||
STRING_TYPE strtype=str_none;
|
||||
|
||||
if(instr.arg[i].constant==instr.arg[i].value) //avoid: call <module.label> ; addr:label
|
||||
{
|
||||
if(instr.type==instr_branch or !disasmgetstringat(instr.arg[i].constant, &strtype, ascii, unicode, len_left) or strtype==str_none)
|
||||
|
|
@ -296,14 +315,16 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
|
|||
case str_none:
|
||||
break;
|
||||
case str_ascii:
|
||||
len_left-=sprintf(temp_string, "%s:\"%s\"", instr.arg[i].mnemonic, ascii);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
temp_string=instr.arg[i].mnemonic;
|
||||
temp_string.append(":\"");
|
||||
temp_string.append(ascii);
|
||||
temp_string.append("\"");
|
||||
break;
|
||||
case str_unicode:
|
||||
len_left-=sprintf(temp_string, "%s:L\"%s\"", instr.arg[i].mnemonic, unicode);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
temp_string=instr.arg[i].mnemonic;
|
||||
temp_string.append(":L\"");
|
||||
temp_string.append(unicode);
|
||||
temp_string.append("\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -313,19 +334,24 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
|
|||
{
|
||||
case str_none:
|
||||
if(*newinfo.label)
|
||||
len_left-=sprintf(temp_string, "[%s]:%s", instr.arg[i].mnemonic, newinfo.label);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
{
|
||||
temp_string="[";
|
||||
temp_string.append(instr.arg[i].mnemonic);
|
||||
temp_string.append("]:");
|
||||
temp_string.append(newinfo.label);
|
||||
}
|
||||
break;
|
||||
case str_ascii:
|
||||
len_left-=sprintf(temp_string, "[%s]:\"%s\"", instr.arg[i].mnemonic, ascii);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
temp_string="[";
|
||||
temp_string.append(instr.arg[i].mnemonic);
|
||||
temp_string.append("]:");
|
||||
temp_string.append(ascii);
|
||||
break;
|
||||
case str_unicode:
|
||||
len_left-=sprintf(temp_string, "[%s]:L\"%s\"", instr.arg[i].mnemonic, unicode);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
temp_string="[";
|
||||
temp_string.append(instr.arg[i].mnemonic);
|
||||
temp_string.append("]:");
|
||||
temp_string.append(unicode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -337,51 +363,45 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoget(duint addr, SEGMENTREG segment, ADDR
|
|||
{
|
||||
case str_none:
|
||||
if(*newinfo.label)
|
||||
len_left-=sprintf(temp_string, "%s:%s", instr.arg[i].mnemonic, newinfo.label);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
{
|
||||
temp_string=instr.arg[i].mnemonic;
|
||||
temp_string.append(":");
|
||||
temp_string.append(newinfo.label);
|
||||
}
|
||||
break;
|
||||
case str_ascii:
|
||||
len_left-=sprintf(temp_string, "%s:\"%s\"", instr.arg[i].mnemonic, ascii);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
temp_string=instr.arg[i].mnemonic;
|
||||
temp_string.append(":\"");
|
||||
temp_string.append(ascii);
|
||||
temp_string.append("\"");
|
||||
break;
|
||||
case str_unicode:
|
||||
len_left-=sprintf(temp_string, "%s:L\"%s\"", instr.arg[i].mnemonic, unicode);
|
||||
if(len_left<0)
|
||||
temp_string[MAX_COMMENT_SIZE]=0;
|
||||
temp_string=instr.arg[i].mnemonic;
|
||||
temp_string.append(":L\"");
|
||||
temp_string.append(unicode);
|
||||
temp_string.append("\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
continue;
|
||||
if(!strstr(addrinfo->comment, temp_string))
|
||||
|
||||
if(!strstr(addrinfo->comment, temp_string.c_str()))
|
||||
{
|
||||
unsigned int maxlen=MAX_COMMENT_SIZE-j-1;
|
||||
if(maxlen<temp_string.length())
|
||||
temp_string.at(maxlen-1)=0;
|
||||
if(j)
|
||||
j+=sprintf(addrinfo->comment+j, ", %s", temp_string);
|
||||
j+=sprintf(addrinfo->comment+j, ", %s", temp_string.c_str());
|
||||
else
|
||||
j+=sprintf(addrinfo->comment+j, "%s", temp_string);
|
||||
j+=sprintf(addrinfo->comment+j, "%s", temp_string.c_str());
|
||||
retval=true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if(addrinfo->flags&flagbookmark)
|
||||
{
|
||||
addrinfo->isbookmark=bookmarkget(addr);
|
||||
retval=true;
|
||||
}
|
||||
if(addrinfo->flags&flagfunction)
|
||||
{
|
||||
if(functionget(addr, &addrinfo->function.start, &addrinfo->function.end))
|
||||
retval=true;
|
||||
}
|
||||
if(addrinfo->flags&flagloop)
|
||||
{
|
||||
if(loopget(addrinfo->loop.depth, addr, &addrinfo->loop.start, &addrinfo->loop.end))
|
||||
retval=true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -390,18 +410,18 @@ extern "C" DLL_EXPORT bool _dbg_addrinfoset(duint addr, ADDRINFO* addrinfo)
|
|||
bool retval=false;
|
||||
if(addrinfo->flags&flaglabel) //set label
|
||||
{
|
||||
if(labelset(addr, addrinfo->label))
|
||||
if(labelset(addr, addrinfo->label, true))
|
||||
retval=true;
|
||||
}
|
||||
if(addrinfo->flags&flagcomment) //set comment
|
||||
{
|
||||
if(commentset(addr, addrinfo->comment))
|
||||
if(commentset(addr, addrinfo->comment, true))
|
||||
retval=true;
|
||||
}
|
||||
if(addrinfo->flags&flagbookmark) //set bookmark
|
||||
{
|
||||
if(addrinfo->isbookmark)
|
||||
retval=bookmarkset(addr);
|
||||
retval=bookmarkset(addr, true);
|
||||
else
|
||||
retval=bookmarkdel(addr);
|
||||
}
|
||||
|
|
@ -538,7 +558,7 @@ extern "C" DLL_EXPORT int _dbg_getbplist(BPXTYPE type, BPMAP* bpmap)
|
|||
{
|
||||
if(!bpmap)
|
||||
return 0;
|
||||
BREAKPOINT* list;
|
||||
std::vector<BREAKPOINT> list;
|
||||
int bpcount=bpgetlist(&list);
|
||||
if(bpcount==0)
|
||||
{
|
||||
|
|
@ -882,7 +902,7 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
|
|||
case DBG_LOOP_OVERLAPS:
|
||||
{
|
||||
FUNCTION_LOOP_INFO* info=(FUNCTION_LOOP_INFO*)param1;
|
||||
return (uint)loopoverlaps(info->depth, info->start, info->end);
|
||||
return (uint)loopoverlaps(info->depth, info->start, info->end, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -914,6 +934,54 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
|
|||
return (uint)false;
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_SET_AUTO_COMMENT_AT:
|
||||
{
|
||||
return (uint)commentset((uint)param1, (const char*)param2, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_DELETE_AUTO_COMMENT_RANGE:
|
||||
{
|
||||
commentdelrange((uint)param1, (uint)param2);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_SET_AUTO_LABEL_AT:
|
||||
{
|
||||
return (uint)labelset((uint)param1, (const char*)param2, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_DELETE_AUTO_LABEL_RANGE:
|
||||
{
|
||||
labeldelrange((uint)param1, (uint)param2);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_SET_AUTO_BOOKMARK_AT:
|
||||
{
|
||||
return (uint)bookmarkset((uint)param1, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_DELETE_AUTO_BOOKMARK_RANGE:
|
||||
{
|
||||
bookmarkdelrange((uint)param1, (uint)param2);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_SET_AUTO_FUNCTION_AT:
|
||||
{
|
||||
return (uint)functionadd((uint)param1, (uint)param2, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_DELETE_AUTO_FUNCTION_RANGE:
|
||||
{
|
||||
functiondelrange((uint)param1, (uint)param2);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <new>
|
||||
|
||||
HINSTANCE hInst;
|
||||
char sqlitedb_basedir[deflen]="";
|
||||
char dbbasepath[deflen]="";
|
||||
char dbpath[3*deflen]="";
|
||||
|
||||
void* emalloc(size_t size)
|
||||
|
|
@ -17,34 +17,47 @@ void efree(void* ptr)
|
|||
}
|
||||
|
||||
static int emalloc_count=0;
|
||||
static char alloctrace[MAX_PATH]="";
|
||||
|
||||
void* emalloc(size_t size, const char* reason)
|
||||
{
|
||||
//unsigned char* a=(unsigned char*)VirtualAlloc(0, size+0x1000, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
|
||||
unsigned char* a=new (std::nothrow)unsigned char[size+0x1000];
|
||||
unsigned char* a=new (std::nothrow)unsigned char[size];
|
||||
if(!a)
|
||||
{
|
||||
MessageBoxA(0, "Could not allocate memory", "Error", MB_ICONERROR);
|
||||
ExitProcess(1);
|
||||
}
|
||||
memset(a, 0, size+0x1000);
|
||||
memset(a, 0, size);
|
||||
emalloc_count++;
|
||||
/*FILE* file=fopen("alloctrace.txt", "a+");
|
||||
/*
|
||||
FILE* file=fopen(alloctrace, "a+");
|
||||
fprintf(file, "DBG%.5d:alloc:"fhex":%s:"fhex"\n", emalloc_count, a, reason, size);
|
||||
fclose(file);*/
|
||||
fclose(file);
|
||||
*/
|
||||
return a;
|
||||
}
|
||||
|
||||
void efree(void* ptr, const char* reason)
|
||||
{
|
||||
emalloc_count--;
|
||||
/*FILE* file=fopen("alloctrace.txt", "a+");
|
||||
/*
|
||||
FILE* file=fopen(alloctrace, "a+");
|
||||
fprintf(file, "DBG%.5d:efree:"fhex":%s\n", emalloc_count, ptr, reason);
|
||||
fclose(file);*/
|
||||
//VirtualFree(ptr, 0, MEM_RELEASE);
|
||||
fclose(file);
|
||||
*/
|
||||
delete[] (unsigned char*)ptr;
|
||||
}
|
||||
|
||||
int memleaks()
|
||||
{
|
||||
return emalloc_count;
|
||||
}
|
||||
|
||||
void setalloctrace(const char* file)
|
||||
{
|
||||
strcpy(alloctrace, file);
|
||||
}
|
||||
|
||||
bool arraycontains(const char* cmd_list, const char* cmd)
|
||||
{
|
||||
//TODO: fix this function a little
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@
|
|||
#include <stdarg.h>
|
||||
#include <psapi.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <tlhelp32.h>
|
||||
#include "..\x64_dbg_bridge\bridgemain.h"
|
||||
#include "sqlite\sqlite3.h"
|
||||
#include "jansson\jansson.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include "dbghelp\dbghelp.h"
|
||||
|
|
@ -37,8 +38,6 @@
|
|||
#define DLL_IMPORT __declspec(dllimport)
|
||||
#endif //DLL_IMPORT
|
||||
|
||||
#include "dbg.h"
|
||||
|
||||
//defines
|
||||
#define deflen 1024
|
||||
|
||||
|
|
@ -92,7 +91,7 @@ enum BITMASK
|
|||
|
||||
//superglobal variables
|
||||
extern HINSTANCE hInst;
|
||||
extern char sqlitedb_basedir[deflen];
|
||||
extern char dbbasepath[deflen];
|
||||
extern char dbpath[3*deflen];
|
||||
|
||||
//functions
|
||||
|
|
@ -100,6 +99,8 @@ void* emalloc(size_t size);
|
|||
void efree(void* ptr);
|
||||
void* emalloc(size_t size, const char* reason);
|
||||
void efree(void* ptr, const char* reason);
|
||||
int memleaks();
|
||||
void setalloctrace(const char* file);
|
||||
bool arraycontains(const char* cmd_list, const char* cmd);
|
||||
bool scmp(const char* a, const char* b);
|
||||
void formathex(char* string);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,49 +3,165 @@
|
|||
|
||||
#include "_global.h"
|
||||
|
||||
//superglobal variables
|
||||
extern sqlite3* userdb;
|
||||
//ranges
|
||||
typedef std::pair<uint, uint> Range;
|
||||
typedef std::pair<uint, Range> ModuleRange; //modhash + RVA range
|
||||
typedef std::pair<int, ModuleRange> DepthModuleRange; //depth + modulerange
|
||||
|
||||
//typedefs
|
||||
typedef void (*EXPORTENUMCALLBACK)(uint base, const char* mod, const char* name, uint addr);
|
||||
struct RangeCompare
|
||||
{
|
||||
bool operator()(const Range& a, const Range& b) const //a before b?
|
||||
{
|
||||
return a.second < b.first;
|
||||
}
|
||||
};
|
||||
|
||||
struct OverlappingRangeCompare
|
||||
{
|
||||
bool operator()(const Range& a, const Range& b) const //a before b?
|
||||
{
|
||||
return a.second < b.first || a.second < b.second;
|
||||
}
|
||||
};
|
||||
|
||||
struct ModuleRangeCompare
|
||||
{
|
||||
bool operator()(const ModuleRange& a, const ModuleRange& b) const
|
||||
{
|
||||
if(a.first < b.first) //module hash is smaller
|
||||
return true;
|
||||
if(a.first != b.first) //module hashes are not equal
|
||||
return false;
|
||||
return a.second.second < b.second.first; //a.second is before b.second
|
||||
}
|
||||
};
|
||||
|
||||
struct DepthModuleRangeCompare
|
||||
{
|
||||
bool operator()(const DepthModuleRange& a, const DepthModuleRange& b) const
|
||||
{
|
||||
if(a.first < b.first) //module depth is smaller
|
||||
return true;
|
||||
if(a.first != b.first) //module depths are not equal
|
||||
return false;
|
||||
if(a.second.first < b.second.first) //module hash is smaller
|
||||
return true;
|
||||
if(a.second.first != b.second.first) //module hashes are not equal
|
||||
return false;
|
||||
return a.second.second.second < b.second.second.first; //a.second.second is before b.second.second
|
||||
}
|
||||
};
|
||||
|
||||
//structures
|
||||
struct MODINFO
|
||||
{
|
||||
uint base;
|
||||
uint size;
|
||||
char name[MAX_MODULE_SIZE];
|
||||
char extension[MAX_MODULE_SIZE];
|
||||
uint base; //module base
|
||||
uint size; //module size
|
||||
uint hash; //full module name hash
|
||||
char name[MAX_MODULE_SIZE]; //module name (without extension)
|
||||
char extension[MAX_MODULE_SIZE]; //file extension
|
||||
};
|
||||
typedef std::map<Range, MODINFO, RangeCompare> ModulesInfo;
|
||||
|
||||
void dbinit();
|
||||
bool dbsave();
|
||||
bool dbload();
|
||||
struct COMMENTSINFO
|
||||
{
|
||||
char mod[MAX_MODULE_SIZE];
|
||||
uint addr;
|
||||
char text[MAX_COMMENT_SIZE];
|
||||
bool manual;
|
||||
};
|
||||
typedef std::map<uint, COMMENTSINFO> CommentsInfo;
|
||||
|
||||
struct LABELSINFO
|
||||
{
|
||||
char mod[MAX_MODULE_SIZE];
|
||||
uint addr;
|
||||
char text[MAX_LABEL_SIZE];
|
||||
bool manual;
|
||||
};
|
||||
typedef std::map<uint, LABELSINFO> LabelsInfo;
|
||||
|
||||
struct BOOKMARKSINFO
|
||||
{
|
||||
char mod[MAX_MODULE_SIZE];
|
||||
uint addr;
|
||||
bool manual;
|
||||
};
|
||||
typedef std::map<uint, BOOKMARKSINFO> BookmarksInfo;
|
||||
|
||||
struct FUNCTIONSINFO
|
||||
{
|
||||
char mod[MAX_MODULE_SIZE];
|
||||
uint start;
|
||||
uint end;
|
||||
bool manual;
|
||||
};
|
||||
typedef std::map<ModuleRange, FUNCTIONSINFO, ModuleRangeCompare> FunctionsInfo;
|
||||
|
||||
struct LOOPSINFO
|
||||
{
|
||||
char mod[MAX_MODULE_SIZE];
|
||||
uint start;
|
||||
uint end;
|
||||
uint parent;
|
||||
int depth;
|
||||
bool manual;
|
||||
};
|
||||
typedef std::map<DepthModuleRange, LOOPSINFO, DepthModuleRangeCompare> LoopsInfo;
|
||||
|
||||
//typedefs
|
||||
typedef void (*EXPORTENUMCALLBACK)(uint base, const char* mod, const char* name, uint addr);
|
||||
|
||||
void dbsave();
|
||||
void dbload();
|
||||
void dbclose();
|
||||
|
||||
bool modload(uint base, uint size, const char* fullpath);
|
||||
bool modunload(uint base);
|
||||
void modclear();
|
||||
bool modnamefromaddr(uint addr, char* modname, bool extension);
|
||||
uint modbasefromaddr(uint addr);
|
||||
uint modhashfromva(uint va);
|
||||
uint modhashfromname(const char* mod);
|
||||
uint modbasefromname(const char* modname);
|
||||
|
||||
bool apienumexports(uint base, EXPORTENUMCALLBACK cbEnum);
|
||||
bool commentset(uint addr, const char* text);
|
||||
|
||||
bool commentset(uint addr, const char* text, bool manual);
|
||||
bool commentget(uint addr, char* text);
|
||||
bool commentdel(uint addr);
|
||||
bool labelset(uint addr, const char* text);
|
||||
void commentdelrange(uint start, uint end);
|
||||
void commentcachesave(JSON root);
|
||||
void commentcacheload(JSON root);
|
||||
|
||||
bool labelset(uint addr, const char* text, bool manual);
|
||||
bool labelfromstring(const char* text, uint* addr);
|
||||
bool labelget(uint addr, char* text);
|
||||
bool labeldel(uint addr);
|
||||
bool bookmarkset(uint addr);
|
||||
void labeldelrange(uint start, uint end);
|
||||
void labelcachesave(JSON root);
|
||||
void labelcacheload(JSON root);
|
||||
|
||||
bool bookmarkset(uint addr, bool manual);
|
||||
bool bookmarkget(uint addr);
|
||||
bool bookmarkdel(uint addr);
|
||||
bool functionget(duint addr, duint* start, duint* end);
|
||||
bool functionoverlaps(uint start, uint end);
|
||||
void bookmarkdelrange(uint start, uint end);
|
||||
void bookmarkcachesave(JSON root);
|
||||
void bookmarkcacheload(JSON root);
|
||||
|
||||
bool functionadd(uint start, uint end, bool manual);
|
||||
bool functionget(uint addr, uint* start, uint* end);
|
||||
bool functionoverlaps(uint start, uint end);
|
||||
bool functiondel(uint addr);
|
||||
bool loopget(int depth, uint addr, uint* start, uint* end);
|
||||
bool loopoverlaps(int depth, uint start, uint end);
|
||||
void functiondelrange(uint start, uint end);
|
||||
void functioncachesave(JSON root);
|
||||
void functioncacheload(JSON root);
|
||||
|
||||
bool loopadd(uint start, uint end, bool manual);
|
||||
bool loopget(int depth, uint addr, uint* start, uint* end);
|
||||
bool loopoverlaps(int depth, uint start, uint end, int* finaldepth);
|
||||
bool loopdel(int depth, uint addr);
|
||||
void loopcachesave(JSON root);
|
||||
void loopcacheload(JSON root);
|
||||
|
||||
#endif // _ADDRINFO_H
|
||||
|
|
|
|||
|
|
@ -13,6 +13,5 @@ bool assembleat(uint addr, const char* instruction)
|
|||
if(XEDParseAssemble(&parse)==XEDPARSE_ERROR)
|
||||
return false;
|
||||
bool ret=memwrite(fdProcessInfo->hProcess, (void*)addr, parse.dest, parse.dest_size, 0);
|
||||
GuiUpdateAllViews();
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,285 +1,144 @@
|
|||
#include "breakpoint.h"
|
||||
#include "debugger.h"
|
||||
#include "addrinfo.h"
|
||||
#include "sqlhelper.h"
|
||||
#include "console.h"
|
||||
#include "memory.h"
|
||||
#include "threading.h"
|
||||
|
||||
static BREAKPOINT bpall[1000]; //TODO: fix this size
|
||||
static int bpcount=0;
|
||||
static BreakpointsInfo breakpoints;
|
||||
|
||||
int bpgetlist(BREAKPOINT** list)
|
||||
int bpgetlist(std::vector<BREAKPOINT>* list)
|
||||
{
|
||||
if(list)
|
||||
*list=bpall;
|
||||
return bpcount;
|
||||
if(!DbgIsDebugging())
|
||||
return false;
|
||||
BREAKPOINT curBp;
|
||||
int count=0;
|
||||
for(BreakpointsInfo::iterator i=breakpoints.begin(); i!=breakpoints.end(); ++i)
|
||||
{
|
||||
curBp=i->second;
|
||||
curBp.addr+=modbasefromname(curBp.mod);
|
||||
curBp.active=memisvalidreadptr(fdProcessInfo->hProcess, curBp.addr);
|
||||
count++;
|
||||
if(list)
|
||||
list->push_back(curBp);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
bool bpnew(uint addr, bool enabled, bool singleshoot, short oldbytes, BP_TYPE type, DWORD titantype, const char* name)
|
||||
{
|
||||
if(bpget(addr, type, name, 0)) //breakpoint found
|
||||
if(!DbgIsDebugging() or !memisvalidreadptr(fdProcessInfo->hProcess, addr) or bpget(addr, type, name, 0))
|
||||
return false;
|
||||
char modname[256]="";
|
||||
char sql[deflen]="";
|
||||
char bpname[MAX_BREAKPOINT_SIZE]="";
|
||||
if(modnamefromaddr(addr, modname, true)) //no module
|
||||
{
|
||||
uint modbase=modbasefromaddr(addr);
|
||||
if(name and *name)
|
||||
{
|
||||
sqlstringescape(name, bpname);
|
||||
sprintf(sql, "INSERT INTO breakpoints (addr,enabled,singleshoot,oldbytes,type,titantype,mod,name) VALUES (%"fext"d,%d,%d,%d,%d,%d,'%s','%s')", addr-modbase, enabled, singleshoot, oldbytes, type, titantype, modname, bpname);
|
||||
}
|
||||
else
|
||||
sprintf(sql, "INSERT INTO breakpoints (addr,enabled,singleshoot,oldbytes,type,titantype,mod) VALUES (%"fext"d,%d,%d,%d,%d,%d,'%s')", addr-modbase, enabled, singleshoot, oldbytes, type, titantype, modname);
|
||||
}
|
||||
BREAKPOINT bp;
|
||||
modnamefromaddr(addr, bp.mod, true);
|
||||
uint modbase=modbasefromaddr(addr);
|
||||
bp.active=true;
|
||||
bp.addr=addr-modbase;
|
||||
bp.enabled=enabled;
|
||||
if(name and *name)
|
||||
strcpy(bp.name, name);
|
||||
else
|
||||
{
|
||||
if(name and *name)
|
||||
{
|
||||
sqlstringescape(name, bpname);
|
||||
sprintf(sql, "INSERT INTO breakpoints (addr,enabled,singleshoot,oldbytes,type,titantype,name) VALUES (%"fext"d,%d,%d,%d,%d,%d,'%s')", addr, enabled, singleshoot, oldbytes, type, titantype, bpname);
|
||||
}
|
||||
else
|
||||
sprintf(sql, "INSERT INTO breakpoints (addr,enabled,singleshoot,oldbytes,type,titantype) VALUES (%"fext"d,%d,%d,%d,%d,%d)", addr, enabled, singleshoot, oldbytes, type, titantype);
|
||||
}
|
||||
if(!sqlexec(userdb, sql))
|
||||
{
|
||||
dprintf("SQL Error: %s\nSQL Query: %s\n", sqllasterror(), sql);
|
||||
return false;
|
||||
}
|
||||
bpenumall(0); //update breakpoint list
|
||||
dbsave();
|
||||
GuiUpdateBreakpointsView();
|
||||
*bp.name='\0';
|
||||
bp.oldbytes=oldbytes;
|
||||
bp.singleshoot=singleshoot;
|
||||
bp.titantype=titantype;
|
||||
bp.type=type;
|
||||
breakpoints.insert(std::make_pair(BreakpointKey(type, modhashfromva(addr)), bp));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bpget(uint addr, BP_TYPE type, const char* name, BREAKPOINT* bp)
|
||||
{
|
||||
char sql[deflen]="";
|
||||
char modname[256]="";
|
||||
char bpname[MAX_BREAKPOINT_SIZE]="";
|
||||
uint modbase=0;
|
||||
if(!modnamefromaddr(addr, modname, true)) //no module
|
||||
{
|
||||
if(bp)
|
||||
*bp->mod=0;
|
||||
if(name and *name)
|
||||
{
|
||||
sqlstringescape(name, bpname);
|
||||
sprintf(sql, "SELECT addr,enabled,singleshoot,oldbytes,type,titantype,mod,name FROM breakpoints WHERE (addr=%"fext"d AND type=%d AND mod IS NULL) OR name='%s'", addr, type, bpname);
|
||||
}
|
||||
else
|
||||
sprintf(sql, "SELECT addr,enabled,singleshoot,oldbytes,type,titantype,mod,name FROM breakpoints WHERE (addr=%"fext"d AND type=%d AND mod IS NULL)", addr, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bp)
|
||||
strcpy(bp->mod, modname);
|
||||
modbase=modbasefromaddr(addr);
|
||||
if(name and *name)
|
||||
{
|
||||
sqlstringescape(name, bpname);
|
||||
sprintf(sql, "SELECT addr,enabled,singleshoot,oldbytes,type,titantype,mod,name FROM breakpoints WHERE (addr=%"fext"d AND type=%d AND mod='%s') OR name='%s'", addr-modbase, type, modname, bpname);
|
||||
}
|
||||
else
|
||||
sprintf(sql, "SELECT addr,enabled,singleshoot,oldbytes,type,titantype,mod,name FROM breakpoints WHERE (addr=%"fext"d AND type=%d AND mod='%s')", addr-modbase, type, modname);
|
||||
}
|
||||
sqlite3_stmt* stmt;
|
||||
lock(WAITID_USERDB);
|
||||
if(sqlite3_prepare_v2(userdb, sql, -1, &stmt, 0)!=SQLITE_OK)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
if(!DbgIsDebugging())
|
||||
return false;
|
||||
}
|
||||
if(sqlite3_step(stmt)!=SQLITE_ROW)
|
||||
BREAKPOINT curBp;
|
||||
if(!name)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
if(!bp) //just check if a breakpoint exists
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
BreakpointsInfo::iterator found=breakpoints.find(BreakpointKey(type, modhashfromva(addr)));
|
||||
if(found==breakpoints.end()) //not found
|
||||
return false;
|
||||
if(!bp)
|
||||
return true;
|
||||
curBp=found->second;
|
||||
curBp.addr+=modbasefromaddr(addr);
|
||||
curBp.active=memisvalidreadptr(fdProcessInfo->hProcess, curBp.addr);
|
||||
*bp=curBp;
|
||||
return true;
|
||||
}
|
||||
memset(bp, 0, sizeof(BREAKPOINT));
|
||||
if(!modbase)
|
||||
for(BreakpointsInfo::iterator i=breakpoints.begin(); i!=breakpoints.end(); ++i)
|
||||
{
|
||||
const char* mod=(const char*)sqlite3_column_text(stmt, 6); //mod
|
||||
if(mod)
|
||||
modbase=modbasefromname(mod);
|
||||
curBp=i->second;
|
||||
if(name and *name)
|
||||
{
|
||||
if(!strcmp(name, curBp.name))
|
||||
{
|
||||
if(bp)
|
||||
{
|
||||
curBp.addr+=modbasefromname(curBp.mod);
|
||||
curBp.active=memisvalidreadptr(fdProcessInfo->hProcess, curBp.addr);
|
||||
*bp=curBp;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef _WIN64
|
||||
bp->addr=sqlite3_column_int64(stmt, 0)+modbase; //addr
|
||||
#else
|
||||
bp->addr=sqlite3_column_int(stmt, 0)+modbase; //addr
|
||||
#endif // _WIN64
|
||||
if(sqlite3_column_int(stmt, 1)) //enabled
|
||||
bp->enabled=true;
|
||||
else
|
||||
bp->enabled=false;
|
||||
if(sqlite3_column_int(stmt, 2)) //singleshoot
|
||||
bp->singleshoot=true;
|
||||
else
|
||||
bp->singleshoot=false;
|
||||
bp->oldbytes=(short)(sqlite3_column_int(stmt, 3)&0xFFFF); //oldbytes
|
||||
bp->type=(BP_TYPE)sqlite3_column_int(stmt, 4); //type
|
||||
bp->titantype=sqlite3_column_int(stmt, 5); //titantype
|
||||
const char* bpname_=(const char*)sqlite3_column_text(stmt, 7); //name
|
||||
if(bpname_)
|
||||
strcpy(bp->name, bpname_);
|
||||
else
|
||||
*bp->name=0;
|
||||
//TODO: fix this
|
||||
if(memisvalidreadptr(fdProcessInfo->hProcess, bp->addr))
|
||||
bp->active=true;
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bpdel(uint addr, BP_TYPE type)
|
||||
{
|
||||
BREAKPOINT found;
|
||||
if(!bpget(addr, type, 0, &found))
|
||||
if(!DbgIsDebugging())
|
||||
return false;
|
||||
char modname[256]="";
|
||||
char sql[deflen]="";
|
||||
if(!modnamefromaddr(addr, modname, true)) //no module
|
||||
sprintf(sql, "DELETE FROM breakpoints WHERE addr=%"fext"d AND mod IS NULL AND type=%d", addr, type);
|
||||
else
|
||||
sprintf(sql, "DELETE FROM breakpoints WHERE addr=%"fext"d AND mod='%s' AND type=%d", addr-modbasefromaddr(addr), modname, type);
|
||||
if(!sqlexec(userdb, sql))
|
||||
{
|
||||
dprintf("SQL Error: %s\nSQL Query: %s\n", sqllasterror(), sql);
|
||||
return false;
|
||||
}
|
||||
bpenumall(0); //update breakpoint list
|
||||
dbsave();
|
||||
GuiUpdateBreakpointsView();
|
||||
return true;
|
||||
return (breakpoints.erase(BreakpointKey(type, modhashfromva(addr)))>0);
|
||||
}
|
||||
|
||||
bool bpenable(uint addr, BP_TYPE type, bool enable)
|
||||
{
|
||||
BREAKPOINT found;
|
||||
if(!bpget(addr, type, 0, &found))
|
||||
if(!DbgIsDebugging())
|
||||
return false;
|
||||
char modname[256]="";
|
||||
char sql[deflen]="";
|
||||
if(!modnamefromaddr(addr, modname, true)) //no module
|
||||
sprintf(sql, "UPDATE breakpoints SET enabled=%d WHERE addr=%"fext"d AND mod IS NULL AND type=%d", enable, addr, type);
|
||||
else
|
||||
sprintf(sql, "UPDATE breakpoints SET enabled=%d WHERE addr=%"fext"d AND mod='%s' AND type=%d", enable, addr-modbasefromaddr(addr), modname, type);
|
||||
if(!sqlexec(userdb, sql))
|
||||
{
|
||||
dprintf("SQL Error: %s\nSQL Query: %s\n", sqllasterror(), sql);
|
||||
BreakpointsInfo::iterator found=breakpoints.find(BreakpointKey(type, modhashfromva(addr)));
|
||||
if(found==breakpoints.end()) //not found
|
||||
return false;
|
||||
}
|
||||
bpenumall(0); //update breakpoint list
|
||||
dbsave();
|
||||
GuiUpdateBreakpointsView();
|
||||
breakpoints[found->first].enabled=enable;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bpsetname(uint addr, BP_TYPE type, const char* name)
|
||||
{
|
||||
if(!name)
|
||||
if(!DbgIsDebugging() or !name or !*name)
|
||||
return false;
|
||||
char modname[256]="";
|
||||
char sql[deflen]="";
|
||||
char bpname[MAX_BREAKPOINT_SIZE]="";
|
||||
sqlstringescape(name, bpname);
|
||||
if(!modnamefromaddr(addr, modname, true)) //no module
|
||||
sprintf(sql, "UPDATE breakpoints SET name='%s' WHERE addr=%"fext"d AND mod IS NULL AND type=%d", bpname, addr, type);
|
||||
else
|
||||
sprintf(sql, "UPDATE breakpoints SET name='%s' WHERE addr=%"fext"d AND mod='%s' AND type=%d", bpname, addr-modbasefromaddr(addr), modname, type);
|
||||
if(!sqlexec(userdb, sql))
|
||||
{
|
||||
dprintf("SQL Error: %s\nSQL Query: %s\n", sqllasterror(), sql);
|
||||
BreakpointsInfo::iterator found=breakpoints.find(BreakpointKey(type, modhashfromva(addr)));
|
||||
if(found==breakpoints.end()) //not found
|
||||
return false;
|
||||
}
|
||||
bpenumall(0); //update breakpoint list
|
||||
dbsave();
|
||||
GuiUpdateBreakpointsView();
|
||||
strcpy(breakpoints[found->first].name, name);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bpenumall(BPENUMCALLBACK cbEnum, const char* module)
|
||||
{
|
||||
if(!DbgIsDebugging())
|
||||
return false;
|
||||
bool retval=true;
|
||||
if(!cbEnum)
|
||||
bpcount=0;
|
||||
char sql[deflen]="";
|
||||
if(!module)
|
||||
sprintf(sql, "SELECT addr,enabled,singleshoot,oldbytes,type,titantype,mod,name FROM breakpoints");
|
||||
else
|
||||
sprintf(sql, "SELECT addr,enabled,singleshoot,oldbytes,type,titantype,mod,name FROM breakpoints WHERE mod='%s'", module);
|
||||
sqlite3_stmt* stmt;
|
||||
lock(WAITID_USERDB);
|
||||
if(sqlite3_prepare_v2(userdb, sql, -1, &stmt, 0)!=SQLITE_OK)
|
||||
BREAKPOINT curBp;
|
||||
for(BreakpointsInfo::iterator i=breakpoints.begin(); i!=breakpoints.end(); ++i)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
if(sqlite3_step(stmt)!=SQLITE_ROW)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
BREAKPOINT curbp;
|
||||
do
|
||||
{
|
||||
#ifdef _WIN64
|
||||
uint rva=sqlite3_column_int64(stmt, 0); //addr
|
||||
#else
|
||||
uint rva=sqlite3_column_int(stmt, 0); //addr
|
||||
#endif // _WIN64
|
||||
if(sqlite3_column_int(stmt, 1)) //enabled
|
||||
curbp.enabled=true;
|
||||
else
|
||||
curbp.enabled=false;
|
||||
if(sqlite3_column_int(stmt, 2)) //singleshoot
|
||||
curbp.singleshoot=true;
|
||||
else
|
||||
curbp.singleshoot=false;
|
||||
curbp.oldbytes=(short)(sqlite3_column_int(stmt, 3)&0xFFFF); //oldbytes
|
||||
curbp.type=(BP_TYPE)sqlite3_column_int(stmt, 4); //type
|
||||
curbp.titantype=sqlite3_column_int(stmt, 5); //titantype
|
||||
const char* modname=(const char*)sqlite3_column_text(stmt, 6); //mod
|
||||
if(modname)
|
||||
strcpy(curbp.mod, modname);
|
||||
else
|
||||
*curbp.mod=0;
|
||||
const char* bpname=(const char*)sqlite3_column_text(stmt, 7); //name
|
||||
if(bpname)
|
||||
strcpy(curbp.name, bpname);
|
||||
else
|
||||
*curbp.name=0;
|
||||
uint modbase=modbasefromname(modname);
|
||||
if(!modbase) //module not loaded
|
||||
*curbp.mod=0;
|
||||
curbp.addr=modbase+rva;
|
||||
if(cbEnum)
|
||||
curBp=i->second;
|
||||
curBp.addr+=modbasefromname(curBp.mod); //RVA to VA
|
||||
curBp.active=memisvalidreadptr(fdProcessInfo->hProcess, curBp.addr); //TODO: wtf am I doing?
|
||||
if(module and *module)
|
||||
{
|
||||
if(!cbEnum(&curbp))
|
||||
if(!strcmp(curBp.mod, module))
|
||||
{
|
||||
if(!cbEnum(&curBp))
|
||||
retval=false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!cbEnum(&curBp))
|
||||
retval=false;
|
||||
}
|
||||
else if(bpcount<1000)
|
||||
{
|
||||
memcpy(&bpall[bpcount], &curbp, sizeof(BREAKPOINT));
|
||||
bpcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
while(sqlite3_step(stmt)==SQLITE_ROW);
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -290,9 +149,13 @@ bool bpenumall(BPENUMCALLBACK cbEnum)
|
|||
|
||||
int bpgetcount(BP_TYPE type)
|
||||
{
|
||||
char sql[deflen]="";
|
||||
sprintf(sql, "SELECT * FROM breakpoints WHERE type=%d", type);
|
||||
return sqlrowcount(userdb, sql);
|
||||
int count=0;
|
||||
for(BreakpointsInfo::iterator i=breakpoints.begin(); i!=breakpoints.end(); ++i)
|
||||
{
|
||||
if(i->first.first==type)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void bptobridge(const BREAKPOINT* bp, BRIDGEBP* bridge)
|
||||
|
|
@ -319,4 +182,58 @@ void bptobridge(const BREAKPOINT* bp, BRIDGEBP* bridge)
|
|||
default:
|
||||
bridge->type=bp_none;
|
||||
}
|
||||
}
|
||||
|
||||
void bpcachesave(JSON root)
|
||||
{
|
||||
const JSON jsonbreakpoints=json_array();
|
||||
for(BreakpointsInfo::iterator i=breakpoints.begin(); i!=breakpoints.end(); ++i)
|
||||
{
|
||||
const BREAKPOINT curBreakpoint=i->second;
|
||||
if(curBreakpoint.singleshoot)
|
||||
continue; //skip
|
||||
JSON curjsonbreakpoint=json_object();
|
||||
json_object_set_new(curjsonbreakpoint, "address", json_hex(curBreakpoint.addr));
|
||||
json_object_set_new(curjsonbreakpoint, "enabled", json_boolean(curBreakpoint.enabled));
|
||||
if(curBreakpoint.type==BPNORMAL)
|
||||
json_object_set_new(curjsonbreakpoint, "oldbytes", json_hex(curBreakpoint.oldbytes));
|
||||
json_object_set_new(curjsonbreakpoint, "type", json_integer(curBreakpoint.type));
|
||||
json_object_set_new(curjsonbreakpoint, "titantype", json_hex(curBreakpoint.titantype));
|
||||
json_object_set_new(curjsonbreakpoint, "name", json_string(curBreakpoint.name));
|
||||
json_object_set_new(curjsonbreakpoint, "module", json_string(curBreakpoint.mod));
|
||||
json_array_append_new(jsonbreakpoints, curjsonbreakpoint);
|
||||
}
|
||||
if(json_array_size(jsonbreakpoints))
|
||||
json_object_set(root, "breakpoints", jsonbreakpoints);
|
||||
json_decref(jsonbreakpoints);
|
||||
}
|
||||
|
||||
void bpcacheload(JSON root)
|
||||
{
|
||||
breakpoints.clear();
|
||||
const JSON jsonbreakpoints=json_object_get(root, "breakpoints");
|
||||
if(jsonbreakpoints)
|
||||
{
|
||||
size_t i;
|
||||
JSON value;
|
||||
json_array_foreach(jsonbreakpoints, i, value)
|
||||
{
|
||||
BREAKPOINT curBreakpoint;
|
||||
memset(&curBreakpoint, 0, sizeof(BREAKPOINT));
|
||||
curBreakpoint.type=(BP_TYPE)json_integer_value(json_object_get(value, "type"));
|
||||
if(curBreakpoint.type==BPNORMAL)
|
||||
curBreakpoint.oldbytes=(short)json_hex_value(json_object_get(value, "oldbytes"));
|
||||
curBreakpoint.addr=(uint)json_hex_value(json_object_get(value, "address"));
|
||||
curBreakpoint.enabled=json_boolean_value(json_object_get(value, "enabled"));
|
||||
curBreakpoint.titantype=(DWORD)json_hex_value(json_object_get(value, "titantype"));
|
||||
const char* name=json_string_value(json_object_get(value, "name"));
|
||||
if(name)
|
||||
strcpy(curBreakpoint.name, name);
|
||||
const char* mod=json_string_value(json_object_get(value, "module"));
|
||||
if(mod && *mod && strlen(mod)<MAX_MODULE_SIZE)
|
||||
strcpy(curBreakpoint.mod, mod);
|
||||
const uint key=modhashfromname(curBreakpoint.mod)+curBreakpoint.addr;
|
||||
breakpoints.insert(std::make_pair(BreakpointKey(curBreakpoint.type, key), curBreakpoint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,9 +28,11 @@ struct BREAKPOINT
|
|||
|
||||
//typedefs
|
||||
typedef bool (*BPENUMCALLBACK)(const BREAKPOINT* bp);
|
||||
typedef std::pair<BP_TYPE, uint> BreakpointKey;
|
||||
typedef std::map<BreakpointKey, BREAKPOINT> BreakpointsInfo;
|
||||
|
||||
//functions
|
||||
int bpgetlist(BREAKPOINT** list);
|
||||
int bpgetlist(std::vector<BREAKPOINT>* list);
|
||||
bool bpnew(uint addr, bool enabled, bool singleshoot, short oldbytes, BP_TYPE type, DWORD titantype, const char* name);
|
||||
bool bpget(uint addr, BP_TYPE type, const char* name, BREAKPOINT* bp);
|
||||
bool bpdel(uint addr, BP_TYPE type);
|
||||
|
|
@ -40,5 +42,7 @@ bool bpenumall(BPENUMCALLBACK cbEnum);
|
|||
bool bpenumall(BPENUMCALLBACK cbEnum, const char* module);
|
||||
int bpgetcount(BP_TYPE type);
|
||||
void bptobridge(const BREAKPOINT* bp, BRIDGEBP* bridge);
|
||||
void bpcachesave(JSON root);
|
||||
void bpcacheload(JSON root);
|
||||
|
||||
#endif // _BREAKPOINT_H
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef __DBG_H__
|
||||
#define __DBG_H__
|
||||
|
||||
#include <windows.h>
|
||||
#include "_global.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void DLL_IMPORT dbg(const char* a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __DBG_H__
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="dbg" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="x64">
|
||||
<Option output="bin/x64/dbg" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)_x64" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x64/" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gnu_gcc_compiler_x64" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-DBUILD_DLL" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="user32" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="x32">
|
||||
<Option output="bin/x32/dbg" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)_x32" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x32/" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-DBUILD_DLL" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="user32" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Unit filename="dbg.cpp" />
|
||||
<Unit filename="dbg.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#include "dbg.h"
|
||||
|
||||
// a sample exported function
|
||||
void DLL_EXPORT dbg(const char* a)
|
||||
{
|
||||
char b[256]="";
|
||||
strcpy(b,a);
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* To use this exported function of dll, include this header
|
||||
* in your project.
|
||||
*/
|
||||
|
||||
#ifdef BUILD_DLL
|
||||
#define DLL_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLL_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void DLL_EXPORT dbg(const char* a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __MAIN_H__
|
||||
|
|
@ -46,7 +46,7 @@ static void cbUserBreakpoint();
|
|||
|
||||
void dbgdisablebpx()
|
||||
{
|
||||
BREAKPOINT* list;
|
||||
std::vector<BREAKPOINT> list;
|
||||
int bpcount=bpgetlist(&list);
|
||||
for(int i=0; i<bpcount; i++)
|
||||
{
|
||||
|
|
@ -57,7 +57,7 @@ void dbgdisablebpx()
|
|||
|
||||
void dbgenablebpx()
|
||||
{
|
||||
BREAKPOINT* list;
|
||||
std::vector<BREAKPOINT> list;
|
||||
int bpcount=bpgetlist(&list);
|
||||
for(int i=0; i<bpcount; i++)
|
||||
{
|
||||
|
|
@ -387,35 +387,36 @@ static BOOL CALLBACK SymRegisterCallbackProc64(HANDLE hProcess, ULONG ActionCode
|
|||
|
||||
static bool cbSetModuleBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
//TODO: more breakpoint types
|
||||
if(!bp->enabled)
|
||||
return true;
|
||||
switch(bp->type)
|
||||
{
|
||||
case BPNORMAL:
|
||||
if(bp->enabled)
|
||||
{
|
||||
if(!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
|
||||
dprintf("could not set breakpoint "fhex"!\n", bp->addr);
|
||||
}
|
||||
break;
|
||||
{
|
||||
if(!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
|
||||
dprintf("could not set breakpoint "fhex"!\n", bp->addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEMORY:
|
||||
if(bp->enabled)
|
||||
{
|
||||
uint size=0;
|
||||
memfindbaseaddr(fdProcessInfo->hProcess, bp->addr, &size);
|
||||
bool restore=false;
|
||||
if(!bp->singleshoot)
|
||||
restore=true;
|
||||
if(!SetMemoryBPXEx(bp->addr, size, bp->titantype, restore, (void*)cbMemoryBreakpoint))
|
||||
dprintf("could not set memory breakpoint "fhex"!\n", bp->addr);
|
||||
}
|
||||
break;
|
||||
{
|
||||
uint size=0;
|
||||
memfindbaseaddr(fdProcessInfo->hProcess, bp->addr, &size);
|
||||
bool restore=false;
|
||||
if(!bp->singleshoot)
|
||||
restore=true;
|
||||
if(!SetMemoryBPXEx(bp->addr, size, bp->titantype, restore, (void*)cbMemoryBreakpoint))
|
||||
dprintf("could not set memory breakpoint "fhex"!\n", bp->addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case BPHARDWARE:
|
||||
if(bp->enabled)
|
||||
{
|
||||
if(!SetHardwareBreakPoint(bp->addr, (bp->titantype>>8)&0xF, (bp->titantype>>4)&0xF, bp->titantype&0xF, (void*)cbHardwareBreakpoint))
|
||||
dprintf("could not set hardware breakpoint "fhex"!\n", bp->addr);
|
||||
}
|
||||
break;
|
||||
{
|
||||
if(!SetHardwareBreakPoint(bp->addr, (bp->titantype>>8)&0xF, (bp->titantype>>4)&0xF, bp->titantype&0xF, (void*)cbHardwareBreakpoint))
|
||||
dprintf("could not set hardware breakpoint "fhex"!\n", bp->addr);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -515,9 +516,9 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
|||
#else
|
||||
strcat(sqlitedb, ".dd32");
|
||||
#endif // _WIN64
|
||||
sprintf(dbpath, "%s\\%s", sqlitedb_basedir, sqlitedb);
|
||||
sprintf(dbpath, "%s\\%s", dbbasepath, sqlitedb);
|
||||
dprintf("Database file: %s\n", dbpath);
|
||||
dbinit();
|
||||
dbload();
|
||||
SymSetOptions(SYMOPT_DEBUG|SYMOPT_LOAD_LINES);
|
||||
GuiSymbolLogClear();
|
||||
SymInitialize(fdProcessInfo->hProcess, 0, false); //initialize symbols
|
||||
|
|
@ -528,10 +529,11 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo)
|
|||
modInfo.SizeOfStruct=sizeof(modInfo);
|
||||
if(SymGetModuleInfo64(fdProcessInfo->hProcess, (DWORD64)base, &modInfo))
|
||||
modload((uint)base, modInfo.ImageSize, modInfo.ImageName);
|
||||
bpenumall(0); //update breakpoint list
|
||||
//bpenumall(0); //update breakpoint list
|
||||
char modname[256]="";
|
||||
if(modnamefromaddr((uint)base, modname, true))
|
||||
bpenumall(cbSetModuleBreakpoints, modname);
|
||||
GuiUpdateBreakpointsView();
|
||||
if(!bFileIsDll and !bIsAttached) //Set entry breakpoint
|
||||
{
|
||||
pDebuggedBase=(uint)CreateProcessInfo->lpBaseOfImage; //debugged base = executable
|
||||
|
|
@ -692,10 +694,11 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
|
|||
modInfo.SizeOfStruct=sizeof(IMAGEHLP_MODULE64);
|
||||
if(SymGetModuleInfo64(fdProcessInfo->hProcess, (DWORD64)base, &modInfo))
|
||||
modload((uint)base, modInfo.ImageSize, modInfo.ImageName);
|
||||
bpenumall(0); //update breakpoint list
|
||||
//bpenumall(0); //update breakpoint list
|
||||
char modname[256]="";
|
||||
if(modnamefromaddr((uint)base, modname, true))
|
||||
bpenumall(cbSetModuleBreakpoints, modname);
|
||||
GuiUpdateBreakpointsView();
|
||||
bool bAlreadySetEntry=false;
|
||||
if(bFileIsDll and !_stricmp(DLLDebugFileName, szFileName) and !bIsAttached) //Set entry breakpoint
|
||||
{
|
||||
|
|
@ -756,6 +759,7 @@ static void cbUnloadDll(UNLOAD_DLL_DEBUG_INFO* UnloadDll)
|
|||
char modname[256]="???";
|
||||
if(modnamefromaddr((uint)base, modname, true))
|
||||
bpenumall(cbRemoveModuleBreakpoints, modname);
|
||||
GuiUpdateBreakpointsView();
|
||||
SymUnloadModule64(fdProcessInfo->hProcess, (DWORD64)base);
|
||||
dprintf("DLL Unloaded: "fhex" %s\n", base, modname);
|
||||
|
||||
|
|
@ -773,6 +777,8 @@ static void cbUnloadDll(UNLOAD_DLL_DEBUG_INFO* UnloadDll)
|
|||
plugincbcall(CB_PAUSEDEBUG, &pauseInfo);
|
||||
wait(WAITID_RUN);
|
||||
}
|
||||
|
||||
modunload((uint)base);
|
||||
}
|
||||
|
||||
static void cbOutputDebugString(OUTPUT_DEBUG_STRING_INFO* DebugString)
|
||||
|
|
@ -1192,16 +1198,16 @@ CMDRESULT cbDebugSetBPX(int argc, char* argv[]) //bp addr [,name [,type]]
|
|||
dprintf("error setting breakpoint at "fhex"!\n (memread)", addr);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
else if(!SetBPX(addr, type, (void*)cbUserBreakpoint))
|
||||
{
|
||||
dprintf("error setting breakpoint at "fhex"! (SetBPX)\n", addr);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
else if(!bpnew(addr, true, singleshoot, oldbytes, BPNORMAL, type, bpname))
|
||||
{
|
||||
dprintf("error setting breakpoint at "fhex"!\n (bpnew)", addr);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
else if(!SetBPX(addr, type, (void*)cbUserBreakpoint))
|
||||
{
|
||||
dprintf("error setting breakpoint at "fhex"! (SetBPX)\n", addr);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
dprintf("breakpoint at "fhex" set!\n", addr);
|
||||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
|
|
@ -1259,7 +1265,7 @@ CMDRESULT cbDebugDeleteBPX(int argc, char* argv[])
|
|||
|
||||
static bool cbEnableAllBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint) or !bpenable(bp->addr, BPNORMAL, true))
|
||||
if(!bpenable(bp->addr, BPNORMAL, true) or !SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
|
||||
{
|
||||
dprintf("could not enable "fhex"\n", bp->addr);
|
||||
return false;
|
||||
|
|
@ -1286,7 +1292,7 @@ CMDRESULT cbDebugEnableBPX(int argc, char* argv[])
|
|||
BREAKPOINT found;
|
||||
if(bpget(0, BPNORMAL, arg1, &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!SetBPX(found.addr, found.titantype, (void*)cbUserBreakpoint) or !bpenable(found.addr, BPNORMAL, true))
|
||||
if(!bpenable(found.addr, BPNORMAL, true) or !SetBPX(found.addr, found.titantype, (void*)cbUserBreakpoint))
|
||||
{
|
||||
dprintf("could not enable "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1306,7 +1312,7 @@ CMDRESULT cbDebugEnableBPX(int argc, char* argv[])
|
|||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
if(!SetBPX(found.addr, found.titantype, (void*)cbUserBreakpoint) or !bpenable(found.addr, BPNORMAL, true))
|
||||
if(!bpenable(found.addr, BPNORMAL, true) or !SetBPX(found.addr, found.titantype, (void*)cbUserBreakpoint))
|
||||
{
|
||||
dprintf("could not enable "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1318,7 +1324,7 @@ CMDRESULT cbDebugEnableBPX(int argc, char* argv[])
|
|||
|
||||
static bool cbDisableAllBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(!DeleteBPX(bp->addr) or !bpenable(bp->addr, BPNORMAL, false))
|
||||
if(!bpenable(bp->addr, BPNORMAL, false) or !DeleteBPX(bp->addr))
|
||||
{
|
||||
dprintf("could not disable "fhex"\n", bp->addr);
|
||||
return false;
|
||||
|
|
@ -1345,7 +1351,7 @@ CMDRESULT cbDebugDisableBPX(int argc, char* argv[])
|
|||
BREAKPOINT found;
|
||||
if(bpget(0, BPNORMAL, arg1, &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!DeleteBPX(found.addr) or !bpenable(found.addr, BPNORMAL, false))
|
||||
if(!bpenable(found.addr, BPNORMAL, false) or !DeleteBPX(found.addr))
|
||||
{
|
||||
dprintf("could not disable "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1364,7 +1370,7 @@ CMDRESULT cbDebugDisableBPX(int argc, char* argv[])
|
|||
dputs("breakpoint already disabled!");
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
if(!DeleteBPX(found.addr) or !bpenable(found.addr, BPNORMAL, false))
|
||||
if(!bpenable(found.addr, BPNORMAL, false) or !DeleteBPX(found.addr))
|
||||
{
|
||||
dprintf("could not disable "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1518,7 +1524,7 @@ CMDRESULT cbDebugSetMemoryBpx(int argc, char* argv[])
|
|||
dputs("hardware breakpoint already set!");
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
if(!SetMemoryBPXEx(base, size, type, restore, (void*)cbMemoryBreakpoint) or !bpnew(base, true, singleshoot, 0, BPMEMORY, type, 0))
|
||||
if(!bpnew(base, true, singleshoot, 0, BPMEMORY, type, 0) or !SetMemoryBPXEx(base, size, type, restore, (void*)cbMemoryBreakpoint))
|
||||
{
|
||||
dputs("error setting memory breakpoint!");
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1534,7 +1540,7 @@ static bool cbDeleteAllMemoryBreakpoints(const BREAKPOINT* bp)
|
|||
return true;
|
||||
uint size;
|
||||
memfindbaseaddr(fdProcessInfo->hProcess, bp->addr, &size);
|
||||
if(!RemoveMemoryBPX(bp->addr, size) or !bpdel(bp->addr, BPMEMORY))
|
||||
if(!bpdel(bp->addr, BPMEMORY) or !RemoveMemoryBPX(bp->addr, size))
|
||||
{
|
||||
dprintf("delete memory breakpoint failed: "fhex"\n", bp->addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1563,7 +1569,7 @@ CMDRESULT cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
|
|||
{
|
||||
uint size;
|
||||
memfindbaseaddr(fdProcessInfo->hProcess, found.addr, &size);
|
||||
if(!RemoveMemoryBPX(found.addr, size) or !bpdel(found.addr, BPMEMORY))
|
||||
if(!bpdel(found.addr, BPMEMORY) or !RemoveMemoryBPX(found.addr, size))
|
||||
{
|
||||
dprintf("delete memory breakpoint failed: "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1578,7 +1584,7 @@ CMDRESULT cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
|
|||
}
|
||||
uint size;
|
||||
memfindbaseaddr(fdProcessInfo->hProcess, found.addr, &size);
|
||||
if(!RemoveMemoryBPX(found.addr, size) or !bpdel(found.addr, BPMEMORY))
|
||||
if(!bpdel(found.addr, BPMEMORY) or !RemoveMemoryBPX(found.addr, size))
|
||||
{
|
||||
dprintf("delete memory breakpoint failed: "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1670,7 +1676,7 @@ CMDRESULT cbDebugSetHardwareBreakpoint(int argc, char* argv[])
|
|||
dputs("hardware breakpoint already set!");
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
if(!SetHardwareBreakPoint(addr, drx, type, size, (void*)cbHardwareBreakpoint) or !bpnew(addr, true, false, 0, BPHARDWARE, titantype, 0))
|
||||
if(!bpnew(addr, true, false, 0, BPHARDWARE, titantype, 0) or !SetHardwareBreakPoint(addr, drx, type, size, (void*)cbHardwareBreakpoint))
|
||||
{
|
||||
dputs("error setting hardware breakpoint!");
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1684,7 +1690,7 @@ static bool cbDeleteAllHardwareBreakpoints(const BREAKPOINT* bp)
|
|||
{
|
||||
if(!bp->enabled)
|
||||
return true;
|
||||
if(!DeleteHardwareBreakPoint((bp->titantype>>8)&0xF) or !bpdel(bp->addr, BPHARDWARE))
|
||||
if(!bpdel(bp->addr, BPHARDWARE) or !DeleteHardwareBreakPoint((bp->titantype>>8)&0xF))
|
||||
{
|
||||
dprintf("delete hardware breakpoint failed: "fhex"\n", bp->addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1711,7 +1717,7 @@ CMDRESULT cbDebugDeleteHardwareBreakpoint(int argc, char* argv[])
|
|||
BREAKPOINT found;
|
||||
if(bpget(0, BPHARDWARE, arg1, &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!DeleteHardwareBreakPoint((found.titantype>>8)&0xF) or !bpdel(found.addr, BPHARDWARE))
|
||||
if(!bpdel(found.addr, BPHARDWARE) or !DeleteHardwareBreakPoint((found.titantype>>8)&0xF))
|
||||
{
|
||||
dprintf("delete hardware breakpoint failed: "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1724,7 +1730,7 @@ CMDRESULT cbDebugDeleteHardwareBreakpoint(int argc, char* argv[])
|
|||
dprintf("no such hardware breakpoint \"%s\"\n", arg1);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
if(!DeleteHardwareBreakPoint((found.titantype>>8)&0xF) or !bpdel(found.addr, BPHARDWARE))
|
||||
if(!bpdel(found.addr, BPHARDWARE) or !DeleteHardwareBreakPoint((found.titantype>>8)&0xF))
|
||||
{
|
||||
dprintf("delete hardware breakpoint failed: "fhex"\n", found.addr);
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -1817,6 +1823,17 @@ CMDRESULT cbDebugMemset(int argc, char* argv[])
|
|||
|
||||
CMDRESULT cbBenchmark(int argc, char* argv[])
|
||||
{
|
||||
uint addr=memfindbaseaddr(fdProcessInfo->hProcess, GetContextData(UE_CIP), 0);
|
||||
DWORD ticks=GetTickCount();
|
||||
char comment[MAX_COMMENT_SIZE]="";
|
||||
for(uint i=addr; i<addr+100000; i++)
|
||||
{
|
||||
commentset(i, "test", false);
|
||||
labelset(i, "test", false);
|
||||
bookmarkset(i, false);
|
||||
functionadd(i, i, false);
|
||||
}
|
||||
dprintf("%ums\n", GetTickCount()-ticks);
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ CMDRESULT cbInstrCmt(int argc, char* argv[])
|
|||
uint addr=0;
|
||||
if(!valfromstring(argv[1], &addr, false))
|
||||
return STATUS_ERROR;
|
||||
if(!commentset(addr, argv[2]))
|
||||
if(!commentset(addr, argv[2], true))
|
||||
{
|
||||
dputs("error setting comment");
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -259,6 +259,7 @@ CMDRESULT cbInstrCmtdel(int argc, char* argv[])
|
|||
dputs("error deleting comment");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
@ -272,11 +273,12 @@ CMDRESULT cbInstrLbl(int argc, char* argv[])
|
|||
uint addr=0;
|
||||
if(!valfromstring(argv[1], &addr, false))
|
||||
return STATUS_ERROR;
|
||||
if(!labelset(addr, argv[2]))
|
||||
if(!labelset(addr, argv[2], true))
|
||||
{
|
||||
dputs("error setting label");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +310,7 @@ CMDRESULT cbInstrBookmarkSet(int argc, char* argv[])
|
|||
uint addr=0;
|
||||
if(!valfromstring(argv[1], &addr, false))
|
||||
return STATUS_ERROR;
|
||||
if(!bookmarkset(addr))
|
||||
if(!bookmarkset(addr, true))
|
||||
{
|
||||
dputs("failed to set bookmark!");
|
||||
return STATUS_ERROR;
|
||||
|
|
@ -338,22 +340,14 @@ CMDRESULT cbInstrBookmarkDel(int argc, char* argv[])
|
|||
|
||||
CMDRESULT cbLoaddb(int argc, char* argv[])
|
||||
{
|
||||
if(!dbload())
|
||||
{
|
||||
dputs("failed to load database from disk!");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
dbload();
|
||||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
CMDRESULT cbSavedb(int argc, char* argv[])
|
||||
{
|
||||
if(!dbsave())
|
||||
{
|
||||
dputs("failed to save database to disk!");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
dbsave();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
@ -380,6 +374,7 @@ CMDRESULT cbAssemble(int argc, char* argv[])
|
|||
dprintf("failed to assemble \"%s\"\n", argv[2]);
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
@ -400,6 +395,7 @@ CMDRESULT cbFunctionAdd(int argc, char* argv[])
|
|||
return STATUS_ERROR;
|
||||
}
|
||||
dputs("function added!");
|
||||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
@ -419,6 +415,7 @@ CMDRESULT cbFunctionDel(int argc, char* argv[])
|
|||
return STATUS_ERROR;
|
||||
}
|
||||
dputs("function deleted!");
|
||||
GuiUpdateAllViews();
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
*/
|
||||
|
||||
#ifndef JANSSON_H
|
||||
#define JANSSON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for size_t */
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "jansson_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* version */
|
||||
|
||||
#define JANSSON_MAJOR_VERSION 2
|
||||
#define JANSSON_MINOR_VERSION 6
|
||||
#define JANSSON_MICRO_VERSION 0
|
||||
|
||||
/* Micro version is omitted if it's 0 */
|
||||
#define JANSSON_VERSION "2.6"
|
||||
|
||||
/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
|
||||
for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
|
||||
#define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \
|
||||
(JANSSON_MINOR_VERSION << 8) | \
|
||||
(JANSSON_MICRO_VERSION << 0))
|
||||
|
||||
|
||||
/* types */
|
||||
|
||||
typedef enum {
|
||||
JSON_OBJECT,
|
||||
JSON_ARRAY,
|
||||
JSON_STRING,
|
||||
JSON_INTEGER,
|
||||
JSON_REAL,
|
||||
JSON_TRUE,
|
||||
JSON_FALSE,
|
||||
JSON_NULL
|
||||
} json_type;
|
||||
|
||||
typedef struct json_t
|
||||
{
|
||||
json_type type;
|
||||
size_t refcount;
|
||||
} json_t;
|
||||
|
||||
typedef json_t* JSON;
|
||||
|
||||
#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */
|
||||
#if JSON_INTEGER_IS_LONG_LONG
|
||||
#ifdef _WIN32
|
||||
#define JSON_INTEGER_FORMAT "I64d"
|
||||
#else
|
||||
#define JSON_INTEGER_FORMAT "lld"
|
||||
#endif
|
||||
typedef long long json_int_t;
|
||||
#else
|
||||
#define JSON_INTEGER_FORMAT "ld"
|
||||
typedef long json_int_t;
|
||||
#endif /* JSON_INTEGER_IS_LONG_LONG */
|
||||
#endif
|
||||
|
||||
#define json_typeof(json) ((json)->type)
|
||||
#define json_is_object(json) ((json) && json_typeof(json) == JSON_OBJECT)
|
||||
#define json_is_array(json) ((json) && json_typeof(json) == JSON_ARRAY)
|
||||
#define json_is_string(json) ((json) && json_typeof(json) == JSON_STRING)
|
||||
#define json_is_integer(json) ((json) && json_typeof(json) == JSON_INTEGER)
|
||||
#define json_is_real(json) ((json) && json_typeof(json) == JSON_REAL)
|
||||
#define json_is_number(json) (json_is_integer(json) || json_is_real(json))
|
||||
#define json_is_true(json) ((json) && json_typeof(json) == JSON_TRUE)
|
||||
#define json_is_false(json) ((json) && json_typeof(json) == JSON_FALSE)
|
||||
#define json_boolean_value json_is_true
|
||||
#define json_is_boolean(json) (json_is_true(json) || json_is_false(json))
|
||||
#define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL)
|
||||
|
||||
/* construction, destruction, reference counting */
|
||||
|
||||
__declspec(dllimport) json_t* json_object(void);
|
||||
__declspec(dllimport) json_t* json_array(void);
|
||||
__declspec(dllimport) json_t* json_string(const char *value);
|
||||
__declspec(dllimport) json_t* json_stringn(const char *value, size_t len);
|
||||
__declspec(dllimport) json_t* json_string_nocheck(const char *value);
|
||||
__declspec(dllimport) json_t* json_stringn_nocheck(const char *value, size_t len);
|
||||
__declspec(dllimport) json_t* json_integer(json_int_t value);
|
||||
static JSON_INLINE
|
||||
json_t *json_hex(json_int_t value)
|
||||
{
|
||||
char hexvalue[20];
|
||||
#ifdef _WIN64
|
||||
sprintf(hexvalue, "0x%llX", value);
|
||||
#else //x64
|
||||
sprintf(hexvalue, "0x%X", value);
|
||||
#endif //_WIN64
|
||||
return json_string(hexvalue);
|
||||
}
|
||||
__declspec(dllimport) json_t* json_real(double value);
|
||||
__declspec(dllimport) json_t* json_true(void);
|
||||
__declspec(dllimport) json_t* json_false(void);
|
||||
#define json_boolean(val) ((val) ? json_true() : json_false())
|
||||
__declspec(dllimport) json_t* json_null(void);
|
||||
|
||||
static JSON_INLINE
|
||||
json_t *json_incref(json_t *json)
|
||||
{
|
||||
if(json && json->refcount != (size_t)-1)
|
||||
++json->refcount;
|
||||
return json;
|
||||
}
|
||||
|
||||
/* do not call json_delete directly */
|
||||
__declspec(dllimport) void json_delete(json_t *json);
|
||||
|
||||
static JSON_INLINE
|
||||
void json_decref(json_t *json)
|
||||
{
|
||||
if(json && json->refcount != (size_t)-1 && --json->refcount == 0)
|
||||
json_delete(json);
|
||||
}
|
||||
|
||||
|
||||
/* error reporting */
|
||||
|
||||
#define JSON_ERROR_TEXT_LENGTH 160
|
||||
#define JSON_ERROR_SOURCE_LENGTH 80
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int line;
|
||||
int column;
|
||||
int position;
|
||||
char source[JSON_ERROR_SOURCE_LENGTH];
|
||||
char text[JSON_ERROR_TEXT_LENGTH];
|
||||
} json_error_t;
|
||||
|
||||
|
||||
/* getters, setters, manipulation */
|
||||
|
||||
__declspec(dllimport) void json_object_seed(size_t seed);
|
||||
__declspec(dllimport) size_t json_object_size(const json_t *object);
|
||||
__declspec(dllimport) json_t* json_object_get(const json_t *object, const char *key);
|
||||
__declspec(dllimport) int json_object_set_new(json_t *object, const char *key, json_t *value);
|
||||
__declspec(dllimport) int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value);
|
||||
__declspec(dllimport) int json_object_del(json_t *object, const char *key);
|
||||
__declspec(dllimport) int json_object_clear(json_t *object);
|
||||
__declspec(dllimport) int json_object_update(json_t *object, json_t *other);
|
||||
__declspec(dllimport) int json_object_update_existing(json_t *object, json_t *other);
|
||||
__declspec(dllimport) int json_object_update_missing(json_t *object, json_t *other);
|
||||
__declspec(dllimport) void* json_object_iter(json_t *object);
|
||||
__declspec(dllimport) void* json_object_iter_at(json_t *object, const char *key);
|
||||
__declspec(dllimport) void* json_object_key_to_iter(const char *key);
|
||||
__declspec(dllimport) void* json_object_iter_next(json_t *object, void *iter);
|
||||
__declspec(dllimport) const char* json_object_iter_key(void *iter);
|
||||
__declspec(dllimport) json_t* json_object_iter_value(void *iter);
|
||||
__declspec(dllimport) int json_object_iter_set_new(json_t *object, void *iter, json_t *value);
|
||||
|
||||
#define json_object_foreach(object, key, value) \
|
||||
for(key = json_object_iter_key(json_object_iter(object)); \
|
||||
key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
|
||||
key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key))))
|
||||
|
||||
#define json_array_foreach(array, index, value) \
|
||||
for(index = 0; \
|
||||
index < json_array_size(array) && (value = json_array_get(array, index)); \
|
||||
index++)
|
||||
|
||||
static JSON_INLINE
|
||||
int json_object_set(json_t *object, const char *key, json_t *value)
|
||||
{
|
||||
return json_object_set_new(object, key, json_incref(value));
|
||||
}
|
||||
|
||||
static JSON_INLINE
|
||||
int json_object_set_nocheck(json_t *object, const char *key, json_t *value)
|
||||
{
|
||||
return json_object_set_new_nocheck(object, key, json_incref(value));
|
||||
}
|
||||
|
||||
static JSON_INLINE
|
||||
int json_object_iter_set(json_t *object, void *iter, json_t *value)
|
||||
{
|
||||
return json_object_iter_set_new(object, iter, json_incref(value));
|
||||
}
|
||||
|
||||
__declspec(dllimport) size_t json_array_size(const json_t *array);
|
||||
__declspec(dllimport) json_t* json_array_get(const json_t *array, size_t index);
|
||||
__declspec(dllimport) int json_array_set_new(json_t *array, size_t index, json_t *value);
|
||||
__declspec(dllimport) int json_array_append_new(json_t *array, json_t *value);
|
||||
__declspec(dllimport) int json_array_insert_new(json_t *array, size_t index, json_t *value);
|
||||
__declspec(dllimport) int json_array_remove(json_t *array, size_t index);
|
||||
__declspec(dllimport) int json_array_clear(json_t *array);
|
||||
__declspec(dllimport) int json_array_extend(json_t *array, json_t *other);
|
||||
|
||||
static JSON_INLINE
|
||||
int json_array_set(json_t *array, size_t ind, json_t *value)
|
||||
{
|
||||
return json_array_set_new(array, ind, json_incref(value));
|
||||
}
|
||||
|
||||
static JSON_INLINE
|
||||
int json_array_append(json_t *array, json_t *value)
|
||||
{
|
||||
return json_array_append_new(array, json_incref(value));
|
||||
}
|
||||
|
||||
static JSON_INLINE
|
||||
int json_array_insert(json_t *array, size_t ind, json_t *value)
|
||||
{
|
||||
return json_array_insert_new(array, ind, json_incref(value));
|
||||
}
|
||||
|
||||
__declspec(dllimport) const char* json_string_value(const json_t *string);
|
||||
__declspec(dllimport) size_t json_string_length(const json_t *string);
|
||||
__declspec(dllimport) json_int_t json_integer_value(const json_t *integer);
|
||||
static JSON_INLINE
|
||||
json_int_t json_hex_value(const json_t* hex)
|
||||
{
|
||||
json_int_t ret;
|
||||
const char* hexvalue;
|
||||
hexvalue=json_string_value(hex);
|
||||
if(!hexvalue)
|
||||
return 0;
|
||||
#ifdef _WIN64
|
||||
sscanf(hexvalue, "0x%llX", &ret);
|
||||
#else //x64
|
||||
sscanf(hexvalue, "0x%X", &ret);
|
||||
#endif //_WIN64
|
||||
return ret;
|
||||
}
|
||||
__declspec(dllimport) double json_real_value(const json_t *real);
|
||||
__declspec(dllimport) double json_number_value(const json_t *json);
|
||||
|
||||
__declspec(dllimport) int json_string_set(json_t *string, const char *value);
|
||||
__declspec(dllimport) int json_string_setn(json_t *string, const char *value, size_t len);
|
||||
__declspec(dllimport) int json_string_set_nocheck(json_t *string, const char *value);
|
||||
__declspec(dllimport) int json_string_setn_nocheck(json_t *string, const char *value, size_t len);
|
||||
__declspec(dllimport) int json_integer_set(json_t *integer, json_int_t value);
|
||||
__declspec(dllimport) int json_real_set(json_t *real, double value);
|
||||
|
||||
/* pack, unpack */
|
||||
|
||||
__declspec(dllimport) json_t* json_pack(const char *fmt, ...);
|
||||
__declspec(dllimport) json_t* json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...);
|
||||
__declspec(dllimport) json_t* json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap);
|
||||
|
||||
#define JSON_VALIDATE_ONLY 0x1
|
||||
#define JSON_STRICT 0x2
|
||||
|
||||
__declspec(dllimport) int json_unpack(json_t *root, const char *fmt, ...);
|
||||
__declspec(dllimport) int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...);
|
||||
__declspec(dllimport) int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap);
|
||||
|
||||
|
||||
/* equality */
|
||||
|
||||
__declspec(dllimport) int json_equal(json_t *value1, json_t *value2);
|
||||
|
||||
|
||||
/* copying */
|
||||
|
||||
__declspec(dllimport) json_t* json_copy(json_t *value);
|
||||
__declspec(dllimport) json_t* json_deep_copy(const json_t *value);
|
||||
|
||||
|
||||
/* decoding */
|
||||
|
||||
#define JSON_REJECT_DUPLICATES 0x1
|
||||
#define JSON_DISABLE_EOF_CHECK 0x2
|
||||
#define JSON_DECODE_ANY 0x4
|
||||
#define JSON_DECODE_INT_AS_REAL 0x8
|
||||
#define JSON_ALLOW_NUL 0x10
|
||||
|
||||
typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data);
|
||||
|
||||
__declspec(dllimport) json_t* json_loads(const char *input, size_t flags, json_error_t *error);
|
||||
__declspec(dllimport) json_t* json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error);
|
||||
__declspec(dllimport) json_t* json_loadf(FILE *input, size_t flags, json_error_t *error);
|
||||
__declspec(dllimport) json_t* json_load_file(const char *path, size_t flags, json_error_t *error);
|
||||
__declspec(dllimport) json_t* json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error);
|
||||
|
||||
|
||||
/* encoding */
|
||||
|
||||
#define JSON_INDENT(n) ((n) & 0x1F)
|
||||
#define JSON_COMPACT 0x20
|
||||
#define JSON_ENSURE_ASCII 0x40
|
||||
#define JSON_SORT_KEYS 0x80
|
||||
#define JSON_PRESERVE_ORDER 0x100
|
||||
#define JSON_ENCODE_ANY 0x200
|
||||
#define JSON_ESCAPE_SLASH 0x400
|
||||
#define JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11)
|
||||
|
||||
typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data);
|
||||
|
||||
__declspec(dllimport) char* json_dumps(const json_t *json, size_t flags);
|
||||
__declspec(dllimport) int json_dumpf(const json_t *json, FILE *output, size_t flags);
|
||||
__declspec(dllimport) int json_dump_file(const json_t *json, const char *path, size_t flags);
|
||||
__declspec(dllimport) int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags);
|
||||
|
||||
/* custom memory allocation */
|
||||
|
||||
typedef void *(*json_malloc_t)(size_t);
|
||||
typedef void (*json_free_t)(void *);
|
||||
|
||||
__declspec(dllimport) void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2014 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
*
|
||||
*
|
||||
* This file specifies a part of the site-specific configuration for
|
||||
* Jansson, namely those things that affect the public API in
|
||||
* jansson.h.
|
||||
*
|
||||
* The CMake system will generate the jansson_config.h file and
|
||||
* copy it to the build and install directories.
|
||||
*/
|
||||
|
||||
#ifndef JANSSON_CONFIG_H
|
||||
#define JANSSON_CONFIG_H
|
||||
|
||||
/* Define this so that we can disable scattered automake configuration in source files */
|
||||
#ifndef JANSSON_USING_CMAKE
|
||||
#define JANSSON_USING_CMAKE
|
||||
#endif
|
||||
|
||||
/* Note: when using cmake, JSON_INTEGER_IS_LONG_LONG is not defined nor used,
|
||||
* as we will also check for __int64 etc types.
|
||||
* (the definition was used in the automake system) */
|
||||
|
||||
/* Bring in the cmake-detected defines */
|
||||
#define HAVE_STDINT_H 1
|
||||
/* #undef HAVE_INTTYPES_H */
|
||||
/* #undef HAVE_SYS_TYPES_H */
|
||||
|
||||
/* Include our standard type header for the integer typedef */
|
||||
|
||||
#if defined(HAVE_STDINT_H)
|
||||
# include <stdint.h>
|
||||
#elif defined(HAVE_INTTYPES_H)
|
||||
# include <inttypes.h>
|
||||
#elif defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* If your compiler supports the inline keyword in C, JSON_INLINE is
|
||||
defined to `inline', otherwise empty. In C++, the inline is always
|
||||
supported. */
|
||||
#ifdef __cplusplus
|
||||
#define JSON_INLINE inline
|
||||
#else
|
||||
#define JSON_INLINE __inline
|
||||
#endif
|
||||
|
||||
|
||||
#define json_int_t long long
|
||||
#define json_strtoint _strtoi64
|
||||
#define JSON_INTEGER_FORMAT "I64d"
|
||||
|
||||
|
||||
/* If locale.h and localeconv() are available, define to 1, otherwise to 0. */
|
||||
#define JSON_HAVE_LOCALECONV 1
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,252 @@
|
|||
/*
|
||||
LZ4 - Fast LZ compression algorithm
|
||||
Header File
|
||||
Copyright (C) 2011-2014, Yann Collet.
|
||||
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
You can contact the author at :
|
||||
- LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
|
||||
- LZ4 source repository : http://code.google.com/p/lz4/
|
||||
*/
|
||||
#ifndef _LZ4_H
|
||||
#define _LZ4_H
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************
|
||||
Version
|
||||
**************************************/
|
||||
#define LZ4_VERSION_MAJOR 1 /* for major interface/format changes */
|
||||
#define LZ4_VERSION_MINOR 1 /* for minor interface/format changes */
|
||||
#define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */
|
||||
|
||||
|
||||
/**************************************
|
||||
Compiler Options
|
||||
**************************************/
|
||||
#if (defined(__GNUC__) && defined(__STRICT_ANSI__)) || (defined(_MSC_VER) && !defined(__cplusplus)) /* Visual Studio */
|
||||
# define inline __inline /* Visual C is not C99, but supports some kind of inline */
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************
|
||||
Simple Functions
|
||||
**************************************/
|
||||
|
||||
__declspec(dllimport) int LZ4_compress (const char* source, char* dest, int inputSize);
|
||||
__declspec(dllimport) int LZ4_decompress_safe (const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
/*
|
||||
LZ4_compress() :
|
||||
Compresses 'inputSize' bytes from 'source' into 'dest'.
|
||||
Destination buffer must be already allocated,
|
||||
and must be sized to handle worst cases situations (input data not compressible)
|
||||
Worst case size evaluation is provided by function LZ4_compressBound()
|
||||
inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
|
||||
return : the number of bytes written in buffer dest
|
||||
or 0 if the compression fails
|
||||
|
||||
LZ4_decompress_safe() :
|
||||
maxOutputSize : is the size of the destination buffer (which must be already allocated)
|
||||
return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function is protected against buffer overflow exploits (never writes outside of output buffer, and never reads outside of input buffer). Therefore, it is protected against malicious data packets
|
||||
*/
|
||||
|
||||
|
||||
/**************************************
|
||||
Advanced Functions
|
||||
**************************************/
|
||||
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
|
||||
#define LZ4_COMPRESSBOUND(isize) ((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
|
||||
|
||||
/*
|
||||
LZ4_compressBound() :
|
||||
Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible)
|
||||
primarily useful for memory allocation of output buffer.
|
||||
inline function is recommended for the general case,
|
||||
macro is also provided when result needs to be evaluated at compilation (such as stack memory allocation).
|
||||
|
||||
isize : is the input size. Max supported value is LZ4_MAX_INPUT_SIZE
|
||||
return : maximum output size in a "worst case" scenario
|
||||
or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)
|
||||
*/
|
||||
__declspec(dllimport) int LZ4_compressBound(int isize);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_compress_limitedOutput() :
|
||||
Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'.
|
||||
If it cannot achieve it, compression will stop, and result of the function will be zero.
|
||||
This function never writes outside of provided output buffer.
|
||||
|
||||
inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
|
||||
maxOutputSize : is the size of the destination buffer (which must be already allocated)
|
||||
return : the number of bytes written in buffer 'dest'
|
||||
or 0 if the compression fails
|
||||
*/
|
||||
__declspec(dllimport) int LZ4_compress_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_decompress_fast() :
|
||||
originalSize : is the original and therefore uncompressed size
|
||||
return : the number of bytes read from the source buffer (in other words, the compressed size)
|
||||
If the source stream is malformed, the function will stop decoding and return a negative result.
|
||||
note : This function is a bit faster than LZ4_decompress_safe()
|
||||
This function never writes outside of output buffers, but may read beyond input buffer in case of malicious data packet.
|
||||
Use this function preferably into a trusted environment (data to decode comes from a trusted source).
|
||||
Destination buffer must be already allocated. Its size must be a minimum of 'outputSize' bytes.
|
||||
*/
|
||||
__declspec(dllimport) int LZ4_decompress_fast (const char* source, char* dest, int originalSize);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_decompress_safe_partial() :
|
||||
This function decompress a compressed block of size 'inputSize' at position 'source'
|
||||
into output buffer 'dest' of size 'maxOutputSize'.
|
||||
The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached,
|
||||
reducing decompression time.
|
||||
return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
|
||||
Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller.
|
||||
Always control how many bytes were decoded.
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets
|
||||
*/
|
||||
__declspec(dllimport) int LZ4_decompress_safe_partial (const char* source, char* dest, int inputSize, int targetOutputSize, int maxOutputSize);
|
||||
|
||||
|
||||
/*
|
||||
These functions are provided should you prefer to allocate memory for compression tables with your own allocation methods.
|
||||
To know how much memory must be allocated for the compression tables, use :
|
||||
int LZ4_sizeofState();
|
||||
|
||||
Note that tables must be aligned on 4-bytes boundaries, otherwise compression will fail (return code 0).
|
||||
|
||||
The allocated memory can be provided to the compressions functions using 'void* state' parameter.
|
||||
LZ4_compress_withState() and LZ4_compress_limitedOutput_withState() are equivalent to previously described functions.
|
||||
They just use the externally allocated memory area instead of allocating their own (on stack, or on heap).
|
||||
*/
|
||||
__declspec(dllimport) int LZ4_sizeofState(void);
|
||||
__declspec(dllimport) int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
|
||||
__declspec(dllimport) int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
|
||||
/**************************************
|
||||
Streaming Functions
|
||||
**************************************/
|
||||
__declspec(dllimport) void* LZ4_create (const char* inputBuffer);
|
||||
__declspec(dllimport) int LZ4_compress_continue (void* LZ4_Data, const char* source, char* dest, int inputSize);
|
||||
__declspec(dllimport) int LZ4_compress_limitedOutput_continue (void* LZ4_Data, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
__declspec(dllimport) char* LZ4_slideInputBuffer (void* LZ4_Data);
|
||||
__declspec(dllimport) int LZ4_free (void* LZ4_Data);
|
||||
|
||||
/*
|
||||
These functions allow the compression of dependent blocks, where each block benefits from prior 64 KB within preceding blocks.
|
||||
In order to achieve this, it is necessary to start creating the LZ4 Data Structure, thanks to the function :
|
||||
|
||||
void* LZ4_create (const char* inputBuffer);
|
||||
The result of the function is the (void*) pointer on the LZ4 Data Structure.
|
||||
This pointer will be needed in all other functions.
|
||||
If the pointer returned is NULL, then the allocation has failed, and compression must be aborted.
|
||||
The only parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer.
|
||||
The input buffer must be already allocated, and size at least 192KB.
|
||||
'inputBuffer' will also be the 'const char* source' of the first block.
|
||||
|
||||
All blocks are expected to lay next to each other within the input buffer, starting from 'inputBuffer'.
|
||||
To compress each block, use either LZ4_compress_continue() or LZ4_compress_limitedOutput_continue().
|
||||
Their behavior are identical to LZ4_compress() or LZ4_compress_limitedOutput(),
|
||||
but require the LZ4 Data Structure as their first argument, and check that each block starts right after the previous one.
|
||||
If next block does not begin immediately after the previous one, the compression will fail (return 0).
|
||||
|
||||
When it's no longer possible to lay the next block after the previous one (not enough space left into input buffer), a call to :
|
||||
char* LZ4_slideInputBuffer(void* LZ4_Data);
|
||||
must be performed. It will typically copy the latest 64KB of input at the beginning of input buffer.
|
||||
Note that, for this function to work properly, minimum size of an input buffer must be 192KB.
|
||||
==> The memory position where the next input data block must start is provided as the result of the function.
|
||||
|
||||
Compression can then resume, using LZ4_compress_continue() or LZ4_compress_limitedOutput_continue(), as usual.
|
||||
|
||||
When compression is completed, a call to LZ4_free() will release the memory used by the LZ4 Data Structure.
|
||||
*/
|
||||
|
||||
|
||||
__declspec(dllimport) int LZ4_sizeofStreamState(void);
|
||||
__declspec(dllimport) int LZ4_resetStreamState(void* state, const char* inputBuffer);
|
||||
|
||||
/*
|
||||
These functions achieve the same result as :
|
||||
void* LZ4_create (const char* inputBuffer);
|
||||
|
||||
They are provided here to allow the user program to allocate memory using its own routines.
|
||||
|
||||
To know how much space must be allocated, use LZ4_sizeofStreamState();
|
||||
Note also that space must be 4-bytes aligned.
|
||||
|
||||
Once space is allocated, you must initialize it using : LZ4_resetStreamState(void* state, const char* inputBuffer);
|
||||
void* state is a pointer to the space allocated.
|
||||
It must be aligned on 4-bytes boundaries, and be large enough.
|
||||
The parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer.
|
||||
The input buffer must be already allocated, and size at least 192KB.
|
||||
'inputBuffer' will also be the 'const char* source' of the first block.
|
||||
|
||||
The same space can be re-used multiple times, just by initializing it each time with LZ4_resetStreamState().
|
||||
return value of LZ4_resetStreamState() must be 0 is OK.
|
||||
Any other value means there was an error (typically, pointer is not aligned on 4-bytes boundaries).
|
||||
*/
|
||||
|
||||
|
||||
__declspec(dllimport) int LZ4_decompress_safe_withPrefix64k (const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
__declspec(dllimport) int LZ4_decompress_fast_withPrefix64k (const char* source, char* dest, int outputSize);
|
||||
|
||||
/*
|
||||
*_withPrefix64k() :
|
||||
These decoding functions work the same as their "normal name" versions,
|
||||
but can use up to 64KB of data in front of 'char* dest'.
|
||||
These functions are necessary to decode inter-dependant blocks.
|
||||
*/
|
||||
|
||||
|
||||
/**************************************
|
||||
Obsolete Functions
|
||||
**************************************/
|
||||
/*
|
||||
These functions are deprecated and should no longer be used.
|
||||
They are provided here for compatibility with existing user programs.
|
||||
*/
|
||||
__declspec(dllimport) int LZ4_uncompress (const char* source, char* dest, int outputSize);
|
||||
__declspec(dllimport) int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_LZ4_H
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef _LZ4FILE_H
|
||||
#define _LZ4FILE_H
|
||||
|
||||
typedef enum _LZ4_STATUS
|
||||
{
|
||||
LZ4_SUCCESS,
|
||||
LZ4_FAILED_OPEN_INPUT,
|
||||
LZ4_FAILED_OPEN_OUTPUT,
|
||||
LZ4_NOT_ENOUGH_MEMORY,
|
||||
LZ4_INVALID_ARCHIVE,
|
||||
LZ4_CORRUPTED_ARCHIVE
|
||||
} LZ4_STATUS;
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
__declspec(dllimport) LZ4_STATUS LZ4_compress_file(const char* input_filename, const char* output_filename);
|
||||
__declspec(dllimport) LZ4_STATUS LZ4_decompress_file(const char* input_filename, const char* output_filename);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_LZ4FILE_H
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
LZ4 HC - High Compression Mode of LZ4
|
||||
Header File
|
||||
Copyright (C) 2011-2014, Yann Collet.
|
||||
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
You can contact the author at :
|
||||
- LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
|
||||
- LZ4 source repository : http://code.google.com/p/lz4/
|
||||
*/
|
||||
#ifndef _LZ4HC_H
|
||||
#define _LZ4HC_H
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
__declspec(dllimport) int LZ4_compressHC (const char* source, char* dest, int inputSize);
|
||||
/*
|
||||
LZ4_compressHC :
|
||||
return : the number of bytes in compressed buffer dest
|
||||
or 0 if compression fails.
|
||||
note : destination buffer must be already allocated.
|
||||
To avoid any problem, size it to handle worst cases situations (input data not compressible)
|
||||
Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h")
|
||||
*/
|
||||
|
||||
__declspec(dllimport) int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
/*
|
||||
LZ4_compress_limitedOutput() :
|
||||
Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'.
|
||||
If it cannot achieve it, compression will stop, and result of the function will be zero.
|
||||
This function never writes outside of provided output buffer.
|
||||
|
||||
inputSize : Max supported value is 1 GB
|
||||
maxOutputSize : is maximum allowed size into the destination buffer (which must be already allocated)
|
||||
return : the number of output bytes written in buffer 'dest'
|
||||
or 0 if compression fails.
|
||||
*/
|
||||
|
||||
|
||||
__declspec(dllimport) int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel);
|
||||
__declspec(dllimport) int LZ4_compressHC2_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
||||
/*
|
||||
Same functions as above, but with programmable 'compressionLevel'.
|
||||
Recommended values are between 4 and 9, although any value between 0 and 16 will work.
|
||||
'compressionLevel'==0 means use default 'compressionLevel' value.
|
||||
Values above 16 behave the same as 16.
|
||||
Equivalent variants exist for all other compression functions below.
|
||||
*/
|
||||
|
||||
/* Note :
|
||||
Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license)
|
||||
*/
|
||||
|
||||
|
||||
/**************************************
|
||||
Using an external allocation
|
||||
**************************************/
|
||||
__declspec(dllimport) int LZ4_sizeofStateHC(void);
|
||||
__declspec(dllimport) int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize);
|
||||
__declspec(dllimport) int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
__declspec(dllimport) int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel);
|
||||
__declspec(dllimport) int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
||||
|
||||
/*
|
||||
These functions are provided should you prefer to allocate memory for compression tables with your own allocation methods.
|
||||
To know how much memory must be allocated for the compression tables, use :
|
||||
int LZ4_sizeofStateHC();
|
||||
|
||||
Note that tables must be aligned for pointer (32 or 64 bits), otherwise compression will fail (return code 0).
|
||||
|
||||
The allocated memory can be provided to the compressions functions using 'void* state' parameter.
|
||||
LZ4_compress_withStateHC() and LZ4_compress_limitedOutput_withStateHC() are equivalent to previously described functions.
|
||||
They just use the externally allocated memory area instead of allocating their own (on stack, or on heap).
|
||||
*/
|
||||
|
||||
|
||||
/**************************************
|
||||
Streaming Functions
|
||||
**************************************/
|
||||
__declspec(dllimport) void* LZ4_createHC (const char* inputBuffer);
|
||||
__declspec(dllimport) int LZ4_compressHC_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize);
|
||||
__declspec(dllimport) int LZ4_compressHC_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
__declspec(dllimport) char* LZ4_slideInputBufferHC (void* LZ4HC_Data);
|
||||
__declspec(dllimport) int LZ4_freeHC (void* LZ4HC_Data);
|
||||
|
||||
__declspec(dllimport) int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel);
|
||||
__declspec(dllimport) int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
||||
|
||||
/*
|
||||
These functions allow the compression of dependent blocks, where each block benefits from prior 64 KB within preceding blocks.
|
||||
In order to achieve this, it is necessary to start creating the LZ4HC Data Structure, thanks to the function :
|
||||
|
||||
void* LZ4_createHC (const char* inputBuffer);
|
||||
The result of the function is the (void*) pointer on the LZ4HC Data Structure.
|
||||
This pointer will be needed in all other functions.
|
||||
If the pointer returned is NULL, then the allocation has failed, and compression must be aborted.
|
||||
The only parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer.
|
||||
The input buffer must be already allocated, and size at least 192KB.
|
||||
'inputBuffer' will also be the 'const char* source' of the first block.
|
||||
|
||||
All blocks are expected to lay next to each other within the input buffer, starting from 'inputBuffer'.
|
||||
To compress each block, use either LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue().
|
||||
Their behavior are identical to LZ4_compressHC() or LZ4_compressHC_limitedOutput(),
|
||||
but require the LZ4HC Data Structure as their first argument, and check that each block starts right after the previous one.
|
||||
If next block does not begin immediately after the previous one, the compression will fail (return 0).
|
||||
|
||||
When it's no longer possible to lay the next block after the previous one (not enough space left into input buffer), a call to :
|
||||
char* LZ4_slideInputBufferHC(void* LZ4HC_Data);
|
||||
must be performed. It will typically copy the latest 64KB of input at the beginning of input buffer.
|
||||
Note that, for this function to work properly, minimum size of an input buffer must be 192KB.
|
||||
==> The memory position where the next input data block must start is provided as the result of the function.
|
||||
|
||||
Compression can then resume, using LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue(), as usual.
|
||||
|
||||
When compression is completed, a call to LZ4_freeHC() will release the memory used by the LZ4HC Data Structure.
|
||||
*/
|
||||
|
||||
__declspec(dllimport) int LZ4_sizeofStreamStateHC(void);
|
||||
__declspec(dllimport) int LZ4_resetStreamStateHC(void* state, const char* inputBuffer);
|
||||
|
||||
/*
|
||||
These functions achieve the same result as :
|
||||
void* LZ4_createHC (const char* inputBuffer);
|
||||
|
||||
They are provided here to allow the user program to allocate memory using its own routines.
|
||||
|
||||
To know how much space must be allocated, use LZ4_sizeofStreamStateHC();
|
||||
Note also that space must be aligned for pointers (32 or 64 bits).
|
||||
|
||||
Once space is allocated, you must initialize it using : LZ4_resetStreamStateHC(void* state, const char* inputBuffer);
|
||||
void* state is a pointer to the space allocated.
|
||||
It must be aligned for pointers (32 or 64 bits), and be large enough.
|
||||
The parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer.
|
||||
The input buffer must be already allocated, and size at least 192KB.
|
||||
'inputBuffer' will also be the 'const char* source' of the first block.
|
||||
|
||||
The same space can be re-used multiple times, just by initializing it each time with LZ4_resetStreamState().
|
||||
return value of LZ4_resetStreamStateHC() must be 0 is OK.
|
||||
Any other value means there was an error (typically, state is not aligned for pointers (32 or 64 bits)).
|
||||
*/
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_LZ4HC_H
|
||||
|
|
@ -0,0 +1,431 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// MurmurHash3 was written by Austin Appleby, and is placed in the public
|
||||
// domain. The author hereby disclaims copyright to this source code.
|
||||
|
||||
// Note - The x86 and x64 versions do _not_ produce the same results, as the
|
||||
// algorithms are optimized for their respective platforms. You can still
|
||||
// compile and run any of them on any platform, but your performance with the
|
||||
// non-native version will be less than optimal.
|
||||
|
||||
#include "murmurhash.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
// Microsoft Visual Studio
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#define FORCE_INLINE __forceinline
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ROTL32(x,y) _rotl(x,y)
|
||||
#define ROTL64(x,y) _rotl64(x,y)
|
||||
|
||||
#define BIG_CONSTANT(x) (x)
|
||||
|
||||
// Other compilers
|
||||
|
||||
#else // defined(_MSC_VER)
|
||||
|
||||
#define FORCE_INLINE inline __attribute__((always_inline))
|
||||
|
||||
inline uint32_t rotl32 ( uint32_t x, int8_t r )
|
||||
{
|
||||
return (x << r) | (x >> (32 - r));
|
||||
}
|
||||
|
||||
inline uint64_t rotl64 ( uint64_t x, int8_t r )
|
||||
{
|
||||
return (x << r) | (x >> (64 - r));
|
||||
}
|
||||
|
||||
#define ROTL32(x,y) rotl32(x,y)
|
||||
#define ROTL64(x,y) rotl64(x,y)
|
||||
|
||||
#define BIG_CONSTANT(x) (x##LLU)
|
||||
|
||||
#endif // !defined(_MSC_VER)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Block read - if your platform needs to do endian-swapping or can only
|
||||
// handle aligned reads, do the conversion here
|
||||
|
||||
FORCE_INLINE uint32_t getblock32 ( const uint32_t * p, int i )
|
||||
{
|
||||
return p[i];
|
||||
}
|
||||
|
||||
FORCE_INLINE uint64_t getblock64 ( const uint64_t * p, int i )
|
||||
{
|
||||
return p[i];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Finalization mix - force all bits of a hash block to avalanche
|
||||
|
||||
FORCE_INLINE uint32_t fmix32 ( uint32_t h )
|
||||
{
|
||||
h ^= h >> 16;
|
||||
h *= 0x85ebca6b;
|
||||
h ^= h >> 13;
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= h >> 16;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
FORCE_INLINE uint64_t fmix64 ( uint64_t k )
|
||||
{
|
||||
k ^= k >> 33;
|
||||
k *= BIG_CONSTANT(0xff51afd7ed558ccd);
|
||||
k ^= k >> 33;
|
||||
k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53);
|
||||
k ^= k >> 33;
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_32 ( const void * key, int len,
|
||||
uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 4;
|
||||
|
||||
uint32_t h1 = seed;
|
||||
|
||||
const uint32_t c1 = 0xcc9e2d51;
|
||||
const uint32_t c2 = 0x1b873593;
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);
|
||||
|
||||
for(int i = -nblocks; i; i++)
|
||||
{
|
||||
uint32_t k1 = getblock32(blocks,i);
|
||||
|
||||
k1 *= c1;
|
||||
k1 = ROTL32(k1,15);
|
||||
k1 *= c2;
|
||||
|
||||
h1 ^= k1;
|
||||
h1 = ROTL32(h1,13);
|
||||
h1 = h1*5+0xe6546b64;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*4);
|
||||
|
||||
uint32_t k1 = 0;
|
||||
|
||||
switch(len & 3)
|
||||
{
|
||||
case 3:
|
||||
k1 ^= tail[2] << 16;
|
||||
case 2:
|
||||
k1 ^= tail[1] << 8;
|
||||
case 1:
|
||||
k1 ^= tail[0];
|
||||
k1 *= c1;
|
||||
k1 = ROTL32(k1,15);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len;
|
||||
|
||||
h1 = fmix32(h1);
|
||||
|
||||
*(uint32_t*)out = h1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_128 ( const void * key, const int len,
|
||||
uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 16;
|
||||
|
||||
uint32_t h1 = seed;
|
||||
uint32_t h2 = seed;
|
||||
uint32_t h3 = seed;
|
||||
uint32_t h4 = seed;
|
||||
|
||||
const uint32_t c1 = 0x239b961b;
|
||||
const uint32_t c2 = 0xab0e9789;
|
||||
const uint32_t c3 = 0x38b34ae5;
|
||||
const uint32_t c4 = 0xa1e38b93;
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);
|
||||
|
||||
for(int i = -nblocks; i; i++)
|
||||
{
|
||||
uint32_t k1 = getblock32(blocks,i*4+0);
|
||||
uint32_t k2 = getblock32(blocks,i*4+1);
|
||||
uint32_t k3 = getblock32(blocks,i*4+2);
|
||||
uint32_t k4 = getblock32(blocks,i*4+3);
|
||||
|
||||
k1 *= c1;
|
||||
k1 = ROTL32(k1,15);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
|
||||
h1 = ROTL32(h1,19);
|
||||
h1 += h2;
|
||||
h1 = h1*5+0x561ccd1b;
|
||||
|
||||
k2 *= c2;
|
||||
k2 = ROTL32(k2,16);
|
||||
k2 *= c3;
|
||||
h2 ^= k2;
|
||||
|
||||
h2 = ROTL32(h2,17);
|
||||
h2 += h3;
|
||||
h2 = h2*5+0x0bcaa747;
|
||||
|
||||
k3 *= c3;
|
||||
k3 = ROTL32(k3,17);
|
||||
k3 *= c4;
|
||||
h3 ^= k3;
|
||||
|
||||
h3 = ROTL32(h3,15);
|
||||
h3 += h4;
|
||||
h3 = h3*5+0x96cd1c35;
|
||||
|
||||
k4 *= c4;
|
||||
k4 = ROTL32(k4,18);
|
||||
k4 *= c1;
|
||||
h4 ^= k4;
|
||||
|
||||
h4 = ROTL32(h4,13);
|
||||
h4 += h1;
|
||||
h4 = h4*5+0x32ac3b17;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
|
||||
|
||||
uint32_t k1 = 0;
|
||||
uint32_t k2 = 0;
|
||||
uint32_t k3 = 0;
|
||||
uint32_t k4 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15:
|
||||
k4 ^= tail[14] << 16;
|
||||
case 14:
|
||||
k4 ^= tail[13] << 8;
|
||||
case 13:
|
||||
k4 ^= tail[12] << 0;
|
||||
k4 *= c4;
|
||||
k4 = ROTL32(k4,18);
|
||||
k4 *= c1;
|
||||
h4 ^= k4;
|
||||
|
||||
case 12:
|
||||
k3 ^= tail[11] << 24;
|
||||
case 11:
|
||||
k3 ^= tail[10] << 16;
|
||||
case 10:
|
||||
k3 ^= tail[ 9] << 8;
|
||||
case 9:
|
||||
k3 ^= tail[ 8] << 0;
|
||||
k3 *= c3;
|
||||
k3 = ROTL32(k3,17);
|
||||
k3 *= c4;
|
||||
h3 ^= k3;
|
||||
|
||||
case 8:
|
||||
k2 ^= tail[ 7] << 24;
|
||||
case 7:
|
||||
k2 ^= tail[ 6] << 16;
|
||||
case 6:
|
||||
k2 ^= tail[ 5] << 8;
|
||||
case 5:
|
||||
k2 ^= tail[ 4] << 0;
|
||||
k2 *= c2;
|
||||
k2 = ROTL32(k2,16);
|
||||
k2 *= c3;
|
||||
h2 ^= k2;
|
||||
|
||||
case 4:
|
||||
k1 ^= tail[ 3] << 24;
|
||||
case 3:
|
||||
k1 ^= tail[ 2] << 16;
|
||||
case 2:
|
||||
k1 ^= tail[ 1] << 8;
|
||||
case 1:
|
||||
k1 ^= tail[ 0] << 0;
|
||||
k1 *= c1;
|
||||
k1 = ROTL32(k1,15);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len;
|
||||
h2 ^= len;
|
||||
h3 ^= len;
|
||||
h4 ^= len;
|
||||
|
||||
h1 += h2;
|
||||
h1 += h3;
|
||||
h1 += h4;
|
||||
h2 += h1;
|
||||
h3 += h1;
|
||||
h4 += h1;
|
||||
|
||||
h1 = fmix32(h1);
|
||||
h2 = fmix32(h2);
|
||||
h3 = fmix32(h3);
|
||||
h4 = fmix32(h4);
|
||||
|
||||
h1 += h2;
|
||||
h1 += h3;
|
||||
h1 += h4;
|
||||
h2 += h1;
|
||||
h3 += h1;
|
||||
h4 += h1;
|
||||
|
||||
((uint32_t*)out)[0] = h1;
|
||||
((uint32_t*)out)[1] = h2;
|
||||
((uint32_t*)out)[2] = h3;
|
||||
((uint32_t*)out)[3] = h4;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x64_128 ( const void * key, const int len,
|
||||
const uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 16;
|
||||
|
||||
uint64_t h1 = seed;
|
||||
uint64_t h2 = seed;
|
||||
|
||||
const uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
|
||||
const uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint64_t * blocks = (const uint64_t *)(data);
|
||||
|
||||
for(int i = 0; i < nblocks; i++)
|
||||
{
|
||||
uint64_t k1 = getblock64(blocks,i*2+0);
|
||||
uint64_t k2 = getblock64(blocks,i*2+1);
|
||||
|
||||
k1 *= c1;
|
||||
k1 = ROTL64(k1,31);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
|
||||
h1 = ROTL64(h1,27);
|
||||
h1 += h2;
|
||||
h1 = h1*5+0x52dce729;
|
||||
|
||||
k2 *= c2;
|
||||
k2 = ROTL64(k2,33);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
|
||||
h2 = ROTL64(h2,31);
|
||||
h2 += h1;
|
||||
h2 = h2*5+0x38495ab5;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
|
||||
|
||||
uint64_t k1 = 0;
|
||||
uint64_t k2 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15:
|
||||
k2 ^= ((uint64_t)tail[14]) << 48;
|
||||
case 14:
|
||||
k2 ^= ((uint64_t)tail[13]) << 40;
|
||||
case 13:
|
||||
k2 ^= ((uint64_t)tail[12]) << 32;
|
||||
case 12:
|
||||
k2 ^= ((uint64_t)tail[11]) << 24;
|
||||
case 11:
|
||||
k2 ^= ((uint64_t)tail[10]) << 16;
|
||||
case 10:
|
||||
k2 ^= ((uint64_t)tail[ 9]) << 8;
|
||||
case 9:
|
||||
k2 ^= ((uint64_t)tail[ 8]) << 0;
|
||||
k2 *= c2;
|
||||
k2 = ROTL64(k2,33);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
|
||||
case 8:
|
||||
k1 ^= ((uint64_t)tail[ 7]) << 56;
|
||||
case 7:
|
||||
k1 ^= ((uint64_t)tail[ 6]) << 48;
|
||||
case 6:
|
||||
k1 ^= ((uint64_t)tail[ 5]) << 40;
|
||||
case 5:
|
||||
k1 ^= ((uint64_t)tail[ 4]) << 32;
|
||||
case 4:
|
||||
k1 ^= ((uint64_t)tail[ 3]) << 24;
|
||||
case 3:
|
||||
k1 ^= ((uint64_t)tail[ 2]) << 16;
|
||||
case 2:
|
||||
k1 ^= ((uint64_t)tail[ 1]) << 8;
|
||||
case 1:
|
||||
k1 ^= ((uint64_t)tail[ 0]) << 0;
|
||||
k1 *= c1;
|
||||
k1 = ROTL64(k1,31);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len;
|
||||
h2 ^= len;
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = fmix64(h1);
|
||||
h2 = fmix64(h2);
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
((uint64_t*)out)[0] = h1;
|
||||
((uint64_t*)out)[1] = h2;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// MurmurHash3 was written by Austin Appleby, and is placed in the public
|
||||
// domain. The author hereby disclaims copyright to this source code.
|
||||
|
||||
#ifndef _MURMURHASH3_H_
|
||||
#define _MURMURHASH3_H_
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
// Microsoft Visual Studio
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
// Other compilers
|
||||
|
||||
#else // defined(_MSC_VER)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#endif // !defined(_MSC_VER)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out );
|
||||
|
||||
void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out );
|
||||
|
||||
void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef _WIN64
|
||||
static inline
|
||||
unsigned long long murmurhash(const void* data, int len)
|
||||
{
|
||||
unsigned long long hash[2];
|
||||
MurmurHash3_x64_128(data, len, 0x1337, hash);
|
||||
#else //x86
|
||||
static inline
|
||||
unsigned long murmurhash(const void* data, int len)
|
||||
{
|
||||
unsigned int hash[1];
|
||||
MurmurHash3_x86_32(data, len, 0x1337, hash);
|
||||
#endif //_WIN64
|
||||
return hash[0];
|
||||
}
|
||||
|
||||
#endif // _MURMURHASH3_H_
|
||||
|
|
@ -599,7 +599,11 @@ bool scriptcmdexec(const char* command)
|
|||
void scriptabort()
|
||||
{
|
||||
if(bIsRunning)
|
||||
{
|
||||
bAbort=true;
|
||||
while(bIsRunning)
|
||||
Sleep(1);
|
||||
}
|
||||
else //reset the script
|
||||
scriptsetip(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,183 +0,0 @@
|
|||
#include "sqlhelper.h"
|
||||
#include "console.h"
|
||||
#include "threading.h"
|
||||
|
||||
static char lasterror[deflen]="";
|
||||
|
||||
const char* sqllasterror()
|
||||
{
|
||||
return lasterror;
|
||||
}
|
||||
|
||||
bool sqlexec(sqlite3* db, const char* query)
|
||||
{
|
||||
lock(WAITID_USERDB);
|
||||
char* errorText=0;
|
||||
if(sqlite3_exec(db, query, 0, 0, &errorText)!=SQLITE_OK) //error
|
||||
{
|
||||
if(errorText)
|
||||
strcpy(lasterror, errorText);
|
||||
sqlite3_free(errorText);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
*lasterror=0;
|
||||
unlock(WAITID_USERDB);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sqlhasresult(sqlite3* db, const char* query)
|
||||
{
|
||||
lock(WAITID_USERDB);
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(db, query, -1, &stmt, 0)!=SQLITE_OK)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
if(sqlite3_step(stmt)!=SQLITE_ROW)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sqlgettext(sqlite3* db, const char* query, char* result)
|
||||
{
|
||||
if(!result)
|
||||
return false;
|
||||
lock(WAITID_USERDB);
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(db, query, -1, &stmt, 0)!=SQLITE_OK)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
if(sqlite3_step(stmt)!=SQLITE_ROW)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
strcpy(result, (const char*)sqlite3_column_text(stmt, 0));
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sqlgetint(sqlite3* db, const char* query, int* result)
|
||||
{
|
||||
if(!result)
|
||||
return false;
|
||||
lock(WAITID_USERDB);
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(db, query, -1, &stmt, 0)!=SQLITE_OK)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
if(sqlite3_step(stmt)!=SQLITE_ROW)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
*result=sqlite3_column_int(stmt, 0);
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sqlgetuint(sqlite3* db, const char* query, uint* result)
|
||||
{
|
||||
if(!result)
|
||||
return false;
|
||||
lock(WAITID_USERDB);
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(db, query, -1, &stmt, 0)!=SQLITE_OK)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
if(sqlite3_step(stmt)!=SQLITE_ROW)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
#ifdef _WIN64
|
||||
*result=sqlite3_column_int64(stmt, 0);
|
||||
#else
|
||||
*result=sqlite3_column_int(stmt, 0);
|
||||
#endif // _WIN64
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return true;
|
||||
}
|
||||
|
||||
void sqlstringescape(const char* string, char* escaped_string)
|
||||
{
|
||||
if(!string or !escaped_string)
|
||||
return;
|
||||
int len=strlen(string);
|
||||
*escaped_string=0;
|
||||
for(int i=0,j=0; i<len; i++)
|
||||
{
|
||||
if(string[i]=='\"' or string[i]=='\'')
|
||||
j+=sprintf(escaped_string+j, "''");
|
||||
else
|
||||
j+=sprintf(escaped_string+j, "%c", string[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool sqlloadsavedb(sqlite3* memory, const char* file, bool save)
|
||||
{
|
||||
lock(WAITID_USERDB);
|
||||
//CREDIT: http://www.sqlite.org/backup.html
|
||||
int rc;
|
||||
sqlite3* pFile;
|
||||
sqlite3_backup* pBackup;
|
||||
sqlite3* pTo;
|
||||
sqlite3* pFrom;
|
||||
rc=sqlite3_open(file, &pFile);
|
||||
if(rc==SQLITE_OK)
|
||||
{
|
||||
pFrom=(save?memory:pFile);
|
||||
pTo=(save?pFile:memory);
|
||||
pBackup=sqlite3_backup_init(pTo, "main", pFrom, "main");
|
||||
if(pBackup)
|
||||
{
|
||||
sqlite3_backup_step(pBackup, -1);
|
||||
sqlite3_backup_finish(pBackup);
|
||||
}
|
||||
rc=sqlite3_errcode(pTo);
|
||||
}
|
||||
sqlite3_close(pFile);
|
||||
unlock(WAITID_USERDB);
|
||||
return (rc==SQLITE_OK);
|
||||
}
|
||||
|
||||
int sqlrowcount(sqlite3* db, const char* query)
|
||||
{
|
||||
lock(WAITID_USERDB);
|
||||
int rowcount=0;
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(db, query, -1, &stmt, 0)!=SQLITE_OK)
|
||||
{
|
||||
sqlite3_finalize(stmt);
|
||||
unlock(WAITID_USERDB);
|
||||
return false;
|
||||
}
|
||||
while(sqlite3_step(stmt)==SQLITE_ROW)
|
||||
rowcount++;
|
||||
unlock(WAITID_USERDB);
|
||||
return rowcount;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef _SQLHELPER_H
|
||||
|
||||
#include "_global.h"
|
||||
|
||||
const char* sqllasterror();
|
||||
bool sqlexec(sqlite3* db, const char* query);
|
||||
bool sqlhasresult(sqlite3* db, const char* query);
|
||||
bool sqlgettext(sqlite3* db, const char* query, char* result);
|
||||
bool sqlgetuint(sqlite3* db, const char* query, uint* result);
|
||||
bool sqlgetint(sqlite3* db, const char* query, int* result);
|
||||
void sqlstringescape(const char* string, char* escaped_string);
|
||||
bool sqlloadsavedb(sqlite3* memory, const char* file, bool save);
|
||||
int sqlrowcount(sqlite3* db, const char* query);
|
||||
|
||||
#endif // _SQLHELPER_H
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,207 +0,0 @@
|
|||
LIBRARY "sqlite.dll"
|
||||
EXPORTS
|
||||
sqlite3_aggregate_context
|
||||
sqlite3_aggregate_count
|
||||
sqlite3_auto_extension
|
||||
sqlite3_backup_finish
|
||||
sqlite3_backup_init
|
||||
sqlite3_backup_pagecount
|
||||
sqlite3_backup_remaining
|
||||
sqlite3_backup_step
|
||||
sqlite3_bind_blob
|
||||
sqlite3_bind_double
|
||||
sqlite3_bind_int
|
||||
sqlite3_bind_int64
|
||||
sqlite3_bind_null
|
||||
sqlite3_bind_parameter_count
|
||||
sqlite3_bind_parameter_index
|
||||
sqlite3_bind_parameter_name
|
||||
sqlite3_bind_text
|
||||
sqlite3_bind_text16
|
||||
sqlite3_bind_value
|
||||
sqlite3_bind_zeroblob
|
||||
sqlite3_blob_bytes
|
||||
sqlite3_blob_close
|
||||
sqlite3_blob_open
|
||||
sqlite3_blob_read
|
||||
sqlite3_blob_reopen
|
||||
sqlite3_blob_write
|
||||
sqlite3_busy_handler
|
||||
sqlite3_busy_timeout
|
||||
sqlite3_cancel_auto_extension
|
||||
sqlite3_changes
|
||||
sqlite3_clear_bindings
|
||||
sqlite3_close
|
||||
sqlite3_close_v2
|
||||
sqlite3_collation_needed
|
||||
sqlite3_collation_needed16
|
||||
sqlite3_column_blob
|
||||
sqlite3_column_bytes
|
||||
sqlite3_column_bytes16
|
||||
sqlite3_column_count
|
||||
sqlite3_column_decltype
|
||||
sqlite3_column_decltype16
|
||||
sqlite3_column_double
|
||||
sqlite3_column_int
|
||||
sqlite3_column_int64
|
||||
sqlite3_column_name
|
||||
sqlite3_column_name16
|
||||
sqlite3_column_text
|
||||
sqlite3_column_text16
|
||||
sqlite3_column_type
|
||||
sqlite3_column_value
|
||||
sqlite3_commit_hook
|
||||
sqlite3_compileoption_get
|
||||
sqlite3_compileoption_used
|
||||
sqlite3_complete
|
||||
sqlite3_complete16
|
||||
sqlite3_config
|
||||
sqlite3_context_db_handle
|
||||
sqlite3_create_collation
|
||||
sqlite3_create_collation16
|
||||
sqlite3_create_collation_v2
|
||||
sqlite3_create_function
|
||||
sqlite3_create_function16
|
||||
sqlite3_create_function_v2
|
||||
sqlite3_create_module
|
||||
sqlite3_create_module_v2
|
||||
sqlite3_data_count
|
||||
sqlite3_data_directory DATA
|
||||
sqlite3_db_config
|
||||
sqlite3_db_filename
|
||||
sqlite3_db_handle
|
||||
sqlite3_db_mutex
|
||||
sqlite3_db_readonly
|
||||
sqlite3_db_release_memory
|
||||
sqlite3_db_status
|
||||
sqlite3_declare_vtab
|
||||
sqlite3_enable_load_extension
|
||||
sqlite3_enable_shared_cache
|
||||
sqlite3_errcode
|
||||
sqlite3_errmsg
|
||||
sqlite3_errmsg16
|
||||
sqlite3_errstr
|
||||
sqlite3_exec
|
||||
sqlite3_expired
|
||||
sqlite3_extended_errcode
|
||||
sqlite3_extended_result_codes
|
||||
sqlite3_file_control
|
||||
sqlite3_finalize
|
||||
sqlite3_free
|
||||
sqlite3_free_table
|
||||
sqlite3_get_autocommit
|
||||
sqlite3_get_auxdata
|
||||
sqlite3_get_table
|
||||
sqlite3_global_recover
|
||||
sqlite3_initialize
|
||||
sqlite3_interrupt
|
||||
sqlite3_last_insert_rowid
|
||||
sqlite3_libversion
|
||||
sqlite3_libversion_number
|
||||
sqlite3_limit
|
||||
sqlite3_load_extension
|
||||
sqlite3_log
|
||||
sqlite3_malloc
|
||||
sqlite3_memory_alarm
|
||||
sqlite3_memory_highwater
|
||||
sqlite3_memory_used
|
||||
sqlite3_mprintf
|
||||
sqlite3_mutex_alloc
|
||||
sqlite3_mutex_enter
|
||||
sqlite3_mutex_free
|
||||
sqlite3_mutex_leave
|
||||
sqlite3_mutex_try
|
||||
sqlite3_next_stmt
|
||||
sqlite3_open
|
||||
sqlite3_open16
|
||||
sqlite3_open_v2
|
||||
sqlite3_os_end
|
||||
sqlite3_os_init
|
||||
sqlite3_overload_function
|
||||
sqlite3_prepare
|
||||
sqlite3_prepare16
|
||||
sqlite3_prepare16_v2
|
||||
sqlite3_prepare_v2
|
||||
sqlite3_profile
|
||||
sqlite3_progress_handler
|
||||
sqlite3_randomness
|
||||
sqlite3_realloc
|
||||
sqlite3_release_memory
|
||||
sqlite3_reset
|
||||
sqlite3_reset_auto_extension
|
||||
sqlite3_result_blob
|
||||
sqlite3_result_double
|
||||
sqlite3_result_error
|
||||
sqlite3_result_error16
|
||||
sqlite3_result_error_code
|
||||
sqlite3_result_error_nomem
|
||||
sqlite3_result_error_toobig
|
||||
sqlite3_result_int
|
||||
sqlite3_result_int64
|
||||
sqlite3_result_null
|
||||
sqlite3_result_text
|
||||
sqlite3_result_text16
|
||||
sqlite3_result_text16be
|
||||
sqlite3_result_text16le
|
||||
sqlite3_result_value
|
||||
sqlite3_result_zeroblob
|
||||
sqlite3_rollback_hook
|
||||
sqlite3_set_authorizer
|
||||
sqlite3_set_auxdata
|
||||
sqlite3_shutdown
|
||||
sqlite3_sleep
|
||||
sqlite3_snprintf
|
||||
sqlite3_soft_heap_limit
|
||||
sqlite3_soft_heap_limit64
|
||||
sqlite3_sourceid
|
||||
sqlite3_sql
|
||||
sqlite3_status
|
||||
sqlite3_step
|
||||
sqlite3_stmt_busy
|
||||
sqlite3_stmt_readonly
|
||||
sqlite3_stmt_status
|
||||
sqlite3_strglob
|
||||
sqlite3_stricmp
|
||||
sqlite3_strnicmp
|
||||
sqlite3_temp_directory DATA
|
||||
sqlite3_test_control
|
||||
sqlite3_thread_cleanup
|
||||
sqlite3_threadsafe
|
||||
sqlite3_total_changes
|
||||
sqlite3_trace
|
||||
sqlite3_transfer_bindings
|
||||
sqlite3_update_hook
|
||||
sqlite3_uri_boolean
|
||||
sqlite3_uri_int64
|
||||
sqlite3_uri_parameter
|
||||
sqlite3_user_data
|
||||
sqlite3_value_blob
|
||||
sqlite3_value_bytes
|
||||
sqlite3_value_bytes16
|
||||
sqlite3_value_double
|
||||
sqlite3_value_int
|
||||
sqlite3_value_int64
|
||||
sqlite3_value_numeric_type
|
||||
sqlite3_value_text
|
||||
sqlite3_value_text16
|
||||
sqlite3_value_text16be
|
||||
sqlite3_value_text16le
|
||||
sqlite3_value_type
|
||||
sqlite3_version DATA
|
||||
sqlite3_vfs_find
|
||||
sqlite3_vfs_register
|
||||
sqlite3_vfs_unregister
|
||||
sqlite3_vmprintf
|
||||
sqlite3_vsnprintf
|
||||
sqlite3_vtab_config
|
||||
sqlite3_vtab_on_conflict
|
||||
sqlite3_wal_autocheckpoint
|
||||
sqlite3_wal_checkpoint
|
||||
sqlite3_wal_checkpoint_v2
|
||||
sqlite3_wal_hook
|
||||
sqlite3_win32_mbcs_to_utf8
|
||||
sqlite3_win32_set_directory
|
||||
sqlite3_win32_sleep
|
||||
sqlite3_win32_utf8_to_mbcs
|
||||
sqlite3_win32_write_debug
|
||||
winSysInfo DATA
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
static MESSAGE_STACK* gMsgStack=0;
|
||||
static COMMAND* command_list=0;
|
||||
static HANDLE hCommandLoopThread=0;
|
||||
static char alloctrace[MAX_PATH]="";
|
||||
|
||||
//Original code by Aurel from http://www.codeguru.com/cpp/w-p/win32/article.php/c1427/A-Simple-Win32-CommandLine-Parser.htm
|
||||
static void commandlinefree(int argc, char** argv)
|
||||
|
|
@ -207,9 +209,19 @@ static DWORD WINAPI DbgCommandLoopThread(void* a)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void* emalloc_json(size_t size)
|
||||
{
|
||||
return emalloc(size, "json:ptr");
|
||||
}
|
||||
|
||||
static void efree_json(void* ptr)
|
||||
{
|
||||
efree(ptr, "json:ptr");
|
||||
}
|
||||
|
||||
extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
||||
{
|
||||
DeleteFileA("alloctrace.txt");
|
||||
json_set_alloc_funcs(emalloc_json, efree_json);
|
||||
char dir[deflen]="";
|
||||
if(!GetModuleFileNameA(hInst, dir, deflen))
|
||||
return "GetModuleFileNameA failed!";
|
||||
|
|
@ -217,15 +229,20 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
|||
while(dir[len]!='\\')
|
||||
len--;
|
||||
dir[len]=0;
|
||||
strcpy(sqlitedb_basedir, dir); //debug directory
|
||||
PathAppendA(sqlitedb_basedir, "db");
|
||||
strcpy(alloctrace, dir);
|
||||
PathAppendA(alloctrace, "\\alloctrace.txt");
|
||||
DeleteFileA(alloctrace);
|
||||
setalloctrace(alloctrace);
|
||||
strcpy(dbbasepath, dir); //debug directory
|
||||
PathAppendA(dbbasepath, "db");
|
||||
CreateDirectoryA(dbbasepath, 0); //create database directory
|
||||
SetCurrentDirectoryA(dir);
|
||||
gMsgStack=msgallocstack();
|
||||
if(!gMsgStack)
|
||||
return "Could not allocate message stack!";
|
||||
varinit();
|
||||
registercommands();
|
||||
CloseHandle(CreateThread(0, 0, DbgCommandLoopThread, 0, 0, 0));
|
||||
hCommandLoopThread=CreateThread(0, 0, DbgCommandLoopThread, 0, 0, 0);
|
||||
char plugindir[deflen]="";
|
||||
strcpy(plugindir, dir);
|
||||
PathAppendA(plugindir, "plugins");
|
||||
|
|
@ -247,11 +264,21 @@ extern "C" DLL_EXPORT const char* _dbg_dbginit()
|
|||
extern "C" DLL_EXPORT void _dbg_dbgexitsignal()
|
||||
{
|
||||
cbStopDebug(0, 0);
|
||||
scriptabort();
|
||||
wait(WAITID_STOP); //after this, debugging stopped
|
||||
pluginunload();
|
||||
TerminateThread(hCommandLoopThread, 0);
|
||||
cmdfree(command_list);
|
||||
varfree();
|
||||
msgfreestack(gMsgStack);
|
||||
if(memleaks())
|
||||
{
|
||||
char msg[256]="";
|
||||
sprintf(msg, "%d memory leak(s) found!\n\nPlease send 'alloctrace.txt' to the authors of x64_dbg.", memleaks());
|
||||
MessageBoxA(0, msg, "error", MB_ICONERROR|MB_SYSTEMMODAL);
|
||||
}
|
||||
else
|
||||
DeleteFileA(alloctrace);
|
||||
}
|
||||
|
||||
extern "C" DLL_EXPORT bool _dbg_dbgcmddirectexec(const char* cmd)
|
||||
|
|
|
|||
|
|
@ -1,153 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="x64_dbg_dbg" />
|
||||
<Option pch_mode="2" />
|
||||
<Option default_target="x64" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="x32">
|
||||
<Option output="../bin/x32/x32_dbg" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x32/" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gcc" />
|
||||
<Option host_application="../bin/x32/x32_dbg.exe" />
|
||||
<Option run_host_application_in_terminal="0" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-fomit-frame-pointer" />
|
||||
<Add option="-Os" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="..\bin\x32\libx32_bridge.a" />
|
||||
<Add library=".\TitanEngine\TitanEngine_x86.a" />
|
||||
<Add library=".\libdbg_x32.a" />
|
||||
<Add library=".\dbghelp\dbghelp_x86.a" />
|
||||
<Add library=".\sqlite\libsqlite32.a" />
|
||||
<Add library=".\BeaEngine\libBeaEngine.a" />
|
||||
<Add library=".\XEDParse\XEDParse_x86.a" />
|
||||
<Add library=".\DeviceNameResolver\DeviceNameResolver_x86.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="x64">
|
||||
<Option output="../bin/x64/x64_dbg" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x64/" />
|
||||
<Option type="3" />
|
||||
<Option compiler="gnu_gcc_compiler_x64" />
|
||||
<Option host_application="../bin/x64/x64_dbg.exe" />
|
||||
<Option run_host_application_in_terminal="0" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-O3" />
|
||||
<Add option="-Wno-narrowing" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="..\bin\x64\libx64_bridge.a" />
|
||||
<Add library=".\TitanEngine\TitanEngine_x64.a" />
|
||||
<Add library=".\libdbg_x64.a" />
|
||||
<Add library=".\dbghelp\dbghelp_x64.a" />
|
||||
<Add library=".\sqlite\libsqlite64.a" />
|
||||
<Add library=".\BeaEngine\libBeaEngine_64.a" />
|
||||
<Add library=".\XEDParse\XEDParse_x64.a" />
|
||||
<Add library=".\DeviceNameResolver\DeviceNameResolver_x64.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions -Wno-format" />
|
||||
<Add option="-DBUILD_DBG" />
|
||||
<Add directory="$(project_dir)" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-static" />
|
||||
<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="XEDParse/XEDParse.h" />
|
||||
<Unit filename="_exports.cpp" />
|
||||
<Unit filename="_exports.h" />
|
||||
<Unit filename="_global.cpp" />
|
||||
<Unit filename="_global.h" />
|
||||
<Unit filename="_plugin_types.h" />
|
||||
<Unit filename="_plugins.cpp" />
|
||||
<Unit filename="_plugins.h" />
|
||||
<Unit filename="addrinfo.cpp" />
|
||||
<Unit filename="addrinfo.h" />
|
||||
<Unit filename="argument.cpp" />
|
||||
<Unit filename="argument.h" />
|
||||
<Unit filename="assemble.cpp" />
|
||||
<Unit filename="assemble.h" />
|
||||
<Unit filename="breakpoint.cpp" />
|
||||
<Unit filename="breakpoint.h" />
|
||||
<Unit filename="command.cpp" />
|
||||
<Unit filename="command.h" />
|
||||
<Unit filename="console.cpp" />
|
||||
<Unit filename="console.h" />
|
||||
<Unit filename="data.h" />
|
||||
<Unit filename="dbg.h" />
|
||||
<Unit filename="dbghelp/dbghelp.h" />
|
||||
<Unit filename="debugger.cpp" />
|
||||
<Unit filename="debugger.h" />
|
||||
<Unit filename="disasm_fast.cpp" />
|
||||
<Unit filename="disasm_fast.h" />
|
||||
<Unit filename="disasm_helper.cpp" />
|
||||
<Unit filename="disasm_helper.h" />
|
||||
<Unit filename="instruction.cpp" />
|
||||
<Unit filename="instruction.h" />
|
||||
<Unit filename="main.cpp" />
|
||||
<Unit filename="math.cpp" />
|
||||
<Unit filename="math.h" />
|
||||
<Unit filename="memory.cpp" />
|
||||
<Unit filename="memory.h" />
|
||||
<Unit filename="msgqueue.cpp" />
|
||||
<Unit filename="msgqueue.h" />
|
||||
<Unit filename="plugin_loader.cpp" />
|
||||
<Unit filename="plugin_loader.h" />
|
||||
<Unit filename="reference.cpp" />
|
||||
<Unit filename="reference.h" />
|
||||
<Unit filename="simplescript.cpp" />
|
||||
<Unit filename="simplescript.h" />
|
||||
<Unit filename="sqlhelper.cpp" />
|
||||
<Unit filename="sqlhelper.h" />
|
||||
<Unit filename="sqlite/sqlite3.h" />
|
||||
<Unit filename="stackinfo.cpp" />
|
||||
<Unit filename="stackinfo.h" />
|
||||
<Unit filename="symbolinfo.cpp" />
|
||||
<Unit filename="symbolinfo.h" />
|
||||
<Unit filename="thread.cpp" />
|
||||
<Unit filename="thread.h" />
|
||||
<Unit filename="threading.cpp" />
|
||||
<Unit filename="threading.h" />
|
||||
<Unit filename="undocumented.h" />
|
||||
<Unit filename="value.cpp" />
|
||||
<Unit filename="value.h" />
|
||||
<Unit filename="variable.cpp" />
|
||||
<Unit filename="variable.h" />
|
||||
<Unit filename="x64_dbg.cpp" />
|
||||
<Unit filename="x64_dbg.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
<DoxyBlocks>
|
||||
<comment_style block="0" line="0" />
|
||||
<doxyfile_project />
|
||||
<doxyfile_build />
|
||||
<doxyfile_warnings />
|
||||
<doxyfile_output />
|
||||
<doxyfile_dot />
|
||||
<general />
|
||||
</DoxyBlocks>
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
|
|
@ -25,10 +25,10 @@
|
|||
<ClCompile Include="math.cpp" />
|
||||
<ClCompile Include="memory.cpp" />
|
||||
<ClCompile Include="msgqueue.cpp" />
|
||||
<ClCompile Include="murmurhash.cpp" />
|
||||
<ClCompile Include="plugin_loader.cpp" />
|
||||
<ClCompile Include="reference.cpp" />
|
||||
<ClCompile Include="simplescript.cpp" />
|
||||
<ClCompile Include="sqlhelper.cpp" />
|
||||
<ClCompile Include="stackinfo.cpp" />
|
||||
<ClCompile Include="symbolinfo.cpp" />
|
||||
<ClCompile Include="thread.cpp" />
|
||||
|
|
@ -52,22 +52,24 @@
|
|||
<ClInclude Include="command.h" />
|
||||
<ClInclude Include="console.h" />
|
||||
<ClInclude Include="data.h" />
|
||||
<ClInclude Include="dbg.h" />
|
||||
<ClInclude Include="dbghelp\dbghelp.h" />
|
||||
<ClInclude Include="dbg\dbg.h" />
|
||||
<ClInclude Include="debugger.h" />
|
||||
<ClInclude Include="DeviceNameResolver\DeviceNameResolver.h" />
|
||||
<ClInclude Include="disasm_fast.h" />
|
||||
<ClInclude Include="disasm_helper.h" />
|
||||
<ClInclude Include="instruction.h" />
|
||||
<ClInclude Include="jansson\jansson.h" />
|
||||
<ClInclude Include="jansson\jansson_config.h" />
|
||||
<ClInclude Include="lz4\lz4.h" />
|
||||
<ClInclude Include="lz4\lz4file.h" />
|
||||
<ClInclude Include="lz4\lz4hc.h" />
|
||||
<ClInclude Include="math.h" />
|
||||
<ClInclude Include="memory.h" />
|
||||
<ClInclude Include="msgqueue.h" />
|
||||
<ClInclude Include="murmurhash.h" />
|
||||
<ClInclude Include="plugin_loader.h" />
|
||||
<ClInclude Include="reference.h" />
|
||||
<ClInclude Include="simplescript.h" />
|
||||
<ClInclude Include="sqlhelper.h" />
|
||||
<ClInclude Include="sqlite\sqlite3.h" />
|
||||
<ClInclude Include="stackinfo.h" />
|
||||
<ClInclude Include="symbolinfo.h" />
|
||||
<ClInclude Include="thread.h" />
|
||||
|
|
@ -130,7 +132,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32_bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;sqlite\sqlite32.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>lz4\lz4_x86.lib;jansson\jansson_x86.lib;DeviceNameResolver\DeviceNameResolver_x86.lib;XEDParse\XEDParse_x86.lib;$(SolutionDir)bin\x32\x32_bridge.lib;dbghelp\dbghelp_x86.lib;TitanEngine\TitanEngine_x86.lib;BeaEngine\BeaEngine.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
|
@ -145,7 +147,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64_bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;sqlite\sqlite64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>lz4\lz4_x64.lib;jansson\jansson_x64.lib;DeviceNameResolver\DeviceNameResolver_x64.lib;XEDParse\XEDParse_x64.lib;$(SolutionDir)bin\x64\x64_bridge.lib;dbghelp\dbghelp_x64.lib;TitanEngine\TitanEngine_x64.lib;BeaEngine\BeaEngine_64.lib;psapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
|||
|
|
@ -19,12 +19,6 @@
|
|||
<Filter Include="Header Files\dbghelp">
|
||||
<UniqueIdentifier>{5623fb24-3b6d-49a6-a0d3-1cfcc46f87bd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\sqlite">
|
||||
<UniqueIdentifier>{fa9d17d3-a464-4693-b1d8-0d0c10a88bd1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\dbg">
|
||||
<UniqueIdentifier>{c7d6554c-6b4c-42b2-8d0a-7968cdfdba63}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\TitanEngine">
|
||||
<UniqueIdentifier>{23226861-3b20-42db-8dd6-c5d276ba7a83}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
|
@ -34,6 +28,12 @@
|
|||
<Filter Include="Header Files\DeviceNameResolver">
|
||||
<UniqueIdentifier>{f4eb1487-15d6-4836-9d20-339d0f18c31f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\jansson">
|
||||
<UniqueIdentifier>{b63305e2-2b10-46eb-839f-5e9080fa8ad8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\lz4">
|
||||
<UniqueIdentifier>{6a8d58f0-1417-4bff-aecd-0f9f5e0641f9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="_exports.cpp">
|
||||
|
|
@ -90,9 +90,6 @@
|
|||
<ClCompile Include="x64_dbg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sqlhelper.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="plugin_loader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -120,6 +117,9 @@
|
|||
<ClCompile Include="reference.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="murmurhash.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="_exports.h">
|
||||
|
|
@ -146,9 +146,6 @@
|
|||
<ClInclude Include="data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dbg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="debugger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -179,9 +176,6 @@
|
|||
<ClInclude Include="x64_dbg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sqlhelper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="plugin_loader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -230,20 +224,32 @@
|
|||
<ClInclude Include="dbghelp\dbghelp.h">
|
||||
<Filter>Header Files\dbghelp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dbg\dbg.h">
|
||||
<Filter>Header Files\dbg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="XEDParse\XEDParse.h">
|
||||
<Filter>Header Files\XEDParse</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TitanEngine\TitanEngine.h">
|
||||
<Filter>Header Files\TitanEngine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sqlite\sqlite3.h">
|
||||
<Filter>Header Files\sqlite</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DeviceNameResolver\DeviceNameResolver.h">
|
||||
<Filter>Header Files\DeviceNameResolver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jansson\jansson.h">
|
||||
<Filter>Header Files\jansson</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="jansson\jansson_config.h">
|
||||
<Filter>Header Files\jansson</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="murmurhash.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lz4\lz4.h">
|
||||
<Filter>Header Files\lz4</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lz4\lz4file.h">
|
||||
<Filter>Header Files\lz4</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lz4\lz4hc.h">
|
||||
<Filter>Header Files\lz4</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="x64_dbg_exe" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="x32">
|
||||
<Option output="../bin/x32/x32_dbg" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x32" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option use_console_runner="0" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="..\bin\x32\libx32_bridge.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="x64">
|
||||
<Option output="../bin/x64/x64_dbg" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/x64" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gnu_gcc_compiler_x64" />
|
||||
<Option use_console_runner="0" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="..\bin\x64\libx64_bridge.a" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fexceptions" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-static" />
|
||||
</Linker>
|
||||
<Unit filename="resource.h" />
|
||||
<Unit filename="resource.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="x64_dbg_exe.cpp" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
|
|
@ -516,6 +516,7 @@ void CPUDisassembly::setLabel()
|
|||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
void CPUDisassembly::setComment()
|
||||
|
|
@ -539,6 +540,7 @@ void CPUDisassembly::setComment()
|
|||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
void CPUDisassembly::setBookmark()
|
||||
|
|
@ -559,6 +561,7 @@ void CPUDisassembly::setBookmark()
|
|||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
void CPUDisassembly::toggleFunction()
|
||||
|
|
@ -654,8 +657,7 @@ void CPUDisassembly::assembleAt()
|
|||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
|
||||
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
void CPUDisassembly::gotoExpression()
|
||||
|
|
|
|||
|
|
@ -234,6 +234,7 @@ void CPUDump::setLabelSlot()
|
|||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
void CPUDump::gotoExpressionSlot()
|
||||
|
|
|
|||
Loading…
Reference in New Issue