Skip to content

Commit

Permalink
Merge branch 'bugfix-ldpreload'
Browse files Browse the repository at this point in the history
  • Loading branch information
GammaPi committed Jan 7, 2022
2 parents edfb52b + abbb54c commit 1d060ac
Show file tree
Hide file tree
Showing 58 changed files with 1,541 additions and 20,339 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "libScalerHook/tests/lib/plthook"]
path = libScalerHook/tests/lib/plthook
url = https://github.com/kubo/plthook.git
[submodule "libScalerHook/tests/lib/multithreadingtests"]
path = libScalerHook/tests/lib/multithreadingtests
url = https://github.com/UTSASRG/multithreadingtests.git
[submodule "libScalerHook/lib/json"]
path = libScalerHook/lib/json
url = https://github.com/nlohmann/json.git

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions libAnalyzer/src/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions libAnalyzer/src/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions libAnalyzer/src/.idea/src.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def getSymbol(jsonDict, libID, funcAddr):
# ================================================================================================
# ====================================== Debugging Functions =====================================

def printTreeByLevel(node):
def printTreeByLevel(node) -> object:
"""
Performs Level Order Traversal to print each level
:param node: An Invocation Tree Node. Typically the root node should be passed in to print the whole tree.
Expand Down
14 changes: 8 additions & 6 deletions libScalerHook/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ project(ScalerHook)

# Set global (Relative this folder until reset) compiler options
set(CMAKE_C_STANDARD 11)
set(SCALER_HOOK_COMPILATION_FLAGS "-O3" "-g" "-mavx" "-mavx512f" "-mavx512vl" "-Werror")
set(SCALER_HOOK_COMPILATION_FLAGS "-O0" "-g" "-Werror")
# https://json.nlohmann.me/integration/cmake/
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(lib/json)
add_subdirectory(lib/watcher)

set(ScalerHookSrc
src/ExtFuncCallHook_Linux.cpp
src/ExtFuncCallHook.cpp
src/ExtFuncCallHookAsm.cpp
src/ProcInfoParser.cpp
src/ElfParser.cpp
Expand All @@ -21,19 +21,20 @@ set(ScalerHookSrc
src/Timer.cpp
src/Config.cpp
src/Serilizable.cpp
src/VMEmulator.cpp
src/InvocationTree.cpp
src/StringTool.cpp)
#src/VMEmulator.cpp


list(APPEND CMAKE_PREFIX_PATH "/media/umass/datasystem/steven/lib/intel/build/kits/xed-install-base-2021-08-26-lin-x86-64")
find_package(XED REQUIRED)
#find_package(XED REQUIRED)


# Scaler hook library itself. Users need to manually install scalerhook through library functions.
add_library(ScalerHook-HookManualAsm SHARED
${ScalerHookSrc})
target_include_directories(ScalerHook-HookManualAsm PUBLIC src/include lib/inireader)
target_link_libraries(ScalerHook-HookManualAsm PUBLIC pthread dl nlohmann_json::nlohmann_json xed2 xed2-ild)
target_link_libraries(ScalerHook-HookManualAsm PUBLIC pthread dl nlohmann_json::nlohmann_json)
target_compile_definitions(ScalerHook-HookManualAsm PUBLIC XED_ENCODER)
target_compile_options(ScalerHook-HookManualAsm PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})

Expand Down Expand Up @@ -64,7 +65,8 @@ add_executable(ScalerRun
add_library(ScalerHook-HookAuto SHARED src/autoinstall.cpp ${ScalerHookSrc})
target_include_directories(ScalerHook-HookAuto PUBLIC src/include lib/inireader)
target_link_libraries(ScalerHook-HookAuto PUBLIC pthread dl nlohmann_json::nlohmann_json xed2 xed2-ild)
target_compile_definitions(ScalerHook-HookAuto PUBLIC XED_ENCODER NDEBUG)
target_compile_definitions(ScalerHook-HookAuto PUBLIC XED_ENCODER )#NDEBUG
target_link_options(ScalerHook-HookAuto PRIVATE -static-libgcc -static-libstdc++)
target_compile_options(ScalerHook-HookAuto PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})

#add_library(ScalerHook-HookAuto-Brkpoint SHARED src/autoinstall.cpp)
Expand Down
14 changes: 8 additions & 6 deletions libScalerHook/src/Config.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//
// Created by steven on 6/26/21.
//

#include <c++/7/string>
#include <util/tool/Config.h>
#include <c++/7/sstream>
Expand All @@ -10,16 +6,22 @@ scaler::Config *scaler::Config::instance = nullptr;

scaler::Config::Config(std::string fileName) : fileName(fileName) {
reader = new INIReader(fileName);
if (!reader) {
fatalError("Cannot allocate memory for reader");
}
if (reader->ParseError() == -1) {
throwScalerExceptionS(ErrCode::CONFIG_PARSE_FAILED, "Config parsing failed for Path=%s",
this->fileName.c_str());
ERR_LOGS("Config parsing failed for Path=%s", this->fileName.c_str());
}

}

scaler::Config *scaler::Config::getInst(std::string fileName) {
if (instance == nullptr) {
instance = new Config(fileName);
if (!instance) {
fatalError("Cannot allocate memory for instance");
return nullptr;
}
return instance;
} else {
return instance;
Expand Down
Loading

0 comments on commit 1d060ac

Please sign in to comment.