introduce capstone

This commit is contained in:
2026-05-11 14:17:07 +02:00
parent c0de07465b
commit e5413f9abd
3 changed files with 17 additions and 3 deletions
+14 -2
View File
@@ -4,6 +4,18 @@ project(weee CXX)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories(external/ELFIO) option(BUILD_SHARED_LIBS OFF)
add_executable(weee main.cpp) include_directories(external/ELFIO)
include_directories(external/capstone/include)
if(WIN32)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
set(CAPSTONE_ARCHITECTURE_DEFAULT OFF)
set(CAPSTONE_PPC_SUPPORT ON)
add_subdirectory(external/capstone)
add_executable(weee main.cpp)
target_link_libraries(weee PUBLIC capstone)
+1 -1
View File
@@ -36,7 +36,7 @@ project(capstone VERSION ${PROJECT_VERSION_BASE})
# Print the values of PROJECT_VERSION and PROJECT_VERSION_BASE # Print the values of PROJECT_VERSION and PROJECT_VERSION_BASE
message(STATUS "PROJECT_VERSION: ${CPACK_PACKAGE_VERSION} CAPSTONE_VERSION: ${PROJECT_VERSION_BASE}") message(STATUS "PROJECT_VERSION: ${CPACK_PACKAGE_VERSION} CAPSTONE_VERSION: ${PROJECT_VERSION_BASE}")
set(UNIX_COMPILER_OPTIONS -Werror -Wall -Warray-bounds -Wshift-negative-value -Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation) set(UNIX_COMPILER_OPTIONS -Wall -Warray-bounds -Wshift-negative-value -Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)
# maybe-uninitialized is only supported by newer versions of GCC. # maybe-uninitialized is only supported by newer versions of GCC.
# Unfortunately, it is pretty unreliable and reports wrong results. # Unfortunately, it is pretty unreliable and reports wrong results.
+2
View File
@@ -10,4 +10,6 @@ int main() {
const auto& section = reader.sections[i]; const auto& section = reader.sections[i];
std::println(R"(Section n.{} "{}": 0x{:08X} -> 0x{:08X})", i, section->get_name(), section->get_address(), section->get_address() + section->get_size() - 1); std::println(R"(Section n.{} "{}": 0x{:08X} -> 0x{:08X})", i, section->get_name(), section->get_address(), section->get_address() + section->get_size() - 1);
} }
return 0;
} }