org.jf.dexlib2.DebugItemType Java Examples

The following examples show how to use org.jf.dexlib2.DebugItemType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DebugMethodItem.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
public static DebugMethodItem build(RegisterFormatter registerFormatter, DebugItem debugItem) {
    int codeAddress = debugItem.getCodeAddress();
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return new StartLocalMethodItem(codeAddress, -1, registerFormatter, (StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return new EndLocalMethodItem(codeAddress, -1, registerFormatter, (EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return new RestartLocalMethodItem(codeAddress, -1, registerFormatter, (RestartLocal)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return new BeginEpilogueMethodItem(codeAddress, -4);
        case DebugItemType.PROLOGUE_END:
            return new EndPrologueMethodItem(codeAddress, -4);
        case DebugItemType.SET_SOURCE_FILE:
            return new SetSourceFileMethodItem(codeAddress, -3, (SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return new LineNumberMethodItem(codeAddress, -2, (LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #2
Source File: ImmutableDebugItem.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static ImmutableDebugItem of(DebugItem debugItem) {
    if (debugItem instanceof ImmutableDebugItem) {
        return (ImmutableDebugItem)debugItem;
    }
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return ImmutableStartLocal.of((StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return ImmutableEndLocal.of((EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return ImmutableRestartLocal.of((RestartLocal)debugItem);
        case DebugItemType.PROLOGUE_END:
            return ImmutablePrologueEnd.of((PrologueEnd)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return ImmutableEpilogueBegin.of((EpilogueBegin)debugItem);
        case DebugItemType.SET_SOURCE_FILE:
            return ImmutableSetSourceFile.of((SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return ImmutableLineNumber.of((LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #3
Source File: ImmutableDebugItem.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static ImmutableDebugItem of(DebugItem debugItem) {
    if (debugItem instanceof ImmutableDebugItem) {
        return (ImmutableDebugItem)debugItem;
    }
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return ImmutableStartLocal.of((StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return ImmutableEndLocal.of((EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return ImmutableRestartLocal.of((RestartLocal)debugItem);
        case DebugItemType.PROLOGUE_END:
            return ImmutablePrologueEnd.of((PrologueEnd)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return ImmutableEpilogueBegin.of((EpilogueBegin)debugItem);
        case DebugItemType.SET_SOURCE_FILE:
            return ImmutableSetSourceFile.of((SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return ImmutableLineNumber.of((LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #4
Source File: DebugMethodItem.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
public static DebugMethodItem build(RegisterFormatter registerFormatter, DebugItem debugItem) {
    int codeAddress = debugItem.getCodeAddress();
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return new StartLocalMethodItem(codeAddress, -1, registerFormatter, (StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return new EndLocalMethodItem(codeAddress, -1, registerFormatter, (EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return new RestartLocalMethodItem(codeAddress, -1, registerFormatter, (RestartLocal)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return new BeginEpilogueMethodItem(codeAddress, -4);
        case DebugItemType.PROLOGUE_END:
            return new EndPrologueMethodItem(codeAddress, -4);
        case DebugItemType.SET_SOURCE_FILE:
            return new SetSourceFileMethodItem(codeAddress, -3, (SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return new LineNumberMethodItem(codeAddress, -2, (LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #5
Source File: DebugWriter.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
public void writeStartLocal(int codeAddress, int register,
                            @Nullable StringKey name,
                            @Nullable TypeKey type,
                            @Nullable StringKey signature) throws IOException {
    int nameIndex = stringSection.getNullableItemIndex(name);
    int typeIndex = typeSection.getNullableItemIndex(type);
    int signatureIndex = stringSection.getNullableItemIndex(signature);

    writeAdvancePC(codeAddress);
    if (signatureIndex == DexWriter.NO_INDEX) {
        writer.write(DebugItemType.START_LOCAL);
        writer.writeUleb128(register);
        writer.writeUleb128(nameIndex + 1);
        writer.writeUleb128(typeIndex + 1);
    } else {
        writer.write(DebugItemType.START_LOCAL_EXTENDED);
        writer.writeUleb128(register);
        writer.writeUleb128(nameIndex + 1);
        writer.writeUleb128(typeIndex + 1);
        writer.writeUleb128(signatureIndex + 1);
    }
}
 
Example #6
Source File: ClassPool.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
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;
            }
        }
    }
}
 
Example #7
Source File: ClassPool.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
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;
            }
        }
    }
}
 
Example #8
Source File: ClassPool.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
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;
            }
        }
    }
}
 
Example #9
Source File: ImmutableDebugItem.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static ImmutableDebugItem of(DebugItem debugItem) {
    if (debugItem instanceof ImmutableDebugItem) {
        return (ImmutableDebugItem)debugItem;
    }
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return ImmutableStartLocal.of((StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return ImmutableEndLocal.of((EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return ImmutableRestartLocal.of((RestartLocal)debugItem);
        case DebugItemType.PROLOGUE_END:
            return ImmutablePrologueEnd.of((PrologueEnd)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return ImmutableEpilogueBegin.of((EpilogueBegin)debugItem);
        case DebugItemType.SET_SOURCE_FILE:
            return ImmutableSetSourceFile.of((SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return ImmutableLineNumber.of((LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #10
Source File: DebugWriter.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
public void writeStartLocal(int codeAddress, int register,
                            @Nullable StringKey name,
                            @Nullable TypeKey type,
                            @Nullable StringKey signature) throws IOException {
    int nameIndex = stringSection.getNullableItemIndex(name);
    int typeIndex = typeSection.getNullableItemIndex(type);
    int signatureIndex = stringSection.getNullableItemIndex(signature);

    writeAdvancePC(codeAddress);
    if (signatureIndex == DexWriter.NO_INDEX) {
        writer.write(DebugItemType.START_LOCAL);
        writer.writeUleb128(register);
        writer.writeUleb128(nameIndex + 1);
        writer.writeUleb128(typeIndex + 1);
    } else {
        writer.write(DebugItemType.START_LOCAL_EXTENDED);
        writer.writeUleb128(register);
        writer.writeUleb128(nameIndex + 1);
        writer.writeUleb128(typeIndex + 1);
        writer.writeUleb128(signatureIndex + 1);
    }
}
 
Example #11
Source File: DebugWriter.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
public void writeStartLocal(int codeAddress, int register,
                            @Nullable StringKey name,
                            @Nullable TypeKey type,
                            @Nullable StringKey signature) throws IOException {
    int nameIndex = stringSection.getNullableItemIndex(name);
    int typeIndex = typeSection.getNullableItemIndex(type);
    int signatureIndex = stringSection.getNullableItemIndex(signature);

    writeAdvancePC(codeAddress);
    if (signatureIndex == DexWriter.NO_INDEX) {
        writer.write(DebugItemType.START_LOCAL);
        writer.writeUleb128(register);
        writer.writeUleb128(nameIndex + 1);
        writer.writeUleb128(typeIndex + 1);
    } else {
        writer.write(DebugItemType.START_LOCAL_EXTENDED);
        writer.writeUleb128(register);
        writer.writeUleb128(nameIndex + 1);
        writer.writeUleb128(typeIndex + 1);
        writer.writeUleb128(signatureIndex + 1);
    }
}
 
Example #12
Source File: DebugMethodItem.java    From atlas with Apache License 2.0 6 votes vote down vote up
public static DebugMethodItem build(RegisterFormatter registerFormatter, DebugItem debugItem) {
    int codeAddress = debugItem.getCodeAddress();
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return new StartLocalMethodItem(codeAddress, -1, registerFormatter, (StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return new EndLocalMethodItem(codeAddress, -1, registerFormatter, (EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return new RestartLocalMethodItem(codeAddress, -1, registerFormatter, (RestartLocal)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return new BeginEpilogueMethodItem(codeAddress, -4);
        case DebugItemType.PROLOGUE_END:
            return new EndPrologueMethodItem(codeAddress, -4);
        case DebugItemType.SET_SOURCE_FILE:
            return new SetSourceFileMethodItem(codeAddress, -3, (SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return new LineNumberMethodItem(codeAddress, -2, (LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #13
Source File: DebugMethodItem.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
public static DebugMethodItem build(RegisterFormatter registerFormatter, DebugItem debugItem) {
    int codeAddress = debugItem.getCodeAddress();
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return new StartLocalMethodItem(codeAddress, -1, registerFormatter, (StartLocal)debugItem);
        case DebugItemType.END_LOCAL:
            return new EndLocalMethodItem(codeAddress, -1, registerFormatter, (EndLocal)debugItem);
        case DebugItemType.RESTART_LOCAL:
            return new RestartLocalMethodItem(codeAddress, -1, registerFormatter, (RestartLocal)debugItem);
        case DebugItemType.EPILOGUE_BEGIN:
            return new BeginEpilogueMethodItem(codeAddress, -4);
        case DebugItemType.PROLOGUE_END:
            return new EndPrologueMethodItem(codeAddress, -4);
        case DebugItemType.SET_SOURCE_FILE:
            return new SetSourceFileMethodItem(codeAddress, -3, (SetSourceFile)debugItem);
        case DebugItemType.LINE_NUMBER:
            return new LineNumberMethodItem(codeAddress, -2, (LineNumber)debugItem);
        default:
            throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #14
Source File: DebugItemRewriter.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Nonnull @Override public DebugItem rewrite(@Nonnull DebugItem value) {
    switch (value.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return new RewrittenStartLocal((StartLocal)value);
        case DebugItemType.END_LOCAL:
            return new RewrittenEndLocal((EndLocal)value);
        case DebugItemType.RESTART_LOCAL:
            return new RewrittenRestartLocal((RestartLocal)value);
        default:
            return value;
    }
}
 
Example #15
Source File: DebugItemRewriter.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Nonnull @Override public DebugItem rewrite(@Nonnull DebugItem value) {
    switch (value.getDebugItemType()) {
        case DebugItemType.START_LOCAL:
            return new RewrittenStartLocal((StartLocal)value);
        case DebugItemType.END_LOCAL:
            return new RewrittenEndLocal((EndLocal)value);
        case DebugItemType.RESTART_LOCAL:
            return new RewrittenRestartLocal((RestartLocal)value);
        default:
            return value;
    }
}
 
Example #16
Source File: MutableMethodImplementation.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Nonnull
private BuilderDebugItem convertDebugItem(@Nonnull DebugItem debugItem) {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            return new BuilderStartLocal(startLocal.getRegister(), startLocal.getNameReference(),
                    startLocal.getTypeReference(), startLocal.getSignatureReference());
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            return new BuilderEndLocal(endLocal.getRegister());
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            return new BuilderRestartLocal(restartLocal.getRegister());
        }
        case DebugItemType.PROLOGUE_END:
            return new BuilderPrologueEnd();
        case DebugItemType.EPILOGUE_BEGIN:
            return new BuilderEpilogueBegin();
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            return new BuilderLineNumber(lineNumber.getLineNumber());
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            return new BuilderSetSourceFile(setSourceFile.getSourceFileReference());
        }
        default:
            throw new ExceptionWithContext("Invalid debug item type: " + debugItem.getDebugItemType());
    }
}
 
Example #17
Source File: MutableMethodImplementation.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
private BuilderDebugItem convertDebugItem(@Nonnull DebugItem debugItem) {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            return new BuilderStartLocal(startLocal.getRegister(), startLocal.getNameReference(),
                    startLocal.getTypeReference(), startLocal.getSignatureReference());
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            return new BuilderEndLocal(endLocal.getRegister());
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            return new BuilderRestartLocal(restartLocal.getRegister());
        }
        case DebugItemType.PROLOGUE_END:
            return new BuilderPrologueEnd();
        case DebugItemType.EPILOGUE_BEGIN:
            return new BuilderEpilogueBegin();
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            return new BuilderLineNumber(lineNumber.getLineNumber());
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            return new BuilderSetSourceFile(setSourceFile.getSourceFileReference());
        }
        default:
            throw new ExceptionWithContext("Invalid debug item type: " + debugItem.getDebugItemType());
    }
}
 
Example #18
Source File: MutableMethodImplementation.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
private BuilderDebugItem convertDebugItem(@Nonnull DebugItem debugItem) {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            return new BuilderStartLocal(startLocal.getRegister(), startLocal.getNameReference(),
                    startLocal.getTypeReference(), startLocal.getSignatureReference());
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            return new BuilderEndLocal(endLocal.getRegister());
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            return new BuilderRestartLocal(restartLocal.getRegister());
        }
        case DebugItemType.PROLOGUE_END:
            return new BuilderPrologueEnd();
        case DebugItemType.EPILOGUE_BEGIN:
            return new BuilderEpilogueBegin();
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            return new BuilderLineNumber(lineNumber.getLineNumber());
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            return new BuilderSetSourceFile(setSourceFile.getSourceFileReference());
        }
        default:
            throw new ExceptionWithContext("Invalid debug item type: " + debugItem.getDebugItemType());
    }
}
 
Example #19
Source File: BuilderClassPool.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public void writeDebugItem(@Nonnull DebugWriter<BuilderStringReference, BuilderTypeReference> writer,
                           DebugItem debugItem) throws IOException {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            writer.writeStartLocal(startLocal.getCodeAddress(),
                    startLocal.getRegister(),
                    checkStringReference(startLocal.getNameReference()),
                    checkTypeReference(startLocal.getTypeReference()),
                    checkStringReference(startLocal.getSignatureReference()));
            break;
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            writer.writeEndLocal(endLocal.getCodeAddress(), endLocal.getRegister());
            break;
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            writer.writeRestartLocal(restartLocal.getCodeAddress(), restartLocal.getRegister());
            break;
        }
        case DebugItemType.PROLOGUE_END: {
            writer.writePrologueEnd(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.EPILOGUE_BEGIN: {
            writer.writeEpilogueBegin(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            writer.writeLineNumber(lineNumber.getCodeAddress(), lineNumber.getLineNumber());
            break;
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            writer.writeSetSourceFile(setSourceFile.getCodeAddress(),
                    checkStringReference(setSourceFile.getSourceFileReference()));
        }
        default:
            throw new ExceptionWithContext("Unexpected debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #20
Source File: BuilderClassPool.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
@Override
public void writeDebugItem(@Nonnull DebugWriter<BuilderStringReference, BuilderTypeReference> writer,
                           DebugItem debugItem) throws IOException {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            writer.writeStartLocal(startLocal.getCodeAddress(),
                    startLocal.getRegister(),
                    checkStringReference(startLocal.getNameReference()),
                    checkTypeReference(startLocal.getTypeReference()),
                    checkStringReference(startLocal.getSignatureReference()));
            break;
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            writer.writeEndLocal(endLocal.getCodeAddress(), endLocal.getRegister());
            break;
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            writer.writeRestartLocal(restartLocal.getCodeAddress(), restartLocal.getRegister());
            break;
        }
        case DebugItemType.PROLOGUE_END: {
            writer.writePrologueEnd(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.EPILOGUE_BEGIN: {
            writer.writeEpilogueBegin(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            writer.writeLineNumber(lineNumber.getCodeAddress(), lineNumber.getLineNumber());
            break;
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            writer.writeSetSourceFile(setSourceFile.getCodeAddress(),
                    checkStringReference(setSourceFile.getSourceFileReference()));
        }
        default:
            throw new ExceptionWithContext("Unexpected debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #21
Source File: DebugWriter.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public void writeSetSourceFile(int codeAddress, @Nullable StringKey sourceFile) throws IOException {
    writeAdvancePC(codeAddress);
    writer.write(DebugItemType.SET_SOURCE_FILE);
    writer.writeUleb128(stringSection.getNullableItemIndex(sourceFile) + 1);
}
 
Example #22
Source File: DebugWriter.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public void writeEpilogueBegin(int codeAddress) throws IOException {
    writeAdvancePC(codeAddress);
    writer.write(DebugItemType.EPILOGUE_BEGIN);
}
 
Example #23
Source File: DebugWriter.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public void writePrologueEnd(int codeAddress) throws IOException {
    writeAdvancePC(codeAddress);
    writer.write(DebugItemType.PROLOGUE_END);
}
 
Example #24
Source File: DebugWriter.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public void writeRestartLocal(int codeAddress, int register) throws IOException {
    writeAdvancePC(codeAddress);
    writer.write(DebugItemType.RESTART_LOCAL);
    writer.writeUleb128(register);
}
 
Example #25
Source File: DebugWriter.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public void writeEndLocal(int codeAddress, int register) throws IOException {
    writeAdvancePC(codeAddress);
    writer.write(DebugItemType.END_LOCAL);
    writer.writeUleb128(register);
}
 
Example #26
Source File: ClassPool.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
@Override public void writeDebugItem(@Nonnull DebugWriter<CharSequence, CharSequence> writer,
                                     DebugItem debugItem) throws IOException {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            writer.writeStartLocal(startLocal.getCodeAddress(),
                    startLocal.getRegister(),
                    startLocal.getName(),
                    startLocal.getType(),
                    startLocal.getSignature());
            break;
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            writer.writeEndLocal(endLocal.getCodeAddress(), endLocal.getRegister());
            break;
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            writer.writeRestartLocal(restartLocal.getCodeAddress(), restartLocal.getRegister());
            break;
        }
        case DebugItemType.PROLOGUE_END: {
            writer.writePrologueEnd(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.EPILOGUE_BEGIN: {
            writer.writeEpilogueBegin(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            writer.writeLineNumber(lineNumber.getCodeAddress(), lineNumber.getLineNumber());
            break;
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            writer.writeSetSourceFile(setSourceFile.getCodeAddress(), setSourceFile.getSourceFile());
        }
        default:
            throw new ExceptionWithContext("Unexpected debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #27
Source File: ClassPool.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
@Override public void writeDebugItem(@Nonnull DebugWriter<CharSequence, CharSequence> writer,
                                     DebugItem debugItem) throws IOException {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            writer.writeStartLocal(startLocal.getCodeAddress(),
                    startLocal.getRegister(),
                    startLocal.getName(),
                    startLocal.getType(),
                    startLocal.getSignature());
            break;
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            writer.writeEndLocal(endLocal.getCodeAddress(), endLocal.getRegister());
            break;
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            writer.writeRestartLocal(restartLocal.getCodeAddress(), restartLocal.getRegister());
            break;
        }
        case DebugItemType.PROLOGUE_END: {
            writer.writePrologueEnd(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.EPILOGUE_BEGIN: {
            writer.writeEpilogueBegin(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            writer.writeLineNumber(lineNumber.getCodeAddress(), lineNumber.getLineNumber());
            break;
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            writer.writeSetSourceFile(setSourceFile.getCodeAddress(), setSourceFile.getSourceFile());
        }
        default:
            throw new ExceptionWithContext("Unexpected debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #28
Source File: ClassPool.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override public void writeDebugItem(@Nonnull DebugWriter<CharSequence, CharSequence> writer,
                                     DebugItem debugItem) throws IOException {
    switch (debugItem.getDebugItemType()) {
        case DebugItemType.START_LOCAL: {
            StartLocal startLocal = (StartLocal)debugItem;
            writer.writeStartLocal(startLocal.getCodeAddress(),
                    startLocal.getRegister(),
                    startLocal.getName(),
                    startLocal.getType(),
                    startLocal.getSignature());
            break;
        }
        case DebugItemType.END_LOCAL: {
            EndLocal endLocal = (EndLocal)debugItem;
            writer.writeEndLocal(endLocal.getCodeAddress(), endLocal.getRegister());
            break;
        }
        case DebugItemType.RESTART_LOCAL: {
            RestartLocal restartLocal = (RestartLocal)debugItem;
            writer.writeRestartLocal(restartLocal.getCodeAddress(), restartLocal.getRegister());
            break;
        }
        case DebugItemType.PROLOGUE_END: {
            writer.writePrologueEnd(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.EPILOGUE_BEGIN: {
            writer.writeEpilogueBegin(debugItem.getCodeAddress());
            break;
        }
        case DebugItemType.LINE_NUMBER: {
            LineNumber lineNumber = (LineNumber)debugItem;
            writer.writeLineNumber(lineNumber.getCodeAddress(), lineNumber.getLineNumber());
            break;
        }
        case DebugItemType.SET_SOURCE_FILE: {
            SetSourceFile setSourceFile = (SetSourceFile)debugItem;
            writer.writeSetSourceFile(setSourceFile.getCodeAddress(), setSourceFile.getSourceFile());
        }
        default:
            throw new ExceptionWithContext("Unexpected debug item type: %d", debugItem.getDebugItemType());
    }
}
 
Example #29
Source File: DebugWriter.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public void writeEndLocal(int codeAddress, int register) throws IOException {
    writeAdvancePC(codeAddress);
    writer.write(DebugItemType.END_LOCAL);
    writer.writeUleb128(register);
}
 
Example #30
Source File: DebugWriter.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public void writePrologueEnd(int codeAddress) throws IOException {
    writeAdvancePC(codeAddress);
    writer.write(DebugItemType.PROLOGUE_END);
}