[Rcpp-devel] R.e. Debugging Rcpp packages with GDB
Christian Gunning
xian at unm.edu
Tue Jan 18 23:52:35 CET 2011
On Tue, Jan 18, 2011 at 2:46 PM,
<rcpp-devel-request at lists.r-forge.r-project.org> wrote:
>
> Can people share any tricks they use to debug Rcpp packages? For example, can I "print" variables in a format that's a bit more high-level, like something that I would get if I sent them to "cout"?
>
It's not very sophisticated, but I find that much of the time adding
Rf_PrintValue(xx) calls to code gives me as much info as I need. If
it's a non-SEXP object like int, then Rf_PrintValue(wrap(my_int)).
> If that's not entirely obvious from my question, I am not a GDB expert. :-) Basically, my workflow is: "attach to the R process", "set a breakpoint at the function entry point", "single-step and print variable values". I have used watches and conditional breakpoints in GUI debuggers, but not (yet) in gdb. Are there any Rcpp-specific gotchas to using those features with GDB?
I have 2 related "simple questions" after reading through Chapters 1
and 4 of "Writing R Extensions":
My build/test chain is:
R CMD INSTALL mypackage
R --vanilla --debugger gdb
run
require(mypackage)
<test in R>
quit()
<edit code>
R CMD INSTALL mypackage
run
require(mypackage) ## reload package with edits
<lather, rinse, repeat>
1) Is there a "best" way to reload the shared library after
rebuilding it? dyn.unload() and dyn.load()?
2) Is there a simple way to include debugging symbols/keep values from
getting optimized out when building with Rcpp?
Thanks,
Christian
>
> Thanks,
>
> Davor
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel
mailing list