[LLVMdev] debugging opt passed using gdb: could not open input file

David Wiberg dwiberg at gmail.com
Mon Jan 12 09:11:47 PST 2015


Hi Alex,

2015-01-12 9:14 GMT+01:00 Alexander Poddey <alexander.poddey at gmx.net>:
> Hi all,
>
> I would like to be able to debug opt passes.
> - I compiled llvm in debug mode
> - gdb /usr/local/bin/opt
> - run opt -load /path/to/LLVMHello.so -hello <any.bc> /dev/null
>
> and then get /usr/local/bin/opt: opt: err: Could not open input file ....

I think that one problem is that you have "opt" after "run" in your
command. Another detail I noticed is that you are lacking an equals
sign between the "-load" and the plugin filename compared to the opt
documentation.

For your example it would be:
run -load=/path/to/LLVMHello.so -hello < any.bc > /dev/null

>
> could it be the <> syntax is not gdb command window conform?
> I tried to find out if i could provide opt in and out files using standard
> parameter (like opt -i or something), but there seems to be none.
>
> So how could I correctly invoke opt in gdb?

I think that it will work to specify your in and out files using I/O
redirection with the changes described above. If you can't get that to
work you can try:
opt -load=/path/to/LLVMHello.so -hello -o=output.bc input.bc

I haven't got access to gdb and opt at the moment so I can't try the
suggestions myself but I hope they are correct.

Best regards
David

>
> Thx
> Alex
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list