Fix some tiny issues (#803)
* fix "error loading library" error message it displays the macro name instead of the file name before * allow the ending { without escape to ease the input of source-like comments like "while(eax < 40) {" * set some variables before breakpoint command * breakpoint variables
This commit is contained in:
parent
4f45dff9e1
commit
5532333101
|
@ -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); \
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -217,5 +217,7 @@ String stringformatinline(String format)
|
|||
}
|
||||
if(inFormatter && formatString.size())
|
||||
output += handleFormatStringInline(formatString);
|
||||
else if(inFormatter)
|
||||
output += "{";
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue