Make dexdump2 more forgiving on closing not-live register.
Rationale:
In order to match dexdump behavior more closely, we should
not log fatally when an already closed register is closed
again in a debug node. Such a not-live to not-live transition
is clearly redundant, but harmless to just ignore.
Test: test-art-host-dexdump
Bug: 38367835
Change-Id: Icf5397323c7197ccde0ce80caf8d952f44f65a3a
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc
index eaf144b..3d68af1 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -1072,13 +1072,13 @@
<< code_item->registers_size_ << ") in " << GetLocation();
return false;
}
- if (!local_in_reg[reg].is_live_) {
- LOG(ERROR) << "invalid stream - end without start in " << GetLocation();
- return false;
+ // If the register is live, close it properly. Otherwise, closing an already
+ // closed register is sloppy, but harmless if no further action is taken.
+ if (local_in_reg[reg].is_live_) {
+ local_in_reg[reg].end_address_ = address;
+ local_cb(context, local_in_reg[reg]);
+ local_in_reg[reg].is_live_ = false;
}
- local_in_reg[reg].end_address_ = address;
- local_cb(context, local_in_reg[reg]);
- local_in_reg[reg].is_live_ = false;
break;
}
case DBG_RESTART_LOCAL: {