[Rcpp-devel] Debug Rcpp datatypes with lldb
Dirk Eddelbuettel
edd at debian.org
Thu Dec 6 15:34:01 CET 2018
On 6 December 2018 at 13:29, Huelsmann, Till wrote:
| Hello,
|
| First of all, I really like Rccp and would like to thank you all for your work.
s/Rccp/Rcpp/
Rccp = Russian for USSR
Rcpp = R bindings for C++
A not uncommon typo ...
| I try to debug an cpp file, which I source from R, using the lldb debuger.
|
| sourceCpp("source.cpp")
|
| Everything is woking fine, but I dont get how can I show the content of specific datatypes. Like NumericVector or CharackterVector.
|
| E.g.:
|
| (lldb) fr v myvec gives me:
|
| (Rcpp::CharacterVector) myvec= {
| Rcpp::PreserveStorage<Rcpp::Vector<4> > = (data = 0x000055555899e970)
| cache = {
| p = 0x00007fffffffc070
| }
| }
|
| How it is possible to get the values of the vector in lldb?
| I think, that the struct CharacterVector only stores the Memory address of the data.
|
| I have the same problem with NumericVectors, which are stored as double.
| If I tried to access them (format as double, 2072 bytes) but I didn´t get the expected values:
|
| (lldb) memory read –format f 0x000055555899e970
| (llldb) memory read -s2072 -fu -c2072 0x000055555899e970 --force
|
|
| Maybe I have a mistake. I would be very happy if someone could help me.
| I've already posted this question on Stackoverflow, but have not received an answer.
| See: https://stackoverflow.com/questions/53611600/debug-rcpp-with-lldb
I answered it, and I have nothing more to add. Read "Writing R Extension",
twice or more times as it is dense. It explains a) how to launch a debugger
(and while most of us use gdb it applies equally to lldb) and then b) realize
that everything is a SEXP with is opaque.
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel
mailing list