| 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 17 matching lines...) Expand all Loading... |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 #include "config_for_unittests.h" | 30 #include "config_for_unittests.h" |
| 31 #ifdef HAVE_EXECINFO_H | 31 #ifdef HAVE_EXECINFO_H |
| 32 #include <execinfo.h> | 32 #include <execinfo.h> |
| 33 #endif | 33 #endif |
| 34 #include <stdio.h> | 34 #include <stdio.h> |
| 35 #include <stdlib.h> | 35 #include <stdlib.h> |
| 36 #include "base/commandlineflags.h" | 36 #include "base/commandlineflags.h" |
| 37 #include "base/logging.h" | 37 #include "base/logging.h" |
| 38 #include <google/stacktrace.h> | 38 #include <gperftools/stacktrace.h> |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 // Obtain a backtrace, verify that the expected callers are present in the | 42 // Obtain a backtrace, verify that the expected callers are present in the |
| 43 // backtrace, and maybe print the backtrace to stdout. | 43 // backtrace, and maybe print the backtrace to stdout. |
| 44 | 44 |
| 45 // The sequence of functions whose return addresses we expect to see in the | 45 // The sequence of functions whose return addresses we expect to see in the |
| 46 // backtrace. | 46 // backtrace. |
| 47 const int BACKTRACE_STEPS = 6; | 47 const int BACKTRACE_STEPS = 6; |
| 48 | 48 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace | 187 } // namespace |
| 188 //-----------------------------------------------------------------------// | 188 //-----------------------------------------------------------------------// |
| 189 | 189 |
| 190 int main(int argc, char ** argv) { | 190 int main(int argc, char ** argv) { |
| 191 CheckStackTrace(0); | 191 CheckStackTrace(0); |
| 192 printf("PASS\n"); | 192 printf("PASS\n"); |
| 193 return 0; | 193 return 0; |
| 194 } | 194 } |
| OLD | NEW |