일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- anti debugging
- thread local storage
- Injection
- Linux packer
- custom packer
- pthread
- LLVM 난독화
- LLVM
- on stack replacement
- v8 optimizing
- 안티디버깅
- TLS
- so inject
- LLVM Obfuscator
- tracing
- on-stack replacement
- apm
- linux thread
- Obfuscator
- tracerpid
- OSR
- Linux custom packer
- pinpoint
- 난독화
- initial-exec
- android inject
- v8 tracing
- Android
- linux debugging
- uftrace
- Today
- Total
Why should I know this?
LLVM debug tips 본문
https://youtu.be/y4b-sgp6VYA?si=FBwXN-abkikLJwx0
cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_LLD=ON \
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
-DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86" \
-DLLVM_ENABLE_ASSERTION=OFF
-E : Stop before compiling
-S : Stop before assembling
-c : Stop before linking
Dumping LEXER Tokens
clang -Xclang -dump-tokens -E foo.cpp
clang -Xclang -help -E foo.cpp
clang -Xclang -emit-html -o foo.html foo.cpp
clang -Xclang -asp-dump -E foo.cpp
// Only can be used in debug build
clang -Xclang -ast-view -E foo.cpp
Dumping LLVM IR
clang foo.cpp -emit-llvm -S -o - -fno-discard-value-names -g0
-emit-llvm : produce LLVM IR
-S : as human readable foo.ll, not binary foo.bc
-o - : output to stdout rather than to .ll or .bc. file
-fno-discard-value-names : identifiers from source rather than numbers
-g0 : less debug info in IR
clang -emit-llvm -S -O2 -Xclang -disable-llvm-passes foo.cpp
opt -O2 -s foo.ll
clang -emit-llvm -S -O2 foo.cpp
// print what happen during each pass
opt -O2 -print-after-all -S foo.cpp
LOWERING WITH LLC
llc foo.ll
llc -filetype=obj foo.ll
llc --print-after-all foo.ll
llc -debug-pass=Structure foo.ll
// PER PASS DEBUG INFO
opt -licm -debug-only=licm foo.ll -S -o -
clang -O2 -Rpass=licm -c foo.cpp
others, these option can be uses to clang with -mllvm prefixed
-print-after-all
-print-after=
-print-before-all
-print-before=
-stop-after=
-print-module-scope
-debug-pass=Arguments
//TABLE GEN
https://www.youtube.com/watch?v=45gmF77JFBY&ab_channel=FOSDEM
https://llvm.org/docs/TableGen/
https://llvm.org/docs/TableGen/BackEnds.html
https://llvm.org/docs/TableGen/BackEnds.html
https://llvm.org/docs/TableGen/ProgRef.html
'LLVM-STUDY' 카테고리의 다른 글
LLVM 원라인 패치 목록 (0) | 2024.03.17 |
---|---|
LLVM 최적화 패치 제출까지의 순서 정리 (0) | 2024.03.03 |
LLVM 내부에서 활용되는 논리식 모음 (0) | 2023.12.15 |
[TODO] DomConditionCache (0) | 2023.12.11 |
SubclassOptionalData (0) | 2023.12.11 |