Vitaliy FEOKTISTOV
2013-Jan-18 11:24 UTC
[Rd] debugging C/Fortran code with Visual Studio and Intel compilers
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 ? Thank you ! Kind regards, Vitaliy [[alternative HTML version deleted]]
Duncan Murdoch
2013-Jan-18 11:46 UTC
[Rd] debugging C/Fortran code with Visual Studio and Intel compilers
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
Reasonably Related Threads
- multi threaded execution of package
- linux multi-threaded compilation is running only on one processor
- poor IO perfomance
- Fwd: [Bug 8499] AutoWikiBrowser doesn't work (uses .NET 2 framework)
- [LLVMdev] PHINode containing itself causes segfault when compiling Blender OpenCL kernel with R600 backend