Alexander Poddey
2015-Jan-12 08:14 UTC
[LLVMdev] debugging opt passed using gdb: could not open input file
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 .... 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? Thx Alex
David Wiberg
2015-Jan-12 17:11 UTC
[LLVMdev] debugging opt passed using gdb: could not open input file
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
Alexander Poddey
2015-Jan-13 10:48 UTC
[LLVMdev] debugging opt passed using gdb: could not open input file
Hi David, my first follow-up got lost, therefore in short again: using backticks solves the problem: run `opt -load=/pathTo/LLVMHello.so -hello < /pathTo/your.bc > /dev/null` using -load /path was mentioned in the docu, although opt -help states -load=/path; this however did not solve the issue. Thanks for your advice! Alex