On 17/09/2014, 11:52 PM, Andre Mikulec wrote: > Help, > > My Rgui.exe, main.f, main.o, and main.dll are all in the same directory. > When I try to set a breakpoint, I get this response > > (gdb) b main.f:3 > No source file named main.f > > I tried the -gdwarf-2 requirement in both the compiling and linking > statements. This did not fix the problem. > The cygwin site recommended the -g option. I tried this. This did not fix > the problem.
This is getting to be a question about gdb, and I'm no expert on that. I do remember there's a command "dir" which says where to find source; perhaps that is necessary even when the working directory holds the source. > I did not use R CMD SHLIB ( I ran the statements manually ). I don't recommend that. You can add options to R CMD SHLIB, but you are likely to run into problems with R if you leave any out. DUncan Murdoch > > Andre Mikulec > andre_miku...@hotmail.com > > > ---------------------------------------- >> From: r-devel-requ...@r-project.org >> Subject: R-devel Digest, Vol 139, Issue 15 >> To: r-devel@r-project.org >> Date: Tue, 16 Sep 2014 12:00:06 +0200 >> >> Send R-devel mailing list submissions to >> r-devel@r-project.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://stat.ethz.ch/mailman/listinfo/r-devel >> or, via email, send a message with subject or body 'help' to >> r-devel-requ...@r-project.org >> >> You can reach the person managing the list at >> r-devel-ow...@r-project.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of R-devel digest..." >> >> >> Today's Topics: >> >> 1. Debug an R windows (Fortran) DLL within R with gdb? >> (Andre Mikulec) >> 2. Re: Debug an R windows (Fortran) DLL within R with gdb? >> (Duncan Murdoch) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Mon, 15 Sep 2014 17:25:49 -0400 >> From: Andre Mikulec <andre_miku...@hotmail.com> >> To: "r-devel@r-project.org" <r-devel@r-project.org> >> Subject: [Rd] Debug an R windows (Fortran) DLL within R with gdb? >> Message-ID: <blu174-w2834a37215473fee12d3f39c...@phx.gbl> >> Content-Type: text/plain; charset="iso-8859-1" >> >> >> Hi,? >> I have a Fortran 77 subroutine (dll). >> >> On windows XP, how ?would I 'debug it(Fortran) within R' using gdb? >> >> This is how I made it. >> ---------------------- >> >> R CMD SHLIB main.f >> >> gfortran -m32 ? ? -O3 ?-mtune=core2 -c main.f -o main.o >> >> gcc -m32 -shared -s -static-libgcc -o main.dll tmp.def main.o >> -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 >> -Ld:/RCompile/CRANpkg/extralibs64/local/lib -lgfortran >> -LF:/ProgramFiles/R/R-3.1.1/bin/i386 -lR >> >> >> Here is the contents of the file ?main.f >> ----------------------------------------- >> >> ? ? ? SUBROUTINE NGCD(NA, NB, NGCDO)? >> ? ? ? ? IA = NA >> ? ? ? ? IB = NB >> ? ? 1 ? IF (IB.NE.0) THEN >> ? ? ? ? ? ITEMP = IA >> ? ? ? ? ? IA = IB >> ? ? ? ? ? IB = MOD(ITEMP, IB) >> ? ? ? ? ? GOTO 1 >> ? ? ? ? END IF >> ? ? ? ? NGCDO = IA ? >> ? ? ? ? RETURN >> ? ? ? END >> >> Thank you, >> Andre Mikulec >> andre_miku...@hotmail.com >> >> >> >> >> >> ------------------------------ >> >> Message: 2 >> Date: Mon, 15 Sep 2014 18:05:36 -0400 >> From: Duncan Murdoch <murdoch.dun...@gmail.com> >> To: Andre Mikulec <andre_miku...@hotmail.com>, "r-devel@r-project.org" >> <r-devel@r-project.org> >> Subject: Re: [Rd] Debug an R windows (Fortran) DLL within R with gdb? >> Message-ID: <541762b0.1050...@gmail.com> >> Content-Type: text/plain; charset=ISO-8859-1 >> >> On 15/09/2014, 5:25 PM, Andre Mikulec wrote: >>> >>> Hi, >>> I have a Fortran 77 subroutine (dll). >>> >>> On windows XP, how would I 'debug it(Fortran) within R' using gdb? >>> >>> This is how I made it. >>> ---------------------- >>> >>> R CMD SHLIB main.f >>> >>> gfortran -m32 -O3 -mtune=core2 -c main.f -o main.o >>> >>> gcc -m32 -shared -s -static-libgcc -o main.dll tmp.def main.o >>> -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 >>> -Ld:/RCompile/CRANpkg/extralibs64/local/lib -lgfortran >>> -LF:/ProgramFiles/R/R-3.1.1/bin/i386 -lR >>> >>> >>> Here is the contents of the file main.f >>> ----------------------------------------- >>> >>> SUBROUTINE NGCD(NA, NB, NGCDO) >>> IA = NA >>> IB = NB >>> 1 IF (IB.NE.0) THEN >>> ITEMP = IA >>> IA = IB >>> IB = MOD(ITEMP, IB) >>> GOTO 1 >>> END IF >>> NGCDO = IA >>> RETURN >>> END >> >> I don't think you put in any compile options to include symbolic >> information. You need to do that. I think the option you want is >> -gdwarf-2, but I rarely use Fortran, and never use SHLIB, so I could be >> wrong. I'll assume you can figure out how to do that. >> >> Run R under gdb using >> >> gdb Rgui >> >> Load your DLL. >> >> Break to gdb using the menu entry "Misc | Break to debugger". >> >> Set a breakpoint, e.g. >> >> b main.f:3 >> >> to set it on line 3. Then use c to let R continue, and make a call to >> your code. Then the usual gdb commands will work after it breaks. >> >> Duncan Murdoch >> >> >> >> ------------------------------ >> >> _______________________________________________ >> R-devel@r-project.org mailing list DIGESTED >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >> >> End of R-devel Digest, Vol 139, Issue 15 >> **************************************** > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel