1
0
Fork 0

DBG: resolved some issues with removing disabled breakpoints + fixed an issue with the database not being removed when every breakpoint etc was removed

This commit is contained in:
Mr. eXoDia 2014-07-18 17:03:25 +02:00
parent ab829cee65
commit fd621b76ed
2 changed files with 19 additions and 5 deletions

View File

@ -33,6 +33,8 @@ void dbsave()
json_dump_file(root, dbpath, JSON_INDENT(4)); json_dump_file(root, dbpath, JSON_INDENT(4));
LZ4_compress_file(dbpath, dbpath); LZ4_compress_file(dbpath, dbpath);
} }
else //remove database when nothing is in there
DeleteFileA(dbpath);
json_decref(root); //free root json_decref(root); //free root
dprintf("%ums\n", GetTickCount()-ticks); dprintf("%ums\n", GetTickCount()-ticks);
} }

View File

@ -1356,7 +1356,7 @@ CMDRESULT cbDebugSetBPX(int argc, char* argv[]) //bp addr [,name [,type]]
static bool cbDeleteAllBreakpoints(const BREAKPOINT* bp) static bool cbDeleteAllBreakpoints(const BREAKPOINT* bp)
{ {
if(bpdel(bp->addr, BPNORMAL) and DeleteBPX(bp->addr)) if(bpdel(bp->addr, BPNORMAL) and (!bp->enabled or DeleteBPX(bp->addr)))
return true; return true;
dprintf("delete breakpoint failed: "fhex"\n", bp->addr); dprintf("delete breakpoint failed: "fhex"\n", bp->addr);
return false; return false;
@ -1381,9 +1381,15 @@ CMDRESULT cbDebugDeleteBPX(int argc, char* argv[])
BREAKPOINT found; BREAKPOINT found;
if(bpget(0, BPNORMAL, arg1, &found)) //found a breakpoint with name if(bpget(0, BPNORMAL, arg1, &found)) //found a breakpoint with name
{ {
if(!bpdel(found.addr, BPNORMAL) or !DeleteBPX(found.addr)) if(!bpdel(found.addr, BPNORMAL))
{ {
dprintf("delete breakpoint failed: "fhex"\n", found.addr); dprintf("delete breakpoint failed (bpdel): "fhex"\n", found.addr);
return STATUS_ERROR;
}
else if(found.enabled && !DeleteBPX(found.addr))
{
dprintf("delete breakpoint failed (DeleteBPX): "fhex"\n", found.addr);
GuiUpdateAllViews();
return STATUS_ERROR; return STATUS_ERROR;
} }
return STATUS_CONTINUE; return STATUS_CONTINUE;
@ -1394,9 +1400,15 @@ CMDRESULT cbDebugDeleteBPX(int argc, char* argv[])
dprintf("no such breakpoint \"%s\"\n", arg1); dprintf("no such breakpoint \"%s\"\n", arg1);
return STATUS_ERROR; return STATUS_ERROR;
} }
if(!bpdel(found.addr, BPNORMAL) or !DeleteBPX(found.addr)) if(!bpdel(found.addr, BPNORMAL))
{ {
dprintf("delete breakpoint failed: "fhex"\n", found.addr); dprintf("delete breakpoint failed (bpdel): "fhex"\n", found.addr);
return STATUS_ERROR;
}
else if(found.enabled && !DeleteBPX(found.addr))
{
dprintf("delete breakpoint failed (DeleteBPX): "fhex"\n", found.addr);
GuiUpdateAllViews();
return STATUS_ERROR; return STATUS_ERROR;
} }
dputs("breakpoint deleted!"); dputs("breakpoint deleted!");