15b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com/* 25b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * [The "BSD licence"] 300fc68adf2e39aeb9fed35293f2576bbe729ec4bJesusFreke@JesusFreke.com * Copyright (c) 2010 Ben Gruver (JesusFreke) 45b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * All rights reserved. 55b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * 65b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * Redistribution and use in source and binary forms, with or without 75b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * modification, are permitted provided that the following conditions 85b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * are met: 95b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * 1. Redistributions of source code must retain the above copyright 105b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * notice, this list of conditions and the following disclaimer. 115b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * 2. Redistributions in binary form must reproduce the above copyright 125b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * notice, this list of conditions and the following disclaimer in the 135b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * documentation and/or other materials provided with the distribution. 145b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * 3. The name of the author may not be used to endorse or promote products 155b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * derived from this software without specific prior written permission. 165b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * 175b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 185b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 195b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 205b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 215b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 225b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 265b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com */ 285b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com 290c65e0f4f54ead8fd2832c954d516367b3556ae3JesusFreke@JesusFreke.compackage org.jf.baksmali.Adaptors.Format; 305b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com 31a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruverimport org.jf.baksmali.Adaptors.MethodDefinition; 32a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruverimport org.jf.dexlib2.analysis.UnresolvedOdexInstruction; 33a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruverimport org.jf.util.IndentingWriter; 34a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruver 35a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruverimport javax.annotation.Nonnull; 36a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruverimport java.io.IOException; 37a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruver 38a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruverpublic class UnresolvedOdexInstructionMethodItem extends InstructionMethodItem<UnresolvedOdexInstruction> { 39a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruver public UnresolvedOdexInstructionMethodItem(@Nonnull MethodDefinition methodDef, int codeAddress, 40a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruver @Nonnull UnresolvedOdexInstruction instruction) { 41a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruver super(methodDef, codeAddress, instruction); 42c65a8d8b5f2091a6bd835617262840a3f52c5c00JesusFreke@JesusFreke.com } 43c65a8d8b5f2091a6bd835617262840a3f52c5c00JesusFreke@JesusFreke.com 440b2f7d6a57e90424b3ee455c041aab3996c05f2cJesusFreke@JesusFreke.com public boolean writeTo(IndentingWriter writer) throws IOException { 45e01409c11f10de58a47df9bc02c6c715b75c6289JesusFreke@JesusFreke.com writeThrowTo(writer); 46e01409c11f10de58a47df9bc02c6c715b75c6289JesusFreke@JesusFreke.com return true; 476eae34831fee1f116f3a453bdc5e143d68e05e03JesusFreke@JesusFreke.com } 485b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com 490b2f7d6a57e90424b3ee455c041aab3996c05f2cJesusFreke@JesusFreke.com private void writeThrowTo(IndentingWriter writer) throws IOException { 50e01409c11f10de58a47df9bc02c6c715b75c6289JesusFreke@JesusFreke.com writer.write("#Replaced unresolvable odex instruction with a throw\n"); 516eae34831fee1f116f3a453bdc5e143d68e05e03JesusFreke@JesusFreke.com writer.write("throw "); 52a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruver writeRegister(writer, instruction.objectRegisterNum); 535b89857df3124851183c75a134f10b6ba41512a9JesusFreke@JesusFreke.com } 54a55990c876eab2489e824711da23e5abc7bff1a5Ben Gruver} 55