I have an R script that's usually started from the command line with arguments:
./script.R --width=10
It uses Rscript as interpreter:
#!/usr/bin/env Rscript
Unfortunately it gives me a segmentation fault when it executes my compiled C code in R using .C("compiled_function").
So how can I run my R script with the gdb debugger attached?
Rscript apparently does not know the -d option.
I tried this
R -d gdb --vanilla --args --width=10 < script.R
But it didn't work since it passed the --width=10 to the debugger. What is the right call?
Maybe I should start R interactively:
$ R -d gdb --vanilla
But then I don't know how to source my script and pass the arguments (--width=10).