[Rcpp-devel] Debugging an Rcpp/RCppArmadillo program?

Stefano Calza stecalza at gmail.com
Mon Apr 8 16:37:37 CEST 2013


Hi,

if you use emacs you might do the following (tested in Linux, but 
ideally possible in Windows too):

1) open R in emacs (M-x R) and load the *.so. At developement stage it 
might be useful to use sourceCpp
2) open gdb (M-x gdb) in emacs
3) look for R session id (see "ps" command), let's assume it's 1234
4) In the gdb shell:
     a) attach 1234
     b) set breakpoints
     c) signal 0
5) now run R commands and you'll get the debugger stop once into you code

Stefano





On 04/08/2013 03:27 PM, Andre Mikulec wrote:
> Hi,
>
> Pardon me.  I am relatively new.
>
> What is a way ( or effective way ) to debug an Rcpp/RCppArmadillo 
> program that is running within R?
>
> Do I try somehow to set an inline RCpp/RCppArmidillo
> script attribute to 'Debug' ( if this exists? )
>
> Do I recompile R ( with perhaps 'g++ -g -O0' and try to debug an
> Rcpp/RCpp Armadillo file (.so/.dll) in an attached process in the  gdb 
> debugger?
>
> Do I just create an ( independent from R ) Armadillo C++ program .exe 
> (  made with 'g++ -g -O0 )
> ( and use my own BLAS/LAPACK ) outside of R, and just debug the .exe 
> it using gdb?
>
> Or, do I simply, in R, just put many 'print statements' in the inline 
> RCpp/RCppArmidillo script?
>
> What is a strategy?
>
> Thank you,
> Andre Mikulec
> Andre_Mikulec at Hotmail.com <mailto:Andre_Mikulec at Hotmail.com>
>
>
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130408/7f3572dc/attachment.html>


More information about the Rcpp-devel mailing list