diff options
author | Jason Evans <je@facebook.com> | 2010-06-04 22:10:43 (GMT) |
---|---|---|
committer | Jason Evans <je@facebook.com> | 2010-06-04 22:10:43 (GMT) |
commit | b43b7750a6e08706aeb61d83ff1e1eb0c81c910b (patch) | |
tree | 20b0414328dda14e16835e652c86679b91dfb3fe /jemalloc/src | |
parent | 7013d10a9e8e1a183542111747dc9c324560975a (diff) | |
download | jemalloc-b43b7750a6e08706aeb61d83ff1e1eb0c81c910b.zip jemalloc-b43b7750a6e08706aeb61d83ff1e1eb0c81c910b.tar.gz jemalloc-b43b7750a6e08706aeb61d83ff1e1eb0c81c910b.tar.bz2 |
Fix the libunwind version of prof_backtrace().
Fix the libunwind version of prof_backtrace() to set the backtrace depth
for all possible code paths. This fixes the zero-length backtrace
problem when using libunwind.
Diffstat (limited to 'jemalloc/src')
-rw-r--r-- | jemalloc/src/prof.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/jemalloc/src/prof.c b/jemalloc/src/prof.c index 88e8f44..6d6910e 100644 --- a/jemalloc/src/prof.c +++ b/jemalloc/src/prof.c @@ -239,16 +239,15 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) } /* - * Iterate over stack frames until there are no more. Heap-allocate - * and iteratively grow a larger bt if necessary. + * Iterate over stack frames until there are no more, or until no space + * remains in bt. */ for (i = 0; i < max; i++) { unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *)&bt->vec[i]); + bt->len++; err = unw_step(&cursor); - if (err <= 0) { - bt->len = i; + if (err <= 0) break; - } } } #else |