Debugging tools and practices in Windows?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging tools and practices in Windows?

Javier Luraschi
Hello r-devel, could someone share the tools and practices they use to
debug the core R sources in Windows?

For instance, I would like to set a breakpoint in `gl_loadhistory` and
troubleshoot from there.

Thanks in advance - Javier Luraschi

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Debugging tools and practices in Windows?

Duncan Murdoch-2
On 23/02/2017 1:36 PM, Javier Luraschi wrote:
> Hello r-devel, could someone share the tools and practices they use to
> debug the core R sources in Windows?
>
> For instance, I would like to set a breakpoint in `gl_loadhistory` and
> troubleshoot from there.

You're talking about debugging the C code rather than the R code, I think.

These days I mostly avoid debugging in Windows, but when I have to do
it, I use gdb.  There used to be a front end for it (Insight) that
worked in Windows, but I don't think it works with our current gdb
build.  Google names lots of other front ends, but I haven't tried any
of them in Windows.

The other choice is the old fashioned method:  add lots of Rprintf()
statements to the source and recompile.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Debugging tools and practices in Windows?

Javier Luraschi
Right, I'm talking about C code.

Do you remember if you had to set specific CFLAGS or other settings to get
gdb working? I wasn't able to get gdb() working with the standard build
settings.

Otherwise, Rprintf() would work for sure.

Thank you!



On Thu, Feb 23, 2017 at 10:55 AM, Duncan Murdoch <[hidden email]>
wrote:

> On 23/02/2017 1:36 PM, Javier Luraschi wrote:
>
>> Hello r-devel, could someone share the tools and practices they use to
>> debug the core R sources in Windows?
>>
>> For instance, I would like to set a breakpoint in `gl_loadhistory` and
>> troubleshoot from there.
>>
>
> You're talking about debugging the C code rather than the R code, I think.
>
> These days I mostly avoid debugging in Windows, but when I have to do it,
> I use gdb.  There used to be a front end for it (Insight) that worked in
> Windows, but I don't think it works with our current gdb build.  Google
> names lots of other front ends, but I haven't tried any of them in Windows.
>
> The other choice is the old fashioned method:  add lots of Rprintf()
> statements to the source and recompile.
>
> Duncan Murdoch
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Debugging tools and practices in Windows?

Tomas Kalibera
The R for Windows FAQ suggests "make DEBUG=T" and has some more hints
https://cran.r-project.org/bin/windows/base/rw-FAQ.html

Tomas


On 02/23/2017 08:10 PM, Javier Luraschi wrote:

> Right, I'm talking about C code.
>
> Do you remember if you had to set specific CFLAGS or other settings to get
> gdb working? I wasn't able to get gdb() working with the standard build
> settings.
>
> Otherwise, Rprintf() would work for sure.
>
> Thank you!
>
>
>
> On Thu, Feb 23, 2017 at 10:55 AM, Duncan Murdoch <[hidden email]>
> wrote:
>
>> On 23/02/2017 1:36 PM, Javier Luraschi wrote:
>>
>>> Hello r-devel, could someone share the tools and practices they use to
>>> debug the core R sources in Windows?
>>>
>>> For instance, I would like to set a breakpoint in `gl_loadhistory` and
>>> troubleshoot from there.
>>>
>> You're talking about debugging the C code rather than the R code, I think.
>>
>> These days I mostly avoid debugging in Windows, but when I have to do it,
>> I use gdb.  There used to be a front end for it (Insight) that worked in
>> Windows, but I don't think it works with our current gdb build.  Google
>> names lots of other front ends, but I haven't tried any of them in Windows.
>>
>> The other choice is the old fashioned method:  add lots of Rprintf()
>> statements to the source and recompile.
>>
>> Duncan Murdoch
>>
>>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Debugging tools and practices in Windows?

Ray Donnelly
On Thu, Feb 23, 2017 at 7:49 PM, Tomas Kalibera <[hidden email]>
wrote:

> The R for Windows FAQ suggests "make DEBUG=T" and has some more hints
> https://cran.r-project.org/bin/windows/base/rw-FAQ.html
>
> Tomas
>
>
>
> On 02/23/2017 08:10 PM, Javier Luraschi wrote:
>
>> Right, I'm talking about C code.
>>
>> Do you remember if you had to set specific CFLAGS or other settings to get
>> gdb working? I wasn't able to get gdb() working with the standard build
>> settings.
>>
>> Otherwise, Rprintf() would work for sure.
>>
>> Thank you!
>>
>>
>>
>> On Thu, Feb 23, 2017 at 10:55 AM, Duncan Murdoch <
>> [hidden email]>
>> wrote:
>>
>> On 23/02/2017 1:36 PM, Javier Luraschi wrote:
>>>
>>> Hello r-devel, could someone share the tools and practices they use to
>>>> debug the core R sources in Windows?
>>>>
>>>> For instance, I would like to set a breakpoint in `gl_loadhistory` and
>>>> troubleshoot from there.
>>>>
>>>> You're talking about debugging the C code rather than the R code, I
>>> think.
>>>
>>> These days I mostly avoid debugging in Windows, but when I have to do it,
>>> I use gdb.  There used to be a front end for it (Insight) that worked in
>>> Windows, but I don't think it works with our current gdb build.  Google
>>
>> names lots of other front ends, but I haven't tried any of them in
>>> Windows.
>>>
>>>
I feel Qt Creator provides a good enough UI for debugging things on Windows
(it allows you to debug externally-built executables).


> The other choice is the old fashioned method:  add lots of Rprintf()
>>> statements to the source and recompile.
>>>
>>> Duncan Murdoch
>>>
>>>
>>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Debugging tools and practices in Windows?

Andre_Mikulec

I have not tried this in several years, but inside the Makefiles of the R source code, the following will replace the (non)debugging flags with debugging flags.


This (still) may or may not work ...


find . -type f -name 'M*k*' -exec sed -i 's/-O3/-O0 -ggdb3/g' {} \;
find . -type f -name 'M*k*' -exec sed -i 's/-O2/-O0 -ggdb3/g' {} \;
find . -type f -name 'M*k*' -exec sed -i 's/-shared/-shared -O0 -ggdb3/g' {} \;

I was sort of fresh at the this debugging when I started gdb debugging and time has passed by, so the recommended (current) 'R on windows' compiler flags can be found in the g++ documentation for the correct g++ used to compile the current R on Windows.

Andre Mikulec
[hidden email]


________________________________
From: R-devel <[hidden email]> on behalf of Ray Donnelly <[hidden email]>
Sent: Thursday, February 23, 2017 8:37 PM
To: Tomas Kalibera
Cc: r-devel


On Thu, Feb 23, 2017 at 7:49 PM, Tomas Kalibera <[hidden email]>
wrote:


> https://cran.r-project.org/bin/windows/base/rw-FAQ.html

cran.r-project.org

dows XP or later, including on 64-bit versions: See Can I use R on 64-bit Windows?.



>
> Tomas
>
>
>
> On 02/23/2017 08:10 PM, Javier Luraschi wrote:
>
>> Right, I'm talking about C code.
>>
>> Do you remember if you had to set specific CFLAGS or other settings to get
>> gdb working? I wasn't able to get gdb() working with the standard build
>> settings.
>>
>> Otherwise, Rprintf() would work for sure.
>>
>> Thank you!
>>
>>
>>
>> On Thu, Feb 23, 2017 at 10:55 AM, Duncan Murdoch <
>> [hidden email]>
>> wrote:
>>
>> On 23/02/2017 1:36 PM, Javier Luraschi wrote:
>>>
>>> Hello r-devel, could someone share the tools and practices they use to

>>>>
>>>> For instance, I would like to set a breakpoint in `gl_loadhistory` and
>>>> troubleshoot from there.
>>>>
>>>> You're talking about debugging the C code rather than the R code, I
>>> think.
>>>

t,
>>> I use gdb.  There used to be a front end for it (Insight) that worked in

>>
>> names lots of other front ends, but I haven't tried any of them in

>>>
>>>

(it allows you to debug externally-built executables).


> The other choice is the old fashioned method:  add lots of Rprintf()
>>> statements to the source and recompile.
>>>
>>> Duncan Murdoch
>>>
>>>
>>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
R-devel Info Page - ETH Zurich<https://stat.ethz.ch/mailman/listinfo/r-devel>
stat.ethz.ch
Public discussion list on R development. This list is intended for questions and discussion about code development in R. Questions likely to prompt discussion ...



>>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
R-devel Info Page - ETH Zurich<https://stat.ethz.ch/mailman/listinfo/r-devel>
stat.ethz.ch
Public discussion list on R development. This list is intended for questions and discussion about code development in R. Questions likely to prompt discussion ...



>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
R-devel Info Page - ETH Zurich<https://stat.ethz.ch/mailman/listinfo/r-devel>
stat.ethz.ch
Public discussion list on R development. This list is intended for questions and discussion about code development in R. Questions likely to prompt discussion ...




        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel