error_handler: do not print backtrace when early normal exit
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 12 Aug 2015 05:30:40 +0000 (14:30 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 14 Aug 2015 06:59:53 +0000 (15:59 +0900)
Backtrace is very messy when exit with printing help, ...

Change-Id: I6e18db754105aae051e4ec624c62aee9f874b59c
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/util/error_handler.c
tizen/src/util/error_handler.h
vl.c

index 654230726f46aae01d16e6d547d039323c7471a6..af179b8d6e573abce1c26e7a9b7623b6dfbb7d31 100644 (file)
@@ -60,6 +60,8 @@ static LPTOP_LEVEL_EXCEPTION_FILTER prevExceptionFilter;
 static pthread_spinlock_t siglock;
 #endif
 
+bool print_backtrace_at_normal_exit_enabled = false;
+
 /* Print 'backtrace' */
 #ifdef _WIN32
 struct frame_layout {
@@ -175,10 +177,15 @@ static void dump_backtrace(void *ptr, int depth)
 
 static void handle_error_at_exit(void)
 {
-    // dump backtrace log no matter what
-    INFO("Stack backtrace for tracing...\n");
-    INFO("This is not an error.\n");
-    dump_backtrace(NULL, 0);
+    if (print_backtrace_at_normal_exit_enabled) {
+        INFO("Stack backtrace for tracing...\n");
+        INFO("This is not an error.\n");
+        dump_backtrace(NULL, 0);
+    }
+}
+
+void enable_print_backtrace_at_normal_exit(void) {
+    print_backtrace_at_normal_exit_enabled = true;
 }
 
 #ifdef CONFIG_WIN32
index f45b05f320ccfae867e86e578f0b71c337c45021..783dd00dc3be2e8ce5bdcbd69502fb0dae11a683 100644 (file)
@@ -32,5 +32,6 @@
 #define __ERROR_HANDLER_H__
 
 void init_error_handler(void);
+void enable_print_backtrace_at_normal_exit(void);
 
 #endif /* __ERROR_HANDLER_H__ */
diff --git a/vl.c b/vl.c
index d1425ea2af764b99aa309fba08217d0eba306c30..762feb825449d95a50f80cbe407f8c044ed7fdaa 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -136,6 +136,7 @@ int qemu_main(int argc, char **argv, char **envp);
 #include "tizen/src/ui/qt5.h"
 #include "tizen/src/util/ui_operations.h"
 #include "tizen/src/ecs/ecs.h"
+#include "tizen/src/util/error_handler.h"
 # ifdef CONFIG_JAVA_UI
 #include "tizen/src/display/maru_display.h"
 # endif
@@ -4632,6 +4633,9 @@ int main(int argc, char **argv, char **envp)
         }
     }
 
+#ifdef CONFIG_MARU
+    enable_print_backtrace_at_normal_exit();
+#endif
     main_loop();
     bdrv_close_all();
     pause_all_vcpus();