Feat: add event bus and service framework

- introduce EventBus singleton wrapping eventpp::EventDispatcher with
  typed event ids and const void* payloads
- post EventClassFileLoadHook from ClassFileLoadHook callback
- add IService base with typed listen<>() helper that binds a member
  function directly to an event, no virtual onEvent dispatch
- add ServiceManager to register, initialize and shutdown services
- add BytecodeService that subscribes to ClassFileLoadHook
- wire Services::initializeAll() into Agent::init()
This commit is contained in:
xiaozhou233 committed 2026-08-17 15:45:39 +08:00
1 parent 6bf2d31798
commit 6962c4a477
9 files changed
+258 -3

No files matched your search

+15 -2
View File
@@ -1,4 +1,5 @@
#include <jni_common.hpp>
#include <eventbus.hpp>
void JNICALL ClassFileLoadHook(
jvmtiEnv* jvmti_env,
@@ -15,7 +16,19 @@ void JNICALL ClassFileLoadHook(
spdlog::warn("[ClassFileLoadHook] name is null");
return;
}
EventClassFileLoadHook event{
jvmti_env,
jni_env,
class_being_redefined,
loader,
name,
protection_domain,
class_data_len,
classbytes,
new_class_data_len,
new_classbytes
};
// TODO: Impl & Delete this
spdlog::trace("[ClassFileLoadHook] name: {}", name);
EventBus::getInstance().post(EventId::ClassFileLoadHook, &event);
}