Re: PDB [Was: Re: Calling conventions, IMC]
Will Coleda [EMAIL PROTECTED] wrote: bash-2.05a$ make exit ../../../parrot ../tcl.pbc exit.tcl branch_cs: illegal resume offsetmake: *** [exit] Error 1 This is very likely an undefined label. imcc tries to find that at runtime (it could have come out from eval) and fails. So, I'm trying to track down where this badness is happening: bash-2.05a$ ../../pdb tcl.pbc Parrot Debugger 0.0.2 The pdb isn't up yet, to solve such problems. Try to trace it: $ parrot -t tcl.pbc exit.tcl leo
Calling conventions, IMC
(Thanks for the quick response on the last email) I have another problem. I have a 405-line file (containing a single .pcc_sub) that is being included from my main .imc. I get: error:imcc:pcc_return not inside pcc subroutine in file 'lib/interpret.imc' line 397 included from 'tcl.imc' sub '__interpret' line 116 ... Though the file contains: 1 .pcc_sub __interpret prototyped 2# An array of commands to interpret. 3.param PerlArray orig_commands ... 392 DONE: 393.debug(final retval is ') 394.debug(retval) 395.debug('\n) 396.pcc_begin_return 397.return retval 398.pcc_end_return (I know the macro support is going away soon, I'm just trying to get things working with the current snapshot.) So, I /am/ inside a pcc subroutine when I .return. I'm trying to slim this down into a smaller test, but thought I'd post this in the meantime. Regards. -- Will Coke Coledawill at coleda dot com
Re: Calling conventions, IMC
At 12:55 PM -0500 1/19/04, Will Coleda wrote: Though the file contains: 1 .pcc_sub __interpret prototyped 2# An array of commands to interpret. 3.param PerlArray orig_commands ... 392 DONE: 393.debug(final retval is ') 394.debug(retval) 395.debug('\n) 396.pcc_begin_return 397.return retval 398.pcc_end_return Is there a .end at the end of this? -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Calling conventions, IMC
(has a .end) Yup. Managed to shrink it down to: .pcc_sub __interpret prototyped newsub P1, .Sub, __interpret .pcc_begin_return .return 0 .pcc_end_return .end It appears that creating a Sub that refers to the sub you're currently in is the trigger. If I change the sub name to foo, it complains about not finding foo. Comment it out, it compiles. Sorry I didn't narrow down to a test case first -- after months of not touching this, I wasn't sure how long it would take me. =-) On Monday, January 19, 2004, at 01:13 PM, Dan Sugalski wrote: At 12:55 PM -0500 1/19/04, Will Coleda wrote: Though the file contains: 1 .pcc_sub __interpret prototyped 2# An array of commands to interpret. 3.param PerlArray orig_commands ... 392 DONE: 393.debug(final retval is ') 394.debug(retval) 395.debug('\n) 396.pcc_begin_return 397.return retval 398.pcc_end_return Is there a .end at the end of this? -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk -- Will Coke Coledawill at coleda dot com
Re: Calling conventions, IMC
Will Coleda [EMAIL PROTECTED] wrote: 1 .pcc_sub __interpret prototyped 2# An array of commands to interpret. 3.param PerlArray orig_commands Please note that between .pcc_sub and .param nothing is allowed, not even a comment. leo
Re: Calling conventions, IMC
Will Coleda [EMAIL PROTECTED] wrote: (has a .end) Yup. Managed to shrink it down to: .pcc_sub __interpret prototyped newsub P1, .Sub, __interpret .pcc_begin_return .return 0 .pcc_end_return .end Two problems: You are overriding the already existing Sub with that name and 2) you destroy your return continuation, which could be already in P1. leo
Re: Calling conventions, IMC
I didn't expect the code to be very usable, merely compilable. =-) If I want to call myself from myself, how do I do that then? For anything else, I do: .local Sub foo_sub newsub foo_sub, .Sub, __foo .pcc_begin prototyped .arg $S1 .pcc_call foo_sub tellmeagainwhyineedthislabel: .result $S1 .pcc_end If I can't explicitly create foo_sub if I'm in the middle of __foo, how do I recurse using calling conventions? And, in my defense, all this code worked a few months ago. =-) On Monday, January 19, 2004, at 01:54 PM, Leopold Toetsch wrote: Will Coleda [EMAIL PROTECTED] wrote: (has a .end) Yup. Managed to shrink it down to: .pcc_sub __interpret prototyped newsub P1, .Sub, __interpret .pcc_begin_return .return 0 .pcc_end_return .end Two problems: You are overriding the already existing Sub with that name and 2) you destroy your return continuation, which could be already in P1. leo -- Will Coke Coledawill at coleda dot com
Re: Calling conventions, IMC
Will Coleda writes: I didn't expect the code to be very usable, merely compilable. =-) If I want to call myself from myself, how do I do that then? For anything else, I do: .local Sub foo_sub newsub foo_sub, .Sub, __foo .pcc_begin prototyped .arg $S1 .pcc_call foo_sub tellmeagainwhyineedthislabel: .result $S1 .pcc_end If I can't explicitly create foo_sub if I'm in the middle of __foo, how do I recurse using calling conventions You could use P0, which holds the subroutine object. Like using _ in Perl 6. Luke
PDB [Was: Re: Calling conventions, IMC]
Ok. I've converted my code over to do this[1]. I am now able to compile tcl.imc, but all my code fails to run, ala: bash-2.05a$ make exit ../../../parrot ../tcl.pbc exit.tcl branch_cs: illegal resume offsetmake: *** [exit] Error 1 So, I'm trying to track down where this badness is happening: bash-2.05a$ ../../pdb tcl.pbc Parrot Debugger 0.0.2 (pdb) run examples/exit.tcl Restarting And it hangs. if I hit ^D, it closes. This smells like it's ignoring the command line argument and running the pbc with no args, which forces it to read tcl from STDIN. (...dig... yup, that's what it's doing.) So, how can I convince pdb to pass along the args to my bytecode? Also, if I do: bash-2.05a$ ../../pdb tcl.pbc Parrot Debugger 0.0.2 (pdb) load tcl.imc (pdb) list 1 100 I get 32 1/2 lines of output before getting a segfault. (I've attached the crash log) list by itself works fine. There doesn't seem to be a specific X for list 1 X where it consistently segfaults, but anything 12 seems to do a pretty good job. Regards. crash.log Description: Binary data [1] On Monday, January 19, 2004, at 05:16 PM, Luke Palmer wrote: Will Coleda writes: If I can't explicitly create foo_sub if I'm in the middle of __foo, how do I recurse using calling conventions You could use P0, which holds the subroutine object. Like using _ in Perl 6. Luke -- Will Coke Coledawill at coleda dot com
Re: Calling conventions, IMC
At 03:16 PM 1/19/2004 -0700, Luke Palmer wrote: Will Coleda writes: I didn't expect the code to be very usable, merely compilable. =-) If I want to call myself from myself, how do I do that then? For anything else, I do: .local Sub foo_sub newsub foo_sub, .Sub, __foo .pcc_begin prototyped .arg $S1 .pcc_call foo_sub tellmeagainwhyineedthislabel: .result $S1 .pcc_end If I can't explicitly create foo_sub if I'm in the middle of __foo, how do I recurse using calling conventions You could use P0, which holds the subroutine object. Like using _ in Perl 6. I'll commit a fix shortly. -Melvin