Re: [svn ci] Debug segment updates

2005-10-20 Thread Jonathan Worthington

Jonathan Worthington [EMAIL PROTECTED] wrote:
What's left?  Making this work for when you .include files in PIR.  Which 
means monkeying with the lexer and IMCC.  shudder


I've done it and it's available to play with.  I'll admit now that, despite 
having covered quite a bit of the IMCC codebase while working out the best 
way to do this, I'm still no expert on how it works so this may not be 
perfect.  Anyway, an example of the kinda thing that now works:-


$ cat crash1.pir
# Example
.sub main :main
   _test()
.end

.include crash2.pir

.sub _test2
 _does_not_exist()
.end
$ cat crash2.pir
.sub _test
   _test2()
.end
$ parrot crash1.pir
Name '_does_not_exist' not found
current instr.: '_test2' pc 24 (crash1.pir:9)
called from Sub '_test' pc 17 (crash2.pir:2)
called from Sub 'main' pc 7 (crash1.pir:3)

Note how the correct files are named in the backtrace now; before it would 
always say crash1.pir no matter what file it was in.


Also fixed some warnings, plus a bug that pre-dated my debug seg work that 
meant sometimes a file didn't get a debug segment added to it..


Happy debugging,

Jonathan 



[svn ci] Debug segment updates

2005-10-15 Thread Jonathan Worthington

Hi,

A while back I posted an RFC about changing the PASM/PIR debug segment so it 
would be able to give useful info about PBCs produced from multiple files. 
Today I've done a couple of ci's that have put this change into effect, with 
the small change to the original plan that filenames are not stored in the 
debug segment but rather as strings in the constant segment (at leo's 
suggestion).


Note that this has invalidated any existing packfiles.  But that's pretty 
regular these days, what with all this deprecation.  ;-)


I also updated pbc_merge to take advantage of the changes.

$ type crash1.pir
.sub main
   _test()
.end
$ type crash2.pir
.sub _test
   _nonexistent()
.end
$ parrot -o crash1.pbc crash1.pir
$ parrot -o crash2.pbc crash2.pir
$ pbc_merge -o crash.pbc crash1.pbc crash2.pbc
$ parrot crash.pbc
Name '_nonexistent' not found
current instr.: '_test' pc 14 (crash2.pir:2)
called from Sub 'main' pc 7 (crash1.pir:2)

The important bit is the last two lines - notice how we can now report both 
file names in the backtrace.


What's left?  Making this work for when you .include files in PIR.  Which 
means monkeying with the lexer and IMCC.  shudder


Enjoy,

Jonathan