Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ".line" mean in smali code syntax? (Android-Smali Code)

Please take a look at this question

Decompiled smali code contains things like .line 3 or .line 7.

I cannot understand what .line is supposed to be, please elaborate on the usage.

like image 574
Behzad Gh Avatar asked Aug 16 '13 13:08

Behzad Gh


People also ask

What is Smali code in Android?

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 is Smali format?

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 used for?

Smali is intended to serve as a basis for further analysis of Android applications and security implementation techniques. Android applications are mainly written in Java. The Java source code is first compiled into a Java Virtual Machine (JVM) bytecode using a standard Java compiler called Javac.


1 Answers

.line n markers are used for debugging and stacktraces. When an exception goes uncaught, or the stacktrace needs to be filled in, the line number is taken from the .line statement. If this were missing, then stacktraces would lack line numbers.

like image 168
nanofarad Avatar answered Oct 22 '22 06:10

nanofarad