Fix build: Extend the scope of CodeInfo object in ELF writer.
CodeInfo is referenced from DexRegisterMap now, so keep it alive.
Test: ./art/test/testrunner/run_build_test_target.py -j30 art-asan
Change-Id: I47d0eb2a5be26fdaf2e2f6efc1c0909b84b38b31
diff --git a/compiler/debug/elf_debug_info_writer.h b/compiler/debug/elf_debug_info_writer.h
index 87e679f..f2002a0 100644
--- a/compiler/debug/elf_debug_info_writer.h
+++ b/compiler/debug/elf_debug_info_writer.h
@@ -204,12 +204,13 @@
// Decode dex register locations for all stack maps.
// It might be expensive, so do it just once and reuse the result.
+ std::unique_ptr<const CodeInfo> code_info;
std::vector<DexRegisterMap> dex_reg_maps;
if (accessor.HasCodeItem() && mi->code_info != nullptr) {
- const CodeInfo code_info(mi->code_info);
- for (size_t s = 0; s < code_info.GetNumberOfStackMaps(); ++s) {
- const StackMap stack_map = code_info.GetStackMapAt(s);
- dex_reg_maps.push_back(code_info.GetDexRegisterMapOf(
+ code_info.reset(new CodeInfo(mi->code_info));
+ for (size_t s = 0; s < code_info->GetNumberOfStackMaps(); ++s) {
+ const StackMap stack_map = code_info->GetStackMapAt(s);
+ dex_reg_maps.push_back(code_info->GetDexRegisterMapOf(
stack_map, accessor.RegistersSize()));
}
}