[LLVMdev] how to dump a Instruction in gdb?

Zhongxing Xu xuzhongxing at gmail.com
Fri Nov 23 17:11:15 PST 2007


On Nov 23, 2007 6:05 PM, Tianwei <tianwei.sheng at gmail.com> wrote:
>
>
> On Nov 23, 2007 5:29 PM, Duncan Sands <baldrick at free.fr> wrote:
> > Hi,
> >
> >
> >
> > >    I want to know how to dump the a instruction in gdb. I can dump a
> Module
> > > use M.dump(), also is there any such print function which can be used in
> gdb
> > > for a single instruction and its operand?
> >
> > you can dump most things in LLVM the same way as for a module: if I is
> your
> > instruction, I.dump() or I->dump() should work, depending on whether it is
> > a pointer or a reference.
> >
> >
> thanks very much. so for following iterator, how can I use the dump
> function?
>   for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II) {
>
> }

You can try it yourself. First try II->dump(), compile. If it does not
work, try II.dump(). Even you can try (*II)->dump().
Or you can read the source code of inst_iterator, to see what it is,
which operator it overloads.



More information about the llvm-dev mailing list