namespace art { class ArtField; class ArtMethod; class ShadowFrame;
} // namespace art
namespace openjdkjvmti {
class ObjectTagTable;
// A special version that we use to identify special tooling interface versions which mostly matches // the jvmti spec but everything is best effort. This is used to implement the userdebug // 'debug-anything' behavior. // // This is the value 0x70010200. static constexpr jint kArtTiVersion = JVMTI_VERSION_1_2 | 0x40000000;
// Returns whether we are able to use all jvmti features. staticinlinebool IsFullJvmtiAvailable() {
art::Runtime* runtime = art::Runtime::Current(); return runtime->GetInstrumentation()->IsForcedInterpretOnly() ||
runtime->IsJavaDebuggableAtInit();
}
// A structure that is a jvmtiEnv with additional information for the runtime. struct ArtJvmTiEnv : public jvmtiEnv {
art::JavaVMExt* art_vm; void* local_data;
// The ti_version we are compatible with. This is only for giving the correct value for GetVersion // when running on a userdebug/eng device.
jint ti_version;
// Tagging is specific to the jvmtiEnv.
std::unique_ptr<ObjectTagTable> object_tag_table;
// Set of watched fields is unique to each jvmtiEnv. // TODO It might be good to follow the RI and only let one jvmtiEnv ever have the watch caps so // we can record this on the field directly. We could do this either using free access-flag bits // or by putting a list in the ClassExt of a field's DeclaringClass. // TODO Maybe just have an extension to let one put a watch on every field, that would probably be // good enough maybe since you probably want either a few or all/almost all of them.
std::unordered_set<jfieldID> access_watched_fields GUARDED_BY(event_info_mutex_);
std::unordered_set<jfieldID> modify_watched_fields GUARDED_BY(event_info_mutex_);
// Set of breakpoints is unique to each jvmtiEnv.
std::unordered_set<Breakpoint> breakpoints GUARDED_BY(event_info_mutex_);
std::unordered_set<const art::ShadowFrame*> notify_frames GUARDED_BY(event_info_mutex_);
// RW lock to protect access to all of the event data.
art::ReaderWriterMutex event_info_mutex_ DEFAULT_MUTEX_ACQUIRED_AFTER;
std::string last_error_ GUARDED_BY(last_error_mutex_); // Lock to touch the last-error-message.
art::Mutex last_error_mutex_ BOTTOM_MUTEX_ACQUIRED_AFTER;
// Top level lock. Nothing can be held when we get this except for mutator lock for full // thread-suspension. static art::Mutex *gEnvMutex ACQUIRED_AFTER(art::Locks::mutator_lock_);
};
// Macro and constexpr to make error values less annoying to write. #define ERR(e) JVMTI_ERROR_ ## e static constexpr jvmtiError OK = JVMTI_ERROR_NONE;
// Special error code for unimplemented functions in JVMTI static constexpr jvmtiError ERR(NOT_IMPLEMENTED) = JVMTI_ERROR_NOT_AVAILABLE;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.