Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323633
b: refs/heads/master
c: dc4552b
h: refs/heads/master
i:
  323631: 2bc4828
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Aug 8, 2012
1 parent b226d99 commit ed20973
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a7cb8863dd352f052e7b2b86a17410070d1b69af
refs/heads/master: dc4552bf7176573ccf79af04ab8648b015738f4a
19 changes: 19 additions & 0 deletions trunk/tools/perf/util/util.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "../perf.h"
#include "util.h"
#include <sys/mman.h>
#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>

/*
* XXX We need to find a better place for these things...
Expand Down Expand Up @@ -158,3 +161,19 @@ size_t hex_width(u64 v)

return n;
}

/* Obtain a backtrace and print it to stdout. */
void dump_stack(void)
{
void *array[16];
size_t size = backtrace(array, ARRAY_SIZE(array));
char **strings = backtrace_symbols(array, size);
size_t i;

printf("Obtained %zd stack frames.\n", size);

for (i = 0; i < size; i++)
printf("%s\n", strings[i]);

free(strings);
}
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,6 @@ size_t hex_width(u64 v);

char *rtrim(char *s);

void dump_stack(void);

#endif

0 comments on commit ed20973

Please sign in to comment.