aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorGareth McMullin2015-03-22 20:33:57 -0700
committerGareth McMullin2015-03-22 20:33:57 -0700
commitf5ef8671ab18c6913a4cb44292f7054e83230218 (patch)
tree4b29ee229ecc19d719d9b517ea916518687237fc /src/main.c
parenta497127a8d16387ce9b9b01969ca5632b95d8e07 (diff)
parent68f54a35457da4c07ec84bd7e0c2823183e8811e (diff)
Merge pull request #85 from gsmcmullin/exceptions
Cleaner exception handling.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 60db15c..d1b3c86 100644
--- a/src/main.c
+++ b/src/main.c
@@ -28,6 +28,9 @@
#include "jtagtap.h"
#include "jtag_scan.h"
#include "target.h"
+#include "exception.h"
+#include "gdb_packet.h"
+#include "morse.h"
int
main(int argc, char **argv)
@@ -39,9 +42,18 @@ main(int argc, char **argv)
(void) argv;
platform_init();
#endif
- PLATFORM_SET_FATAL_ERROR_RECOVERY();
- gdb_main();
+ while (true) {
+ volatile struct exception e;
+ TRY_CATCH(e, EXCEPTION_ALL) {
+ gdb_main();
+ }
+ if (e.type == EXCEPTION_ERROR) {
+ gdb_putpacketz("EFF");
+ target_list_free();
+ morse("TARGET LOST.", 1);
+ }
+ }
/* Should never get here */
return 0;