Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • asm asm
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4
    • Issues 4
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • asmasm
  • asmasm
  • Issues
  • #317989
Closed
Open
Issue created Nov 28, 2022 by Ian Zerny@zerny

Silent removal of zero-valued entries from the line-number table

When using ASM to inspect or transform line tables it will silently ignore/strip zero-valued lines.

Expected Behavior

Zero-valued line entries should be treated as any other line value and a call to MethodVisitor.visitLineNumber should be made. (The JVM spec does not appear to have any other requirement than that the line entries are unsigned 2-byte values IFAICT. That is also consistent with JVM execution as illustrated by the attached code).

Current Behavior

MethodVisitor never receives a callback.

Steps to Reproduce

Attached is a .class file with a method that has respectively a non-zero line followed by a zero-valued line. Any use of MethodVisitor on these lines will fail to act on the zero-valued entry. The result is that the throw will inherent the previous line value.

Second line number table is that of the main method:

$ javap -v -cp /tmp/test.zip com.android.tools.r8.debuginfo.AsmZeroLineEntryRegressionTest\$TestClass |grep line -B 1
      LineNumberTable:
        line 126: 0
--
      LineNumberTable:
        line 1: 0
        line 0: 8

Executing the program will throw on "line 0":

$ java -cp /tmp/test.zip com.android.tools.r8.debuginfo.AsmZeroLineEntryRegressionTest\$TestClass
Hello, world!
Exception in thread "main" java.lang.RuntimeException: BOO!
	at com.android.tools.r8.debuginfo.AsmZeroLineEntryRegressionTest$TestClass.main(AsmZeroLineEntryRegressionTest.java:0)

Doing an "identity" transformation on this will strip the zero-valued line and the result will be a stack trace at line :1

More details can be found in the R8 regression test or via the R8 tracking bug.

Archive with the single class file test.zip

Assignee
Assign to
Time tracking