[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line number attributes



Archie Cobbs <archie@dellroad.org> wrote:
> In 1.x I used to do this to preserve the line number attributes when
> processing class files:
> 
> 	import soot.baf.toolkits.base.CodeAttributeGenerator;
> 	import soot.tagkit.LineNumberTagAggregator;
> 
> 	...
> 
> 	static {
> 		soot.Main.keepLineNumberAttribute = true;
> 		//soot.Main.keepBytecodeOffsetInfo = true;
> 		CodeAttributeGenerator.v().registerAggregator(
> 		    new LineNumberTagAggregator(true));
> 	}
> 
> What would be the equivalent statemtent(s) in 2.x?

I believe you could use something like: 

args[0] = "-keep-line-number";
Main.v().run(args);

(not tested)

Something similar should work with 1.x too.  keepLineNumberAttribute
probably shouldn't have been a publically modifiable field.

Cheers,
Navin.