[Rd] How to explore R internals through gdb?

From: Kynn Jones <kynnjo_at_gmail.com>
Date: Mon, 08 Jun 2009 14:48:54 -0400

Hi everyone.
I'm trying to learn my way around the R internals. I've gone pretty much as far as I can go with the information given in Writing R Extensions and R Internals, but I still have a lot of questions, too many in fact to post them to the r-devel list. But I think I could answer many of these if I could just step through R's execution during some basic operations.

What I'd like to do is generate a simple R script, e.g.:

# foo.R
foo <- list(x=1, y=2, z=3)

...and then using gdb step through R's execution of this script.

I have two questions.

First, where in the R source would be a good place to set a breakpoint so that I can then step through the execution of such a script?

Second, breakpoints aside, how can I even get R to run such a script under gdb?

For the latter I tried this:

% myR/bin/R -q --vanilla --debugger=gdb --file=foo.R GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-linux-gnu"... Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) c

The program is not being run.
(gdb) r

Starting program: /d0/home/jones/local/pub/work/proj/myR/lib64/R/bin/exec/R -q --vanilla --file=foo.R
/d0/home/jones/local/pub/work/proj/myR/lib64/R/bin/exec/R: error while loading shared libraries: libR.so: cannot open sy

Program exited with code 0177.

What am I doing wrong?

BTW, the version on R I have under myR has been compiled with the -g flag set.

TIA! kynn

        [[alternative HTML version deleted]]

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 08 Jun 2009 - 18:55:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 09 Jun 2009 - 20:37:53 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive