summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2018-04-11 15:44:19 -0700
committer Andreas Gampe <agampe@google.com> 2018-04-12 03:00:35 +0000
commitda802f86c4361c23e827b88573583ee91f0edede (patch)
tree4bdfa080315ae9788df93b80a9d8d2ed8af2fe96 /compiler/driver/compiler_driver.h
parent5abb0696dacb90ad35a571a5b660efb0c4dc3c01 (diff)
ART: Fix core image detection
Accept any .art name starting with "core-." Correctly detects images with multiple dashes. Bug: 64382372 Test: mmma art Test: art/test/testrunner/testrunner.py -b --host Test: Device boots Merged-In: I6c8006411b0ec16225b137dd349d53d9bc0ac03d Change-Id: I6c8006411b0ec16225b137dd349d53d9bc0ac03d
Diffstat (limited to 'compiler/driver/compiler_driver.h')
-rw-r--r--compiler/driver/compiler_driver.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 682cf16d45..a5462eefe2 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -378,11 +378,11 @@ class CompilerDriver {
if (!android::base::EndsWith(boot_image_filename, ".art")) {
return false;
}
- size_t dash_pos = boot_image_filename.find_last_of("-/");
- if (dash_pos == std::string::npos || boot_image_filename[dash_pos] != '-') {
- return false;
+ size_t slash_pos = boot_image_filename.rfind('/');
+ if (slash_pos == std::string::npos) {
+ return android::base::StartsWith(boot_image_filename, "core-");
}
- return (dash_pos >= 4u) && (boot_image_filename.compare(dash_pos - 4u, 4u, "core") == 0);
+ return boot_image_filename.compare(slash_pos + 1, 5u, "core-") == 0;
}
optimizer::DexToDexCompiler& GetDexToDexCompiler() {