[Soot-list] 答复: how to write loaded classes into multiple dex files ?

yinle leo.yin at huawei.com
Fri Feb 9 02:33:36 EST 2018


Hi Steven,

Yes, the newest version soot can write multiple dex files and I moved my tool to it. It works now.
Thank you very much!

-Leo


发件人: Arzt, Steven [mailto:steven.arzt at sit.fraunhofer.de]
发送时间: 2018年2月7日 17:41
收件人: yinle <leo.yin at huawei.com>; soot-list at CS.McGill.CA
主题: RE: [Soot-list] how to write loaded classes into multiple dex files ?

Hi Leo,

Soot does support writing out multiple dex files into an APK. Are you sure that you have the newest version from the develop branch?

Best regards,
  Steven

From: Soot-list [mailto:soot-list-bounces at cs.mcgill.ca] On Behalf Of yinle
Sent: Wednesday, February 7, 2018 10:37 AM
To: soot-list at CS.McGill.CA<mailto:soot-list at CS.McGill.CA>
Subject: [Soot-list] how to write loaded classes into multiple dex files ?

Hi,

I have implemented an instrumentation tool based on Soot for Android jar files (of dex format) and the tool works in general.

However, when the tool processes a Android jar file containing two dex files (one is classes.dex, the other is classes2.dex), it only load classes.dex by default.
When letting Soot use the option “-process-multiple-dex”, the tool will load those two dex files and do instrumentation for all loaded classes, but throw an exception when executing “PackManager.v().writeOutput()” as follows:

       Exception in thread "main" org.jf.util.ExceptionWithContext: Exception occurred while writing code_item for method Landroid/Manifest$permission;-><init>()V
   at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:824)
   at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:267)
   at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:245)
   at soot.toDex.DexPrinter.writeTo(DexPrinter.java:278)                 -------------    Soot throws an Exception.
   at soot.toDex.DexPrinter.printApk(DexPrinter.java:206)
   at soot.toDex.DexPrinter.print(DexPrinter.java:1587)
   at soot.PackManager.writeOutput(PackManager.java:549)
   at soot.Trace.main(Trace.java:1058)


I checked the source code of DexPrinter.writeTo(…), and found it wrote all classes loaded from classes.dex and classes2.dex into one dex file, classes.dex.

It seems that Soot does not support writing loaded classes into multiple dex files.

Can anyone give any help?

Thank you in advance.

-Leo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180209/b890a285/attachment.html>


More information about the Soot-list mailing list