summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2021-03-21 17:49:39 +0000
committer David Srbecky <dsrbecky@google.com> 2021-03-22 14:35:42 +0000
commitefc03b831c35062f51589adc0ec509d4bfa2ef33 (patch)
tree568dd31db77c080da1ffdfdda67db6662d8c2bd5
parent5b0b2e1b5d60514b829f99aed5712dcae3647115 (diff)
Fix reported dex file size to libunwindstack.
Compact dex file size is non-trivial. This has not been a major issue so far since the dex loader in libunwindstack just keeps retrying with bigger size, but we should fix the error. Test: test.py -r -b --host -t 137 Change-Id: Ifa06640fce8efe12cf8e82f573a0da41a37a44fa
-rw-r--r--runtime/jit/debugger_interface.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/jit/debugger_interface.cc b/runtime/jit/debugger_interface.cc
index d2339a0c24..986003b544 100644
--- a/runtime/jit/debugger_interface.cc
+++ b/runtime/jit/debugger_interface.cc
@@ -410,7 +410,10 @@ static void DeleteJITCodeEntryInternal(const JITCodeEntry* entry) {
void AddNativeDebugInfoForDex(Thread* self, const DexFile* dexfile) {
MutexLock mu(self, g_dex_debug_lock);
DCHECK(dexfile != nullptr);
- const ArrayRef<const uint8_t> symfile(dexfile->Begin(), dexfile->Size());
+ // Compact dex files may store data past the size defined in the header.
+ const DexFile::Header& header = dexfile->GetHeader();
+ uint32_t size = std::max(header.file_size_, header.data_off_ + header.data_size_);
+ const ArrayRef<const uint8_t> symfile(dexfile->Begin(), size);
CreateJITCodeEntryInternal<DexNativeInfo>(symfile);
}