1 // Copyright 2021 Code Intelligence GmbH 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package com.code_intelligence.jazzer.instrumentor 16 17 import org.objectweb.asm.Opcodes 18 import org.objectweb.asm.tree.MethodNode 19 20 enum class InstrumentationType { 21 CMP, 22 COV, 23 DIV, 24 GEP, 25 INDIR, 26 NATIVE, 27 } 28 29 internal interface Instrumentor { instrumentnull30 fun instrument(internalClassName: String, bytecode: ByteArray): ByteArray 31 32 fun shouldInstrument(access: Int): Boolean { 33 return (access and Opcodes.ACC_ABSTRACT == 0) && 34 (access and Opcodes.ACC_NATIVE == 0) 35 } 36 shouldInstrumentnull37 fun shouldInstrument(method: MethodNode): Boolean { 38 return shouldInstrument(method.access) && 39 method.instructions.size() > 0 40 } 41 42 companion object { 43 const val ASM_API_VERSION = Opcodes.ASM9 44 } 45 } 46