Smali-structure of methods and classes

I recently burst into some kind of smali code and would like to learn it. I checked the dalvik bytecode link, but I could not find the structure link as to when / how to use these

.locals .local .registers .prologue .line .annotation .parameter 

Do you know other resources to explain more smali structure?

+4
source share
1 answer

Most of them, with the exception of .locals, .registers and .nnation, are part of the debugging information that is stored as part of the method. See the debug_info_item section in the dex-format document for more information on this.

For the .locals and .registers directives, these are two different ways to specify the number of registers available in the method (that is, the registers_size field for code_item, according to the dex-format document). You can find more information about the differences between them on the Register wiki page on smali googlecode.

Finally, the .annotation directive defines annotation. Further information can be found in the dex-format document. In particular, you will want to see the following items:

  • annotations_directory_item: contains links to all annotations of classes, methods, fields and parameters for the class
  • annotation_set_ref_list: contains links to annotations associated with the parameters for the method
  • annotation_set_item: contains a list of annotations that may be associated with a method, field, or class
  • encoded_annotation: retains a separate annotation
+2
source

Source: https://habr.com/ru/post/1500237/


All Articles