https://github.com/JesusFreke/smali/wiki/TypesMethodsAndFields

Types

dalvik's bytecode has two major classes of types, primitive types and reference types. Reference types are objects and arrays, everything else is a primitive.

Primitives are represented by a single letter. I didn't come up with these abbreviations - they are what is actually stored in the dex file, in string form. They are specified in the dex-format.html document (dalvik/docs/dex-format.html in the AOSP repository)

V void - can only be used for return types
Z boolean
B byte
S short
C char
I int
J long (64 bits)
F float
D double (64 bits)

Objects take the form Lpackage/name/ObjectName; - where the leading L indicates that it is an object type, package/name/ is the package that the object is in, ObjectName is the name of the object, and ; denotes the end of the object name. This would be equivalent to package.name.ObjectName in java. Or for a more concrete example, Ljava/lang/String; is equivalent to java.lang.String

Arrays take the form [I - this would be an array of ints with a single dimension. i.e. int[] in java. For arrays with multiple dimensions, you simply add more [ characters. [[I = int[][][[[I = int[][][], etc. (Note: The maximum number of dimensions you can have is 255).

You can also have arrays of objects, [Ljava/lang/String; would be an array of Strings.

Methods

Methods are always specified in a very verbose form that includes the type that contains the method, the method name, the types of the parameters and the return type. All this information is required for the virtual machine to be able to find the correct method, and to be able to perform static analysis on the bytecode (for verification/optimization purposes)

They take the form

  1. Lpackage/name/ObjectName;->MethodName(III)Z

In this example, you should recognize Lpackage/name/ObjectName; as a type. MethodName is obviously the name of the method. (III)Z is the method's signature. III are the parameters (in this case, 3 ints), and Z is the return type (bool).

The method parameters are listed one right after another, with no separators between them.

Here's a more complex example:

  1. method(I[[IILjava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

In java, this would be

  1. String method(int, int[][], int, String, Object[])

Fields

Fields are likewise always specified in verbose form that includes the type that contains the field, the name of the field, and the type of the field. Again, this is to allow the virtual machine to be able to find the correct field, as well as to perform static analysis on the bytecode.

They take the form

  1. Lpackage/name/ObjectName;->FieldName:Ljava/lang/String;

This should be pretty self-explanatory - it is the package name, the field name and the type of the field respectively.

TypesMethodsAndFields的更多相关文章

  1. apk反编译之二——smali学习

    在apk被反编译后,原来的java程序会以smali文件呈现.这就需要补充smali的知识.依旧参考官方文档,择日我将把官方文档做一下翻译.今日先贴出链接地址: 1:了解smali字节码的寄存器 请参 ...

  2. Smali文件语法解析

    大家都应该知道APK文件其实就是一个MIME为ZIP的压缩包,我们修改ZIP后缀名方式可以看到内部的文件结构,例如修改后缀后用RAR打开鳄鱼小顽皮APK能看到的是(Google Play下载的完整版版 ...

  3. Smali语法:数据类型、方法和字段

    数据类型 dalvik字节码有两种类型,原始类型和引用类型.对象和数组是引用类型,其它都是原始类型. smali数据类型都是用一个字母表示,如果你熟悉Java的数据类型,你会发现表示smali数据类型 ...

  4. smali文件内容具体介绍

    大家都应该知道APK文件其实就是一个MIME为ZIP的压缩包,我们修改ZIP后缀名方式可以看到内部的文件结构,例如修改后缀后用RAR打开鳄鱼小顽皮APK能看到的是(Google Play下载的完整版版 ...

随机推荐

  1. MySQL优化之如何了解SQL的执行频率

    http://www.jb51.net/article/50180.htm show [session|global] status 可以根据需要加上参数“ session ”或者“ global ” ...

  2. jQuery:validate设置样式

    jquery.validate.js插件里面的样式设置: ... errorClass: "error",validClass: "valid", ... &l ...

  3. git 命令02

    1.怎么添加远程库2.克隆一个远程库3.什么是分支管理4.什么是标签管理3.搭建git服务器 1.添加远程库.我以github官网上提供给用户注册https://github.com/,可以在官网了自 ...

  4. [转]SSIS error DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER when connecting to Oracle data source

    本文转自:http://blogs.msdn.com/b/jorgepc/archive/2008/02/12/ssis-error-dts-e-cannotacquireconnectionfrom ...

  5. centos7搭建svn服务器并支持http方式访问

    因为公司其他人员需要,需要在服务器上搭建svn服务,途中遇到不少问题,做下记录 第一步,安装svn 默认centos7是已经安装了svn即subversion 检查是否安装 rpm -qa subve ...

  6. 抓取网页图片的脚本(javascript)

    抓取网页图片的脚本(javascript) 本文地址: http://blog.csdn.net/caroline_wendy/article/details/24172223 脚本内容 (没有换行) ...

  7. Java开发岗位面试题归类---怎么好好的准备面试,也算是发展学习方向

    转载:http://blog.csdn.net/qq_27093465/article/details/52181860 一.Java基础 1. String类为什么是final的. 自己找的参考答案 ...

  8. JVM性能调优监控工具jps、jstack、jmap、jhat、jstat等使用详解

    转载:http://blog.csdn.net/tzs_1041218129/article/details/61630981 javap 和 javac javap -help javac -hel ...

  9. Xshell连接mysql数据库乱码问题解决思路总结

    乱码问题一直是一件让人头疼的事情,乱码就是编码格式不统一产生的,下面将一些常见的解决思路整理: 先Xshell连接上数据库,查看数据的编码格式: 一般需要看这么几个地方(附修改命令): 1.数据库的编 ...

  10. 【MVC5】对MySql数据库使用EntityFramework

    版本: MySql : 5.6.3 MySql.Data : 6.9.7 MVC : 5 EntityFramework : 6.1.3 VS : 2015 步骤: 1.安装[mysql-connec ...