NJU-ProjectN / nemu

NJU EMUlator, a full system x86/mips32/riscv32/riscv64 emulator for teaching
Other
859 stars 184 forks source link

nemu/include/debug.h: improve the robustness #7

Closed Michael1015198808 closed 5 years ago

Michael1015198808 commented 5 years ago

prevent multi-call in Assert. If cond calls malloc and failed at the first time, but success at the second time, nemu will execute line 35-38 and output error info but do not stop at line 39. Since line 34 make sure that cond is 0. assert(0) in line 39 is fine.