[Rd] Trying to make DEBUG=T a debug version of R

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 11 14:28:18 CEST 2013


On 11/04/2013 13:01, Duncan Murdoch wrote:
> On 13-04-10 8:02 PM, Andre Mikulec wrote:
>> 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'?
>
> 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.

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.)

> 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
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list