Skip to content

Trying to make DEBUG=T a debug version of R

3 messages · Andre Mikulec, Duncan Murdoch, Brian Ripley

#
Hi,

I am trying to make a debug version of R ( for use with gdb later ) on windows.

I am executing the following.

src\gnuwin32>make clean
src\gnuwin32>make DEBUG=T?

In the output, I see many

-O3 flags

I do not see any

?-g -O0 flags?

which ( I believe/I think ) that is what I need to debug R in gdb.

What is the proper way to 'make' a 'Debug version of R'?

Thank you,
Andre Mikulec
Andre_Mikulec at Hotmail.com
#
On 13-04-10 8:02 PM, Andre Mikulec wrote:
You don't need -O0 to debug in gdb, you just need the -g flag set 
properly, which DEBUG=T will do for you.  That's how I generally do it.

Setting -O0 might make debugging easier (because it eliminates 
optimizations).  To do that, you'll need to change the CFLAGS setting in 
src/gnuwin32/Makefiles.  (You may also be able to do it with a CFLAGS 
environment variable, I haven't tried.)  I don't usually do this, since 
it changes the code:  if you need gdb, chances are the bug is subtle, 
and its behaviour may change with optimization level.  But you may have 
a different preference.

Duncan Murdoch
#
On 11/04/2013 13:01, Duncan Murdoch wrote:
As Duncan says 'set properly'.  Things have changed and are changing 
currently in the gcc/gdb world, so I prefer to be explicit and use 
-gdwarf-2 (which is what DEBUG=T inserts currently).  (At one point that 
was essential, and might be again soon as dwarf-4 is the default in gcc 
4.8.x -- possibly not on Windows, which has other quite fundamental 
changes to exception handling under 4.8.x.)