Re: [Rd] Trouble debugging with gdb, R on Windows

From: Duncan Murdoch <>
Date: Fri 18 Mar 2005 - 19:59:56 GMT

On Fri, 18 Mar 2005 09:49:28 -0800, Seth Falcon <> wrote :

>I'm trying to follow the example in the R for Windows FAQ on running
>gdb and am getting stuck because gdb tells me "Cannot access memory at
>address ...".
>Here's what my gdb session looks like (This one from a cygwin shell,
>but same results from plain Windows CMD shell):
>$ cd R-devel/src/gnuwin32
>$ gdb ../../bin/Rgui.exe
>GNU gdb 5.2.1
>Copyright 2002 Free Software Foundation, Inc.
>GDB is free software, covered by the GNU General Public License, and you are
>welcome to change it and/or distribute copies of it under certain conditions.
>Type "show copying" to see the conditions.
>There is absolutely no warranty for GDB. Type "show warranty" for details.
>This GDB was configured as "i686-pc-mingw32"...

I'm using the same version as you, but I don't see what you're seeing. You got

>(gdb) break WinMain
>Breakpoint 1 at 0x401296: file ../graphapp/graphappmain.c, line 59.
>(gdb) run
>Starting program: y:\falcon\src\R-devel\src\gnuwin32/../../bin/Rgui.exe
>Breakpoint 1, WinMain (Instance=0x400000, PrevInstance=0x0,
> CmdLine=0x261f26 "", CmdShow=10) at ../graphapp/graphappmain.c:59
>59 startgraphapp(Instance, PrevInstance, CmdShow);
>(gdb) break R_ReadConsole
>Cannot access memory at address 0x23e17
>(gdb) info symbol 0x23e17
>R_ReadConsole in section .text

and I get

(gdb) b WinMain
Breakpoint 1 at 0x401296: file ../graphapp/graphappmain.c, line 59. (gdb) run
Starting program: f:\R\svn\r-devel\R\src\gnuwin32/../../bin/Rgui.exe

Breakpoint 1, WinMain (Instance=0x400000, PrevInstance=0x0,

    CmdLine=0x251f13 "", CmdShow=10) at ../graphapp/graphappmain.c:59 59 startgraphapp(Instance, PrevInstance, CmdShow); (gdb) break R_ReadConsole
Breakpoint 2 at 0x1001d5e6
(gdb) info symbol 0x1001d5e6
R_ReadConsole + 6 in section .text

The only thing I can see is that your address for R_ReadConsole looks suspiciously low: normally code gets loaded at addresses above 0x400000. I have no idea what would cause this, and am not even sure it's not perfectly reasonable.

A workaround that might help would be to use the R menu item "Misc|Break to debugger" to break out of R once it is running, and set your breakpoints then, but I don't know that it will make any difference.

Duncan Murdoch mailing list Received on Sat Mar 19 07:04:03 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:26:31 GMT