[ESS] Running R within ESS using gdb
bates at stat.wisc.edu
Fri Feb 26 18:20:14 CET 2010
I am running Emacs 126.96.36.199 and ESS 5.7.1 on an Ubuntu 9.10 system.
Both were installed from Ubuntu packages. This emacs is still called
emacs-snapshot under Ubuntu.
In the past I was able to combine ESS and gdb for debugging compiled
code within R according to the following sequence of steps
1. Start R using ESS
2. Attach any packages whose code I want to debug to this instance of R
3. M-x gdb location_of_R_executable
4. Determine the process number for the R process (M-! pgrep R)
5. Attach gdb to the R process
6. Set a breakpoint at the place where I want to start the debugger
7. Send the 0 signal from gdb
In the past this would send control back to the ESS buffer where I
could type an R expression that would invoke the code I wanted to
debug. gdb would catch the breakpoint and I would continue from
Apparently the emacs interface to gdb (called "gud") has been improved
to handle multiple threads etc. The only problem for me now is that I
can't get past step 5. I can't decide how to set a breakpoint in gdb
because I don't get a gdb prompt. Also it looks as if gdb has taken
over control of the I/O from the ESS buffer. The ESS buffer indicates
the there is no longer an R process attached.
Has anyone successfully combined R under ESS and gdb under gud within
a recent emacs?
Alternatively, can anyone give me a recipe for starting gdb on R
within emacs. I would prefer not to need to use the vanilla interface
to gdb. Would it be as simple as setting the necessary environment
variable (i.e. R_HOME_DIR -- any others?) in the emacs process then
More information about the ESS-help