What are productive ways to debug Rcpp compiled code loaded in R (on OS X Mavericks)?

后端 未结 2 1164
花落未央
花落未央 2020-12-15 03:50

What is the most productive and quickest way to debug shared objects that are loaded into R, in particular on OS X Mavericks? I\'m primarily interested in debugging compile

2条回答
  •  無奈伤痛
    2020-12-15 04:14

    This is tough. I tried Xcode and Eclipse with a standalone C++ application, but it was so difficult to get all the headers and libraries working. Furthermore, the RcppExport code calls your real R function through a pointer which seemed to really confuse Xcode, and I couldn't step into my function.

    I ended up with (gdb or lldb): In R: R -d lldb In debugger, set breakpoint: b functionName run In R: .Call(etc) # or just call your R code which invokes compiled C/C++ code Then back in debugger once break happens, you can step, examine frames, etc.

    This lldb/gdb command quick reference helped a lot.

    Forget about trying to do this in a GUI at this point. Hopefully Rstudio will get this going.

提交回复
热议问题