SW: Instrument Saveables with debug_break

This commit is contained in:
Evan Ramos 2020-02-18 21:08:00 -06:00 committed by Christoph Oelckers
parent 9eefd3d892
commit e6dd2741f3

View file

@ -105,6 +105,7 @@ int Saveable_FindCodeSym(void *ptr, savedcodesym *sym)
} }
} }
debug_break();
return -1; return -1;
} }
@ -135,6 +136,8 @@ int Saveable_FindDataSym(void *ptr, saveddatasym *sym)
return 0; return 0;
} }
} }
debug_break();
return -1; return -1;
} }
@ -146,8 +149,16 @@ int Saveable_RestoreCodeSym(savedcodesym *sym, void **ptr)
return 0; return 0;
} }
if (sym->module > saveablemodules.Size()) return -1; if (sym->module > saveablemodules.Size())
if (sym->index >= saveablemodules[sym->module-1]->numcode) return -1; {
debug_break();
return -1;
}
if (sym->index >= saveablemodules[sym->module-1]->numcode)
{
debug_break();
return -1;
}
*ptr = saveablemodules[sym->module-1]->code[sym->index]; *ptr = saveablemodules[sym->module-1]->code[sym->index];
@ -162,9 +173,21 @@ int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr)
return 0; return 0;
} }
if (sym->module > saveablemodules.Size()) return -1; if (sym->module > saveablemodules.Size())
if (sym->index >= saveablemodules[sym->module-1]->numdata) return -1; {
if (sym->offset >= saveablemodules[sym->module-1]->data[sym->index].size) return -1; debug_break();
return -1;
}
if (sym->index >= saveablemodules[sym->module-1]->numdata)
{
debug_break();
return -1;
}
if (sym->offset >= saveablemodules[sym->module-1]->data[sym->index].size)
{
debug_break();
return -1;
}
*ptr = (void *)((intptr_t)saveablemodules[sym->module-1]->data[sym->index].base + sym->offset); *ptr = (void *)((intptr_t)saveablemodules[sym->module-1]->data[sym->index].base + sym->offset);