From e6dd2741f34975469dd7d31ef3b01547f54743df Mon Sep 17 00:00:00 2001 From: Evan Ramos Date: Tue, 18 Feb 2020 21:08:00 -0600 Subject: [PATCH] SW: Instrument Saveables with debug_break --- source/sw/src/saveable.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/source/sw/src/saveable.cpp b/source/sw/src/saveable.cpp index 6d4911a59..2a66a89a8 100644 --- a/source/sw/src/saveable.cpp +++ b/source/sw/src/saveable.cpp @@ -105,6 +105,7 @@ int Saveable_FindCodeSym(void *ptr, savedcodesym *sym) } } + debug_break(); return -1; } @@ -135,6 +136,8 @@ int Saveable_FindDataSym(void *ptr, saveddatasym *sym) return 0; } } + + debug_break(); return -1; } @@ -146,8 +149,16 @@ int Saveable_RestoreCodeSym(savedcodesym *sym, void **ptr) return 0; } - if (sym->module > saveablemodules.Size()) return -1; - if (sym->index >= saveablemodules[sym->module-1]->numcode) return -1; + if (sym->module > saveablemodules.Size()) + { + debug_break(); + return -1; + } + if (sym->index >= saveablemodules[sym->module-1]->numcode) + { + debug_break(); + return -1; + } *ptr = saveablemodules[sym->module-1]->code[sym->index]; @@ -162,9 +173,21 @@ int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr) return 0; } - if (sym->module > saveablemodules.Size()) return -1; - if (sym->index >= saveablemodules[sym->module-1]->numdata) return -1; - if (sym->offset >= saveablemodules[sym->module-1]->data[sym->index].size) return -1; + if (sym->module > saveablemodules.Size()) + { + 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);