Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

List R variable names and their SEXP in the global env during debugging of compiled C/C++ code (GDB)

$
0
0

The context of this question is debugging of an R packages that calls C or C++ code (eg. via the package Rcpp or directly using the R API) by using gdb (or another) debugger.

How can I list the variable names and find their SEXP pointers to print the values of variables in the global env of R during low-level debugging at C/C++ level using eg. gdb as debugger?

I am using the work flow documented in Writing R Extensions > Debugging of compiled code

R -d gdb

which mentions how to print SEXPressions via

(gdb) p R_PV(mySEXPRvar)
(gdb) call Rf_PrintValue(mySEXPRvar)

but how can I list the variables like the R command ls does?

Edit 1: There is a code example in the Rcpp gallery which shows how to access the global env programmatically (but I would prefer to do this only whithin the debugger): https://gallery.rcpp.org/articles/accessing-environments/


Viewing all articles
Browse latest Browse all 201839

Trending Articles