Fix dexdiag start end address
The end address was computed incorrectly due to a mix-up between pages
and addresses.
Bug: 35800981
Test: dexdiag -s `pid zygote`
Change-Id: I25d6c4b9a1e5395dc05b276111d9ec63c45951e0
diff --git a/dexlayout/dexdiag.cc b/dexlayout/dexdiag.cc
index 211bfdf..3edf051 100644
--- a/dexlayout/dexdiag.cc
+++ b/dexlayout/dexdiag.cc
@@ -238,13 +238,14 @@
<< std::endl;
return;
}
- uint64_t start = (dex_file_start - vdex_start) / kPageSize;
- uint64_t end = RoundUp(start + dex_file_size, kPageSize) / kPageSize;
+ uint64_t start_page = (dex_file_start - vdex_start) / kPageSize;
+ uint64_t start_address = start_page * kPageSize;
+ uint64_t end_page = RoundUp(start_address + dex_file_size, kPageSize) / kPageSize;
std::cout << "DEX "
<< dex_file->GetLocation().c_str()
<< StringPrintf(": %zx-%zx",
- map_start + start * kPageSize,
- map_start + end * kPageSize)
+ map_start + start_page * kPageSize,
+ map_start + end_page * kPageSize)
<< std::endl;
// Build a list of the dex file section types, sorted from highest offset to lowest.
std::vector<dex_ir::DexFileSection> sections;
@@ -254,9 +255,9 @@
dex_ir::SortDirection::kSortDescending);
}
PageCount section_resident_pages;
- ProcessPageMap(pagemap, start, end, sections, §ion_resident_pages);
+ ProcessPageMap(pagemap, start_page, end_page, sections, §ion_resident_pages);
if (g_show_statistics) {
- DisplayDexStatistics(start, end, section_resident_pages, sections);
+ DisplayDexStatistics(start_page, end_page, section_resident_pages, sections);
}
}