Skip to content

Instantly share code, notes, and snippets.

@gerdr
Created October 13, 2012 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerdr/3886259 to your computer and use it in GitHub Desktop.
Save gerdr/3886259 to your computer and use it in GitHub Desktop.
Parrot IO readline fail
$ gdb install/bin/perl6
[...]
(gdb) break Parrot_api_run_bytecode
Breakpoint 1 at 0x401778
(gdb) break Parrot_io_readline_s
Function "Parrot_io_readline_s" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (Parrot_io_readline_s) pending.
(gdb) run -e 'pir::print__is(pir::getstdin__P.readline)'
Starting program: /devel/rakudo/install/bin/perl6 -e 'pir::print__is(pir::getstdin__P.readline)'
[New Thread 2752.0x125c]
[New Thread 2752.0x9a4]
Breakpoint 1, 0x00401778 in Parrot_api_run_bytecode ()
(gdb) s
Single stepping until exit from function Parrot_api_run_bytecode,
which has no line number information.
Parrot_api_run_bytecode (interp_pmc=0x800e8978, pbc=0x800b8540,
args=0x800f660c) at src/embed/bytecode.c:150
150 {
(gdb) print ((Parrot_Handle_attributes*)((Parrot_Interp*)interp_pmc->data)->piodata->table[0]->data)
$1 = (Parrot_Handle_attributes *) 0x8009d3d8
(gdb) print ((Parrot_Handle_attributes*)((Parrot_Interp*)interp_pmc->data)->piodata->table[0]->data)->record_separator
$2 = (STRING *) 0x800805a8
(gdb) print ((Parrot_Handle_attributes*)((Parrot_Interp*)interp_pmc->data)->piodata->table[0]->data)->record_separator->strstart
$3 = 0x6f9e7570 "\n"
(gdb) c
Continuing.
Breakpoint 1, Parrot_api_run_bytecode (interp_pmc=0x800e8978, pbc=0x800b8540,
args=0x800f660c) at src/embed/bytecode.c:151
151 ASSERT_ARGS(Parrot_api_run_bytecode)
(gdb) c
Continuing.
Breakpoint 2, Parrot_io_readline_s (interp=0x80039bc0, handle=0x800ee6bc,
terminator=0x81250824) at src/io/api.c:940
940 ASSERT_ARGS(Parrot_io_readline_s)
(gdb) print ((Parrot_Handle_attributes*)interp->piodata->table[0]->data)
$4 = (Parrot_Handle_attributes *) 0x8009d3d8
(gdb) print ((Parrot_Handle_attributes*)interp->piodata->table[0]->data)->record_separator
$5 = (STRING *) 0x81250824
(gdb) print ((Parrot_Handle_attributes*)interp->piodata->table[0]->data)->record_separator->strstart
$6 = 0x82fdbe64 "-763724221"
$ gdb ./perl6
[...]
(gdb) break Parrot_io_readline_s
Function "Parrot_io_readline_s" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (Parrot_io_readline_s) pending.
(gdb) run -e '$*IN.get'
Starting program: /devel/rakudo/install/bin/perl6 -e '$*IN.get'
[New Thread 4116.0xf64]
[New Thread 4116.0x102c]
Breakpoint 1, Parrot_io_readline_s (interp=0x80039b18, handle=0x800ee614,
terminator=0x81245a54) at src/io/api.c:940
940 ASSERT_ARGS(Parrot_io_readline_s)
(gdb) print terminator->strstart
$1 = 0xfe689d48 "1745786907"
(gdb) bt
#0 Parrot_io_readline_s (interp=0x80039b18, handle=0x800ee614,
terminator=0x81245a54) at src/io/api.c:940
#1 0x6f93ce3d in Parrot_Handle_nci_readline (interp=0x80039b18,
_self=0x800ee614) at src/pmc/handle.c:266
#2 0x6f9491ef in Parrot_NativePCCMethod_invoke (interp=0x80039b18,
_self=0x800dc160, next=0xfeedd05c) at src/pmc/nativepccmethod.c:124
#3 0x6f81d507 in Parrot_callmethodcc_p_sc (cur_opcode=0xfeedd050,
interp=0x80039b18) at src/ops/core_ops.c:18243
#4 0x6f897974 in runops_fast_core (interp=0x80039b18,
runcore_unused=0x800eeb08, pc=0xfeedd050) at src/runcore/cores.c:499
#5 0x6f896faa in runops_int (interp=0x80039b18, offset=27622)
at src/runcore/main.c:220
#6 0x6f8729fb in runops (interp=0x80039b18, offs=27622) at src/call/ops.c:126
#7 0x6f86c881 in Parrot_pcc_invoke_from_sig_object (interp=0x80039b18,
sub_obj=0x80ca1640, call_object=0x80ca16a4) at src/call/pcc.c:338
#8 0x6f854c08 in Parrot_ext_call (interp=0x80039b18, sub_pmc=0x80ca1640,
signature=0x6fa90ddc "P->") at src/extend.c:158
#9 0x6f98afd0 in Parrot_Task_invoke (interp=0x80039b18, _self=0x80c95648,
next=0x0) at src/pmc/task.c:166
#10 0x6f86c82f in Parrot_pcc_invoke_from_sig_object (interp=0x80039b18,
sub_obj=0x80c95648, call_object=0x80ca1654) at src/call/pcc.c:330
#11 0x6f854c08 in Parrot_ext_call (interp=0x80039b18, sub_pmc=0x80c95648,
signature=0x6fa256b1 "->") at src/extend.c:158
#12 0x6f89d818 in Parrot_cx_next_task (interp=0x80039b18, scheduler=0x800ee650)
at src/scheduler.c:218
#13 0x6f89d5de in Parrot_cx_outer_runloop (interp=0x80039b18)
at src/scheduler.c:147
#14 0x6f89d51e in Parrot_cx_begin_execution (interp=0x80039b18,
main=0x800f71a8, argv=0x800f6564) at src/scheduler.c:111
#15 0x6f8aa50b in Parrot_pf_execute_bytecode_program (interp=0x80039b18,
pbc=0x800b8498, args=0x800f6564) at src/packfile/api.c:2829
#16 0x6f84ebd2 in Parrot_api_run_bytecode (interp_pmc=0x800e88d0,
pbc=0x800b8498, args=0x800f6564) at src/embed/bytecode.c:161
#17 0x0040135f in perl6!main ()
$ cat readline.pir
.sub test :main
.local pmc stdin
.local string line
stdin = getstdin
line = stdin.'readline'()
print line
.end
$ gdb ./parrot
[...]
(gdb) break Parrot_io_readline_s
Function "Parrot_io_readline_s" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (Parrot_io_readline_s) pending.
(gdb) run readline.pir
Starting program: /devel/rakudo/install/bin/parrot readline.pir
[New Thread 1076.0x534]
[New Thread 1076.0xf30]
Breakpoint 1, Parrot_io_readline_s (interp=0x80039ad0, handle=0x800ee5cc,
terminator=0x800804b8) at src/io/api.c:940
940 ASSERT_ARGS(Parrot_io_readline_s)
(gdb) print terminator->strstart
$1 = 0x6f9e7570 "\n"
$ cat readline.pl
pir::print__is(pir::getstdin__P.readline)
$ gdb ./nqp
[...]
(gdb) break Parrot_io_readline_s
Function "Parrot_io_readline_s" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (Parrot_io_readline_s) pending.
(gdb) run readline.pl
Starting program: /devel/rakudo/install/bin/nqp readline.pl
[New Thread 4020.0x1274]
[New Thread 4020.0xedc]
Breakpoint 1, Parrot_io_readline_s (interp=0x80039ac0, handle=0x800ee5bc,
terminator=0x800804a8) at src/io/api.c:940
940 ASSERT_ARGS(Parrot_io_readline_s)
(gdb) print terminator->strstart
$1 = 0x6f9e7570 "\n"
$ cat readline.pl
pir::print__is(pir::getstdin__P.readline)
$ gdb ./perl6
[...]
(gdb) break Parrot_io_readline_s
Function "Parrot_io_readline_s" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (Parrot_io_readline_s) pending.
(gdb) run readline.pl
Starting program: /devel/rakudo/install/bin/perl6 readline.pl
[New Thread 4956.0xf28]
[New Thread 4956.0xe70]
Breakpoint 1, Parrot_io_readline_s (interp=0x80039ad0, handle=0x800ee5cc,
terminator=0x812523e4) at src/io/api.c:940
940 ASSERT_ARGS(Parrot_io_readline_s)
(gdb) print terminator->strstart
$1 = 0xfe68946c "cuid_48_1350162742.96173_nfa"
@gerdr
Copy link
Author

gerdr commented Oct 13, 2012

Apparently, the record_separator attribute of the Handle PMC does not get set correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment