I have written an llvm Pass to assign every basic block an stable ID, and output their name and parent name for next analysis. I use dbgs()
to implement that. When I use -opt to run this pass, my command line as follow:
$ opt -load ../../build/Release+Debug+Asserts/lib/libdgutility.so \
-mergereturn -bbnum -dump-bbid -remove-bbnum -stats -debug \
unit1300.bc -o /dev/null
it can output information to terminal, here is a part of my output stream:
FuncName : setcharset 16041 : if.end189
FuncName : setcharset 16042 : if.end190
FuncName : setcharset 16043 : if.end191
FuncName : setcharset 16044 : if.then196
FuncName : setcharset 16045 : land.lhs.true
FuncName : setcharset 16046 : lor.lhs.false209
.
.
.
FuncName : setcharset 16053 : while.end
FuncName : setcharset 16054 : if.else248
but I want to store this information in a file named *.log. I have tried redirection, but it does not work.