Minor logging improvements

This commit is contained in:
Ivan Chikish 2023-07-13 17:53:13 +03:00
parent f11efcd324
commit aa00adc9ec
5 changed files with 27 additions and 21 deletions

View file

@ -33,10 +33,12 @@ void rx::printStackTrace(ucontext_t *context, int fileno) {
char buffer[1024];
flockfile(stderr);
if (int r = unw_init_local2(&cursor, context, UNW_INIT_SIGNAL_FRAME)) {
int len = snprintf(buffer, sizeof(buffer), "unw_init_local: %s\n",
unw_strerror(r));
write(fileno, buffer, len);
funlockfile(stderr);
return;
}
@ -67,6 +69,7 @@ void rx::printStackTrace(ucontext_t *context, int fileno) {
write(fileno, buffer, len);
count++;
} while (unw_step(&cursor) > 0 && count < 32);
funlockfile(stderr);
}
void rx::printStackTrace(ucontext_t *context, orbis::Thread *thread,