On 13-01-18 6:24 AM, Vitaliy FEOKTISTOV wrote:
Hello,

My R code calles a C/Fortran dll and I want to debug C code using Visual
Studio and Intel compilers /debugger

Debugging with Rcpp and RInsight does not work correctly on Windows.

Is there some other way to set breakpoints in C code and access to
variables ?


I've rarely used those compilers, but I've used two strategies for situations like that.

1. Start Rgui.exe in some debugger that works with your compiler. It won't know how to handle R debug info (and unless you've recompiled R there won't be any), but you should be able to set breakpoints in your own code. If your debugger won't set code in an unloaded DLL, you can run R, attach the package, then interrupt R to set breakpoints.

2. If you want to trigger a call to the debugger from your code, there are Windows API functions to do that (but I never had any luck with them); you may also be able to execute

  asm("int $3");

in your function to trigger a debug interrupt. This is a little dangerous, because I think it will crash R if a debugger is not attached.

Or you can use the old fashioned debugging methods, and just insert lots of Rprintf() calls into your C code. This is quite painful, but sometimes is necessary.

Duncan Murdoch

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to