MuPei
January 6, 2022, 5:15am
1
Hi, community!
I have a LLVMIR mlir file like:
1 func @ops(%arg: i32) {
2 %0 = llvm.add %arg0, arg0 : i32
3 ... // some code
4 }
then translate it and link it with debug mode:
mlir-translate -mlir-to-llvmir test.mlir | tee test.ll
llc test.ll --debugger-tune=gdb
which means I can debug it in the gdb.
So when I set a breakpoint (b test.mlir:3
), how can I print the variables in this mlir file, like β%0β?
Thanks,
Pei
You canβt. Adding this would be an interesting project!
1 Like
MuPei
January 6, 2022, 8:18am
3
Thanks for your reply!
Yeah, this could be useful while debugging.
How about having a function like func private @printF32(%arg0: f32)
, which can be called in the gdb/lldb?
Any ideas?
Having such function is just a small part of it: generating the debug info expression to have %arg0 available is a bit more involved. See https://llvm.org/docs/SourceLevelDebugging.html for the LLVM-level doc.
1 Like
MuPei
January 8, 2022, 3:04am
5
Thanks for the doc. Let me check it.