本文整理汇总了Java中org.jf.dexlib2.iface.MethodImplementation.getDebugItems方法的典型用法代码示例。如果您正苦于以下问题:Java MethodImplementation.getDebugItems方法的具体用法?Java MethodImplementation.getDebugItems怎么用?Java MethodImplementation.getDebugItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jf.dexlib2.iface.MethodImplementation
的用法示例。
在下文中一共展示了MethodImplementation.getDebugItems方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourceFileLine
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Override
protected int getSourceFileLine() {
// Parse debug information lazily.
if (sourceFileMethod != null) {
MethodImplementation mi = sourceFileMethod.getImplementation();
if (mi != null) {
for (DebugItem di : mi.getDebugItems()) {
if (di instanceof LineNumber) {
sourceFileLine = ((LineNumber) di).getLineNumber();
break;
}
if (di instanceof SetSourceFile) {
// TODO: Support this type of debug item.
break;
}
}
}
sourceFileMethod = null;
}
return sourceFileLine;
}
示例2: internDebug
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
private void internDebug(@Nonnull Method method) {
for (MethodParameter param : method.getParameters()) {
String paramName = param.getName();
if (paramName != null) {
stringPool.intern(paramName);
}
}
MethodImplementation methodImpl = method.getImplementation();
if (methodImpl != null) {
for (DebugItem debugItem : methodImpl.getDebugItems()) {
switch (debugItem.getDebugItemType()) {
case DebugItemType.START_LOCAL:
StartLocal startLocal = (StartLocal) debugItem;
stringPool.internNullable(startLocal.getName());
typePool.internNullable(startLocal.getType());
stringPool.internNullable(startLocal.getSignature());
break;
case DebugItemType.SET_SOURCE_FILE:
stringPool.internNullable(((SetSourceFile) debugItem).getSourceFile());
break;
}
}
}
}
示例3: reMethodImpl
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Override
protected MethodImplementation reMethodImpl(MethodImplementation methodImplementation) {
if (methodImplementation == null){
return null;
}
Iterable<? extends Instruction> instructions = methodImplementation.getInstructions();
Iterable<? extends DebugItem> debugItems = methodImplementation.getDebugItems();
List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = methodImplementation.getTryBlocks();
return new ImmutableMethodImplementation(methodImplementation.getRegisterCount(), reInstructions(instructions), reTryCatchBlock(methodImplementation.getTryBlocks()), reDebugItem(methodImplementation.getDebugItems()));
}
示例4: of
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Nullable
public static ImmutableMethodImplementation of(@Nullable MethodImplementation methodImplementation) {
if (methodImplementation == null) {
return null;
}
if (methodImplementation instanceof ImmutableMethodImplementation) {
return (ImmutableMethodImplementation)methodImplementation;
}
return new ImmutableMethodImplementation(
methodImplementation.getRegisterCount(),
methodImplementation.getInstructions(),
methodImplementation.getTryBlocks(),
methodImplementation.getDebugItems());
}
示例5: getDebugItems
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Nullable @Override
public Iterable<? extends DebugItem> getDebugItems(@Nonnull BuilderMethod builderMethod) {
MethodImplementation impl = builderMethod.getImplementation();
if (impl == null) {
return null;
}
return impl.getDebugItems();
}
示例6: of
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
public static ImmutableMethodImplementation of( MethodImplementation methodImplementation) {
if (methodImplementation == null) {
return null;
}
if (methodImplementation instanceof ImmutableMethodImplementation) {
return (ImmutableMethodImplementation)methodImplementation;
}
return new ImmutableMethodImplementation(
methodImplementation.getRegisterCount(),
methodImplementation.getInstructions(),
methodImplementation.getTryBlocks(),
methodImplementation.getDebugItems());
}
示例7: getDebugItems
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Override
public Iterable<? extends DebugItem> getDebugItems( BuilderMethod builderMethod) {
MethodImplementation impl = builderMethod.getImplementation();
if (impl == null) {
return null;
}
return impl.getDebugItems();
}
示例8: onSimpleEdit
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Override
protected Method onSimpleEdit(Method patch, PatcherAnnotation annotation, Method target, boolean inPlace) {
if (!inPlace && NATIVE.isSet(patch.getAccessFlags() & target.getAccessFlags())) {
log(ERROR, "cannot rename native method");
}
MethodImplementation implementation = target.getImplementation();
if (isTaggedByLastParameter(patch, false)) {
List<? extends MethodParameter> parameters = patch.getParameters();
MethodParameter lastParameter = parameters.get(parameters.size() - 1);
int tagRegisterCount = (TypeUtils.isWideType(lastParameter) ? 2 : 1);
implementation = new BasicMethodImplementation(
implementation.getRegisterCount() + tagRegisterCount,
implementation.getInstructions(),
implementation.getTryBlocks(),
implementation.getDebugItems());
}
Method patched = new BasicMethod(
patch.getDefiningClass(),
patch.getName(),
patch.getParameters(),
patch.getReturnType(),
patch.getAccessFlags(),
annotation.getFilteredAnnotations(),
implementation);
return super.onSimpleEdit(patched, annotation, target, inPlace);
}
示例9: of
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Nullable
public static ImmutableMethodImplementation of(@Nullable MethodImplementation methodImplementation) {
if (methodImplementation == null) {
return null;
}
if (methodImplementation instanceof ImmutableMethodImplementation) {
return (ImmutableMethodImplementation) methodImplementation;
}
return new ImmutableMethodImplementation(
methodImplementation.getRegisterCount(),
methodImplementation.getInstructions(),
methodImplementation.getTryBlocks(),
methodImplementation.getDebugItems());
}
示例10: getDebugItems
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Nullable
@Override
public Iterable<? extends DebugItem> getDebugItems(@Nonnull PoolMethod method) {
MethodImplementation impl = method.getImplementation();
if (impl != null) {
return impl.getDebugItems();
}
return null;
}
示例11: getDebugItems
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
@Nullable
@Override
public Iterable<? extends DebugItem> getDebugItems(@Nonnull BuilderMethod builderMethod) {
MethodImplementation impl = builderMethod.getImplementation();
if (impl == null) {
return null;
}
return impl.getDebugItems();
}
示例12: DexBody
import org.jf.dexlib2.iface.MethodImplementation; //导入方法依赖的package包/类
/**
* @param code the codeitem that is contained in this body
* @param method the method that is associated with this body
*/
public DexBody(DexFile dexFile, Method method, RefType declaringClassType) {
MethodImplementation code = method.getImplementation();
if (code == null)
throw new RuntimeException("error: no code for method "+ method.getName());
this.declaringClassType = declaringClassType;
tries = code.getTryBlocks();
methodSignature = method.getDefiningClass() +": "+ method.getReturnType() +" "+ method.getName() +"(";
for (MethodParameter mp: method.getParameters())
methodSignature += mp.getType() +",";
List<? extends CharSequence> paramTypes = method.getParameterTypes();
if (paramTypes != null) {
parameterTypes = new ArrayList<Type>();
for (CharSequence type : paramTypes)
parameterTypes.add(DexType.toSoot(type.toString()));
} else {
parameterTypes = Collections.emptyList();
}
isStatic = Modifier.isStatic(method.getAccessFlags());
numRegisters = code.getRegisterCount();
numParameterRegisters = MethodUtil.getParameterRegisterCount(method);
if (!isStatic)
numParameterRegisters--;
instructions = new ArrayList<DexlibAbstractInstruction>();
instructionAtAddress = new HashMap<Integer, DexlibAbstractInstruction>();
registerLocals = new Local[numRegisters];
int address = 0;
for (Instruction instruction : code.getInstructions()) {
DexlibAbstractInstruction dexInstruction = fromInstruction(instruction, address);
instructions.add(dexInstruction);
instructionAtAddress.put(address, dexInstruction);
Debug.printDbg(" put instruction '", dexInstruction ,"' at 0x", Integer.toHexString(address));
address += instruction.getCodeUnits();
}
// Check taken from Android's dalvik/libdex/DexSwapVerify.cpp
if (numParameterRegisters > numRegisters)
throw new RuntimeException("Malformed dex file: insSize (" + numParameterRegisters
+ ") > registersSize (" + numRegisters + ")");
for (DebugItem di: code.getDebugItems()) {
if (di instanceof ImmutableLineNumber) {
ImmutableLineNumber ln = (ImmutableLineNumber)di;
DexlibAbstractInstruction ins = instructionAtAddress(ln.getCodeAddress());
if (ins == null) {
Debug.printDbg("Line number tag pointing to invalid offset: " + ln.getCodeAddress());
continue;
}
ins.setLineNumber(ln.getLineNumber());
Debug.printDbg("Add line number tag " + ln.getLineNumber() + " for instruction: "
+ instructionAtAddress(ln.getCodeAddress()));
}
}
this.dexFile = dexFile;
}