summaryrefslogtreecommitdiff
path: root/include/backtrace.h
blob: 2abece79a9329275962e907fd8f50c087502b1b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

#include <stddef.h>

// Fill dst with a stack trace consisting of return addresses
// in order from top to bottom. returns the number filled (at most len)
size_t backtrace(void **dst, size_t len);


// same as backtrace but with specified instruction and base pointer
size_t backtrace_ex(void **dst, size_t len, void* ip, void *bp);

// TODO symbols
//size_t backtrace_symbols(char *const *dst, size_t len);

// Log a backtrace
void log_backtrace();

// same as log_backtrace with specified insruction and base pointer
void log_backtrace_ex(void *ip, void *bp);