#include "error_handler.h"
#include "emulator_common.h"
#include "emulator.h"
+#include "skin/maruskin_client.h"
#include "debug_ch.h"
MULTI_DEBUG_CHANNEL(qemu, backtrace);
-// deprecated
-/* This table must match the enum definition */
-static char _maru_string_table[][JAVA_MAX_COMMAND_LENGTH] = {
- /* 0 */ "",
- /* 1 */ FAILED_TO_ALLOCATE_MEMORY,
- /* 2 */ FAILED_TO_LOAD_KERNEL CHECK_FILE_VALID,
- /* 3 */ FAILED_TO_LOAD_BIOS CHECK_FILE_VALID,
- /* 4 */ FAILED_TO_INITIALIZE_SKIN,
- /* 5 */ EMULATOR_HAS_STOPPED,
- /* add here.. */
- ""
-};
-
-static int maru_exit_status = MARU_EXIT_NORMAL;
-static char *maru_exit_msg;
-
#ifdef CONFIG_WIN32
static LPTOP_LEVEL_EXCEPTION_FILTER prevExceptionFilter;
#endif
void maru_sighandler(int sig);
#endif
-// deprecated
-char *get_canonical_path(char const *const path)
-{
- if ((int)g_path_is_absolute(path)) {
- return (char *)g_strdup(path);
- }
-
- char *canonical_path;
-
-#ifndef _WIN32
- char *current_dir = g_get_current_dir();
- canonical_path = g_strdup_printf("%s/%s", current_dir, path);
- g_free(current_dir);
-#else
- canonical_path = g_malloc(MAX_PATH);
- GetFullPathName(path, MAX_PATH, canonical_path, NULL);
-#endif
-
- return canonical_path;
-}
-
-// deprecated
-// Use error_report() instead
-void register_exit_message(int status, char const *format, ...)
-{
- va_list args;
-
- if (status >= MARU_EXIT_NORMAL) {
- fprintf(stderr, "Invalid error message index = %d\n",
- status);
- return;
- }
- if (maru_exit_status != MARU_EXIT_NORMAL) {
- fprintf(stderr, "The error message is already registered = %d\n",
- maru_exit_status);
- return;
- }
-
- maru_exit_status = status;
-
- if (maru_exit_status == MARU_EXIT_HB_TIME_EXPIRED) {
- fprintf(stderr, "Skin client could not connect to Skin server."
- " The time of internal heartbeat has expired.\n");
- }
-
- if (!format) {
- format = "";
- }
-
- va_start(args, format);
- char *additional = g_strdup_vprintf(format, args);
- va_end(args);
- maru_exit_msg = g_strdup_printf("%s%s", _maru_string_table[maru_exit_status],
- additional);
- g_free(additional);
-
- if (strlen(maru_exit_msg) >= JAVA_MAX_COMMAND_LENGTH) {
- maru_exit_msg[JAVA_MAX_COMMAND_LENGTH - 1] = '\0';
- }
-
- fprintf(stdout, "The error message is registered = %d : %s\n",
- maru_exit_status, maru_exit_msg);
-}
-
/* Print 'backtrace' */
#ifdef _WIN32
struct frame_layout {
static void handle_error_at_exit(void)
{
-
- // deprecated
- if (maru_exit_status != MARU_EXIT_NORMAL || maru_exit_msg) {
- start_simple_client(maru_exit_msg);
- }
- g_free(maru_exit_msg);
-
// dump backtrace log no matter what
INFO("Stack backtrace for tracing...\n");
INFO("This is not an error.\n");
#ifndef __ERROR_HANDLER_H__
#define __ERROR_HANDLER_H__
-#include "tizen/src/skin/maruskin_client.h"
-
-// deprecated
-/* TODO: define macro for fair of definition */
-/* This enum must match the table definition */
-enum {
- /* 0 */ MARU_EXIT_UNKNOWN = 0,
- /* 1 */ MARU_EXIT_MEMORY_EXCEPTION,
- /* 2 */ MARU_EXIT_KERNEL_FILE_EXCEPTION,
- /* 3 */ MARU_EXIT_BIOS_FILE_EXCEPTION,
- /* 4 */ MARU_EXIT_SKIN_SERVER_FAILED,
- /* 5 */ MARU_EXIT_HB_TIME_EXPIRED,
- /* add here.. */
- MARU_EXIT_NORMAL
-};
-
void init_error_handler(void);
-// deprecated
-void register_exit_message(int status, char const *format, ...);
-// deprecated
-char *get_canonical_path(char const *const path);
#endif /* __ERROR_HANDLER_H__ */