While looking at a dex file, I noticed that in debug_info_item
associated with each code_item
, it is possible to have:
DBG_END_LOCAL
without any DBG_START_LOCAL
with the same register before itDBG_START_LOCAL
for a register that already has a debug info name defined and not yet closed (though this happens much more rarely)I don't understand how I'm supposed to parse these cases. Is there something I'm not understanding about the debug_info_item
format (https://source.android.com/devices/tech/dalvik/dex-format.html)?
Also, just to make sure, am I right that:
DBG_START_LOCAL
and DBG_END_LOCAL
instructions define a debug name just for the instructions within the address range, and a jump
instruction out of that range would make the name go away, even if the instruction pointer doesn't pass through the address pointed to by DBG_END_LOCAL
The parameter registers are all implicitly locals, so you can have a DBG_END_LOCAL with no DBG_START_LOCAL for a parameter register. In the case of a DBG_START_LOCAL for an "existing" local, I would imagine you just implicitly end the previous local and start the new local.
But keep in mind that the debug info is informational only. There's nothing that verifies that it is structured properly, or really even makes sense. e.g. an obfuscator could add nonsense debug info without causing the dex file to fail verification when it is used.
For example, I recently fixed a bug in baksmali related to start/end locals for register values that were out of range for that method.