@@ -30,9 +30,12 @@ class Jimple2Cpg extends X2CpgFrontend[Config]:
30
30
case Some (value) if value.nonEmpty =>
31
31
Options .v().set_src_prec(Options .src_prec_apk)
32
32
Options .v().set_force_android_jar(value)
33
+ Options .v().setPhaseOption(" dex" , " ignore-errors:true" )
33
34
case _ =>
34
35
Options .v().set_src_prec(Options .src_prec_apk_c_j)
35
36
Options .v().set_process_multiple_dex(true )
37
+ Options .v().set_search_dex_in_archives(true )
38
+ Options .v().set_native_code(true )
36
39
// workaround for Soot's bug while parsing large apk.
37
40
// see: https://github.com/soot-oss/soot/issues/1256
38
41
Options .v().setPhaseOption(" jb" , " use-original-names:false" )
@@ -50,7 +53,7 @@ class Jimple2Cpg extends X2CpgFrontend[Config]:
50
53
recurse : Boolean ,
51
54
onlyClasses : Boolean
52
55
): List [ClassFile ] =
53
- val archiveFileExtensions = Set (" .jar" , " .war" , " .zip" )
56
+ val archiveFileExtensions = Set (" .jar" , " .war" , " .zip" , " .apkm " , " .xapk " )
54
57
extractClassesInPackageLayout(
55
58
src,
56
59
tmpDir,
@@ -139,15 +142,31 @@ class Jimple2Cpg extends X2CpgFrontend[Config]:
139
142
G .reset()
140
143
141
144
private def configureSoot (config : Config , outDir : File ): Unit =
142
- // set application mode
143
- Options .v().set_app(false )
144
- Options .v().set_whole_program(false )
145
+ if config.fullResolver then
146
+ // full transitive resolution of all references
147
+ Options .v().set_full_resolver(true )
148
+ // set application mode
149
+ Options .v().set_app(true )
150
+ Options .v().set_whole_program(true )
151
+ Options .v().setPhaseOption(
152
+ " cg.spark" ,
153
+ " enabled:true,on-fly-cg:true,propagator:worklist,safe-newinstance:true"
154
+ )
155
+ Options .v().setPhaseOption(" cg.cha" , " enabled:true" )
156
+ Options .v().setPhaseOption(" tagger" , " enabled:true" )
157
+ else
158
+ Options .v().set_app(false )
159
+ Options .v().set_whole_program(false )
160
+ // don’t choke on missing classes in huge app frameworks
161
+ Options .v().set_ignore_resolution_errors(true )
162
+ Options .v().set_ignore_methodsource_error(true )
145
163
// keep debugging info
146
164
Options .v().set_keep_line_number(true )
147
165
Options .v().set_keep_offset(true )
148
166
// ignore library code
149
167
Options .v().set_no_bodies_for_excluded(true )
150
168
Options .v().set_allow_phantom_refs(true )
169
+ Options .v().set_allow_phantom_elms(true )
151
170
// keep variable names
152
171
Options .v().setPhaseOption(" jb.sils" , " enabled:false" )
153
172
Options .v().setPhaseOption(" jb" , " use-original-names:true" )
@@ -157,12 +176,7 @@ class Jimple2Cpg extends X2CpgFrontend[Config]:
157
176
// output jimple
158
177
Options .v().set_output_format(Options .output_format_jimple)
159
178
Options .v().set_output_dir(outDir.canonicalPath)
160
-
161
179
Options .v().set_dynamic_dir(config.dynamicDirs.asJava)
162
180
Options .v().set_dynamic_package(config.dynamicPkgs.asJava)
163
-
164
- if config.fullResolver then
165
- // full transitive resolution of all references
166
- Options .v().set_full_resolver(true )
167
181
end configureSoot
168
182
end Jimple2Cpg
0 commit comments