google / smali

Other
175 stars 29 forks source link

Don't emit multiple .line directives before an instruction when disassembling #54

Open sgjesse opened 1 month ago

sgjesse commented 1 month ago

When running baksmali the disassembly can have multiple .line directives before an instruction, like this:

.line n
.line n+1
.line n+2
<instruction>

This happens when the line number table have line information for PCs which are not at an exact instruction boundary (in the example above .line n and .line n+1 are on PCs between the previous instruction and <instruction>. The disassembly should only have .line directives for the PCs matching instruction boundaries. So only

.line n+2
<instruction>

for the example above.

Typically this is caused by R8 compiling with PC -to-PC based line tables to be able to share then and save on DEX size.