javaandroidsmali

Is the .catchall used to indicate finally clause in smali for Dalvik byte code?


I noticed that when there is finally clause in the java code, there is always .catchall generated to identify the finally block or to inline it using the .catchall label, but I haven't found any online information about whether is the case or more explanation, does anybody know about this?


Solution

  • Yes, A finally block is one case when a .catchall may be generated. However, it can be used for other things as well. For example, it can also be generated in the case of a synchronized method, to ensure the lock is released.

    The catch all handler is documented in the dex-format specification. Specifically, in the encoded_catch_handler item that is contained in the code_item.

    Also related is the equivalent piece of data in the classfile specification. See the catch_type item, in the exception_table.