summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_debug_stack.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2017-03-24 15:04:58 -0400
committerRob Clark <[email protected]>2017-04-03 11:32:17 -0400
commitc3c884c49ce6ab06df2e49aa39abbb051c9959b5 (patch)
treea295a55a4e2fa4f60e5cfb2cd1f4bb6c08b2007f /src/gallium/auxiliary/util/u_debug_stack.c
parent0c0b29591c264fa386b1354b6efb85375af3213a (diff)
gallium/util: clean up stack frame printing
Prep work for next patch. Ideally 'struct debug_stack_frame' would be opaque, but it is embedded in a bunch of places. But at least we can treat it opaquely. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_debug_stack.c')
-rw-r--r--src/gallium/auxiliary/util/u_debug_stack.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c
index 1faa1903a76..f941234de20 100644
--- a/src/gallium/auxiliary/util/u_debug_stack.c
+++ b/src/gallium/auxiliary/util/u_debug_stack.c
@@ -162,3 +162,20 @@ debug_backtrace_dump(const struct debug_stack_frame *backtrace,
}
}
+
+void
+debug_backtrace_print(FILE *f,
+ const struct debug_stack_frame *backtrace,
+ unsigned nr_frames)
+{
+ unsigned i;
+
+ for (i = 0; i < nr_frames; ++i) {
+ const char *symbol;
+ if (!backtrace[i].function)
+ break;
+ symbol = debug_symbol_name_cached(backtrace[i].function);
+ if (symbol)
+ fprintf(f, "%s\n", symbol);
+ }
+}