gallium/android: Rewrite backtrace helper for android

The previous implementation kept a hashtable of a Backtrace object per
thread.  debug_backtrace_capture is supposed to store a backtrace in
the passed in debug_stack_frame array, but instead overwrote the
per-thread Backtrace object.

This new version works more like the libunwind based capture. We hash
the file and symbol names and store pointers in the debug_stack_frame
struct.  This way debug_backtrace_capture doesn't overwrite previous
captures or allocate memory that needs to be freed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
This commit is contained in:
Kristian H. Kristensen
2020-07-28 21:24:45 -07:00
committed by Marge Bot
parent d0d14f3f64
commit 5ae7098eba
2 changed files with 74 additions and 62 deletions
+5 -3
View File
@@ -59,10 +59,12 @@ extern "C" {
*/
struct debug_stack_frame
{
#ifdef HAVE_LIBUNWIND
unw_word_t start_ip;
unsigned int off;
#if defined(HAVE_ANDROID_PLATFORM) || defined(HAVE_LIBUNWIND)
const char *procname;
uint64_t start_ip;
unsigned off;
const char *map;
unsigned int map_off;
#else
const void *function;
#endif