OLD | NEW |
1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // 3) The gdb unwinder -- also the one used by the c++ exception code. | 46 // 3) The gdb unwinder -- also the one used by the c++ exception code. |
47 // It's obviously well-tested, but has a fatal flaw: it can call | 47 // It's obviously well-tested, but has a fatal flaw: it can call |
48 // malloc() from the unwinder. This is a problem because we're | 48 // malloc() from the unwinder. This is a problem because we're |
49 // trying to use the unwinder to instrument malloc(). | 49 // trying to use the unwinder to instrument malloc(). |
50 // | 50 // |
51 // Note: if you add a new implementation here, make sure it works | 51 // Note: if you add a new implementation here, make sure it works |
52 // correctly when GetStackTrace() is called with max_depth == 0. | 52 // correctly when GetStackTrace() is called with max_depth == 0. |
53 // Some code may do that. | 53 // Some code may do that. |
54 | 54 |
55 #include <config.h> | 55 #include <config.h> |
56 #include <gperftools/stacktrace.h> | 56 #include <google/stacktrace.h> |
57 #include "stacktrace_config.h" | 57 #include "stacktrace_config.h" |
58 | 58 |
59 #if defined(STACKTRACE_INL_HEADER) | 59 #if defined(STACKTRACE_INL_HEADER) |
60 | 60 |
61 #define IS_STACK_FRAMES 0 | 61 #define IS_STACK_FRAMES 0 |
62 #define IS_WITH_CONTEXT 0 | 62 #define IS_WITH_CONTEXT 0 |
63 #define GET_STACK_TRACE_OR_FRAMES \ | 63 #define GET_STACK_TRACE_OR_FRAMES \ |
64 GetStackTrace(void **result, int max_depth, int skip_count) | 64 GetStackTrace(void **result, int max_depth, int skip_count) |
65 #include STACKTRACE_INL_HEADER | 65 #include STACKTRACE_INL_HEADER |
66 #undef IS_STACK_FRAMES | 66 #undef IS_STACK_FRAMES |
(...skipping 25 matching lines...) Expand all Loading... |
92 GetStackFramesWithContext(void **result, int *sizes, int max_depth, \ | 92 GetStackFramesWithContext(void **result, int *sizes, int max_depth, \ |
93 int skip_count, const void *ucp) | 93 int skip_count, const void *ucp) |
94 #include STACKTRACE_INL_HEADER | 94 #include STACKTRACE_INL_HEADER |
95 #undef IS_STACK_FRAMES | 95 #undef IS_STACK_FRAMES |
96 #undef IS_WITH_CONTEXT | 96 #undef IS_WITH_CONTEXT |
97 #undef GET_STACK_TRACE_OR_FRAMES | 97 #undef GET_STACK_TRACE_OR_FRAMES |
98 | 98 |
99 #elif 0 | 99 #elif 0 |
100 // This is for the benefit of code analysis tools that may have | 100 // This is for the benefit of code analysis tools that may have |
101 // trouble with the computed #include above. | 101 // trouble with the computed #include above. |
102 # include "stacktrace_x86-inl.h" | 102 # include "base/stacktrace_x86-inl.h" |
103 # include "stacktrace_libunwind-inl.h" | 103 # include "base/stacktrace_libunwind-inl.h" |
104 # include "stacktrace_generic-inl.h" | 104 # include "base/stacktrace_generic-inl.h" |
105 # include "stacktrace_powerpc-inl.h" | 105 # include "base/stacktrace_powerpc-inl.h" |
106 # include "stacktrace_win32-inl.h" | 106 # include "base/stacktrace_win32-inl.h" |
107 # include "stacktrace_arm-inl.h" | |
108 #else | 107 #else |
109 # error Cannot calculate stack trace: will need to write for your environment | 108 # error Cannot calculate stack trace: will need to write for your environment |
110 #endif | 109 #endif |
OLD | NEW |