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"... (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 (gdb) Any suggestions? Attempting to set other break points (do_BLAH) gives the same result. I compiled with 'make DEBUG=T' per the instructions on Duncan Murdoch's Building R for Windows page. I also tried compiling after modifying the makefiles to remove -02 optimization (see patch below for what I did). Thanks, + seth Index: src/extra/intl/Makefile.win ==================================================================--- src/extra/intl/Makefile.win (revision 33477) +++ src/extra/intl/Makefile.win (working copy) @@ -18,6 +18,10 @@ endif CFLAGS = -O2 $(DEFS) -I. -I../../include +ifdef DEBUG + CFLAGS = $(DEFS) -I. -I../../include +endif + dcigettext-CFLAGS=-DLOCALEDIR=\"\" SOURCES = \ Index: src/gnuwin32/Makefile ==================================================================--- src/gnuwin32/Makefile (revision 33477) +++ src/gnuwin32/Makefile (working copy) @@ -33,8 +33,8 @@ ## use FOPTFLAGS where complex*16 is used. FOPTFLAGS=-O2 -Wall ifdef DEBUG - OPTFLAGS+=-g - FOPTFLAGS+=-g + OPTFLAGS=-g -Wall -pedantic + FOPTFLAGS=-g -Wall DLLFLAGS else DLLFLAGS=-s
On Fri, 18 Mar 2005, 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"... > (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 > (gdb) > > Any suggestions? Attempting to set other break points (do_BLAH) gives > the same result.Not a Windows developer so this may be off but did you try loading the shared library prior to setting your breakpoint? (gdb) break WinMain (gdb) run (gdb) info share ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
On Fri, 18 Mar 2005 09:49:28 -0800, Seth Falcon <sfalcon@fhcrc.org> 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 .textand 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