summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/vm_dump.c b/vm_dump.c
index 5bfd382..0a56d81 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -564,28 +564,27 @@ rb_vmdebug_thread_dump_state(VALUE self)
return Qnil;
}
-VALUE rb_make_backtrace(void);
+static int
+bugreport_backtrace(void *arg, const char *file, int line, const char *method)
+{
+ if (!*(int *)arg) {
+ fprintf(stderr, "-- Ruby level backtrace information"
+ "-----------------------------------------\n");
+ *(int *)arg = 1;
+ }
+ fprintf(stderr, "%s:%d:in `%s'\n", file, line, method);
+ return 0;
+}
void
rb_vm_bugreport(void)
{
- VALUE bt;
-
if (GET_THREAD()->vm) {
int i;
SDR();
- bt = rb_make_backtrace();
-
- if (bt) {
- fprintf(stderr, "-- Ruby level backtrace information"
- "-----------------------------------------\n");
-
- for (i = 0; i < RARRAY_LEN(bt); i++) {
- VALUE str = RARRAY_PTR(bt)[i];
- fprintf(stderr, "%s\n", RSTRING_PTR(str));
- }
- fprintf(stderr, "\n");
+ if (rb_backtrace_each(bugreport_backtrace, &i)) {
+ fputs("\n", stderr);
}
}