DG program slicer enabling for uefi - shijunjing/edk2 GitHub Wiki
https://github.com/mchalupa/dg
Enable the DG static program slicer for Edk2:Compiling Release version DG from sources
jshi19@ub2-uefi-b01:~/llvm$ sudo apt install git cmake make llvm zlib1g-dev clang g++ python3
jshi19@ub2-uefi-b01:~/llvm$ git clone https://github.com/mchalupa/dg
jshi19@ub2-uefi-b01:~/llvm$ cd dg/
jshi19@ub2-uefi-b01:~/llvm/dg$ ~/llvm/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang -v
clang version 10.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jshi19/llvm/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin
jshi19@ub2-uefi-b01:~/llvm/dg$ cmake -DLLVM_DIR=~/llvm/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/cmake/llvm/ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_COMPILER=/home/jshi19/llvm/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang++ -DCMAKE_C_COMPILER=/home/jshi19/llvm/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang .
jshi19@ub2-uefi-b01:~/llvm/dg$ make -j 16
jshi19@ub2-uefi-b01:~/llvm/dg$ make check -j 16
171/171 Test #12: bitvector1-fuzzing
86% tests passed, 24 tests failed out of 171
Total Test time (real) = 25.39 sec
Source level debug DG in Eclipse
- Setup the Eclipse debug environment as wiki steps: https://github.com/shijunjing/edk2/wiki/Eclipse-source-level-debug-linux-projects-from-windows-remotely
- Build the debug version DG with GCC to better co-work with eclipse gdb:
jshi19@ub2-uefi-b01:~/llvm/dg/tools$ git clean -dfx
jshi19@ub2-uefi-b01:~/llvm/dg/tools$ cmake -DLLVM_DIR=~/llvm/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/cmake/llvm/ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE="Debug" .
jshi19@ub2-uefi-b01:~/llvm/dg/tools$ make -j 16
- Create a C/C++ empty project, then set the debug configurations to debug llvm-slicer:
- OK, let's begin the source level debug:
Tips:
I find the Eclipse cannot Step Over (F6) or Resume (F8) just after launch. The workaround is to set Skip All Breakpoints before launch firstly as below, then launch eclipse and press F6 to Step Over once, then unset the Skip All Breakpoints and everything is OK.