Smali语法

根据p命名法, p0thisp1/p2/p3…是传入 参数v0/v1/v2…是局部 变量。比如:
//v0,为局部变量,v0=0x0(null)
const/4 v0, 0x0
//p0,为this (MainActivity),iput-object为属性赋值,即this->btn=null
iput-object v0, p0, Lcn/gaojs/MainActivity;->btn:Landroid/widget/Button;
//p1,为传入参数,this->param=p1
iput-object p1, p0, Lcn/gaojs/MainActivity;->param:I;

//下面几句为:LinearLayout layout = new LinearLayout(d.getContext());
new-instance v0, Landroid/widget/LinearLayout;
invoke-static {}, Lx/x/x/d;->getContext()Landroid/content/Context;
move-result-object v1
//invoke-direct调用时,layout(context),v0为layout,v1为context
invoke-direct {v0, v1}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;)V

// 函数定义:public void handleMessage(Message msg) {
.method public handleMessage(Landroid/os/Message;)V
// 参数赋值:int i = msg.arg1;
iget v1, p1, Landroid/os/Message;->arg1:I
// 函数结束:}
.end method


你可能感兴趣的:(Smali语法)