[Rd] Trouble debugging with gdb, R on Windows

Seth Falcon sfalcon at fhcrc.org
Fri Mar 18 18:49:28 CET 2005


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



More information about the R-devel mailing list