Search in sources :

Example 1 with SmaliPositionManager

use of org.jf.smalidea.debugging.SmaliPositionManager in project smali by JesusFreke.

the class SmaliPositionManagerTest method testGetAllClasses.

public void testGetAllClasses() throws NoDataException {
    myFixture.addFileToProject("my/pkg/blah.smali", testClass);
    SmaliPositionManager positionManager = new SmaliPositionManager(new MockDebugProcess());
    List<ReferenceType> classes = positionManager.getAllClasses(positionManager.getSourcePosition("my.pkg.blah", "getRandomParentType", "(I)I", 0));
    Assert.assertEquals(1, classes.size());
    Assert.assertEquals("my.pkg.blah", classes.get(0).name());
}
Also used : SmaliPositionManager(org.jf.smalidea.debugging.SmaliPositionManager)

Example 2 with SmaliPositionManager

use of org.jf.smalidea.debugging.SmaliPositionManager in project smali by JesusFreke.

the class SmaliPositionManagerTest method testGetSourcePosition.

public void testGetSourcePosition() throws NoDataException {
    myFixture.addFileToProject("my/pkg/blah.smali", testClass);
    SmaliPositionManager positionManager = new SmaliPositionManager(new MockDebugProcess());
    SourcePosition sourcePosition = positionManager.getSourcePosition("my.pkg.blah", "getRandomParentType", "(I)I", 0);
    Assert.assertEquals(Opcode.CONST_4, ((SmaliInstruction) sourcePosition.getElementAt()).getOpcode());
    Assert.assertEquals(0, ((SmaliInstruction) sourcePosition.getElementAt()).getOffset());
    sourcePosition = positionManager.getSourcePosition("my.pkg.blah", "getRandomParentType", "(I)I", 10);
    Assert.assertEquals(Opcode.INVOKE_VIRTUAL, ((SmaliInstruction) sourcePosition.getElementAt()).getOpcode());
    Assert.assertEquals(20, ((SmaliInstruction) sourcePosition.getElementAt()).getOffset());
}
Also used : SourcePosition(com.intellij.debugger.SourcePosition) SmaliPositionManager(org.jf.smalidea.debugging.SmaliPositionManager)

Aggregations

SmaliPositionManager (org.jf.smalidea.debugging.SmaliPositionManager)2 SourcePosition (com.intellij.debugger.SourcePosition)1