12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * Copyright 2013, Google Inc. 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * All rights reserved. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * modification, are permitted provided that the following conditions are 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * met: 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * * Redistributions of source code must retain the above copyright 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * * Redistributions in binary form must reproduce the above 122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * in the documentation and/or other materials provided with the 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * distribution. 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * * Neither the name of Google Inc. nor the names of its 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * contributors may be used to endorse or promote products derived from 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * this software without specific prior written permission. 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)package org.jf.dexlib2.analysis; 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)import org.jf.dexlib2.Opcode; 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)import org.jf.dexlib2.iface.instruction.Instruction; 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/** 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * This represents a "fixed" odexed instruction, where the object register is always null and so the correct type 392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * can't be determined. Typically, these are replaced by an equivalent instruction that would have the same 402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * effect (namely, an NPE) 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)public class UnresolvedOdexInstruction implements Instruction { 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public final Instruction originalInstruction; 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) //the register number that holds the (null) reference type that the instruction operates on 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public final int objectRegisterNum; 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public UnresolvedOdexInstruction(Instruction originalInstruction, int objectRegisterNumber) { 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) this.originalInstruction = originalInstruction; 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) this.objectRegisterNum = objectRegisterNumber; 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) @Override public Opcode getOpcode() { 532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return originalInstruction.getOpcode(); 542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) @Override public int getCodeUnits() { 572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return originalInstruction.getCodeUnits(); 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)