Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smali .local format

Tags:

android

dex

smali

I disassembled an Android application with baksmali, and studied the produced smali code. One of the classes contains the following line:

.local v1, "future":Lcom/android/volley/toolbox/RequestFuture;, "Lcom/android/volley/toolbox/RequestFuture<Ljava/lang/Void;>;"

I'm not sure about the meaning of this line of code.

Does v1 contain a RequestFuture<Void>, that corresponds to variable future in original code? (i.e. is the original code: RequestFuture<Void> future;?) Or is it something different?

like image 543
user2340612 Avatar asked Oct 06 '15 11:10

user2340612


People also ask

What does Smali mean?

Noun. smali m (genitive singular smala, nominative plural smalar) (obsolete, collective) livestock. herder, herdsman. (figuratively) someone who gathers people for an event, such as voting.

What is Smali code?

From the official git¹, “smali/baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation”. The smali code, which is what we wish to modify, can be thought of as an equivalent of assembly code of a C program.

What is Smali and Baksmali?

smali/baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation. The syntax is loosely based on Jasmin's/dedexer's syntax, and supports the full functionality of the dex format (annotations, debug info, line info, etc.)

What are registers in Smali?

the . registers directive specifies the total number of registers in the method, while the alternate . locals directive specifies the number of non-parameter registers in the method. The total number of registers would therefore include the registers needed to hold the method parameters.


Video Answer


1 Answers

Yes, that is part of the debugging information that can optionally be present. It is used when debugging to be able to, e.g. evaluate the value of a local variable.

The .local you mention means exactly what you said. The v1 register holds the value of the future variable from the original source, and its type is RequestFuture<Void>

A .local directive is equivalent to a DBG_START_LOCAL or DBG_START_LOCAL_EXTENDED instruction in the debug info for that method, as defined by the dex format

like image 134
JesusFreke Avatar answered Oct 18 '22 05:10

JesusFreke