Dump backtraces to an arbitrary stream when using libprocstat

This commit is contained in:
Nobuyoshi Nakada 2023-09-26 09:02:37 +09:00
parent d2cc4437a1
commit 5eef125afe
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465
2 changed files with 20 additions and 20 deletions

View file

@ -1121,7 +1121,7 @@ rb_vm_bugreport(const void *ctx, FILE *errout)
if (vm && ec) {
rb_vmdebug_stack_dump_raw(ec, ec->cfp, errout);
rb_backtrace_print_as_bugreport(errout);
fputs("\n", errout);
kputs("\n");
// If we get here, hopefully things are intact enough that
// we can read these two numbers. It is an estimate because
// we are reading without synchronization.
@ -1129,7 +1129,7 @@ rb_vm_bugreport(const void *ctx, FILE *errout)
"---------------------------------------------------\n");
kprintf("Total ractor count: %u\n", vm->ractor.cnt);
kprintf("Ruby thread count for this ractor: %u\n", rb_ec_ractor_ptr(ec)->threads.cnt);
fputs("\n", errout);
kputs("\n");
}
rb_dump_machine_register(errout, ctx);
@ -1230,7 +1230,7 @@ rb_vm_bugreport(const void *ctx, FILE *errout)
else {
struct procstat *prstat = procstat_open_sysctl();
kprintf("* Process memory map:\n\n");
procstat_vm(prstat, &kp);
procstat_vm(prstat, &kp, errout);
procstat_close(prstat);
kprintf("\n");
}