Skip to content

[Rcpp-devel] Debugging an C++ code in package using Rcpp package ?

5 messages · Rich FitzJohn, Qiang Kou, Dirk Eddelbuettel +1 more

#
Hi

What is te easiest way of debugging a package using Rcpp which gives a
segfault in the C++ code?

What is the up-to-date procedure?

I am on OS X and use usually emacs and ess.

Any suggestions?

Thanks,

Raner
#
On a mac, lldb passed to R as `R -d lldb` usually does the trick.  Kevin
Ushey has written a nice article on this here:
  http://kevinushey.github.io/blog/2015/04/13/debugging-with-lldb/
which complements the information in R-exts

https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Debugging-compiled-code

Cheers,
Rich
On Wed, Jan 13, 2016 at 10:17 AM Rainer M Krug <Rainer at krugs.de> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160113/e1e519d4/attachment.html>
#
Hi, Rainer,

Personally I think the video below provides a very nice example to debug in
R package.

https://vimeo.com/11937905

Hope it helps.

Best,

KK

On Wed, Jan 13, 2016 at 5:21 AM, Rich FitzJohn <rich.fitzjohn at gmail.com>
wrote:

  
    
#
Rainer,

The old BioC video is very good, albeit somewhat low-level (which you cannot
avoid with compiled code).

Kevin's write-up is also very nice.

There is also this older post by Doug Bates somewhere but all I find right
now is this:
  http://comments.gmane.org/gmane.emacs.ess.general/4188
which is not what I recall.

These days 'just' using valgrind and the ASAN/UBSAN instrumented R versions
can help too.  I have two blog posts on that as well as some Docker
containers. It probably requires a little bit of familiarity with Docker.

Dirk
#
Dirk Eddelbuettel <edd at debian.org> writes:
Thanks everybody for your input - I will look at it later today after I
did some clearing up of the code in the hope that I see what is wrong.

The links and videos look very interesting.

@Dirk: I wanted to look at Docker anyway for reproducible research (and
the ease of installing some programs under Linux instead of OS X), so I
will look at this as well.

Do you know of a nice intro to docker and how to use R under docker
(including installation of additional software and packages)? I have the
Docker book and read your Rocker intro - so please feel free to pint me there.

Thanks,

Rainer