[Question] How to debug bin2llvmir, add export/import ir in specific point in processing pipeline.
- Dominant language
- C++
- Stars
- 8.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
```
Running phase: Initialization ( 0.01s )
Running phase: LLVM ( 0.01s )
Running phase: Providers initialization ( 0.01s )
Running phase: Input binary to LLVM IR decoding ( 2.06s )
Running phase: LLVM ( 533.48s )
Running phase: x87 fpu register analysis ( 547.43s )
Running phase: Main function identification optimization ( 547.43s )
Running phase: Libgcc idioms optimization ( 547.52s )
Running phase: LLVM instruction optimization ( 547.52s )
Running phase: Conditional branch optimization ( 553.27s )
Running phase: Syscalls optimization ( 616.55s )
Running phase: Stack optimization ( 621.38s )
Running phase: Function parameters and returns optimization ( 782.14s )
Running phase: Register localization optimization ( 1024.30s )
Running phase: LLVM instruction optimization ( 1167.16s )
Running phase: Simple types recovery optimization ( 1174.80s )
Running phase: Disassembly generation ( 1422.09s )
Running phase: Assembly mapping instruction removal ( 1490.47s )
Running phase: C++ class hierarchy optimization ( 1615.97s )
Running phase: Selected functions optimization ( 1620.49s )
Running phase: Unreachable functions optimization ( 1620.49s )
Running phase: LLVM instruction optimization ( 1627.91s )
Running phase: x86 address spaces optimization ( 1633.89s )
Running phase: Make all registers local ( 1633.89s )
Running phase: Value protection optimization ( 1640.82s )
Running phase: LLVM ( 1648.02s )
Running phase: LLVM instruction optimization ( 2915.60s )
Running phase: Simple types recovery optimization ( 2918.18s )
Running phase: Stack pointer operations optimization ( 2918.19s )
Running phase: Instruction idioms optimization ( 2920.84s )
Running phase: LLVM ( 2926.23s )
Running phase: LLVM instruction optimization ( 2964.16s )
Running phase: Instruction idioms optimization ( 2967.12s )
Running phase: Phi removal ( 2972.02s )
Running phase: Value protection optimization ( 2980.36s )
Running phase: Code sinking ( 2981.38s )
Running phase: LLVM ( 2993.56s )
Invalid bitcast
%14 = bitcast i64 %13 to float
DestTy too big for Trunc
%17 = trunc i32 %16 to i32, !insn.addr !2674180
Stored value type does not match pointer operand type!
store i32 %16, i64* %x8.0.reg2mem, !insn.addr !2674181
i64Both operands to a binary operator are not of the same type!
%27 = udiv i32 %16, i64 2097152, !insn.addr !2674186
in function function_223feb4
LLVM ERROR: Broken function found, compilation aborted!
```
When running the decompilation command in bin2llvmir, I got an error. I wonder whether there is a **builtin** method to dump llvm ir in a specific processing pipeline, e.g. before LLVM pass /after the Coding sinking, and I can debug code from there by importing dumped ir afterward. The above passes is really time consuming.
The above is done on the release version, if it is run by debug version, it is much slower.
There is an option --select-functions FUNCS with retdec-decompiler.py, but it is no use on reducing the running time.
Thanks.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with bin2llvmir and retdec-decompiler.py, including the --select-functions FUNCS option, and trace how the processing pipeline is invoked. Determine where an IR dump/import mechanism would fit around the LLVM passes; done means a user can resume from a selected pipeline point without repeating the time-consuming earlier phases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, reverse-engineering
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 22/100