1
0
Fork 0

DBG: add memory breakpoint size (unimplemented) to breakpoint database

This commit is contained in:
mrexodia 2017-08-13 16:27:55 +02:00
parent 9fcfb5b39e
commit b876d3b9f0
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 10 additions and 5 deletions

View File

@ -71,7 +71,7 @@ int BpGetList(std::vector<BREAKPOINT>* List)
return (int)breakpoints.size();
}
bool BpNew(duint Address, bool Enable, bool Singleshot, short OldBytes, BP_TYPE Type, DWORD TitanType, const char* Name)
bool BpNew(duint Address, bool Enable, bool Singleshot, short OldBytes, BP_TYPE Type, DWORD TitanType, const char* Name, duint memsize)
{
ASSERT_DEBUGGING("Export call");
@ -109,6 +109,7 @@ bool BpNew(duint Address, bool Enable, bool Singleshot, short OldBytes, BP_TYPE
bp.singleshoot = Singleshot;
bp.titantype = TitanType;
bp.type = Type;
bp.memsize = memsize;
// Insert new entry to the global list
EXCLUSIVE_ACQUIRE(LockBreakpoints);
@ -658,9 +659,10 @@ void BpCacheSave(JSON Root)
json_object_set_new(jsonObj, "address", json_hex(breakpoint.addr));
json_object_set_new(jsonObj, "enabled", json_boolean(breakpoint.enabled));
// "Normal" breakpoints save the old data
if(breakpoint.type == BPNORMAL)
if(breakpoint.type == BPNORMAL) // "Normal" breakpoints save the old data
json_object_set_new(jsonObj, "oldbytes", json_hex(breakpoint.oldbytes));
else if(breakpoint.type == BPMEMORY) // Memory breakpoints save the memory size
json_object_set_new(jsonObj, "memsize", json_hex(breakpoint.memsize));
json_object_set_new(jsonObj, "type", json_integer(breakpoint.type));
json_object_set_new(jsonObj, "titantype", json_hex(breakpoint.titantype));
@ -713,6 +715,8 @@ void BpCacheLoad(JSON Root)
breakpoint.type = (BP_TYPE)json_integer_value(json_object_get(value, "type"));
if(breakpoint.type == BPNORMAL)
breakpoint.oldbytes = (unsigned short)(json_hex_value(json_object_get(value, "oldbytes")) & 0xFFFF);
else if(breakpoint.type == BPMEMORY)
breakpoint.memsize = json_hex_value(json_object_get(value, "memsize"));
breakpoint.addr = (duint)json_hex_value(json_object_get(value, "address"));
breakpoint.enabled = json_boolean_value(json_object_get(value, "enabled"));
breakpoint.titantype = (DWORD)json_hex_value(json_object_get(value, "titantype"));

View File

@ -39,6 +39,7 @@ struct BREAKPOINT
char commandCondition[MAX_CONDITIONAL_EXPR_SIZE]; // condition to execute the command
uint32 hitcount; // hit counter
bool fastResume; // if true, debugger resumes without any GUI/Script/Plugin interaction.
duint memsize; // memory breakpoint size (not implemented)
};
// Breakpoint enumeration callback
@ -46,7 +47,7 @@ typedef bool (*BPENUMCALLBACK)(const BREAKPOINT* bp);
BREAKPOINT* BpInfoFromAddr(BP_TYPE Type, duint Address);
int BpGetList(std::vector<BREAKPOINT>* List);
bool BpNew(duint Address, bool Enable, bool Singleshot, short OldBytes, BP_TYPE Type, DWORD TitanType, const char* Name);
bool BpNew(duint Address, bool Enable, bool Singleshot, short OldBytes, BP_TYPE Type, DWORD TitanType, const char* Name, duint memsize = 0);
bool BpNewDll(const char* module, bool Enable, bool Singleshot, DWORD TitanType, const char* Name);
bool BpGet(duint Address, BP_TYPE Type, const char* Name, BREAKPOINT* Bp);
bool BpGetAny(BP_TYPE Type, const char* Name, BREAKPOINT* Bp);

View File

@ -730,7 +730,7 @@ bool cbDebugSetMemoryBpx(int argc, char* argv[])
dputs(QT_TRANSLATE_NOOP("DBG", "Memory breakpoint already set!"));
return true;
}
if(!BpNew(base, true, singleshoot, 0, BPMEMORY, type, 0))
if(!BpNew(base, true, singleshoot, 0, BPMEMORY, type, 0, size))
{
dputs(QT_TRANSLATE_NOOP("DBG", "Error setting memory breakpoint! (BpNew)"));
return false;