Hi, everyone. I'm trying to debug an R-module, written in C, and I'm using gdb for this. How can I print "standard" R objects from within C code? BTW, I'm familiar with the advice to use R_PV given in Writing R Extensions, but it's not working for me. E.g., I get (gdb) p R_PV(x) $1 = void and yet (gdb) p *x $2 = {sxpinfo = {type = 16, obj = 0, named = 0, gp = 0, mark = 0, debug = 0, trace = 0, spare = 0, gcgen = 0, gccls = 1}, attrib = 0x608f98, gengc_next_node = 0xa82328, gengc_prev_node = 0xa822c8, u = {primsxp = {offset = 1}, symsxp = { pname = 0x1, value = 0x146fb50, internal = 0x2000000a}, listsxp {carval = 0x1, cdrval = 0x146fb50, tagval = 0x2000000a}, envsxp = {frame = 0x1, enclos = 0x146fb50, hashtab = 0x2000000a}, closxp = {formals = 0x1, body = 0x146fb50, env = 0x2000000a}, promsxp = {value = 0x1, expr 0x146fb50, env = 0x2000000a}}} which suggests to me that x is not "void" (whatever that's supposed to mean here). What I'd like to do is print out SEXP's the way that the R interactive interpreter would display them if one evaluated them on the command line, but to do this from within gdb, or at least via a PRINT function called directly within the C code. Is this possible? TIA! Kynn [[alternative HTML version deleted]]
Hi Kynn -- (gdb) call Rf_PrintValue(x) 'void' is I think the return value of R_PV() Martin Kynn Jones wrote:> Hi, everyone. I'm trying to debug an R-module, written in C, and I'm using > gdb for this. > > How can I print "standard" R objects from within C code? > > BTW, I'm familiar with the advice to use R_PV given in Writing R Extensions, > but it's not working for me. E.g., I get > > (gdb) p R_PV(x) > $1 = void > > and yet > > (gdb) p *x > $2 = {sxpinfo = {type = 16, obj = 0, named = 0, gp = 0, mark = 0, debug = 0, > trace = 0, spare = 0, gcgen = 0, gccls = 1}, > attrib = 0x608f98, gengc_next_node = 0xa82328, gengc_prev_node = 0xa822c8, > u = {primsxp = {offset = 1}, symsxp = { > pname = 0x1, value = 0x146fb50, internal = 0x2000000a}, listsxp > {carval = 0x1, cdrval = 0x146fb50, > tagval = 0x2000000a}, envsxp = {frame = 0x1, enclos = 0x146fb50, > hashtab = 0x2000000a}, closxp = {formals = 0x1, > body = 0x146fb50, env = 0x2000000a}, promsxp = {value = 0x1, expr > 0x146fb50, env = 0x2000000a}}} > > which suggests to me that x is not "void" (whatever that's supposed to mean > here). > > > What I'd like to do is print out SEXP's the way that the R interactive > interpreter would display them if one evaluated them on the command line, > but to do this from within gdb, or at least via a PRINT function called > directly within the C code. > > Is this possible? > > TIA! > > Kynn > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel