Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: src/checks.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/checks.cc
diff --git a/src/checks.cc b/src/checks.cc
index 23c9305f8cda3259049d32e6b5fb595167b1046e..e2c2c079f04b72b8b69b4738380cfaf17844f244 100644
--- a/src/checks.cc
+++ b/src/checks.cc
@@ -4,15 +4,6 @@
#include "src/checks.h"
-#if V8_LIBC_GLIBC || V8_OS_BSD
-# include <cxxabi.h>
-# include <execinfo.h>
-#elif V8_OS_QNX
-# include <backtrace.h>
-#endif // V8_LIBC_GLIBC || V8_OS_BSD
-#include <stdio.h>
-
-#include "src/platform.h"
#include "src/v8.h"
namespace v8 {
@@ -20,75 +11,9 @@ namespace internal {
intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; }
-// Attempts to dump a backtrace (if supported).
-void DumpBacktrace() {
-#if V8_LIBC_GLIBC || V8_OS_BSD
- void* trace[100];
- int size = backtrace(trace, ARRAY_SIZE(trace));
- char** symbols = backtrace_symbols(trace, size);
- OS::PrintError("\n==== C stack trace ===============================\n\n");
- if (size == 0) {
- OS::PrintError("(empty)\n");
- } else if (symbols == NULL) {
- OS::PrintError("(no symbols)\n");
- } else {
- for (int i = 1; i < size; ++i) {
- OS::PrintError("%2d: ", i);
- char mangled[201];
- if (sscanf(symbols[i], "%*[^(]%*[(]%200[^)+]", mangled) == 1) { // NOLINT
- int status;
- size_t length;
- char* demangled = abi::__cxa_demangle(mangled, NULL, &length, &status);
- OS::PrintError("%s\n", demangled != NULL ? demangled : mangled);
- free(demangled);
- } else {
- OS::PrintError("??\n");
- }
- }
- }
- free(symbols);
-#elif V8_OS_QNX
- char out[1024];
- bt_accessor_t acc;
- bt_memmap_t memmap;
- bt_init_accessor(&acc, BT_SELF);
- bt_load_memmap(&acc, &memmap);
- bt_sprn_memmap(&memmap, out, sizeof(out));
- OS::PrintError(out);
- bt_addr_t trace[100];
- int size = bt_get_backtrace(&acc, trace, ARRAY_SIZE(trace));
- OS::PrintError("\n==== C stack trace ===============================\n\n");
- if (size == 0) {
- OS::PrintError("(empty)\n");
- } else {
- bt_sprnf_addrs(&memmap, trace, size, const_cast<char*>("%a\n"),
- out, sizeof(out), NULL);
- OS::PrintError(out);
- }
- bt_unload_memmap(&memmap);
- bt_release_accessor(&acc);
-#endif // V8_LIBC_GLIBC || V8_OS_BSD
-}
-
} } // namespace v8::internal
-// Contains protection against recursive calls (faults while handling faults).
-extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) {
- fflush(stdout);
- fflush(stderr);
- i::OS::PrintError("\n\n#\n# Fatal error in %s, line %d\n# ", file, line);
- va_list arguments;
- va_start(arguments, format);
- i::OS::VPrintError(format, arguments);
- va_end(arguments);
- i::OS::PrintError("\n#\n");
- v8::internal::DumpBacktrace();
- fflush(stderr);
- i::OS::Abort();
-}
-
-
void CheckEqualsHelper(const char* file,
int line,
const char* expected_source,
« src/base/macros.h ('K') | « src/checks.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698