A Semantic-Aware Log Automation Tool for Failure Diagnosis.
SmartLog is a log automation tool. Through learning logging rules from existing logs, SmartLog can decide whether to log a given code snippet or not , and finally inserts logging statement when necessary.
- Change directory to Clang tools directory.
cd path/to/llvm-source-tree/tools/clang/tools
- Download source code.
git clone https://github.com/ZhouyangJia/SmartLog.git
- Add add_subdirectory(SmartLog) to CMakeList.txt.
echo "add_subdirectory(SmartLog)" >> CMakeLists.txt
- Recompile Clang and try following command to test.
ls path/to/llvm-build/Release/bin/clang-smartlog
- Generate compile_commands.json. More infomation about compile_commands.json.
cd test/
tar zxvf bftpd-3.2.tar
cd bftpd/
./configure
bear make
- Generate compiled_files.def, This file has all names of compiled source files.
../../script/extract_command.pl compile_commands.json
- Generate call dependence before running SmartLog (Compiler CallDependence tool first).
../../script/call_dependence.sh
- Generate logging_statement.out, logging_behavior.out, normalizes_behavior.out and logging_rules.out.
cat compiled_files.def | xargs clang-smartlog -find-logging-behavior > logging_rules.out
logging_statement.out. The logging statements, including function name and call location.
logging_behavior.out. The logging behavior, including error-prone function name, function call expression, function call location, argument index, log type (SA for sensitive argement, RV for return value and PA for pointer argument), check condition, check location, logging statement, log approach (LL for local log, RL for remote log and NL for no log), log location.
normalizes_behavior.out. The normalized behavior, including error-prone function name, argument index, log type, normalized check condition, log approach.
- Generate patches.
python ../../script/patch.py > patch.out