[Rd] Debugging packages with compiled C code on Windows
Jeroen Ooms
jeroenoom@ @end|ng |rom gm@||@com
Tue Jun 2 01:14:28 CEST 2020
On Mon, Jun 1, 2020 at 11:36 PM Sue McDonald <sudomeme using gmail.com> wrote:
>
> I have several related questions.
>
> 1. Is it possible to use a GUI: Rstudio/Eclipse/Visual-studio to debug
> compiled code on Windows? Things that work on Eclipse for Windows do not
> work on Eclipse for Windows.
> 2. R CMD INSTALL seems to override default attempts to provide
> CFLAGS="-DDEBUG -g3 -O0"
> 3. Is it necessary to compile R with debug turned on? One of the FAQs
> mentioned to compile R with make DEBUG=T.
> 4. Using Rtools 4.0 and Jeroen's scripts for building R works great (many
> thanks). But does not seem to have an impact on optimization, other than
> including -gwarf-2. It adds -DNDEBUG flag. Is that sufficient for
> debugging compiled code in a package? Obviously, I just need to debug
> package code, so does it matter?
If you use the official R-for-Windows installation, you should install
your R package with R CMD INSTALL --debug in order to keep debug
symbols. That is usually sufficient to get a backtrace with e.g
drmingw. See FAQ 8.4 of
https://cran.r-project.org/bin/windows/base/rw-FAQ.html
Coincidentally I am also working on a special debugging build of R,
which uses -g -O0 for all compiled code. It is not final yet, but it
should work. You can test it here:
https://github.com/r-windows/rtools-packages/pull/119
More information about the R-devel
mailing list