diff options
author | Ben Gruver <jesusfreke@jesusfreke.com> | 2011-10-10 00:47:44 -0400 |
---|---|---|
committer | Ben Gruver <jesusfreke@jesusfreke.com> | 2011-10-10 00:47:44 -0400 |
commit | f5f64b26f7dd568ecded2b6090e710d68c8daab7 (patch) | |
tree | 4e2304a39b547b85bc1eebb4b525eaf641256948 | |
parent | f356647461ce8181d9d0d8dc1d598e3ad3c5a480 (diff) | |
download | smali-f5f64b26f7dd568ecded2b6090e710d68c8daab7.tar.gz |
Add support for assembling format 21c odex instructions
-rw-r--r-- | smali/src/main/antlr3/org/jf/smali/smaliParser.g | 7 | ||||
-rw-r--r-- | smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/smali/src/main/antlr3/org/jf/smali/smaliParser.g b/smali/src/main/antlr3/org/jf/smali/smaliParser.g index 354a4b54..8fe6ba81 100644 --- a/smali/src/main/antlr3/org/jf/smali/smaliParser.g +++ b/smali/src/main/antlr3/org/jf/smali/smaliParser.g @@ -709,10 +709,13 @@ instruction returns [int size] INSTRUCTION_FORMAT21c_FIELD REGISTER COMMA fully_qualified_field {$size = Format.Format21c.size;} -> ^(I_STATEMENT_FORMAT21c_FIELD[$start, "I_STATEMENT_FORMAT21c_FIELD"] INSTRUCTION_FORMAT21c_FIELD REGISTER fully_qualified_field) | //e.g. sget-object-volatile v0 java/lang/System/out LJava/io/PrintStream; - INSTRUCTION_FORMAT21c_FIELD_ODEX REGISTER COMMA fully_qualified_field + INSTRUCTION_FORMAT21c_FIELD_ODEX REGISTER COMMA fully_qualified_field {$size = Format.Format21c.size;} { - throwOdexedInstructionException(input, $INSTRUCTION_FORMAT21c_FIELD_ODEX.text); + if (!allowOdex) { + throwOdexedInstructionException(input, $INSTRUCTION_FORMAT21c_FIELD_ODEX.text); + } } + -> ^(I_STATEMENT_FORMAT21c_FIELD[$start, "I_STATEMENT_FORMAT21c_FIELD"] INSTRUCTION_FORMAT21c_FIELD_ODEX REGISTER fully_qualified_field) | //e.g. const-string v1 "Hello World!" INSTRUCTION_FORMAT21c_STRING REGISTER COMMA STRING_LITERAL {$size = Format.Format21c.size;} -> ^(I_STATEMENT_FORMAT21c_STRING[$start, "I_STATEMENT_FORMAT21c_STRING"] INSTRUCTION_FORMAT21c_STRING REGISTER STRING_LITERAL) diff --git a/smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g b/smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g index ddd7995f..12ccde73 100644 --- a/smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g +++ b/smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g @@ -999,9 +999,9 @@ instruction[int totalMethodRegisters, int methodParameterRegisters, List<Instruc $instructions.add(new Instruction20t(opcode, addressOffset)); } | //e.g. sget_object v0 java/lang/System/out LJava/io/PrintStream; - ^(I_STATEMENT_FORMAT21c_FIELD INSTRUCTION_FORMAT21c_FIELD REGISTER fully_qualified_field) + ^(I_STATEMENT_FORMAT21c_FIELD inst=(INSTRUCTION_FORMAT21c_FIELD | INSTRUCTION_FORMAT21c_FIELD_ODEX) REGISTER fully_qualified_field) { - Opcode opcode = Opcode.getOpcodeByName($INSTRUCTION_FORMAT21c_FIELD.text); + Opcode opcode = Opcode.getOpcodeByName($inst.text); short regA = parseRegister_byte($REGISTER.text, $totalMethodRegisters, $methodParameterRegisters); FieldIdItem fieldIdItem = $fully_qualified_field.fieldIdItem; |