OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "checks.h" | 28 #include "checks.h" |
29 | 29 |
30 #if V8_LIBC_GLIBC || V8_OS_BSD | 30 #if V8_LIBC_GLIBC || V8_OS_BSD |
31 # include <cxxabi.h> | 31 # include <cxxabi.h> |
32 # include <execinfo.h> | 32 # include <execinfo.h> |
| 33 #elif V8_OS_QNX |
| 34 # include <backtrace.h> |
33 #endif // V8_LIBC_GLIBC || V8_OS_BSD | 35 #endif // V8_LIBC_GLIBC || V8_OS_BSD |
34 #include <stdio.h> | 36 #include <stdio.h> |
35 | 37 |
36 #include "platform.h" | 38 #include "platform.h" |
37 #include "v8.h" | 39 #include "v8.h" |
38 | 40 |
39 | 41 |
40 // Attempts to dump a backtrace (if supported). | 42 // Attempts to dump a backtrace (if supported). |
41 static V8_INLINE void DumpBacktrace() { | 43 static V8_INLINE void DumpBacktrace() { |
42 #if V8_LIBC_GLIBC || V8_OS_BSD | 44 #if V8_LIBC_GLIBC || V8_OS_BSD |
(...skipping 14 matching lines...) Expand all Loading... |
57 size_t length; | 59 size_t length; |
58 char* demangled = abi::__cxa_demangle(mangled, NULL, &length, &status); | 60 char* demangled = abi::__cxa_demangle(mangled, NULL, &length, &status); |
59 i::OS::PrintError("%s\n", demangled != NULL ? demangled : mangled); | 61 i::OS::PrintError("%s\n", demangled != NULL ? demangled : mangled); |
60 free(demangled); | 62 free(demangled); |
61 } else { | 63 } else { |
62 i::OS::PrintError("??\n"); | 64 i::OS::PrintError("??\n"); |
63 } | 65 } |
64 } | 66 } |
65 } | 67 } |
66 free(symbols); | 68 free(symbols); |
| 69 #elif V8_OS_QNX |
| 70 char out[1024]; |
| 71 bt_accessor_t acc; |
| 72 bt_memmap_t memmap; |
| 73 bt_init_accessor(&acc, BT_SELF); |
| 74 bt_load_memmap(&acc, &memmap); |
| 75 bt_sprn_memmap(&memmap, out, sizeof(out)); |
| 76 i::OS::PrintError(out); |
| 77 bt_addr_t trace[100]; |
| 78 int size = bt_get_backtrace(&acc, trace, ARRAY_SIZE(trace)); |
| 79 i::OS::PrintError("\n==== C stack trace ===============================\n\n"); |
| 80 if (size == 0) { |
| 81 i::OS::PrintError("(empty)\n"); |
| 82 } else { |
| 83 bt_sprnf_addrs(&memmap, trace, size, const_cast<char*>("%a\n"), |
| 84 out, sizeof(out), NULL); |
| 85 i::OS::PrintError(out); |
| 86 } |
| 87 bt_unload_memmap(&memmap); |
| 88 bt_release_accessor(&acc); |
67 #endif // V8_LIBC_GLIBC || V8_OS_BSD | 89 #endif // V8_LIBC_GLIBC || V8_OS_BSD |
68 } | 90 } |
69 | 91 |
70 | 92 |
71 // Contains protection against recursive calls (faults while handling faults). | 93 // Contains protection against recursive calls (faults while handling faults). |
72 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) { | 94 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) { |
73 i::AllowHandleDereference allow_deref; | 95 i::AllowHandleDereference allow_deref; |
74 i::AllowDeferredHandleDereference allow_deferred_deref; | 96 i::AllowDeferredHandleDereference allow_deferred_deref; |
75 fflush(stdout); | 97 fflush(stdout); |
76 fflush(stderr); | 98 fflush(stderr); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 i::OS::PrintError("\n#\n\n"); | 147 i::OS::PrintError("\n#\n\n"); |
126 i::OS::Abort(); | 148 i::OS::Abort(); |
127 } | 149 } |
128 | 150 |
129 | 151 |
130 namespace v8 { namespace internal { | 152 namespace v8 { namespace internal { |
131 | 153 |
132 intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; } | 154 intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; } |
133 | 155 |
134 } } // namespace v8::internal | 156 } } // namespace v8::internal |
OLD | NEW |