debugging C/Fortran code with Visual Studio and Intel compilers

classic Classic list List threaded Threaded
2 messages Options
FVA
Reply | Threaded
Open this post in threaded view
|

debugging C/Fortran code with Visual Studio and Intel compilers

FVA
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]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: debugging C/Fortran code with Visual Studio and Intel compilers

Duncan Murdoch-2
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel