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.
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.