Commit Graph
49 Commits
Author SHA1 Message Date
xiaozhou233 3cd28c9bcb BugFix: keep libloader exception-free so a bad config cannot crash the JVM
- loader: libloader is reflectively loaded, so its unwind tables are never registered with the OS and a C++ exception thrown inside it cannot be caught - it crashed the target JVM with EXCEPTION_ILLEGAL_INSTRUCTION when config.toml was missing a required key. Replace the throwing config reads with contains() + get(key, default) + early return, and drop the ineffective try/catch in entrypoint()

- config: parse config.toml without exceptions (toml++ parse_result) and remove the throwing get()/getPath()/getArray() overloads

- build: compile libloader with -fno-exceptions (+ SPDLOG_NO_EXCEPTIONS) so exception-capable code fails the build instead of crashing at runtime
2026-10-16 12:59:26 +08:00
xiaozhou233 fd6fe0abdb Refactor: remove unused loader config helpers
- config: drop get_loader_config / print_loader_config and the LoaderConfig struct, which were unused and still referenced the v1 key JuiceAgent.Loader.JuiceAgentNativeLibraryPath

- config: drop the now-unneeded ConfigStruct.hpp and Utils.hpp includes (consumers include Utils.hpp directly)
2026-10-15 20:06:22 +08:00
xiaozhou233 eb7fd31817 Feat: initialize built-in / custom jar loader and fix entry class lookup
- Loader: dispatch initialize() on JarLoader.Mode; BuiltIn serializes the config and calls JuiceAgentBootstrap.start, CustomJar calls the configured EntryClass.EntryMethod

- Utils: normalize class names to the JNI internal form ('.' -> '/') so JNI FindClass accepts Java binary names like Example.Main (fixes NoClassDefFoundError on custom jar entry)

- Utils: rework Serializer, drop the unused Deserializer/LocalRef, add to_java_string_array / toDelimitedString and a no-argument call_static_java_method overload

- Config: remove the unused serialize_loader_config helper
2026-10-14 21:01:14 +08:00
xiaozhou233 92ad21003f Feat: support built-in and custom jar loading modes
- Split jar loading into load_builtin (extract and register the bundled JuiceAgent API jar) and load_custom (register a user-supplied jar) in a new JarLoader.cpp

- Check JuiceAgent.Version against CONFIG_VERSION and dispatch on JarLoader.Mode (BuiltIn / CustomJar) during preload

- Pass the parsed Config into Loader::initialize and add CONFIG_VERSION in JuiceAgent.hpp

- Restore Config::Utils loader-config helpers on top of the new getPath API
2026-10-14 19:23:41 +08:00
xiaozhou233 11cf47c4c2 Feat: add logging for config parse and access errors
- Log parse failures in the Config constructor via spdlog::error

- Log missing keys and type mismatches (error when throwing, warn when falling back to defaults)
2026-10-14 16:25:29 +08:00
xiaozhou233 3626abb35a Refactor: migrate TOML parser from toml11 to toml++
- Replace vendored single-header toml11 (includes/toml.hpp) with the toml++ library (includes/toml++)

- Rewrite Config to use toml::parse_file and expose typed get/getArray/getPath/contains accessors, storing parse errors instead of logging them

- Update bundled license to toml++
2026-10-14 16:21:48 +08:00
xiaozhou233 0ddcfcd7c8 Remove remapper whitelist JNI declarations 2026-08-19 18:30:58 +08:00
xiaozhou233 dbae5e5258 Fix: do not auto-read config when runtime dir is empty
Config no longer falls back to the current working directory when no
runtime directory is specified, so an empty runtime dir leaves the config
invalid instead of silently parsing config.toml from the CWD.
2026-08-18 20:11:00 +08:00
xiaozhou233 51bcfbd549 Refactor: rebuild libagent with simplified lifecycle
- Replace eventbus/services with Agent preload/init lifecycle
- Move JNI header to shared includes; add jni_common.hpp umbrella header
- Reduce ClassFileLoadHook to a stub for later implementation
- Add eventpp dependency
- Document custom API JAR workflow (WIP)
2026-08-16 21:14:44 +08:00
xiaozhou233 3b180e7199 Fix: harden libloader config handling
- Guard Config against NULL runtime_dir
- Read JuiceAgent.Version from config instead of hardcoding 2
- Move LoaderConfig to ConfigStruct.hpp; remove obsolete JuiceAgent.hpp
2026-08-16 21:08:13 +08:00
xiaozhou233 a1b0eb8b84 Feat: add inject-via-java-api example with JNI refactor
- Rename JNI class from InjectorNative to Injector in libinject.c

- Add JNI header for cn.xiaozhou233.juiceagent.injector.Injector

- Add inject-via-java-api example with HowToUse.txt and 如何使用.txt
2026-08-15 21:51:48 +08:00
xiaozhou233 1931072b96 Fix: harden injector/libinject/loader against UB, format bugs and leaks 2026-08-15 12:30:49 +08:00
xiaozhou233 ce08b19170 Feat: add Config/Utils headers and Loader module, wire entrypoint into DllMain 2026-08-15 12:26:12 +08:00
xiaozhou233 998f4d139e Fix: switch Logger to truncating file sink with flush-on-trace 2026-08-15 11:42:15 +08:00
xiaozhou233 01f966c5f2 Refactor: add spdlog vendored headers, Logger wrapper and libloader module skeleton 2026-08-15 11:20:36 +08:00
xiaozhou233 fe64308942 DELETE: all code 2026-08-15 10:23:15 +08:00
xiaozhou233 1dcad52e15 Revert "Perf & Fix: reduce ClassFileLoadHook overhead and fix retransform patch path"
This reverts commit bb5b215a33.
2026-08-14 23:09:40 +08:00
xiaozhou233 bb5b215a33 Perf & Fix: reduce ClassFileLoadHook overhead and fix retransform patch path
- Skip mutable event dispatch when no mutable listeners exist (hot path)
- Wire retransformClass bytecode into pendingRetransform so patches are applied
- Guard pendingRetransform with its mutex; check jvmti Allocate result
- Store global refs in captured ClassFileData and release on re-capture
- Add null/exception checks in defineClass/getLoadedClasses
- Extract shared find_class_by_internal_name helper
- Use CONFIGURE_DEPENDS for CMake globs; guard InitLogger; delete leaked jArgs
2026-08-14 17:07:36 +08:00
xiaozhou233 cc1c2bff30 BugFix: The path for JuiceAgentNativeLibraryPath could not be resolved 2026-05-04 20:46:15 +08:00
xiaozhou233 4be6324cf3 BugFix: Handle path 2026-04-29 19:47:02 +08:00
xiaozhou233andCopilot 01c46c6b98 feat: remove timestamp generation from tempfile creation and improve error logging
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 21:54:14 +08:00
xiaozhou233andCopilot e2d6dcaa25 feat: remove JuiceAgentAPIJarPath from LoaderConfig and update loader logic to use temporary file
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 21:31:21 +08:00
xiaozhou233 75062b805c refactor: add JuiceAgent-API bytes/ write_to_tempfile / make_timestamp_filename 2026-04-28 21:25:02 +08:00
xiaozhou233 6564a0e020 feat: Update logger to use ColorConsoleAppender for improved output 2026-04-22 21:37:23 +08:00
xiaozhou233 50773f5456 Feat: Call Java Implementation 2026-04-20 14:04:53 +08:00
xiaozhou233 ccb332cb42 [Feat] Serializer 2026-04-20 13:18:58 +08:00
xiaozhou233 9a2dd217f1 [Refactor] Update configuration handling in JarLoader and enhance Config class 2026-04-19 22:26:51 +08:00
xiaozhou233 e7ce54188b [Refactor] Enhance Config class with type-safe get method and value reading 2026-04-19 18:44:59 +08:00
xiaozhou233 9f366645c9 Feat: libagent can now read the config 2026-04-19 18:36:26 +08:00
xiaozhou233 6a7e5a1d38 [Refactor] Config and Loader
[Add] toml11 library
[Refactor] Config
[Refactor] Data Struct
[Refactor] Loader
2026-04-19 16:41:39 +08:00
xiaozhou233 8b0bf8f211 Style: move LocalRef to header / move check_and_clear_exception to header 2026-04-18 19:24:49 +08:00
xiaozhou233 11aaac0f0b Style: Config 2026-04-16 21:29:13 +08:00
xiaozhou233 3ce1bccf02 Impl: Read config and print 2026-03-24 19:56:51 +08:00
xiaozhou233 172f354b04 [Refactor] Config 2026-03-07 16:41:20 +08:00
xiaozhou233 353fe3e5a5 Update libagent 2025-11-21 23:13:39 +08:00
xiaozhou233 76055183d2 [Update] Logger and injector 2025-11-21 19:52:15 +08:00
xiaozhou233 07a71eab12 Delete Code 2025-11-21 16:55:40 +08:00
xiaozhou233 386dc14a01 [WIP] move juiceloader 2025-11-09 15:33:07 +08:00
xiaozhou233 094e7bc0d4 [WIP] update example config and add JuiceLoaderLibraryPath 2025-11-09 15:07:31 +08:00
xiaozhou233 21df0346db [Update] Read Config 2025-11-08 19:25:09 +08:00
xiaozhou233 73910150b2 [Update] 2025-11-08 18:59:34 +08:00
xiaozhou233 de971d6481 [Refactor] CPP 2025-11-08 14:12:35 +08:00
xiaozhou233 c05a00efaa [BugFix & Config] Fix Many bugs 2025-10-17 11:21:33 +08:00
xiaozhou233 9a13a10a23 [WIP] [Update & BugFix] Config 2025-10-17 03:32:49 +08:00
xiaozhou233 d01517f09c [Update] BootstrapAPI
[Add] Entry can use JuiceLoader Now!
2025-10-13 13:15:52 +08:00
xiaozhou233 1e11e7e164 [BugFix] Params
my bad ;-;
2025-10-13 12:46:02 +08:00
xiaozhou233 8813190c29 [Update] Param & Logger
[Add] Support Custom Path
[Refactor] Some Log
2025-10-13 10:03:16 +08:00
xiaozhou233 2df1e4c80f [Refactor] Utils 2025-10-13 09:22:27 +08:00
xiaozhou233 9000aaf0aa [BugFix & Refactor] Wrong JNI Func and Construction Refactor 2025-10-08 17:01:21 +08:00