PageRenderTime 57ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/tutorial/guide/cmdline.txt

https://github.com/Eeeeddddy/soot
Plain Text | 568 lines | 390 code | 178 blank | 0 comment | 0 complexity | 4517e3a3b49ee25c3ca8569745aee670 MD5 | raw file
  1. Argument classes are those you specify explicitly to Soot. When you
  2. use Soot's command line interface, argument classes are those classes
  3. which are either listed explicitly on the command line or found in a
  4. directory specified with the -process-dir option. When you use the
  5. Soot's Eclipse plug-in, argument classes are those which you selected
  6. before starting Soot from the Navigator popup menu, or all classes in
  7. the current project if you started Soot from the Project menu.
  8. Application classes are classes that Soot analyzes, transforms, and
  9. turns into output files.
  10. Library classes are classes which are referred to, directly or
  11. indirectly, by the application classes, but which are not themselves
  12. application classes. Soot resolves these classes and reads .class or
  13. .jimple source files for them, but it does not perform transformations
  14. on library classes or write output files for them.
  15. All argument classes are necessarily application classes. When Soot is
  16. not in ``application mode'', argument classes are the only application
  17. classes; other classes referenced from the argument classes become
  18. library classes.
  19. When Soot is in application mode, every class referenced from the
  20. argument classes, directly or indirectly, is also an application
  21. class, unless its package name indicates that it is part of the
  22. standard Java runtime system.
  23. Users may fine-tune the designation of application and library classes
  24. using the Application Mode Options.
  25. Here is a simple example to clarify things. Suppose your program
  26. consists of three class files generated from the following source:
  27. // UI.java
  28. interface UI {
  29. public void display(String msg);
  30. }
  31. // HelloWorld.java
  32. class HelloWorld {
  33. public static void main(String[] arg) {
  34. UI ui = new TextUI();
  35. ui.display("Hello World");
  36. }
  37. }
  38. // TextUI.java
  39. import java.io.*;
  40. class TextUI implements UI {
  41. public void display(String msg) {
  42. System.out.println(msg);
  43. }
  44. }
  45. If you run
  46. java soot.Main HelloWorld
  47. HelloWorld is the only argument class and the only application class. UI and TextUI are library classes, along with java.lang.System, java.lang.String, java.io.PrintStream, and a host of other classes from the Java runtime system that get dragged in indirectly by the references to String and System.out.
  48. If you run
  49. java soot.Main --app HelloWorld
  50. HelloWorld remains the only argument class, but the application classes include UI and TextUI as well as HelloWorld. java.lang.System et. al. remain library classes.
  51. If you run
  52. java soot.Main -i java. --app HelloWorld
  53. HelloWorld is still the only argument class, but the set of application classes includes the referenced Java runtime classes in packages whose names start with java. as well as HelloWorld, UI, and textUI. The set of library classes includes the referenced classes from other packages in the Java runtime.
  54. OPTIONS
  55. General Options
  56. -h, -help
  57. Display the textual help message and exit immediately without further processing.
  58. -pl, -phase-list
  59. Print a list of the available phases and sub-phases, then exit.
  60. -ph phase, -phase-help phase
  61. Print a help message about the phase or sub-phase named phase, then exit. To see the help message of more than one phase, specify multiple phase-help options.
  62. -version
  63. Display information about the version of Soot being run, then exit without further processing.
  64. -v, -verbose
  65. Provide detailed information about what Soot is doing as it runs.
  66. -interactive-mode
  67. Runs interactively, with Soot providing detailed information as it iterates through intra-procedural analyses.
  68. -app
  69. Run in application mode, processing all classes referenced by argument classes.
  70. -w, -whole-program
  71. Run in whole program mode, taking into consideration the whole program when performing analyses and transformations. Soot uses the Call Graph Constructor to build a call graph for the program, then applies enabled transformations in the Whole-Jimple Transformation, Whole-Jimple Optimization, and Whole-Jimple Annotation packs before applying enabled intraprocedural transformations.
  72. Note that the Whole-Jimple Optimization pack is normally disabled (and thus not applied by whole program mode), unless you also specify the Whole Program Optimize option.
  73. -ws, -whole-shimple
  74. Run in whole shimple mode, taking into consideration the whole program when performing Shimple analyses and transformations. Soot uses the Call Graph Constructor to build a call graph for the program, then applies enabled transformations in the Whole-Shimple Transformation and Whole-Shimple Optimization before applying enabled intraprocedural transformations.
  75. Note that the Whole-Shimple Optimization pack is normally disabled (and thus not applied by whole shimple mode), unless you also specify the Whole Program Optimize option.
  76. -validate
  77. Causes internal checks to be done on bodies in the various Soot IRs, to make sure the transformations have not done something strange. This option may degrade Soot's performance.
  78. -debug
  79. Print various debugging information as Soot runs, particularly from the Baf Body Phase and the Jimple Annotation Pack Phase.
  80. -debug-resolver
  81. Print debugging information about class resolving.
  82. Input Options
  83. -cp path, -soot-class-path path, -soot-classpath path
  84. Use path as the list of directories in which Soot should search
  85. for classes. path should be a series of directories, separated by
  86. the path separator character for your system.
  87. If no classpath is set on the command line, but the system
  88. property soot.class.path has been set, Soot uses its value as the
  89. classpath.
  90. If neither the command line nor the system properties specify a
  91. Soot classpath, Soot falls back on a default classpath consisting
  92. of the value of the system property java.class.path followed
  93. java.home/lib/rt.jar, where java.home stands for the contents of
  94. the system property java.home and / stands for the system file
  95. separator.
  96. -process-dir dir
  97. Add all classes found in dir to the set of argument classes which
  98. is analyzed and transformed by Soot. You can specify the option
  99. more than once, to add argument classes from multiple directories.
  100. If subdirectories of dir contain .class or .jimple files, Soot
  101. assumes that the subdirectory names correspond to components of
  102. the classes' package names. If dir contains
  103. subA/subB/MyClass.class, for instance, then Soot assumes MyClass
  104. is in package subA.subB.
  105. -src-prec format
  106. (default value: c)
  107. Sets format as Soot's preference for the type of source files to
  108. read when it looks for a class.
  109. Possible values:
  110. c, class
  111. Try to resolve classes first from .class files found in the Soot
  112. classpath. Fall back to .jimple files only when unable to find a
  113. .class file. J, jimple
  114. Try to resolve classes first from .jimple files found in the Soot
  115. classpath. Fall back to .class files only when unable to find a
  116. .jimple file. java
  117. Try to resolve classes first from .java files found in the Soot
  118. classpath. Fall back to .class files only when unable to find a
  119. .java file.
  120. -full-resolver
  121. Normally, Soot resolves only that application classes and any
  122. classes that they refer to, along with any classes it needs for
  123. the Jimple typing, but it does not transitively resolve references
  124. in these additional classes that were resolved only because they
  125. were referenced. This switch forces full transitive resolution of
  126. all references found in all classes that are resolved, regardless
  127. of why they were resolved.
  128. In whole-program mode, class resolution is always fully
  129. transitive. Therefore, in whole-program mode, this switch has no
  130. effect, and class resolution is always performed as if it were
  131. turned on.
  132. -allow-phantom-refs
  133. Allow Soot to process a class even if it cannot find all classes
  134. referenced by that class. This may cause Soot to produce incorrect
  135. results.
  136. -use-old-type-assigner
  137. (default value: false)
  138. Disable the reimplemented type assigner. This uses improved data
  139. structures to provide a significant performance benefit, but has
  140. not yet been thoroughly tested.
  141. -main-class class
  142. By default, the first class mentioned on the command-line is
  143. treated as the main class (entry point) in whole-program
  144. analysis. This option overrides this default.
  145. Output Options
  146. -d dir, -output-dir dir
  147. (default value: ./sootOutput)
  148. Store output files in dir. dir may be relative to the working
  149. directory.
  150. -f format, -output-format format
  151. (default value: c)
  152. Specify the format of output files Soot should produce, if any.
  153. Note that while the abbreviated formats (jimp, shimp, b, and
  154. grimp) are easier to read than their unabbreviated counterparts
  155. (jimple, shimple, baf, and grimple), they may contain
  156. ambiguities. Method signatures in the abbreviated formats, for
  157. instance, are not uniquely determined.
  158. Possible values:
  159. J, jimple
  160. Produce .jimple files, which contain a textual form of Soot's
  161. Jimple internal representation. j, jimp
  162. Produce .jimp files, which contain an abbreviated form of Jimple.
  163. S, shimple
  164. Produce .shimple files, containing a textual form of Soot's SSA
  165. Shimple internal representation. Shimple adds Phi nodes to Jimple.
  166. s, shimp
  167. Produce .shimp files, which contain an abbreviated form of
  168. Shimple. B, baf
  169. Produce .baf files, which contain a textual form of Soot's Baf
  170. internal representation. b
  171. Produce .b files, which contain an abbreviated form of Baf. G,
  172. grimple
  173. Produce .grimple files, which contain a textual form of Soot's
  174. Grimp internal representation. g, grimp
  175. Produce .grimp files, which contain an abbreviated form of Grimp.
  176. X, xml
  177. Produce .xml files containing an annotated version of the Soot's
  178. Jimple internal representation. n, none
  179. Produce no output files. jasmin
  180. Produce .jasmin files, suitable as input to the jasmin bytecode
  181. assembler. c, class
  182. Produce Java .class files, executable by any Java Virtual Machine.
  183. d, dava
  184. Produce .java files generated by the Dava decompiler.
  185. -outjar, -output-jar
  186. Saves output files into a Jar file instead of a directory. The
  187. output Jar file name should be specified using the Output
  188. Directory (output-dir) option. Note that if the output Jar file
  189. exists before Soot runs, any files inside it will first be
  190. removed.
  191. -xml-attributes
  192. Save in XML format a variety of tags which Soot has attached to
  193. its internal representations of the application classes. The XML
  194. file can then be read by the Soot plug-in for the Eclipse IDE,
  195. which can display the annotations together with the program
  196. source, to aid program understanding.
  197. -print-tags, -print-tags-in-output
  198. Print in output files (either in Jimple or Dave) a variety of tags
  199. which Soot has attached to its internal representations of the
  200. application classes. The tags will be printed on the line
  201. succeeding the stmt that they are attached to.
  202. -no-output-source-file-attribute
  203. Don't output Source File Attribute when producing class files.
  204. -no-output-inner-classes-attribute
  205. Don't output inner classes attribute in class files.
  206. -dump-body phaseName
  207. Specify that phaseName is one of the phases to be dumped. For
  208. example -dump-body jb -dump-body jb.a would dump each method
  209. before and after the jb and jb.a phases. The pseudo phase name
  210. ``ALL'' causes all phases to be dumped.
  211. Output files appear in subdirectories under the soot output
  212. directory, with names like
  213. className/methodSignature/phasename-graphType-number.in and
  214. className/methodSignature/phasename-graphType-number.out. The
  215. ``in'' and ``out'' suffixes distinguish the internal
  216. representations of the method before and after the phase executed.
  217. -dump-cfg phaseName
  218. Specify that any control flow graphs constructed during the
  219. phaseName phases should be dumped. For example -dump-cfg jb
  220. -dump-cfg bb.lso would dump all CFGs constructed during the jb and
  221. bb.lso phases. The pseudo phase name ``ALL'' causes CFGs
  222. constructed in all phases to be dumped.
  223. The control flow graphs are dumped in the form of a file
  224. containing input to dot graph visualization tool. Output dot files
  225. are stored beneath the soot output directory, in files with names
  226. like: className/methodSignature/phasename-graphType-number.dot,
  227. where number serves to distinguish graphs in phases that produce
  228. more than one (for example, the Aggregator may produce multiple
  229. ExceptionalUnitGraphs).
  230. -show-exception-dests
  231. (default value: true)
  232. Indicate whether to show exception destination edges as well as
  233. control flow edges in dumps of exceptional control flow graphs.
  234. -gzip
  235. (default value: false)
  236. This option causes Soot to compress output files of intermediate
  237. representations with GZip. It does not apply to class files output
  238. by Soot.
  239. Processing Options
  240. -p phase opt:val, -phase-option phase opt:val
  241. Set phase's run-time option named opt to value.
  242. This is a mechanism for specifying phase-specific options to
  243. different parts of Soot. See Soot phase options for details about
  244. the available phases and options.
  245. -O, -optimize
  246. Perform intraprocedural optimizations on the application classes.
  247. -W, -whole-optimize
  248. Perform whole program optimizations on the application
  249. classes. This enables the Whole-Jimple Optimization pack as well
  250. as whole program mode and intraprocedural optimizations.
  251. -via-grimp
  252. Convert Jimple to bytecode via the Grimp intermediate
  253. representation instead of via the Baf intermediate representation.
  254. -via-shimple
  255. Enable Shimple, Soot's SSA representation. This generates Shimple
  256. bodies for the application classes, optionally transforms them
  257. with analyses that run on SSA form, then turns them back into
  258. Jimple for processing by the rest of Soot. For more information,
  259. see the documentation for the shimp, stp, and sop phases.
  260. -throw-analysis arg
  261. (default value: pedantic)
  262. This option specifies how to estimate the exceptions which each
  263. statement may throw when constructing exceptional CFGs.
  264. Possible values:
  265. pedantic
  266. Says that any instruction may throw any Throwable
  267. whatsoever. Strictly speaking this is correct, since the Java
  268. libraries include the Thread.stop(Throwable) method, which allows
  269. other threads to cause arbitrary exceptions to occur at arbitrary
  270. points in the execution of a victim thread. unit
  271. Says that each statement in the intermediate representation may
  272. throw those exception types associated with the corresponding Java
  273. bytecode instructions in the JVM Specification. The analysis deals
  274. with each statement in isolation, without regard to the
  275. surrounding program.
  276. -omit-excepting-unit-edges
  277. When constructing an ExceptionalUnitGraph or
  278. ExceptionalBlockGraph, include edges to an exception handler only
  279. from the predecessors of an instruction which may throw an
  280. exceptions to the handler, and not from the excepting instruction
  281. itself, unless the excepting instruction has potential side
  282. effects.
  283. Omitting edges from excepting units allows more accurate flow
  284. analyses (since if an instruction without side effects throws an
  285. exception, it has not changed the state of the computation). This
  286. accuracy, though, could lead optimizations to generate
  287. unverifiable code, since the dataflow analyses performed by
  288. bytecode verifiers might include paths to exception handlers from
  289. all protected instructions, regardless of whether the instructions
  290. have side effects. (In practice, the pedantic throw analysis
  291. suffices to pass verification in all VMs tested with Soot to date,
  292. but the JVM specification does allow for less discriminating
  293. verifiers which would reject some code that might be generated
  294. using the pedantic throw analysis without also adding edges from
  295. all excepting units.)
  296. -trim-cfgs
  297. When constructing CFGs which include exceptional edges, minimize
  298. the number of edges leading to exception handlers by analyzing
  299. which instructions might actually be executed before an exception
  300. is thrown, instead of assuming that every instruction protected by
  301. a handler has the potential to throw an exception the handler
  302. catches.
  303. -trim-cfgs is shorthand for -throw-analysis unit
  304. -omit-excepting-unit-edges -p jb.tt enabled:true.
  305. Application Mode Options
  306. -i pkg, -include pkg
  307. Designate classes in packages whose names begin with pkg
  308. (e.g. java.util.) as application classes which should be analyzed
  309. and output. This option allows you to selectively analyze classes
  310. in some packages that Soot normally treats as library classes.
  311. You can use the include option multiple times, to designate the
  312. classes of multiple packages as application classes.
  313. If you specify both include and exclude options, first the classes
  314. from all excluded packages are marked as library classes, then the
  315. classes from all included packages are marked as application
  316. classes.
  317. -x pkg, -exclude pkg
  318. Excludes any classes in packages whose names begin with pkg from
  319. the set of application classes which are analyzed and output,
  320. treating them as library classes instead. This option allows you
  321. to selectively exclude classes which would normally be treated as
  322. application classes
  323. You can use the exclude option multiple times, to designate the
  324. classes of multiple packages as library classes.
  325. If you specify both include and exclude options, first the classes
  326. from all excluded packages are marked as library classes, then the
  327. classes from all included packages are marked as application
  328. classes.
  329. -include-all
  330. Soot uses a default list of packages (such as java.) which are
  331. deemed to contain library classes. This switch removes the default
  332. packages from the list of packages containing library
  333. classes. Individual packages can then be added using the exclude
  334. option.
  335. -dynamic-class class
  336. Mark class as a class which the application may load
  337. dynamically. Soot will read it as a library class even if it is
  338. not referenced from the argument classes. This permits whole
  339. program optimizations on programs which load classes dynamically
  340. if the set of classes that can be loaded is known at compile time.
  341. You can use the dynamic class option multiple times to specify
  342. more than one dynamic class.
  343. -dynamic-dir dir
  344. Mark all class files in dir as classes that may be loaded
  345. dynamically. Soot will read them as library classes even if they
  346. are not referenced from the argument classes.
  347. You can specify more than one directory of potentially dynamic
  348. classes by specifying multiple dynamic directory options.
  349. -dynamic-package pkg
  350. Marks all class files belonging to the package pkg or any of its
  351. subpackages as classes which the application may load
  352. dynamically. Soot will read all classes in pkg as library classes,
  353. even if they are not referenced by any of the argument classes.
  354. To specify more than one dynamic package, use the dynamic package
  355. option multiple times.
  356. Input Attribute Options
  357. -keep-line-number
  358. Preserve line number tables for class files throughout the
  359. transformations.
  360. -keep-bytecode-offset, -keep-offset
  361. Maintain bytecode offset tables for class files throughout the
  362. transformations.
  363. Annotation Options
  364. -annot-purity
  365. Purity anaysis implemented by Antoine Mine and based on the paper
  366. A Combined Pointer and Purity Analysis Java Programs by Alexandru
  367. Salcianu and Martin Rinard.
  368. -annot-nullpointer
  369. Perform a static analysis of which dereferenced pointers may have
  370. null values, and annotate class files with attributes encoding the
  371. results of the analysis. For details, see the documentation for
  372. Null Pointer Annotation and for the Array Bounds and Null Pointer
  373. Check Tag Aggregator.
  374. -annot-arraybounds
  375. Perform a static analysis of which array bounds checks may safely
  376. be eliminated and annotate output class files with attributes
  377. encoding the results of the analysis. For details, see the
  378. documentation for Array Bounds Annotation and for the Array Bounds
  379. and Null Pointer Check Tag Aggregator.
  380. -annot-side-effect
  381. Enable the generation of side-effect attributes.
  382. -annot-fieldrw
  383. Enable the generation of field read/write attributes.
  384. Miscellaneous Options
  385. -time
  386. Report the time required to perform some of Soot's
  387. transformations.
  388. -subtract-gc
  389. Attempt to subtract time spent in garbage collection from the
  390. reports of times required for transformations.