NeoMutt
2025-12-11-1009-ga75d9e
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
backtrace.c
Go to the documentation of this file.
1
22
28
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
#include "
version.h
"
36
40
void
show_backtrace
(
void
)
41
{
42
unw_cursor_t cursor = { 0 };
43
unw_context_t uc = { 0 };
44
unw_word_t ip = 0;
45
unw_word_t sp = 0;
46
char
buf[256] = { 0 };
47
48
printf(
"\n%s\n"
,
mutt_make_version
());
49
printf(
"Backtrace\n"
);
50
mutt_debug
(
LL_DEBUG1
,
"\nBacktrace\n"
);
51
unw_getcontext(&uc);
52
unw_init_local(&cursor, &uc);
53
while
(unw_step(&cursor) > 0)
54
{
55
unw_get_reg(&cursor, UNW_REG_IP, &ip);
56
unw_get_reg(&cursor, UNW_REG_SP, &sp);
57
unw_get_proc_name(&cursor, buf,
sizeof
(buf), &ip);
58
if
(buf[0] ==
'_'
)
59
continue
;
60
printf(
" %s() ip = %lx, sp = %lx\n"
, buf, (
long
) ip, (
long
) sp);
61
mutt_debug
(
LL_DEBUG1
,
" %s() ip = %lx, sp = %lx\n"
, buf, (
long
) ip, (
long
) sp);
62
}
63
printf(
"\n"
);
64
}
show_backtrace
void show_backtrace(void)
Log the program's call stack.
Definition
backtrace.c:40
lib.h
Convenience wrapper for the debug headers.
mutt_debug
#define mutt_debug(LEVEL,...)
Definition
logging2.h:91
LL_DEBUG1
@ LL_DEBUG1
Log at debug level 1.
Definition
logging2.h:45
lib.h
Convenience wrapper for the library headers.
muttlib.h
Some miscellaneous functions.
mutt_make_version
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition
version.c:293
version.h
Display version and copyright about NeoMutt.