Context: I have used RStudio on Ubuntu 18.04 to create an hello world R package with C++ code using Rcpp like described here in Rcpp Package Development:
Writing R extensions explains how I can start R with GDB attached for debugging via this shell command:
$ R -d gdb --vanilla
I want to use QtCreator instead of gdb to have debugging GUI, but this doesn't work (just opens a hex dump window and I cannot run R):
$ R -d qtcreator --vanilla
How can I use QtCreator for debugging?
Edit 1:
Attaching the QtCreator debugger to a running R session does not work:
If I start R, get the process ID in R via Sys.getpid()
and choose
Debug > Start Debugging > Attach to running application I get an error:
Edit 2: The ptrace
error is caused by kernel hardening that allows only debugging of child processes. I could solve this (temporarily) via
sudo su -
echo 0 > /proc/sys/kernel/yama/ptrace_scope
exit
Still an open issue: The QtCreator debugger shows the assembly code (not the C/C++ code)