summaryrefslogtreecommitdiff
path: root/src/tests/stacktrace_unittest.cc
diff options
context:
space:
mode:
authorcsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2007-04-16 20:49:32 +0000
committercsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2007-04-16 20:49:32 +0000
commit74ad5d57ec08abace386befc6c3c695d85f44d1a (patch)
tree1a5611be12a74fde48de69d13476ab02ca7d20cc /src/tests/stacktrace_unittest.cc
parentddbf2f027fb4ca8781fd50820ceb870570f414bc (diff)
downloadgperftools-74ad5d57ec08abace386befc6c3c695d85f44d1a.tar.gz
Fri Apr 13 14:50:51 2007 Google Inc. <opensource@google.com>
* google-perftools: version 0.90 release * (As the version-number jump hints, this is a major new release: almost every piece of functionality was rewritten. I can't do justice to all the changes, but will concentrate on highlights.) *** USER-VISIBLE CHANGES: * Ability to "release" unused memory added to tcmalloc * Exposed more tweaking knobs via environment variables (see docs) * pprof tries harder to map addresses to functions * tcmalloc_minimal compiles and runs on FreeBSD 6.0 and Solaris 10 *** INTERNAL CHANGES: * Much better 64-bit support * Better multiple-processor support (e.g. multicore contention tweaks) * Support for recent kernel ABI changes (e.g. new arg to mremap) * Addition of spinlocks to tcmalloc to reduce contention cost * Speed up tcmalloc by using __thread on systems that support TLS * Total redesign of heap-checker to improve liveness checking * More portable stack-frame analysis -- no more hard-coded constants! * Disentangled heap-profiler code and heap-checker code * Several new unittests to test, e.g., thread-contention costs * Lots of small (but important!) bug fixes: e.g., fixing GetPC on amd64 *** KNOWN PROBLEMS: * CPU-profiling may crash on x86_64 (64-bit) systems. See the README * Profiling/heap-checking may deadlock on x86_64 systems. See README git-svn-id: http://gperftools.googlecode.com/svn/trunk@28 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'src/tests/stacktrace_unittest.cc')
-rw-r--r--src/tests/stacktrace_unittest.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/tests/stacktrace_unittest.cc b/src/tests/stacktrace_unittest.cc
index b73cf4b..5a4b654 100644
--- a/src/tests/stacktrace_unittest.cc
+++ b/src/tests/stacktrace_unittest.cc
@@ -28,15 +28,15 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "config.h"
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include "base/commandlineflags.h"
#include "base/logging.h"
-#include "google/stacktrace.h"
+#include <google/stacktrace.h>
-#ifdef HAVE_EXECINFO_H
-#include <execinfo.h>
-#endif
// Obtain a backtrace, verify that the expected callers are present in the
// backtrace, and maybe print the backtrace to stdout.
@@ -94,35 +94,25 @@ void CheckStackTraceLeaf(void) {
const int STACK_LEN = 10;
void *stack[STACK_LEN];
int size;
- void *top, *bottom;
size = GetStackTrace(stack, STACK_LEN, 0);
printf("Obtained %d stack frames.\n", size);
CHECK_LE(size, STACK_LEN);
- // GetStackExtent() may not be implemented
- if (GetStackExtent(NULL, &top, &bottom)) {
- printf("%p %p\n", top, bottom);
- }
-
- for (int i = 0; i < BACKTRACE_STEPS; i++)
- {
- CheckRetAddrIsInFunction(stack[i], expected_stack[i]);
- }
-
-
#ifdef HAVE_EXECINFO_H
{
char **strings = backtrace_symbols(stack, size);
-
printf("Obtained %d stack frames.\n", size);
for (int i = 0; i < size; i++)
- printf("%s\n", strings[i]);
+ printf("%s %p\n", strings[i], stack[i]);
printf("CheckStackTrace() addr: %p\n", &CheckStackTrace);
free(strings);
}
#endif
+ for (int i = 0; i < BACKTRACE_STEPS; i++) {
+ CheckRetAddrIsInFunction(stack[i], expected_stack[i]);
+ }
}
//-----------------------------------------------------------------------//