PASM/PIR source line info is off by one (at least) on several instructions.
Please run:
$ parrot -d10 <your>.pir 2>&1 | less
and compare line numbers (2nd columns) with src lines in $EDITOR.
Fixes and tests welcome. Re test: There is an opcode C<getline>, which 
would be handy just for testing this stuff, if it's filled with some 
functionality (see also C<Parrot_Context_info()>).
Thanks,
leo
The .end seems to be replaced by an implicit end.
-Vishal
On 6/29/06, Will Coleda via RT <parrotbug...@parrotcode.org> wrote:
>
> Hey, Vishal:
>
> > [vsoni - Tue Jun 27 05:48:27 2006]:
> >
> > Hi,
> >
> > This was a straight forward fix. The line number was being decremented
> > at the start of a 'sub' token imcc.y.
> >
> >
> > Thanks,
> > Vishal
> >
> > Here is a sample run
> >
> > Sample Code:
> > -------------------
> > .sub main :main
> >     print "2\n"
> >     print "3\n"
> >     print "4\n"
> > .end
> >
> > Output:
> > --------
> > ./parrot -d 10 ./hello.pir
> > 1
> > last:5
> > pcc_sub main nparams 0
> >
> > Dumping the instructions status:
> > -------------------------------
> > nins line blck deep flags           type opnr size   pc  X ins
> >    0    1    0    0     0          80000   -1    0    0     main:
> >    1    2    0    0     1              0  413    2    0    print "2\n"
> >    2    3    0    0     1              0  413    2    2    print "3\n"
> >    3    4    0    0     1              0  413    2    4    print "4\n"
> >    4    4    0    0     0          18000    0    1    6    end
>
> Looks like the first line is fixed there (1) and then the guts are fixed
> (2,3,4), but is the
> duplicate line 4 correct? (is that corresponding to the implicit end that
> PIR puts in, or the .end
> of the subroutine?
>
> If you can just validate that, we can apply this.
>
> >
> > Labels
> > name    pos     last ref
> > -----------------------
> >
> >
> > Dumping the CFG:
> > -------------------------------
> > 0 (0)    ->              <-
> >
> >
> > Dumping the Dominators Tree:
> > -------------------------------
> >  0 <- ( 0)  0
> >
> > Loop info
> > ---------
> >
> >
> >
> > Patch
> > --------
> >
> > Index: compilers/imcc/imcc.y
> >
> =========================================================
> ==========
> > --- compilers/imcc/imcc.y       (revision 13035)
> > +++ compilers/imcc/imcc.y       (working copy)
> > @@ -202,7 +202,7 @@
> >      r->type = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED :
> > VT_PCC_SUB;
> >      r->pcc_sub = calloc(1, sizeof(struct pcc_sub_t));
> >      cur_call = r;
> > -    i->line = line - 1;
> > +    i->line = line ;
> >      add_namespace(interp, unit);
> >      return i;
> >  }
> >
> >
> >
> >
> >
>
>
-- 
Thanks,
Vishal
Did we get this one in?
-Vishal
-- 
Thanks,
Vishal
Can you please apply this patch for me? This is a fix to the YACC file. As a
result you will also have to checkin the imcparser.c and imcparser.h after
applying the patch and recompiling the source.
Thanks,
Vishal
Index: compilers/imcc/imcc.y
===================================================================
--- compilers/imcc/imcc.y       (revision 13035)
+++ compilers/imcc/imcc.y       (working copy)
@@ -202,7 +202,7 @@
    r->type = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED : VT_PCC_SUB;
    r->pcc_sub = calloc(1, sizeof(struct pcc_sub_t));
    cur_call = r;
-    i->line = line - 1;
+    i->line = line ;
    add_namespace(interp, unit);
    return i;
 }
-- 
Thanks,
Vishal