Skip to content
Atif Aziz edited this page Oct 17, 2017 · 1 revision

This is a page gathering how-tos and links to relevant information to get some things running.

Debugging with Monodevelop

At some point in the past, I did manage to have the rClr native code debugged from Monodevelop. I think, anyway. Seems I cannot anymore.

Now regarding how to figure how the following issue, which ends up with the R console spitting the dummy. How to set up the mono soft debugger to attach to the R process.

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at RDotNet.Devices.CharacterDeviceAdapter.ResetConsole () [0x00000] in <filename unknown>:0 
export MONODEVELOP_SDB_TEST=1

Seems that following the instructions work. Can hook up breakpoints. However when trying to debug the R.NET related issue, catching the exception fails. The mono runtime spits the dummy with a SIGSEV.

Debugging tools

Aside from valgrind, sayw the mention on the R-devel mailing list of the AddressSanitizer. Seems to be soon included in LLVM clang and gcc.

Data marshalling

The following links stem from looking how to invoke from rClr.dll a managed method such as public object CreateSomeRdotNetStructure(IntPtr ptr, int sexptype). It looks like the corresponding type to IntPtr is (void *), but while P/Invoke from C# works, rdotnet as a proof, I could not find the other way around to obtain an IntPtr. I think I could create the IntPtr in C# from end int or long, but this is where the rub is: a platform-dependent code...

Other links of interest

Read http://www.codeproject.com/Articles/416471/CLR-Hosting-Customizing-the-CLR and the follow up article.

Clone this wiki locally