Sunday, June 13, 2010

Yes, I would like some frozen yogurt with my baksmali please

smali/baksmali v1.2.3 is out, and now includes the ability to deodex odex files from froyo.

You can download the new versions on the downloads page of the googlecode project

In addition to the changes related to supporting froyo, the new version has a new lexer that uses much less static memory. (The old lexer had around 30mb of static data. ugh!). The new lexer is written with jflex instead of ANTLR, but it still hooks in with the ANTLR parser.

There was also a significant change in how "undeodexable" instructions are handled. If you want to read up on the details, go take a look at the comments in issue 29 and issue 33. Thanks to Paul from, brut.all, master.homer, flipz and JrEE2kX for the reporting/discussion/testing around this issue.

As usual, there are a number of little performance tweaks here and there, and a few new bug spots on the bottom of my shoes.


  1. I'm trying to change text color and when I edit the statusbaricon.smali and run "java -Xmx512M -jar smali.jar classout/ -o new-classes.dex" I get major errors. This is started when the new Froyo FRF83 was deodexed. I'm stuck now and can't make changed to my themes for the new Froyo update. Please help.

  2. First off, Thanks for all the hours you put into this! It is really awesome work.

    I'm looking through some smali code and most of it is obvious but these lines are giving me pause. Care to help:

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    sub-int v5, v1, v6

    invoke-virtual {p1, v6, v5}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;


    Basically the sub-int and the line with substring(II).
    Thanks for your time.

  3. The best resource to learn about specific opcodes is the dalvik-bytecode.html doc in the dalvik project in AOSP. Other useful docs are the dex-format.html and the instruction-formats.html

    sub-int is just simple subtraction. sub-int v5, v1, v6 would be v5 = v1 - v6

    For this one:
    invoke-virtual {p1, v6, v5}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    this is calling the substring(int, int) method on the String instance in p1, with v6 as the first parameter, and v5 as the 2nd parameter. The two Is in parenthesis are the method parameters, I is short for Integer. The part after the parenthesis is the return type - in this case the method returns another string object.

    Hope that helps! If you need any other help, feel free to ask here, or drop by #smali on the freenode network :)


Note: Only a member of this blog may post a comment.