summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sorin Basca <sorinbasca@google.com> 2022-04-14 19:01:47 +0000
committer Sorin Basca <sorinbasca@google.com> 2022-04-20 13:39:03 +0000
commit6f052db1c3e2c9f9a23a5df351c4e85fe8e32e07 (patch)
tree92038f025ad5e00c19d3a94d52eb36b2c4153209
parentcdac020aa256454dcee9e0e293a85024cecd3a4c (diff)
Fix the line info storage for obfuscated methods
With R8 v3.1.4, the debug information gets removed from the dex file. Therefore code that has been obfuscated needs to store the program counter instead of the line number. This is done similarly to I5ab54620b2bfba1059543696ff7310b8496b1893. Fixes: 228000954 Test: m -j32 ahat ahat-tests && java -jar out/host/linux-x86/framework/ahat-tests.jar Test: testrunner.py --host -t 638-no-line-number Change-Id: I2714aec63288cccd979adc73022e172d9cc993df
-rw-r--r--runtime/gc/allocation_record.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/gc/allocation_record.cc b/runtime/gc/allocation_record.cc
index ffd4d2b582..7bcf375b16 100644
--- a/runtime/gc/allocation_record.cc
+++ b/runtime/gc/allocation_record.cc
@@ -32,7 +32,14 @@ namespace gc {
int32_t AllocRecordStackTraceElement::ComputeLineNumber() const {
DCHECK(method_ != nullptr);
- return method_->GetLineNumFromDexPC(dex_pc_);
+ int32_t line_number = method_->GetLineNumFromDexPC(dex_pc_);
+ if (line_number == -1 && !method_->IsProxyMethod()) {
+ // If we failed to map the dex pc to a line number, then most probably there is no debug info.
+ // Make the line_number same as the dex pc - it can be decoded later using a map file.
+ // See b/30183883 and b/228000954.
+ line_number = static_cast<int32_t>(dex_pc_);
+ }
+ return line_number;
}
const char* AllocRecord::GetClassDescriptor(std::string* storage) const {