usually what happens is (# meant to be a comment char)
% R -d gdb -f test.R
gdb> run
...segfault happens, breaks into gdb
gdb> bt # print the backtrace
gdb> up # move up the stack, to get to 'your' frame
gdb> l # show source listing, use -O0 compiler flag, see gdb> help dir
gdb> print some_suspect_variable
gdb> call Rf_PrintValue(some_suspect_sexp)
gdb> break suspect_function
gdb> run # restart script, but break at suspect_function
and so on, i.e., you've got all the info you need. A neat trick is to
leave gdb running, repair and R CMD SHLIB your C code, return to gdb and
gdb> run
to restart the same script but using the new shared lib (possibly
preserving breakpoints and other debugging info you'd used in previous
sessions).
I'm a heavy emacs user but find it easier to stick with gdb from the
shell -- one less layer to get in the way, when I'm confused enough as
it is.
Wow! Thanks for the detailed reply, your approach makes perfect sense...
... especially given that my core file was for some unknown reason 0
bytes which
gdb didn't find too funny.
cheers
David
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel