Index: experimental/mac_debugger/nacl_debug_helper/nacl_oop_debugger_hooks.c |
diff --git a/experimental/mac_debugger/nacl_debug_helper/nacl_oop_debugger_hooks.c b/experimental/mac_debugger/nacl_debug_helper/nacl_oop_debugger_hooks.c |
deleted file mode 100644 |
index e85f1951a8a46ffa58aff271231c3065a7b277b9..0000000000000000000000000000000000000000 |
--- a/experimental/mac_debugger/nacl_debug_helper/nacl_oop_debugger_hooks.c |
+++ /dev/null |
@@ -1,91 +0,0 @@ |
-/* |
- * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
- * Use of this source code is governed by a BSD-style license that can be |
- * found in the LICENSE file. |
- */ |
- |
-#include "native_client/src/include/nacl_platform.h" |
-#include "native_client/src/trusted/service_runtime/nacl_oop_debugger_hooks.h" |
-#include "native_client/src/trusted/service_runtime/sel_ldr.h" |
-#include <unistd.h> |
-#include <sys/types.h> |
-#include <memory.h> |
-void SendMessageToDebuggerAndHalt(const char *fmt, ...); |
- |
-void NaClOopDebuggerAppCreateHook(struct NaClApp *nap) { |
- char* ign_var = getenv("NACL_DANGEROUS_IGNORE_VALIDATOR"); |
- if (!ign_var) |
- ign_var = "Null"; |
- printf("------->CC2 NaClOopDebuggerAppCreateHook pid=%d ign_var=[%s]\n", getpid(), ign_var); |
- sleep(3); |
- printf(" procedingÉ\n"); |
- |
- if (NULL == nap) |
- return; |
- SendMessageToDebuggerAndHalt( |
- "-event AppCreate -nap %p -mem_start %p -user_entry_pt %p " |
- "-initial_entry_pt %p", |
- nap, |
- (void *) nap->mem_start, |
- (void *) nap->user_entry_pt, |
- (void *) nap->initial_entry_pt); |
-} |
- |
-void NaClOopDebuggerThreadCreateHook(struct NaClAppThread *natp) { |
- SendMessageToDebuggerAndHalt("-event ThreadCreate -natp %p", natp); |
-} |
-void NaClOopDebuggerThreadExitHook(struct NaClAppThread *natp, |
- int exit_code) { |
- SendMessageToDebuggerAndHalt("-event ThreadExit -natp %p -exit_code %d", |
- natp, |
- exit_code); |
-} |
- |
-void NaClOopDebuggerAppExitHook(int exit_code) { |
- SendMessageToDebuggerAndHalt("-event AppExit -exit_code %d", exit_code); |
-} |
- |
-void OutputDebugString(const char* msg) { |
- printf("--------> OutputDebugString #6 [%s]\n", msg); |
- asm ("movl %0, %%eax;" |
- "int $3;" // trap instruction |
- //"syscall" |
- //"vmxoff;" |
- "nop;" |
- : |
- :"r"(msg) |
- :"%eax" |
- ); |
-} |
- |
-void SendMessageToDebuggerAndHalt(const char *fmt, ...) { |
- if (NULL == fmt) { |
- NaClLog(LOG_FATAL, "SendMessageToDebuggerAndHalt: fmt == NULL\n"); |
- return; |
- } |
- |
-#define kVarMsgSize 512 |
- /* |
- * Prefix has GUID string specific to our OOP debugger, so that it |
- * can differentiate it from other uses of trap instruction. |
- */ |
- char const prefix[] = "{7AA7C9CF-89EC-4ed3-8DAD-6DC84302AB11} -version 1 "; |
- char msg[sizeof(prefix) - 1 + kVarMsgSize]; |
- char *post_pref_msg = msg + sizeof(prefix) - 1; |
- signed int res = 0; |
- va_list marker; |
- strcpy(msg, prefix); |
- va_start(marker, fmt); |
- res = vsnprintf(post_pref_msg, kVarMsgSize, fmt, marker); |
- if (-1 != res) { |
- /* |
- * Sends a string to the debugger by raising TRAP signal. |
- */ |
- OutputDebugString(msg); |
- } else { |
- NaClLog(LOG_FATAL, |
- "SendMessageToDebuggerAndHalt: _vsnprintf_s returned -1\n"); |
- } |
-#undef kVarMsgSize |
-} |
- |