Kernel call stack trace?
Kernel call stack trace?
How can it be implemented? I've managed to find a macro called __FUNCTION__, but how can I write it to a buffer on each call? Maybe, there's an attribute for hooking prologue?
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
- Alan Kay
Re: Kernel call stack trace?
Did you read about libbacktrace?
The general idea behind getting backtrace is that it's a two-stage process:
0. Invoke bt_get_backtrace or similar function.
1. It parses the chain of saved frame pointers and return addresses (with some minor architecture-specific details you can get these addresses from stack).
2. Resolve return addresses to function names by parsing debug information (if it's present in your executable image or some separate file).
You can also look here:
The general idea behind getting backtrace is that it's a two-stage process:
0. Invoke bt_get_backtrace or similar function.
1. It parses the chain of saved frame pointers and return addresses (with some minor architecture-specific details you can get these addresses from stack).
2. Resolve return addresses to function names by parsing debug information (if it's present in your executable image or some separate file).
You can also look here:
man 3 backtrace wrote:Code: Select all
BACKTRACE(3) Linux Programmer's Manual BACKTRACE(3) NAME backtrace, backtrace_symbols, backtrace_symbols_fd - support for application self-debugging SYNOPSIS #include <execinfo.h> int backtrace(void **buffer, int size); char **backtrace_symbols(void *const *buffer, int size); void backtrace_symbols_fd(void *const *buffer, int size, int fd);