Search code examples
numbersstacklineproguardtrace

proguard stack trace line numbers missing


I am having issues with recovering stack traces from my Proguarded application that I'd really appreciate some help with.

Even though I explictly request to keep attributes such as SourceFile and LineNumberTable, they aren't actually kept for my application.

I've tried disabling shrinking, optimisation and everything except obfuscation itself but nothing seems to work. I've looked up other questions but everyone's seems to be fixed just by keeping the SourceFile and LineNumberTable attributes, but this isn't working for me.

I am using Proguard version 4.6, jdk 1.6. Jar file created using javac through an ant script.

Proguard config:

-libraryjars '...'  #library jars here, omitted
-injars 'filename.jar'
-outjars 'export/filename.jar'

#-useuniqueclassmembernames
-dontusemixedcaseclassnames
-dontshrink
-dontskipnonpubliclibraryclassmembers
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keepparameternames
-printmapping 'export/mapping.map'
-dontoptimize
-dontnote "!DuplicateClassPrinter*"
-keep class org.** { *; }
-dontwarn org.**

-keep class myprogram.engine.scripting.functions.** {
    <methods>;
}

-keep class scriptfacade.** {
    <fields>;
    <methods>;
}

-keep,allowshrinking class myprogram.engine.scripting.functions.* {
    <methods>;
}

#...default keep classes etc below (omitted) 

Thanks very much,

pyre


Solution

  • The problem is not actually with proguard, but ant not keeping line numbers by default. See this link