NeoMutt  2024-03-23-147-g885fbc
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
backtrace.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <libunwind.h>
31#include <stdio.h>
32#include "mutt/lib.h"
33#include "lib.h"
34#include "muttlib.h"
35
40{
41 unw_cursor_t cursor;
42 unw_context_t uc;
43 unw_word_t ip, sp;
44 char buf[256];
45
46 printf("\n%s\n", mutt_make_version());
47 printf("Backtrace\n");
48 mutt_debug(LL_DEBUG1, "\nBacktrace\n");
49 unw_getcontext(&uc);
50 unw_init_local(&cursor, &uc);
51 while (unw_step(&cursor) > 0)
52 {
53 unw_get_reg(&cursor, UNW_REG_IP, &ip);
54 unw_get_reg(&cursor, UNW_REG_SP, &sp);
55 unw_get_proc_name(&cursor, buf, sizeof(buf), &ip);
56 if (buf[0] == '_')
57 continue;
58 printf(" %s() ip = %lx, sp = %lx\n", buf, (long) ip, (long) sp);
59 mutt_debug(LL_DEBUG1, " %s() ip = %lx, sp = %lx\n", buf, (long) ip, (long) sp);
60 }
61 printf("\n");
62}
void show_backtrace(void)
Log the program's call stack.
Definition: backtrace.c:39
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
Convenience wrapper for the library headers.
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:893
Some miscellaneous functions.
Key value store.