#1399 "LineNumberTable" coinciding start_pc

vkuzkokov Fri 21 Jan 2011

Related to #1388 and issue DanielFath came across while debugging in F4.

I don't know who is wrong here, but it seems like Eclipse doesn't handle subj well. The simplest example (I could make) triggering this strange behavior is:

class Main {
  new make(|This| f) { f(this) }
  static Void main()
  {
    s := Main //breakpoint here doesn't work
    {         //same here
      echo(it)
    }
    echo("hi") //breakpoint here does work
  }
}

Here's what fanp -l -f test.fan Main.main gives:

main () -> sys::Void [const public static]
  [Local 0] s -> script::Main
  [Code]
  [LineNumbers] size=14
     0: 5
     0: 6
     9: 9
  [LineNumber] size=2
     3

The second one gets eliminated if we incorporate this patch.

diff -r 892843b596b9 src/compiler/fan/assembler/CodeAsm.fan
--- a/src/compiler/fan/assembler/CodeAsm.fan    Thu Jan 20 11:22:20 2011 -0500
+++ b/src/compiler/fan/assembler/CodeAsm.fan    Fri Jan 21 12:18:46 2011 +0600
@@ -1631,11 +1631,12 @@
   private Void line(Loc loc)
   {
     line := loc.line
-    if (line == null || lastLine == line) return
+    if (line == null || lastLine == line || lastCode == code.size) return
     lineCount++
     lines.writeI2(code.size)
     lines.writeI2(line)
     lastLine = line
+    lastCode = code.size
   }

 //////////////////////////////////////////////////////////////////////////
@@ -1651,6 +1652,7 @@
   Buf lines
   Int lineCount
   Int lastLine := -1
+  Int lastCode := -1
   Loop[] loopStack

   // protected region fields

And breakpoint on s := Main now works, of course.

brian Tue 25 Jan 2011

Seems like a weird problem, but thanks for investigating and providing patch.

I pushed a fix

Login or Signup to reply.