ART: Split Runtime::IsNativeDebuggable
Ensure that the main version cannot be called in the zygote.
Bug: 119063276
Test: m test-art-host
Test: device boots
Change-Id: Ic3d158d5d75fa6982411402f69062ac333b20798
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 67513f9..cc4f56c 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3112,7 +3112,7 @@
return (jit == nullptr) || !jit->GetCodeCache()->ContainsPc(quick_code);
}
- if (runtime->IsNativeDebuggable()) {
+ if (runtime->IsNativeDebuggableZygoteOK()) {
DCHECK(runtime->UseJitCompilation() && runtime->GetJit()->JitAtFirstUse());
// If we are doing native debugging, ignore application's AOT code,
// since we want to JIT it (at first use) with extra stackmaps for native
diff --git a/runtime/runtime.h b/runtime/runtime.h
index be5b3c1..4bc16e2 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -650,6 +650,13 @@
void DeoptimizeBootImage();
bool IsNativeDebuggable() const {
+ CHECK(!is_zygote_ || IsAotCompiler());
+ return is_native_debuggable_;
+ }
+
+ // Note: prefer not to use this method, but the checked version above. The separation exists
+ // as the runtime state may change for a zygote child.
+ bool IsNativeDebuggableZygoteOK() const {
return is_native_debuggable_;
}