Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created January 25, 2009 22:02
Show Gist options
  • Select an option

  • Save methodmissing/52562 to your computer and use it in GitHub Desktop.

Select an option

Save methodmissing/52562 to your computer and use it in GitHub Desktop.
(gdb) b eval.c : 10544
Breakpoint 2 at 0x330ba: file eval.c, line 10545.
(gdb) run -e 'Thread.new{ Fiber.new{p 1}.resume }'
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /Users/lourens/projects/ruby187/miniruby -e 'Thread.new{ Fiber.new{p 1}.resume }'
Breakpoint 2, rb_thread_save_context (th=0x802000) at eval.c:10545
10545 len = ruby_stack_length(&pos);
(gdb) p len
$1 = 0
(gdb) p th
$2 = (rb_thread_t) 0x802000
(gdb) n
10546 th->stk_len = 0;
(gdb) p len
$3 = 1132
(gdb) n
10547 th->stk_pos = pos;
(gdb) p th->stk_len
$4 = 0
(gdb) n
10548 if (len > th->stk_max) {
(gdb) p th->stk_pos
$5 = (VALUE *) 0xbfffe5fc
(gdb) p th->stk_max
$6 = 0
(gdb) n
10549 VALUE *ptr = realloc(th->stk_ptr, sizeof(VALUE) * len);
(gdb) n
10550 if (!ptr) rb_memerror();
(gdb) n
10551 th->stk_ptr = ptr;
(gdb) p th->stk_ptr
$7 = (VALUE *) 0x0
(gdb) n
10552 th->stk_max = len;
(gdb) n
10554 th->stk_len = len;
(gdb) n
10556 MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len);
(gdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment