Fantastic, it works perfectly, many thanks!

Guillaume

> On 15 Jun 2016, at 21:49, Kevin Ushey <kevinus...@gmail.com> wrote:
> 
> Hi Guillaume,
> 
> I have a script that does this (for OS X) here, taking advantage of
> the new '--batch' argument to lldb:
> 
>    https://github.com/kevinushey/etc/blob/master/lang/r/mac/bin/r-lldb
> 
> Note that, on recent versions of OS X due to system integrity
> protection, this may not work with the system lldb, as it appears
> there are restrictions on how certain environment variables, e.g.
> DYLD_FALLBACK_LIBRARY_PATH, can be set for system executables. (If you
> are indeed on OS X, you can try building your own version of lldb --
> see e.g. 
> https://github.com/kevinushey/etc/blob/master/platform/mac/install-llvm.sh
> for that)
> 
> In the end, you should be able to use this script as e.g.
> 
>    r-lldb -f test.R
> 
> and this will launch lldb, set R as the target process, with '-f
> test.R' passed to the R executable.
> 
> Depending on your OS / configuration, you might need to tweak the
> script, but it will hopefully either 'work out of the box' or at least
> serve as a starting point for your version.
> 
> Best,
> Kevin
> 
> On Wed, Jun 15, 2016 at 12:39 PM, Guillaume Chapron
> <carnivorescie...@gmail.com> wrote:
>> Hello,
>> 
>> I am debugging a package that contains some compiled C code. The C code uses 
>> R random number generator so I cannot (or have not figured out how to) debug 
>> it without running it through R. What I do is to type the following in the 
>> terminal:
>> 
>> R --debugger=lldb
>> 
>> then in the lldb prompt
>> 
>> r
>> 
>> and within R
>> 
>> source("~/Desktop/test.R”)
>> 
>> which is the file calling the C library. When the library crashes I can 
>> navigate the C memory to see where is the problem.
>> 
>> My question is whether there is a way to have this in single line or script 
>> to run from the terminal. I have looked on stackoverflow but could not find.
>> 
>> Many thanks
>> 
>> Guillaume
>> ______________________________________________
>> R-package-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel

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

Reply via email to