aboutsummaryrefslogtreecommitdiff
path: root/agent/src/main/java/com/code_intelligence/jazzer/instrumentor/ClassInstrumentor.kt
diff options
context:
space:
mode:
Diffstat (limited to 'agent/src/main/java/com/code_intelligence/jazzer/instrumentor/ClassInstrumentor.kt')
-rw-r--r--agent/src/main/java/com/code_intelligence/jazzer/instrumentor/ClassInstrumentor.kt18
1 files changed, 9 insertions, 9 deletions
diff --git a/agent/src/main/java/com/code_intelligence/jazzer/instrumentor/ClassInstrumentor.kt b/agent/src/main/java/com/code_intelligence/jazzer/instrumentor/ClassInstrumentor.kt
index f6728a1a..4c3eabcb 100644
--- a/agent/src/main/java/com/code_intelligence/jazzer/instrumentor/ClassInstrumentor.kt
+++ b/agent/src/main/java/com/code_intelligence/jazzer/instrumentor/ClassInstrumentor.kt
@@ -14,6 +14,8 @@
package com.code_intelligence.jazzer.instrumentor
+import com.code_intelligence.jazzer.runtime.CoverageMap
+
fun extractClassFileMajorVersion(classfileBuffer: ByteArray): Int {
return ((classfileBuffer[6].toInt() and 0xff) shl 8) or (classfileBuffer[7].toInt() and 0xff)
}
@@ -24,7 +26,11 @@ class ClassInstrumentor constructor(bytecode: ByteArray) {
private set
fun coverage(initialEdgeId: Int): Int {
- val edgeCoverageInstrumentor = EdgeCoverageInstrumentor(initialEdgeId)
+ val edgeCoverageInstrumentor = EdgeCoverageInstrumentor(
+ defaultEdgeCoverageStrategy,
+ defaultCoverageMap,
+ initialEdgeId,
+ )
instrumentedBytecode = edgeCoverageInstrumentor.instrument(instrumentedBytecode)
return edgeCoverageInstrumentor.numEdges
}
@@ -41,13 +47,7 @@ class ClassInstrumentor constructor(bytecode: ByteArray) {
}
companion object {
- init {
- try {
- // Calls JNI_OnLoad_jazzer_initialize in the driver, which registers the native methods.
- System.loadLibrary("jazzer_initialize")
- } catch (_: UnsatisfiedLinkError) {
- // Make it possible to use (parts of) the agent without the driver.
- }
- }
+ val defaultEdgeCoverageStrategy = StaticMethodStrategy()
+ val defaultCoverageMap = CoverageMap::class.java
}
}