Is there a way to print the IR (file) line number of a arbitrary llvm instruction?
I’m debugging an analysis pass and it would help a lot if I could exactly identify which instruction I’m outputting information about on the screen.
Thanks.
Is there a way to print the IR (file) line number of a arbitrary llvm instruction?
I’m debugging an analysis pass and it would help a lot if I could exactly identify which instruction I’m outputting information about on the screen.
Thanks.
Hi,
I'm debugging an analysis pass and it would help a lot if I could exactly
identify which instruction I'm outputting information about on the screen.
Usually there's no concept of line number in the in-memory data
structures (.bc is equally valid input and doesn't have lines).
If you run the "debug-ir" pass before yours it'll add Dwarf info to
each instruction, which describes what you want. You can then access
it with Instruction::getDebugLoc.
Cheers.
Tim.
Hi Tim,
it worked perfectly.
Thank you.
Hi,
I’m debugging an analysis pass and it would help a lot if I could exactly
identify which instruction I’m outputting information about on the screen.
Usually there’s no concept of line number in the in-memory data
structures (.bc is equally valid input and doesn’t have lines).
If you run the “debug-ir” pass before yours it’ll add Dwarf info to
each instruction, which describes what you want. You can then access
it with Instruction::getDebugLoc.
Cheers.
Tim.