On Tue, Jan 18, 2011 at 2:46 PM,
<rcpp-devel-requ...@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!
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to