Since there's no support for exception handling in C, the try-catch
blocks have been deleted, and throw clauses are replaced. When a runtime
error happens, we're printing out the error message. Disassembling of
the current instruction interrupts. This behavior is achieved by adding
sigsetjmp() to discard further disassembling after the error message
prints and by adding the siglongjmp() function to imitate throwing an
error.The goal was to maintain the same output as it was.
Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com>
---
disas/nanomips.cpp | 135 +++++++++++++++++++++++----------------------
1 file changed, 69 insertions(+), 66 deletions(-)
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 769368a984..a8cd878809 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -31,7 +31,6 @@
#include "disas/dis-asm.h"
#include <string.h>
-#include <stdexcept>
#include <stdio.h>
#include <stdarg.h>
@@ -90,6 +89,8 @@ struct Pool {
static img_address m_pc;
static TABLE_ATTRIBUTE_TYPE m_requested_instruction_categories;
+static struct disassemble_info *disassm_info;
+static jmp_buf j_buf;