diff --git a/src/bridge/bridgemain.cpp b/src/bridge/bridgemain.cpp index 6390b5b5..92787439 100644 --- a/src/bridge/bridgemain.cpp +++ b/src/bridge/bridgemain.cpp @@ -31,7 +31,7 @@ static bool bDisableGUIUpdate; szLib=name; \ hInst=LoadLibraryW(name); \ if(!hInst) \ - return L"Error loading library \"" L#name L"\"!" + return L"Error loading library \"" name L"\"!" #define LOADEXPORT(name) \ *((FARPROC*)&name)=GetProcAddress(hInst, #name); \ diff --git a/src/dbg/debugger.cpp b/src/dbg/debugger.cpp index beb23d23..5fe03b2c 100644 --- a/src/dbg/debugger.cpp +++ b/src/dbg/debugger.cpp @@ -515,6 +515,8 @@ static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr bp.addr += ModBaseFromAddr(CIP); bp.active = true; //a breakpoint that has been hit is active + varset("$breakpointcounter", bp.hitcount, false); //save the breakpoint counter as a variable + //get condition values bool breakCondition; bool logCondition; @@ -581,7 +583,42 @@ static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr if(*bp.commandText && commandCondition) //command { //TODO: commands like run/step etc will fuck up your shit - DbgCmdExec(bp.commandText); + varset("$breakpointcondition", breakCondition ? 1 : 0, false); + varset("$breakpointlogcondition", logCondition, false); + _dbg_dbgcmddirectexec(bp.commandText); + duint script_breakcondition; + int size; + VAR_TYPE type; + if(varget("$breakpointcondition", &script_breakcondition, &size, &type)) + { + if(script_breakcondition != 0) + { + breakCondition = true; + if(bp.singleshoot) + BpDelete(bp.addr, bptype); + switch(bptype) + { + case BPNORMAL: + printSoftBpInfo(bp); + break; + case BPHARDWARE: + printHwBpInfo(bp); + break; + case BPMEMORY: + printMemBpInfo(bp, ExceptionAddress); + break; + default: + break; + } + GuiSetDebugState(paused); + DebugUpdateGui(CIP, true); + PLUG_CB_PAUSEDEBUG pauseInfo; + pauseInfo.reserved = nullptr; + plugincbcall(CB_PAUSEDEBUG, &pauseInfo); + } + else + breakCondition = false; + } } if(breakCondition) //break the debugger { diff --git a/src/dbg/stringformat.cpp b/src/dbg/stringformat.cpp index 7c7b9a7b..476da357 100644 --- a/src/dbg/stringformat.cpp +++ b/src/dbg/stringformat.cpp @@ -217,5 +217,7 @@ String stringformatinline(String format) } if(inFormatter && formatString.size()) output += handleFormatStringInline(formatString); + else if(inFormatter) + output += "{"; return output; -} \ No newline at end of file +} diff --git a/src/dbg/variable.cpp b/src/dbg/variable.cpp index 472ff9b7..ddfc373d 100644 --- a/src/dbg/variable.cpp +++ b/src/dbg/variable.cpp @@ -80,6 +80,11 @@ void varinit() // Hidden variables varnew("$ans\1$an", 0, VAR_HIDDEN); + // Breakpoint variables + varnew("$breakpointcondition", 0, VAR_SYSTEM); + varnew("$breakpointcounter", 0, VAR_SYSTEM); + varnew("$breakpointlogcondition", 0, VAR_SYSTEM); + // Read-only variables varnew("$lastalloc", 0, VAR_READONLY); // Last memory allocation varnew("$_EZ_FLAG", 0, VAR_READONLY); // Equal/zero flag for internal use (1 = equal, 0 = unequal) @@ -373,4 +378,4 @@ bool varenum(VAR* List, size_t* Size) } return true; -} \ No newline at end of file +}