Reputation: 459
When working with LLVM IR, we can use LLVM Raw Stream to print the type of every llvm::Value. e.g.
void someFunction(llvm::IRBuilder* iBuilder) {
llvm::Value* v = iBuilder->getInt64(0);
// Print the type of value "v"
v->getType()->print(llvm::outs()); // line A, get "i64" in stdout
}
However, if we want to debug some related codes, I don't think it is a good practise to modify the original code (add print
function call) and compile again in order to get some debug information of value type.
So, assumed I have a break point at "line A", can I get some human readable type information (similar to "i64" in stdout) of llvm::Value* v
in lldb?
Upvotes: 4
Views: 3440
Reputation: 459
As describe in the comment of @IsmailBadawi, we can use p v->dump()
p v->getType()->dump()
to print the target information (in stdout
instead of debug output)
Upvotes: 3