summaryrefslogtreecommitdiff
path: root/runtime/runtime.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/runtime.h')
-rw-r--r--runtime/runtime.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 38741f1706..133db0893c 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -133,6 +133,19 @@ class Runtime {
static bool Create(const RuntimeOptions& raw_options, bool ignore_unrecognized)
SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_);
+ enum class RuntimeDebugState {
+ // This doesn't support any debug features / method tracing. This is the expected state usually.
+ kNonJavaDebuggable,
+ // This supports method tracing and a restricted set of debug features (for ex: redefinition
+ // isn't supported). We transition to this state when method tracing has started or when the
+ // debugger was attached and transition back to NonDebuggable once the tracing has stopped /
+ // the debugger agent has detached..
+ kJavaDebuggable,
+ // The runtime was started as a debuggable runtime. This allows us to support the extended set
+ // of debug features (for ex: redefinition). We never transition out of this state.
+ kJavaDebuggableAtInit
+ };
+
bool EnsurePluginLoaded(const char* plugin_name, std::string* error_msg);
bool EnsurePerfettoPlugin(std::string* error_msg);
@@ -784,7 +797,12 @@ class Runtime {
}
bool IsJavaDebuggable() const {
- return is_java_debuggable_;
+ return runtime_debug_state_ == RuntimeDebugState::kJavaDebuggable ||
+ runtime_debug_state_ == RuntimeDebugState::kJavaDebuggableAtInit;
+ }
+
+ bool IsJavaDebuggableAtInit() const {
+ return runtime_debug_state_ == RuntimeDebugState::kJavaDebuggableAtInit;
}
void SetProfileableFromShell(bool value) {
@@ -803,7 +821,7 @@ class Runtime {
return is_profileable_;
}
- void SetJavaDebuggable(bool value);
+ void SetRuntimeDebugState(RuntimeDebugState state);
// Deoptimize the boot image, called for Java debuggable apps.
void DeoptimizeBootImage() REQUIRES(Locks::mutator_lock_);
@@ -1347,7 +1365,7 @@ class Runtime {
bool non_standard_exits_enabled_;
// Whether Java code needs to be debuggable.
- bool is_java_debuggable_;
+ RuntimeDebugState runtime_debug_state_;
bool monitor_timeout_enable_;
uint64_t monitor_timeout_ns_;