I tried to change value of gHotSpotVMStructs
to 0 to prevent using HotSpot Debugger but while i tried to compile my code - my compiler thrown an error
CMakeFiles\JavaHotspotAttachCrasher.dir/objects.a(library.cpp.obj):library.cpp:(.rdata$.refptr.gHotSpotVMStructs[.refptr.gHotSpotVMStructs]+0x0): undefined reference to gHotSpotVMStructs
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\JavaHotspotAttachCrasher.dir\build.make:96: libJavaHotspotAttachCrasher.dll] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:110: CMakeFiles/JavaHotspotAttachCrasher.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:117: CMakeFiles/JavaHotspotAttachCrasher.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:136: JavaHotspotAttachCrasher] Error 2
My CMAKE file
cmake_minimum_required(VERSION 3.20)
project(JavaHotspotAttachCrasher)
set(CMAKE_CXX_FLAGS "-s -O3")
set(CMAKE_CXX_STANDARD 14)
include_directories("C:/Program Files/Java/jdk1.8.0_311/jre/bin/server")
add_library(SecretLib SHARED "C:/Program Files/Java/jdk1.8.0_311/jre/bin/server/jvm.dll")
set_target_properties(SecretLib PROPERTIES LINKER_LANGUAGE CXX)
add_library(JavaHotspotAttachCrasher SHARED library.cpp)
target_link_libraries(JavaHotspotAttachCrasher SecretLib)
My C++ file
#include <iostream>
extern void *gHotSpotVMStructs;
void hello() {
std::cout << "Disabled gHotSpot" << std::endl;
gHotSpotVMStructs = 0;
}
Any ideas how to compile it?