[Rcpp-devel] R.e. Debugging Rcpp packages with GDB
Andrew Redd
amredd at gmail.com
Tue Jan 25 04:10:24 CET 2011
Davor,
A good place to start might be to mirror the behavior of the str in base R.
That gives quick truncated information, the kind that is helpful in
debugging.
-Andrew
On Mon, Jan 24, 2011 at 7:55 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 24 January 2011 at 16:36, Davor Cubranic wrote:
> | To follow up my original post, it is possible to define GDB
> pretty-printers using Python. (See
> http://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html.) Would
> people be interested in having Rcpp-specific pretty printers?
>
> That would be great. I have read about this feature ever since gcb 7.0 was
> announced but have never used. It probably would make a lot of sense here.
>
> Dirk
>
> | Davor
> |
> | On 2011-01-19, at 7:01 AM, Dirk Eddelbuettel wrote:
> |
> | >
> | > On 19 January 2011 at 08:43, Douglas Bates wrote:
> | > | > | 2) Is there a simple way to include debugging symbols/keep values
> from
> | > | > | getting optimized out when building with Rcpp?
> | > | >
> | > | > You could always include -g and then strip what you don't need --
> which is
> | > | > what Debian and Ubuntu do to give you the *-dbg packages.
> | > | >
> | > | > R sits on top of Makefile logic, and make is pretty powerful
> language. You
> | > | > can (literally) do just about anything.... Setting CFGLAGS /
> CXXFLAGS or
> | > | > their PKG_* variants is probably easiest.
> | > |
> | > | Or create a file $HOME/.R/Makevars and define CXXFLAGS and CFLAGS in
> | > | there. I have the following contents
> | > |
> | > | CFLAGS= -g -pipe -std=gnu99 -Wall -pedantic
> | > | CFLAGS= -g -O3 -pipe -std=gnu99 -Wall -pedantic
> | > | CXXFLAGS= -g -pipe -Wall -pedantic
> | > | CXXFLAGS= -g -pipe -std=c++0x -Wall -pedantic
> | > | CXXFLAGS= -g -O3 -pipe -Wall -pedantic
> | > | CXXFLAGS= -g -O3 -pipe -std=c++0x -Wall -pedantic
> | > |
> | > | and comment out the trailing lines if I want to suppress the c++0x
> | > | standard or the optimization when using the debugger.
> | >
> | > Seconded.
> | >
> | > That is actually what I do, including the better-than-awesome ccache:
> | >
> | > edd at max:~$ cat .R/Makevars
> | > # edd 03 Mar 2009
> | >
> | > ## for C code
> | > CFLAGS=-g -O3 -Wall -pipe -pedantic -std=gnu99
> | > #CFLAGS=-O3 -g0 -Wall -pipe -std=gnu99
> | > ## for C++ code
> | > CXXFLAGS= -g -O3 -Wall -pipe -pedantic -Wno-variadic-macros
> | > #CXXFLAGS= -g0 -O3 -Wall -pipe -Wno-variadic-macros
> | > #CXXFLAGS= -O3 -g0 -Wall -pipe
> | > ## for Fortran code
> | > #FFLAGS=-g -O3 -Wall -pipe
> | > FFLAGS=-O3 -g0 -Wall -pipe
> | > ## for Fortran 95 code
> | > #FCFLAGS=-g -O3 -Wall -pipe
> | > FCFLAGS=-O3 -g0 -Wall -pipe
> | >
> | > CC=ccache gcc
> | > CXX=ccache g++
> | > FC=ccache gfortran
> | > F77=ccache gfortran
> | > MAKE=make -j4
> | > edd at max:~$
> | >
> | >
> | > The -Wno-variadic-macros was once needed when Romain was a tad more
> | > aggressive in trying new C++0x features.
> | >
> | > The 'make -j4' also takes care of parallel builds.
> | >
> | > Dirk
> | >
> | > --
> | > Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
> | > _______________________________________________
> | > Rcpp-devel mailing list
> | > Rcpp-devel at lists.r-forge.r-project.org
> | >
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> |
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110124/8b8a3441/attachment.htm>
More information about the Rcpp-devel
mailing list