DBG+GUI+BRIDGE+PROJECT: updated AStyle and formatting
parent
033a495925
commit
d5e578ee6a
BIN
hooks/AStyle.dll
BIN
hooks/AStyle.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,30 +1,5 @@
|
|||
# hooks
|
||||
|
||||
This contains two binaries `AStyleWhore.exe` and `AStyle.dll` to format any code before you commit. They are signed with GPG.
|
||||
This contains two binaries `AStyleWhore.exe` and `AStyle.dll` to format any code before you commit. They are signed with the serial number `37 ba b6 0f 84 53 0e 5e e5 76 ba d2 6d 45 4b 58`.
|
||||
|
||||
To verify:
|
||||
|
||||
```
|
||||
gpg --verify AStyle.dll.sig AStyle.dll
|
||||
gpg: Signature made 07/08/16 06:01:39 W. Europe Daylight Time using RSA key ID AA0073B4
|
||||
gpg: Good signature from "Duncan Ogilvie <mr.exodia.tpodt@gmail.com>" [ultimate]
|
||||
|
||||
gpg --verify AStyleWhore.exe.sig AStyleWhore.exe
|
||||
gpg: Signature made 07/08/16 06:01:42 W. Europe Daylight Time using RSA key ID AA0073B4
|
||||
gpg: Good signature from "Duncan Ogilvie <mr.exodia.tpodt@gmail.com>" [ultimate]
|
||||
```
|
||||
|
||||
The *key ID* should match the last 8 characters of the signature of [this commit](https://github.com/x64dbg/x64dbg/commit/c855c15fd79870312ea5b4a1fbf3cb0dd8ae6240).
|
||||
|
||||
Git hashes are:
|
||||
|
||||
```
|
||||
git ls-files -s
|
||||
100644 6ef20910c6ab4e94cc2270e289a5b73d712c9c50 0 AStyle.dll
|
||||
100644 5ea8a5daf0580e030406cedb83fb73ca9c187138 0 AStyle.dll.sig
|
||||
100644 10dd63522b059eb3a43c01b35b807a9d50b5034d 0 AStyleWhore.exe
|
||||
100644 d910d7ff178703b1452bc717491e5c24b9db1945 0 AStyleWhore.exe.sig
|
||||
100644 0706138f1ec594c0b5d41978900b9d45cd2d99d7 0 pre-commit
|
||||
```
|
||||
|
||||
If you are unsure about the integrity of the files, don't hesitate to contact me (mrexodia). The source code is available at [BitBucket](https://bitbucket.org/mrexodia/astylewhore). The version of `AStyle.dll` is compiled from `AStyle_2.04_windows.zip` which came from [Sourceforge](https://sourceforge.net/projects/astyle/files/astyle/astyle%202.04/AStyle_2.04_windows.zip/download).
|
||||
If you are unsure about the integrity of the files, don't hesitate to contact me (mrexodia). The source code is available at [BitBucket](https://bitbucket.org/mrexodia/astylewhore). The version of `AStyle.dll` is compiled from `AStyle_2.06_windows.zip` which came from [Sourceforge](https://sourceforge.net/projects/astyle/files/astyle/astyle%202.06/AStyle_2.06_windows.zip/download).
|
|
@ -54,7 +54,7 @@ public:
|
|||
*/
|
||||
int Count() const
|
||||
{
|
||||
if(_listInfo.size != _listInfo.count * sizeof(Type)) //make sure the user is using the correct type.
|
||||
if(_listInfo.size != _listInfo.count * sizeof(Type)) //make sure the user is using the correct type.
|
||||
__debugbreak();
|
||||
return _listInfo.count;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
*/
|
||||
Type & operator[](size_t index) const
|
||||
{
|
||||
if(index >= size_t(Count())) //make sure the out-of-bounds access is caught as soon as possible.
|
||||
if(index >= size_t(Count())) //make sure the out-of-bounds access is caught as soon as possible.
|
||||
__debugbreak();
|
||||
return Data()[index];
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ BRIDGE_IMPEXP bool BridgeSettingRead(int* errorLine)
|
|||
}
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
if(success) //if we failed to read the file, the current settings are better than none at all
|
||||
if(success) //if we failed to read the file, the current settings are better than none at all
|
||||
{
|
||||
EnterCriticalSection(&csIni);
|
||||
int errline = 0;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c1bf5682a05836e5f54319db92248116a4a9ccc6
|
||||
Subproject commit 05adc360018b6810cb0a6bbaa247de6522bdf9c5
|
|
@ -202,11 +202,11 @@ static bool getLabel(duint addr, char* label, bool noFuncOffset)
|
|||
strncat_s(label, MAX_LABEL_SIZE, temp, _TRUNCATE);
|
||||
}
|
||||
}
|
||||
if(!retval) //search for CALL <jmp.&user32.MessageBoxA>
|
||||
if(!retval) //search for CALL <jmp.&user32.MessageBoxA>
|
||||
{
|
||||
BASIC_INSTRUCTION_INFO basicinfo;
|
||||
memset(&basicinfo, 0, sizeof(BASIC_INSTRUCTION_INFO));
|
||||
if(disasmfast(addr, &basicinfo, true) && basicinfo.branch && !basicinfo.call && basicinfo.memory.value) //thing is a JMP
|
||||
if(disasmfast(addr, &basicinfo, true) && basicinfo.branch && !basicinfo.call && basicinfo.memory.value) //thing is a JMP
|
||||
{
|
||||
duint val = 0;
|
||||
if(MemRead(basicinfo.memory.value, &val, sizeof(val), nullptr, true))
|
||||
|
@ -229,7 +229,7 @@ static bool getLabel(duint addr, char* label, bool noFuncOffset)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(!retval) //search for module entry
|
||||
if(!retval) //search for module entry
|
||||
{
|
||||
if(addr != 0 && ModEntryFromAddr(addr) == addr)
|
||||
{
|
||||
|
@ -825,7 +825,7 @@ extern "C" DLL_EXPORT duint _dbg_sendmessage(DBGMSG type, void* param1, void* pa
|
|||
{
|
||||
if(dbgisstopped())
|
||||
{
|
||||
switch(type) //ignore win events
|
||||
switch(type) //ignore win events
|
||||
{
|
||||
//these functions are safe to call when we did not initialize yet
|
||||
case DBG_DEINITIALIZE_LOCKS:
|
||||
|
|
|
@ -125,7 +125,7 @@ PLUG_IMPEXP void _plugin_startscript(CBPLUGINSCRIPT cbScript)
|
|||
|
||||
PLUG_IMPEXP bool _plugin_waituntilpaused()
|
||||
{
|
||||
while(DbgIsDebugging() && dbgisrunning()) //wait until the debugger paused
|
||||
while(DbgIsDebugging() && dbgisrunning()) //wait until the debugger paused
|
||||
{
|
||||
Sleep(1);
|
||||
GuiProcessEvents(); //workaround for scripts being executed on the GUI thread
|
||||
|
|
|
@ -85,7 +85,7 @@ void AdvancedAnalysis::analyzeFunction(duint entryPoint, bool writedata)
|
|||
{
|
||||
auto start = queue.front();
|
||||
queue.pop();
|
||||
if(visited.count(start) || !inRange(start)) //already visited or out of range
|
||||
if(visited.count(start) || !inRange(start)) //already visited or out of range
|
||||
continue;
|
||||
visited.insert(start);
|
||||
|
||||
|
@ -106,11 +106,11 @@ void AdvancedAnalysis::analyzeFunction(duint entryPoint, bool writedata)
|
|||
for(int i = 1; i < mCp.Size(); i++)
|
||||
mEncMap[node.end - mBase + i] = (byte)enc_middle;
|
||||
}
|
||||
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //jump
|
||||
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //jump
|
||||
{
|
||||
//set the branch destinations
|
||||
node.brtrue = mCp.BranchDestination();
|
||||
if(mCp.GetId() != X86_INS_JMP) //unconditional jumps dont have a brfalse
|
||||
if(mCp.GetId() != X86_INS_JMP) //unconditional jumps dont have a brfalse
|
||||
node.brfalse = node.end + mCp.Size();
|
||||
|
||||
//add node to the function graph
|
||||
|
@ -124,14 +124,14 @@ void AdvancedAnalysis::analyzeFunction(duint entryPoint, bool writedata)
|
|||
|
||||
break;
|
||||
}
|
||||
if(mCp.InGroup(CS_GRP_CALL)) //call
|
||||
if(mCp.InGroup(CS_GRP_CALL)) //call
|
||||
{
|
||||
//TODO: handle no return
|
||||
duint target = mCp.BranchDestination();
|
||||
if(inRange(target) && mEntryPoints.find(target) == mEntryPoints.end())
|
||||
mCandidateEPs.insert(target);
|
||||
}
|
||||
if(mCp.InGroup(CS_GRP_RET)) //return
|
||||
if(mCp.InGroup(CS_GRP_RET)) //return
|
||||
{
|
||||
node.terminal = true;
|
||||
graph.AddNode(node);
|
||||
|
|
|
@ -154,14 +154,14 @@ void ControlFlowAnalysis::BasicBlockStarts()
|
|||
{
|
||||
bSkipFilling = true; //skip INT3/NOP/whatever filling bytes (those are not part of the control flow)
|
||||
}
|
||||
else if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //branches
|
||||
else if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //branches
|
||||
{
|
||||
auto dest1 = getReferenceOperand();
|
||||
duint dest2 = 0;
|
||||
if(mCp.GetId() != X86_INS_JMP) //conditional jump
|
||||
if(mCp.GetId() != X86_INS_JMP) //conditional jump
|
||||
dest2 = addr + mCp.Size();
|
||||
|
||||
if(!dest1 && !dest2) //TODO: better code for this (make sure absolutely no filling is inserted)
|
||||
if(!dest1 && !dest2) //TODO: better code for this (make sure absolutely no filling is inserted)
|
||||
bSkipFilling = true;
|
||||
if(dest1)
|
||||
mBlockStarts.insert(dest1);
|
||||
|
@ -224,7 +224,7 @@ void ControlFlowAnalysis::BasicBlocks()
|
|||
}
|
||||
else
|
||||
addr++;
|
||||
if(addr == nextStart) //special case handling overlapping blocks
|
||||
if(addr == nextStart) //special case handling overlapping blocks
|
||||
{
|
||||
insertBlock(BasicBlock(start, prevaddr, 0, nextStart));
|
||||
insertParent(nextStart, start);
|
||||
|
@ -263,7 +263,7 @@ void ControlFlowAnalysis::Functions()
|
|||
auto parents = findParents(block->start);
|
||||
if(!block->function)
|
||||
{
|
||||
if(!parents || mFunctionStarts.count(block->start)) //no parents = function start
|
||||
if(!parents || mFunctionStarts.count(block->start)) //no parents = function start
|
||||
{
|
||||
auto functionStart = block->start;
|
||||
block->function = functionStart;
|
||||
|
@ -274,7 +274,7 @@ void ControlFlowAnalysis::Functions()
|
|||
else //in function
|
||||
{
|
||||
auto function = findFunctionStart(block, parents);
|
||||
if(!function) //this happens with loops / unreferenced blocks sometimes
|
||||
if(!function) //this happens with loops / unreferenced blocks sometimes
|
||||
delayedBlocks.push_back(DelayedBlock(block, parents));
|
||||
else
|
||||
block->function = function;
|
||||
|
@ -315,7 +315,7 @@ void ControlFlowAnalysis::Functions()
|
|||
for(const auto & block : mBlocks)
|
||||
{
|
||||
auto found = mFunctions.find(block.second.function);
|
||||
if(found == mFunctions.end()) //unreferenced block
|
||||
if(found == mFunctions.end()) //unreferenced block
|
||||
{
|
||||
unreferencedCount++;
|
||||
continue;
|
||||
|
@ -425,7 +425,7 @@ duint ControlFlowAnalysis::getReferenceOperand() const
|
|||
else if(op.type == X86_OP_MEM)
|
||||
{
|
||||
auto dest = duint(op.mem.disp);
|
||||
if(op.mem.base == X86_REG_RIP) //rip-relative
|
||||
if(op.mem.base == X86_REG_RIP) //rip-relative
|
||||
dest += mCp.Address() + mCp.Size();
|
||||
if(inRange(dest))
|
||||
return dest;
|
||||
|
|
|
@ -62,7 +62,7 @@ void LinearAnalysis::analyseFunctions()
|
|||
for(size_t i = 0; i < mFunctions.size(); i++)
|
||||
{
|
||||
auto & function = mFunctions[i];
|
||||
if(function.end) //skip already-analysed functions
|
||||
if(function.end) //skip already-analysed functions
|
||||
continue;
|
||||
auto maxaddr = mBase + mSize;
|
||||
if(i < mFunctions.size() - 1)
|
||||
|
@ -96,19 +96,19 @@ duint LinearAnalysis::findFunctionEnd(duint start, duint maxaddr)
|
|||
{
|
||||
if(mCp.Disassemble(addr, translateAddr(addr), MAX_DISASM_BUFFER))
|
||||
{
|
||||
if(addr + mCp.Size() > maxaddr) //we went past the maximum allowed address
|
||||
if(addr + mCp.Size() > maxaddr) //we went past the maximum allowed address
|
||||
break;
|
||||
|
||||
const auto & op = mCp.x86().operands[0];
|
||||
if((mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) && op.type == X86_OP_IMM) //jump
|
||||
if((mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) && op.type == X86_OP_IMM) //jump
|
||||
{
|
||||
auto dest = duint(op.imm);
|
||||
|
||||
if(dest >= maxaddr) //jump across function boundaries
|
||||
if(dest >= maxaddr) //jump across function boundaries
|
||||
{
|
||||
//currently unused
|
||||
}
|
||||
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
|
||||
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
|
||||
{
|
||||
fardest = dest;
|
||||
}
|
||||
|
@ -117,10 +117,10 @@ duint LinearAnalysis::findFunctionEnd(duint start, duint maxaddr)
|
|||
jumpback = addr;
|
||||
}
|
||||
}
|
||||
else if(mCp.InGroup(CS_GRP_RET)) //possible function end?
|
||||
else if(mCp.InGroup(CS_GRP_RET)) //possible function end?
|
||||
{
|
||||
end = addr;
|
||||
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
|
||||
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -137,9 +137,9 @@ duint LinearAnalysis::getReferenceOperand() const
|
|||
for(auto i = 0; i < mCp.OpCount(); i++)
|
||||
{
|
||||
const auto & op = mCp.x86().operands[i];
|
||||
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //skip jumps/loops
|
||||
if(mCp.InGroup(CS_GRP_JUMP) || mCp.IsLoop()) //skip jumps/loops
|
||||
continue;
|
||||
if(op.type == X86_OP_IMM) //we are looking for immediate references
|
||||
if(op.type == X86_OP_IMM) //we are looking for immediate references
|
||||
{
|
||||
auto dest = duint(op.imm);
|
||||
if(inRange(dest))
|
||||
|
|
|
@ -120,7 +120,7 @@ void RecursiveAnalysis::analyzeFunction(duint entryPoint)
|
|||
{
|
||||
//set the branch destinations
|
||||
node.brtrue = mCp.BranchDestination();
|
||||
if(mCp.GetId() != X86_INS_JMP && mCp.GetId() != X86_INS_LJMP) //unconditional jumps dont have a brfalse
|
||||
if(mCp.GetId() != X86_INS_JMP && mCp.GetId() != X86_INS_LJMP) //unconditional jumps dont have a brfalse
|
||||
node.brfalse = node.end + mCp.Size();
|
||||
|
||||
//consider register/memory branches as terminal nodes
|
||||
|
|
|
@ -17,7 +17,7 @@ std::map<BreakpointKey, BREAKPOINT> breakpoints;
|
|||
|
||||
static void setBpActive(BREAKPOINT & bp)
|
||||
{
|
||||
if(bp.type == BPHARDWARE) //TODO: properly implement this (check debug registers)
|
||||
if(bp.type == BPHARDWARE) //TODO: properly implement this (check debug registers)
|
||||
bp.active = true;
|
||||
else if(bp.type == BPDLL || bp.type == BPEXCEPTION)
|
||||
bp.active = true;
|
||||
|
@ -478,7 +478,7 @@ bool BpEnumAll(BPENUMCALLBACK EnumCallback, const char* Module, duint base)
|
|||
BREAKPOINT bpInfo = j->second;
|
||||
if(bpInfo.type != BPDLL && bpInfo.type != BPEXCEPTION)
|
||||
{
|
||||
if(base) //workaround for some Windows bullshit with compatibility mode
|
||||
if(base) //workaround for some Windows bullshit with compatibility mode
|
||||
bpInfo.addr += base;
|
||||
else
|
||||
bpInfo.addr += ModBaseFromName(bpInfo.mod);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 90eed9913a12ef5afec007b4d91f77301b66cc76
|
||||
Subproject commit d5034cf6d647e98cb01e9e1fc4efa5086f8fc6a5
|
|
@ -155,12 +155,12 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
|
|||
dputs(QT_TRANSLATE_NOOP("DBG", "This may take very long, depending on your network connection and data in the debug directory..."));
|
||||
Memory<char*> szDefaultStore(MAX_SETTING_SIZE + 1);
|
||||
const char* szSymbolStore = szDefaultStore();
|
||||
if(!BridgeSettingGet("Symbols", "DefaultStore", szDefaultStore())) //get default symbol store from settings
|
||||
if(!BridgeSettingGet("Symbols", "DefaultStore", szDefaultStore())) //get default symbol store from settings
|
||||
{
|
||||
strcpy_s(szDefaultStore(), MAX_SETTING_SIZE, "https://msdl.microsoft.com/download/symbols");
|
||||
BridgeSettingSet("Symbols", "DefaultStore", szDefaultStore());
|
||||
}
|
||||
if(argc < 2) //no arguments
|
||||
if(argc < 2) //no arguments
|
||||
{
|
||||
SymDownloadAllSymbols(szSymbolStore); //download symbols for all modules
|
||||
GuiSymbolRefreshCurrent();
|
||||
|
@ -181,7 +181,7 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
|
|||
return false;
|
||||
}
|
||||
wchar_t szOldSearchPath[MAX_PATH] = L"";
|
||||
if(!SafeSymGetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath, MAX_PATH)) //backup current search path
|
||||
if(!SafeSymGetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath, MAX_PATH)) //backup current search path
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "SymGetSearchPath failed!"));
|
||||
return false;
|
||||
|
@ -190,12 +190,12 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
|
|||
if(argc > 2)
|
||||
szSymbolStore = argv[2];
|
||||
sprintf_s(szServerSearchPath, "SRV*%s*%s", szSymbolCachePath, szSymbolStore);
|
||||
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, StringUtils::Utf8ToUtf16(szServerSearchPath).c_str())) //set new search path
|
||||
if(!SafeSymSetSearchPathW(fdProcessInfo->hProcess, StringUtils::Utf8ToUtf16(szServerSearchPath).c_str())) //set new search path
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "SymSetSearchPath (1) failed!"));
|
||||
return false;
|
||||
}
|
||||
if(!SafeSymUnloadModule64(fdProcessInfo->hProcess, (DWORD64)modbase)) //unload module
|
||||
if(!SafeSymUnloadModule64(fdProcessInfo->hProcess, (DWORD64)modbase)) //unload module
|
||||
{
|
||||
SafeSymSetSearchPathW(fdProcessInfo->hProcess, szOldSearchPath);
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "SymUnloadModule64 failed!"));
|
||||
|
@ -203,7 +203,7 @@ bool cbDebugDownloadSymbol(int argc, char* argv[])
|
|||
}
|
||||
auto symOptions = SafeSymGetOptions();
|
||||
SafeSymSetOptions(symOptions & ~SYMOPT_IGNORE_CVREC);
|
||||
if(!SymLoadModuleExW(fdProcessInfo->hProcess, 0, wszModulePath, 0, (DWORD64)modbase, 0, 0, 0)) //load module
|
||||
if(!SymLoadModuleExW(fdProcessInfo->hProcess, 0, wszModulePath, 0, (DWORD64)modbase, 0, 0, 0)) //load module
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "SymLoadModuleEx failed!"));
|
||||
SafeSymSetOptions(symOptions);
|
||||
|
@ -405,7 +405,7 @@ bool cbInstrExinfo(int argc, char* argv[])
|
|||
dputs_untranslated("EXCEPTION_DEBUG_INFO:");
|
||||
dprintf_untranslated(" dwFirstChance: %X\n", info.dwFirstChance);
|
||||
auto exceptionName = ExceptionCodeToName(record.ExceptionCode);
|
||||
if(!exceptionName.size()) //if no exception was found, try the error codes (RPC_S_*)
|
||||
if(!exceptionName.size()) //if no exception was found, try the error codes (RPC_S_*)
|
||||
exceptionName = ErrorCodeToName(record.ExceptionCode);
|
||||
if(exceptionName.size())
|
||||
dprintf_untranslated(" ExceptionCode: %08X (%s)\n", record.ExceptionCode, exceptionName.c_str());
|
||||
|
|
|
@ -142,14 +142,14 @@ bool cbDebugSetBPX(int argc, char* argv[]) //bp addr [,name [,type]]
|
|||
|
||||
bool cbDebugDeleteBPX(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //delete all breakpoints
|
||||
if(argc < 2) //delete all breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPNORMAL))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No breakpoints to delete!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDeleteAllBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDeleteAllBreakpoints)) //at least one deletion failed
|
||||
{
|
||||
GuiUpdateAllViews();
|
||||
return false;
|
||||
|
@ -159,7 +159,7 @@ bool cbDebugDeleteBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!BpDelete(found.addr, BPNORMAL))
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ bool cbDebugDeleteBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -202,21 +202,21 @@ bool cbDebugDeleteBPX(int argc, char* argv[])
|
|||
|
||||
bool cbDebugEnableBPX(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //enable all breakpoints
|
||||
if(argc < 2) //enable all breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPNORMAL))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No breakpoints to enable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbEnableAllBreakpoints)) //at least one enable failed
|
||||
if(!BpEnumAll(cbEnableAllBreakpoints)) //at least one enable failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All breakpoints enabled!"));
|
||||
GuiUpdateAllViews();
|
||||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!SetBPX(found.addr, found.titantype, (void*)cbUserBreakpoint))
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ bool cbDebugEnableBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -260,21 +260,21 @@ bool cbDebugEnableBPX(int argc, char* argv[])
|
|||
|
||||
bool cbDebugDisableBPX(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //delete all breakpoints
|
||||
if(argc < 2) //delete all breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPNORMAL))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No breakpoints to disable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDisableAllBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDisableAllBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All breakpoints disabled!"));
|
||||
GuiUpdateAllViews();
|
||||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPNORMAL, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!BpEnable(found.addr, BPNORMAL, false))
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ bool cbDebugDisableBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPNORMAL, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -475,21 +475,21 @@ bool cbDebugSetHardwareBreakpoint(int argc, char* argv[])
|
|||
|
||||
bool cbDebugDeleteHardwareBreakpoint(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //delete all breakpoints
|
||||
if(argc < 2) //delete all breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPHARDWARE))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No hardware breakpoints to delete!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDeleteAllHardwareBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDeleteAllHardwareBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All hardware breakpoints deleted!"));
|
||||
GuiUpdateAllViews();
|
||||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPHARDWARE, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPHARDWARE, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!BpDelete(found.addr, BPHARDWARE))
|
||||
{
|
||||
|
@ -504,7 +504,7 @@ bool cbDebugDeleteHardwareBreakpoint(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such hardware breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -532,14 +532,14 @@ bool cbDebugEnableHardwareBreakpoint(int argc, char* argv[])
|
|||
dputs(QT_TRANSLATE_NOOP("DBG", "You can only set 4 hardware breakpoints"));
|
||||
return false;
|
||||
}
|
||||
if(argc < 2) //enable all hardware breakpoints
|
||||
if(argc < 2) //enable all hardware breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPHARDWARE))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No hardware breakpoints to enable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbEnableAllHardwareBreakpoints)) //at least one enable failed
|
||||
if(!BpEnumAll(cbEnableAllHardwareBreakpoints)) //at least one enable failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All hardware breakpoints enabled!"));
|
||||
GuiUpdateAllViews();
|
||||
|
@ -547,7 +547,7 @@ bool cbDebugEnableHardwareBreakpoint(int argc, char* argv[])
|
|||
}
|
||||
BREAKPOINT found;
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such hardware breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -577,14 +577,14 @@ bool cbDebugEnableHardwareBreakpoint(int argc, char* argv[])
|
|||
|
||||
bool cbDebugDisableHardwareBreakpoint(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //delete all hardware breakpoints
|
||||
if(argc < 2) //delete all hardware breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPHARDWARE))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No hardware breakpoints to disable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDisableAllHardwareBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDisableAllHardwareBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All hardware breakpoints disabled!"));
|
||||
GuiUpdateAllViews();
|
||||
|
@ -592,7 +592,7 @@ bool cbDebugDisableHardwareBreakpoint(int argc, char* argv[])
|
|||
}
|
||||
BREAKPOINT found;
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPHARDWARE, 0, &found)) //invalid hardware breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such hardware breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -744,21 +744,21 @@ bool cbDebugSetMemoryBpx(int argc, char* argv[])
|
|||
|
||||
bool cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //delete all breakpoints
|
||||
if(argc < 2) //delete all breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPMEMORY))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No memory breakpoints to delete!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDeleteAllMemoryBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDeleteAllMemoryBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All memory breakpoints deleted!"));
|
||||
GuiUpdateAllViews();
|
||||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPMEMORY, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPMEMORY, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
duint size;
|
||||
MemFindBaseAddr(found.addr, &size);
|
||||
|
@ -775,7 +775,7 @@ bool cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such memory breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -799,14 +799,14 @@ bool cbDebugDeleteMemoryBreakpoint(int argc, char* argv[])
|
|||
|
||||
bool cbDebugEnableMemoryBreakpoint(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //enable all memory breakpoints
|
||||
if(argc < 2) //enable all memory breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPMEMORY))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No memory breakpoints to enable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbEnableAllMemoryBreakpoints)) //at least one enable failed
|
||||
if(!BpEnumAll(cbEnableAllMemoryBreakpoints)) //at least one enable failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All memory breakpoints enabled!"));
|
||||
GuiUpdateAllViews();
|
||||
|
@ -814,7 +814,7 @@ bool cbDebugEnableMemoryBreakpoint(int argc, char* argv[])
|
|||
}
|
||||
BREAKPOINT found;
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such memory breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -844,14 +844,14 @@ bool cbDebugEnableMemoryBreakpoint(int argc, char* argv[])
|
|||
|
||||
bool cbDebugDisableMemoryBreakpoint(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //disable all memory breakpoints
|
||||
if(argc < 2) //disable all memory breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPMEMORY))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No memory breakpoints to disable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDisableAllMemoryBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDisableAllMemoryBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All memory breakpoints disabled!"));
|
||||
GuiUpdateAllViews();
|
||||
|
@ -859,7 +859,7 @@ bool cbDebugDisableMemoryBreakpoint(int argc, char* argv[])
|
|||
}
|
||||
BREAKPOINT found;
|
||||
duint addr = 0;
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
|
||||
if(!valfromstring(argv[1], &addr) || !BpGet(addr, BPMEMORY, 0, &found)) //invalid memory breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such memory breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -984,7 +984,7 @@ bool cbDebugBcDll(int argc, char* argv[])
|
|||
dputs(QT_TRANSLATE_NOOP("DBG", "No DLL breakpoints to delete!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDeleteAllDllBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDeleteAllDllBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All DLL breakpoints deleted!"));
|
||||
DebugUpdateBreakpointsViewAsync();
|
||||
|
@ -1010,14 +1010,14 @@ bool cbDebugBcDll(int argc, char* argv[])
|
|||
|
||||
bool cbDebugBpDllEnable(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //disable all DLL breakpoints
|
||||
if(argc < 2) //disable all DLL breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPDLL))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No DLL breakpoints to enable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbEnableAllDllBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbEnableAllDllBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All DLL breakpoints enabled!"));
|
||||
GuiUpdateAllViews();
|
||||
|
@ -1025,7 +1025,7 @@ bool cbDebugBpDllEnable(int argc, char* argv[])
|
|||
}
|
||||
BREAKPOINT found;
|
||||
duint addr = 0;
|
||||
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
|
||||
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such DLL breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -1051,14 +1051,14 @@ bool cbDebugBpDllEnable(int argc, char* argv[])
|
|||
|
||||
bool cbDebugBpDllDisable(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //disable all DLL breakpoints
|
||||
if(argc < 2) //disable all DLL breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPDLL))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No DLL breakpoints to disable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDisableAllDllBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDisableAllDllBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All DLL breakpoints disabled!"));
|
||||
GuiUpdateAllViews();
|
||||
|
@ -1066,7 +1066,7 @@ bool cbDebugBpDllDisable(int argc, char* argv[])
|
|||
}
|
||||
BREAKPOINT found;
|
||||
duint addr = 0;
|
||||
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
|
||||
if(!BpGetAny(BPDLL, argv[1], &found)) //invalid DLL breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such DLL breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -1183,14 +1183,14 @@ bool cbDebugDeleteExceptionBPX(int argc, char* argv[])
|
|||
dputs(QT_TRANSLATE_NOOP("DBG", "No exception breakpoints to delete!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDeleteAllExceptionBreakpoints)) //at least one enable failed
|
||||
if(!BpEnumAll(cbDeleteAllExceptionBreakpoints)) //at least one enable failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All exception breakpoints deleted!"));
|
||||
DebugUpdateBreakpointsViewAsync();
|
||||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!BpDelete(found.addr, BPEXCEPTION))
|
||||
{
|
||||
|
@ -1200,7 +1200,7 @@ bool cbDebugDeleteExceptionBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
|
||||
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such exception breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -1217,21 +1217,21 @@ bool cbDebugDeleteExceptionBPX(int argc, char* argv[])
|
|||
|
||||
bool cbDebugEnableExceptionBPX(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //enable all breakpoints
|
||||
if(argc < 2) //enable all breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPEXCEPTION))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No exception breakpoints to enable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbEnableAllExceptionBreakpoints)) //at least one enable failed
|
||||
if(!BpEnumAll(cbEnableAllExceptionBreakpoints)) //at least one enable failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All exception breakpoints enabled!"));
|
||||
DebugUpdateBreakpointsViewAsync();
|
||||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!BpEnable(found.addr, BPEXCEPTION, true))
|
||||
{
|
||||
|
@ -1242,7 +1242,7 @@ bool cbDebugEnableExceptionBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
|
||||
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such exception breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
@ -1265,21 +1265,21 @@ bool cbDebugEnableExceptionBPX(int argc, char* argv[])
|
|||
|
||||
bool cbDebugDisableExceptionBPX(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2) //disable all breakpoints
|
||||
if(argc < 2) //disable all breakpoints
|
||||
{
|
||||
if(!BpGetCount(BPEXCEPTION))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No exception breakpoints to disable!"));
|
||||
return true;
|
||||
}
|
||||
if(!BpEnumAll(cbDisableAllExceptionBreakpoints)) //at least one deletion failed
|
||||
if(!BpEnumAll(cbDisableAllExceptionBreakpoints)) //at least one deletion failed
|
||||
return false;
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "All exception breakpoints disabled!"));
|
||||
GuiUpdateAllViews();
|
||||
return true;
|
||||
}
|
||||
BREAKPOINT found;
|
||||
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
|
||||
if(BpGet(0, BPEXCEPTION, argv[1], &found)) //found a breakpoint with name
|
||||
{
|
||||
if(!BpEnable(found.addr, BPEXCEPTION, false))
|
||||
{
|
||||
|
@ -1290,7 +1290,7 @@ bool cbDebugDisableExceptionBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
duint addr = 0;
|
||||
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
|
||||
if((!ExceptionNameToCode(argv[1], reinterpret_cast<unsigned int*>(&addr)) && !valfromstring(argv[1], &addr)) || !BpGet(addr, BPEXCEPTION, 0, &found)) //invalid breakpoint
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "No such exception breakpoint \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
|
|
@ -134,7 +134,7 @@ bool cbDebugStop(int argc, char* argv[])
|
|||
//history
|
||||
HistoryClear();
|
||||
DWORD BeginTick = GetTickCount();
|
||||
while(waitislocked(WAITID_STOP)) //custom waiting
|
||||
while(waitislocked(WAITID_STOP)) //custom waiting
|
||||
{
|
||||
unlock(WAITID_RUN);
|
||||
Sleep(100);
|
||||
|
|
|
@ -26,7 +26,7 @@ static bool ReadWriteVariable(const char* varname, const std::function<bool(duin
|
|||
if(!isvar || !valtostring(varname, set_value, true))
|
||||
{
|
||||
duint value;
|
||||
if(valfromstring(varname, &value)) //if the var is a value already it's an invalid destination
|
||||
if(valfromstring(varname, &value)) //if the var is a value already it's an invalid destination
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid variable \"%s\"\n"), varname);
|
||||
return false;
|
||||
|
@ -288,7 +288,7 @@ bool cbInstrCmp(int argc, char* argv[])
|
|||
ezflag = 1;
|
||||
else
|
||||
ezflag = 0;
|
||||
if(valuesignedcalc()) //signed comparision
|
||||
if(valuesignedcalc()) //signed comparision
|
||||
{
|
||||
if((dsint)arg1 < (dsint)arg2)
|
||||
bsflag = 0;
|
||||
|
@ -313,7 +313,7 @@ bool cbInstrMov(int argc, char* argv[])
|
|||
if(IsArgumentsLessThan(argc, 3))
|
||||
return false;
|
||||
String srcText = argv[2];
|
||||
if(srcText[0] == '#' && srcText[srcText.length() - 1] == '#') //handle mov addr, #DATA#
|
||||
if(srcText[0] == '#' && srcText[srcText.length() - 1] == '#') //handle mov addr, #DATA#
|
||||
{
|
||||
//do some checks on the data
|
||||
String dataText = srcText.substr(1, srcText.length() - 2);
|
||||
|
@ -355,7 +355,7 @@ bool cbInstrMov(int argc, char* argv[])
|
|||
if(!isvar || !valtostring(argv[1], set_value, true))
|
||||
{
|
||||
duint value;
|
||||
if(valfromstring(argv[1], &value)) //if the var is a value already it's an invalid destination
|
||||
if(valfromstring(argv[1], &value)) //if the var is a value already it's an invalid destination
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid dest \"%s\"\n"), argv[1]);
|
||||
return false;
|
||||
|
|
|
@ -37,12 +37,12 @@ bool cbInstrLog(int argc, char* argv[])
|
|||
dputs_untranslated(msg);
|
||||
scriptlog(msg);
|
||||
};
|
||||
if(argc == 1) //just log newline
|
||||
if(argc == 1) //just log newline
|
||||
{
|
||||
logputs("");
|
||||
return true;
|
||||
}
|
||||
if(argc == 2) //inline logging: log "format {rax}"
|
||||
if(argc == 2) //inline logging: log "format {rax}"
|
||||
{
|
||||
logputs(stringformatinline(argv[1]).c_str());
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ bool cbInstrFindAllMem(int argc, char* argv[])
|
|||
|
||||
static bool cbFindAsm(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
|
||||
{
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
{
|
||||
GuiReferenceInitialize(refinfo->name);
|
||||
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
|
||||
|
@ -372,7 +372,7 @@ struct VALUERANGE
|
|||
|
||||
static bool cbRefFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
|
||||
{
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
{
|
||||
GuiReferenceInitialize(refinfo->name);
|
||||
GuiReferenceAddColumn(sizeof(duint) * 2, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
|
||||
|
@ -454,7 +454,7 @@ bool cbInstrRefFindRange(int argc, char* argv[])
|
|||
|
||||
static bool cbRefStr(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
|
||||
{
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
{
|
||||
GuiReferenceInitialize(refinfo->name);
|
||||
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
|
||||
|
@ -467,7 +467,7 @@ static bool cbRefStr(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINF
|
|||
}
|
||||
bool found = false;
|
||||
char string[MAX_STRING_SIZE] = "";
|
||||
if(basicinfo->branch) //branches have no strings (jmp dword [401000])
|
||||
if(basicinfo->branch) //branches have no strings (jmp dword [401000])
|
||||
return false;
|
||||
auto addRef = [&]()
|
||||
{
|
||||
|
@ -524,7 +524,7 @@ bool cbInstrRefStr(int argc, char* argv[])
|
|||
|
||||
static bool cbModCallFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
|
||||
{
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
{
|
||||
GuiReferenceInitialize(refinfo->name);
|
||||
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
|
||||
|
@ -537,7 +537,7 @@ static bool cbModCallFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, R
|
|||
bool found = false;
|
||||
char label[MAX_LABEL_SIZE] = "";
|
||||
char module[MAX_MODULE_SIZE] = "";
|
||||
if(basicinfo->call) //we are looking for calls
|
||||
if(basicinfo->call) //we are looking for calls
|
||||
{
|
||||
duint ptr = basicinfo->addr > 0 ? basicinfo->addr : basicinfo->memory.value;
|
||||
found = DbgGetLabelAt(ptr, SEG_DEFAULT, label) && !LabelGet(ptr, label) && !strstr(label, "sub_") && DbgGetModuleAt(ptr, module); //a non-user label
|
||||
|
@ -674,7 +674,7 @@ struct GUIDRefInfo
|
|||
|
||||
static bool cbGUIDFind(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFINFO* refinfo)
|
||||
{
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
if(!disasm || !basicinfo) //initialize
|
||||
{
|
||||
GuiReferenceInitialize(refinfo->name);
|
||||
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Address")));
|
||||
|
@ -942,7 +942,7 @@ static int yaraScanCallback(int message, void* message_data, void* user_data)
|
|||
pattern = yara_print_string(match->data, match->match_length);
|
||||
auto offset = duint(match->base + match->offset);
|
||||
duint addr;
|
||||
if(scanInfo->rawFile) //convert raw offset to virtual offset
|
||||
if(scanInfo->rawFile) //convert raw offset to virtual offset
|
||||
addr = valfileoffsettova(scanInfo->modname, offset);
|
||||
else
|
||||
addr = base + offset;
|
||||
|
@ -1019,7 +1019,7 @@ bool cbInstrYara(int argc, char* argv[])
|
|||
base = addr;
|
||||
}
|
||||
std::vector<unsigned char> rawFileData;
|
||||
if(rawFile) //read the file from disk
|
||||
if(rawFile) //read the file from disk
|
||||
{
|
||||
char modPath[MAX_PATH] = "";
|
||||
if(!ModPathFromAddr(base, modPath, MAX_PATH))
|
||||
|
@ -1055,7 +1055,7 @@ bool cbInstrYara(int argc, char* argv[])
|
|||
if(yr_compiler_create(&yrCompiler) == ERROR_SUCCESS)
|
||||
{
|
||||
yr_compiler_set_callback(yrCompiler, yaraCompilerCallback, 0);
|
||||
if(yr_compiler_add_string(yrCompiler, rulesContent.c_str(), nullptr) == 0) //no errors found
|
||||
if(yr_compiler_add_string(yrCompiler, rulesContent.c_str(), nullptr) == 0) //no errors found
|
||||
{
|
||||
YR_RULES* yrRules;
|
||||
if(yr_compiler_get_rules(yrCompiler, &yrRules) == ERROR_SUCCESS)
|
||||
|
|
|
@ -50,7 +50,7 @@ bool cbDebugSwitchthread(int argc, char* argv[])
|
|||
if(argc > 1)
|
||||
if(!valfromstring(argv[1], &threadid, false))
|
||||
return false;
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
|
||||
return false;
|
||||
|
@ -72,7 +72,7 @@ bool cbDebugSuspendthread(int argc, char* argv[])
|
|||
if(argc > 1)
|
||||
if(!valfromstring(argv[1], &threadid, false))
|
||||
return false;
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
|
||||
return false;
|
||||
|
@ -94,7 +94,7 @@ bool cbDebugResumethread(int argc, char* argv[])
|
|||
if(argc > 1)
|
||||
if(!valfromstring(argv[1], &threadid, false))
|
||||
return false;
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
|
||||
return false;
|
||||
|
@ -120,7 +120,7 @@ bool cbDebugKillthread(int argc, char* argv[])
|
|||
if(argc > 2)
|
||||
if(!valfromstring(argv[2], &exitcode, false))
|
||||
return false;
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
|
||||
return false;
|
||||
|
@ -184,7 +184,7 @@ bool cbDebugSetPriority(int argc, char* argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
switch((int)priority) //check if the priority value is valid
|
||||
switch((int)priority) //check if the priority value is valid
|
||||
{
|
||||
case THREAD_PRIORITY_NORMAL:
|
||||
case THREAD_PRIORITY_ABOVE_NORMAL:
|
||||
|
@ -199,7 +199,7 @@ bool cbDebugSetPriority(int argc, char* argv[])
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
if(!ThreadIsValid((DWORD)threadid)) //check if the thread is valid
|
||||
{
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid thread %X\n"), DWORD(threadid));
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,7 @@ bool cbBadCmd(int argc, char* argv[])
|
|||
int valsize = 0;
|
||||
bool isvar = false;
|
||||
bool hexonly = false;
|
||||
if(valfromstring(*argv, &value, false, false, &valsize, &isvar, &hexonly, true)) //dump variable/value/register/etc
|
||||
if(valfromstring(*argv, &value, false, false, &valsize, &isvar, &hexonly, true)) //dump variable/value/register/etc
|
||||
{
|
||||
varset("$ans", value, true);
|
||||
if(valsize)
|
||||
|
@ -30,11 +30,11 @@ bool cbBadCmd(int argc, char* argv[])
|
|||
auto symbolic = SymGetSymbolicName(value);
|
||||
if(symbolic.length())
|
||||
symbolic = " " + symbolic;
|
||||
if(isvar) // and *cmd!='.' and *cmd!='x') //prevent stupid 0=0 stuff
|
||||
if(isvar) // and *cmd!='.' and *cmd!='x') //prevent stupid 0=0 stuff
|
||||
{
|
||||
if(value > 9 && !hexonly)
|
||||
{
|
||||
if(!valuesignedcalc()) //signed numbers
|
||||
if(!valuesignedcalc()) //signed numbers
|
||||
#ifdef _WIN64
|
||||
sprintf_s(format_str, "%%s=%%.%dllX (%%llud)%%s\n", valsize); // TODO: This and the following statements use "%llX" for a "int"-typed variable. Maybe we can use "%X" everywhere?
|
||||
#else //x86
|
||||
|
@ -58,7 +58,7 @@ bool cbBadCmd(int argc, char* argv[])
|
|||
{
|
||||
if(value > 9 && !hexonly)
|
||||
{
|
||||
if(!valuesignedcalc()) //signed numbers
|
||||
if(!valuesignedcalc()) //signed numbers
|
||||
#ifdef _WIN64
|
||||
sprintf_s(format_str, "%%s=%%.%dllX (%%llud)%%s\n", valsize);
|
||||
#else //x86
|
||||
|
@ -354,31 +354,31 @@ bool cbInstrVisualize(int argc, char* argv[])
|
|||
const unsigned char* curData = (addr >= _base && addr < _base + _size) ? _data() + (addr - _base) : nullptr;
|
||||
if(_cp.Disassemble(addr, curData, MAX_DISASM_BUFFER))
|
||||
{
|
||||
if(addr + _cp.Size() > maxaddr) //we went past the maximum allowed address
|
||||
if(addr + _cp.Size() > maxaddr) //we went past the maximum allowed address
|
||||
break;
|
||||
|
||||
const cs_x86_op & operand = _cp.x86().operands[0];
|
||||
if((_cp.InGroup(CS_GRP_JUMP) || _cp.IsLoop()) && operand.type == X86_OP_IMM) //jump
|
||||
if((_cp.InGroup(CS_GRP_JUMP) || _cp.IsLoop()) && operand.type == X86_OP_IMM) //jump
|
||||
{
|
||||
duint dest = (duint)operand.imm;
|
||||
|
||||
if(dest >= maxaddr) //jump across function boundaries
|
||||
if(dest >= maxaddr) //jump across function boundaries
|
||||
{
|
||||
//currently unused
|
||||
}
|
||||
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
|
||||
else if(dest > addr && dest > fardest) //save the farthest JXX destination forward
|
||||
{
|
||||
fardest = dest;
|
||||
}
|
||||
else if(end && dest < end && _cp.GetId() == X86_INS_JMP) //save the last JMP backwards
|
||||
else if(end && dest < end && _cp.GetId() == X86_INS_JMP) //save the last JMP backwards
|
||||
{
|
||||
jumpback = addr;
|
||||
}
|
||||
}
|
||||
else if(_cp.InGroup(CS_GRP_RET)) //possible function end?
|
||||
else if(_cp.InGroup(CS_GRP_RET)) //possible function end?
|
||||
{
|
||||
end = addr;
|
||||
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
|
||||
if(fardest < addr) //we stop if the farthest JXX destination forward is before this RET
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -641,7 +641,7 @@ static void printSoftBpInfo(const BREAKPOINT & bp)
|
|||
static void printHwBpInfo(const BREAKPOINT & bp)
|
||||
{
|
||||
const char* bpsize = "";
|
||||
switch(TITANGETSIZE(bp.titantype)) //size
|
||||
switch(TITANGETSIZE(bp.titantype)) //size
|
||||
{
|
||||
case UE_HARDWARE_SIZE_1:
|
||||
bpsize = "byte, ";
|
||||
|
@ -659,7 +659,7 @@ static void printHwBpInfo(const BREAKPOINT & bp)
|
|||
#endif //_WIN64
|
||||
}
|
||||
char* bptype;
|
||||
switch(TITANGETTYPE(bp.titantype)) //type
|
||||
switch(TITANGETTYPE(bp.titantype)) //type
|
||||
{
|
||||
case UE_HARDWARE_EXECUTE:
|
||||