Add safe frame-pointer backtrace unwinder

This commit is contained in:
Nathan Slingerland 2024-09-16 11:00:37 -07:00 committed by Qi Wang
parent 3a0d9cdadb
commit edc1576f03
13 changed files with 271 additions and 1 deletions

View file

@ -167,6 +167,9 @@
/* Use gcc intrinsics for profile backtracing if defined. */
#undef JEMALLOC_PROF_GCC
/* Use frame pointer for profile backtracing if defined. Linux only. */
#undef JEMALLOC_PROF_FRAME_POINTER
/* JEMALLOC_PAGEID enabled page id */
#undef JEMALLOC_PAGEID

View file

@ -114,6 +114,13 @@ static const bool config_prof_libunwind =
false
#endif
;
static const bool config_prof_frameptr =
#ifdef JEMALLOC_PROF_FRAME_POINTER
true
#else
false
#endif
;
static const bool maps_coalesce =
#ifdef JEMALLOC_MAPS_COALESCE
true

View file

@ -154,5 +154,12 @@ static inline int malloc_close(int fd) {
#endif
}
static inline off_t malloc_lseek(int fd, off_t offset, int whence) {
#if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_lseek)
return (off_t)syscall(SYS_lseek, fd, offset, whence);
#else
return lseek(fd, offset, whence);
#endif
}
#endif /* JEMALLOC_INTERNAL_MALLOC_IO_H */

View file

@ -20,6 +20,7 @@ void prof_fdump_impl(tsd_t *tsd);
void prof_idump_impl(tsd_t *tsd);
bool prof_mdump_impl(tsd_t *tsd, const char *filename);
void prof_gdump_impl(tsd_t *tsd);
uintptr_t prof_thread_stack_start(uintptr_t stack_end);
/* Used in unit tests. */
typedef int (prof_sys_thread_name_read_t)(char *buf, size_t limit);