From 3450d4db0dc78e83652fe0dfd32ff7a37a005eeb Mon Sep 17 00:00:00 2001 From: Toon Moene Date: Sat, 9 Feb 2002 10:27:11 +0100 Subject: [PATCH] invoke.texi: Add a short debugging session as an example to the documentation of -g. 2002-02-09 Toon Moene * invoke.texi: Add a short debugging session as an example to the documentation of -g. From-SVN: r49636 --- gcc/f/ChangeLog | 5 +++++ gcc/f/invoke.texi | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index a2214e54c44..dfa656d5bd4 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,8 @@ +2002-02-09 Toon Moene + + * invoke.texi: Add a short debugging session + as an example to the documentation of -g. + 2002-02-06 Toon Moene PR fortran/4730 fortran/5473 diff --git a/gcc/f/invoke.texi b/gcc/f/invoke.texi index ff2de1a1c9c..896064b4919 100644 --- a/gcc/f/invoke.texi +++ b/gcc/f/invoke.texi @@ -1,11 +1,11 @@ -@c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +@c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 @c Free Software Foundation, Inc. @c This is part of the G77 manual. @c For copying conditions, see the file g77.texi. @ignore @c man begin COPYRIGHT -Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001 +Copyright @copyright{} 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -1398,6 +1398,37 @@ either your program or @command{g77} Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging information. + +A sample debugging session looks like this (note the use of the breakpoint): +@smallexample +$ cat gdb.f + PROGRAM PROG + DIMENSION A(10) + DATA A /1.,2.,3.,4.,5.,6.,7.,8.,9.,10./ + A(5) = 4. + PRINT*,A + END +$ g77 -g -O gdb.f +$ gdb a.out +... +(gdb) break MAIN__ +Breakpoint 1 at 0x8048e96: file gdb.f, line 4. +(gdb) run +Starting program: /home/toon/g77-bugs/./a.out +Breakpoint 1, MAIN__ () at gdb.f:4 +4 A(5) = 4. +Current language: auto; currently fortran +(gdb) print a(5) +$1 = 5 +(gdb) step +5 PRINT*,A +(gdb) print a(5) +$2 = 4 +... +@end smallexample +One could also add the setting of the breakpoint and the first run command +to the file @file{.gdbinit} in the current directory, to simplify the debugging +session. @end table @xref{Debugging Options,,Options for Debugging Your Program or GCC, -- 2.30.2