[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GDB
From: |
Peter Willis |
Subject: |
Re: GDB |
Date: |
Sun, 7 Feb 2016 10:49:23 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
Hello Christian,
ddd is the debugging program. You are running ddd to open your
executable file and step through it. ddd is a graphical user interface
front end for gdb debugger. ddd is just passing control messages to
gdb and reading back the responses and displaying those in a window (or
two).
Start up of ddd can be done via the command line.
ie:
ddd <PROGRAM_FILE_PATH_AND_NAME_TO_DEBUG>
EXAMPLE:
ddd C:\my_files\my_program_to_debug.exe
You may need to double up back slashes (? I cant know it all....):
C:\\my_files\\my_program_to_debug.exe
The all assumes that you have compiled you application with the 'debug'
flag set :
gfortran -O0 -Og .......
ie: zero optimizations (-O0) and debugging on (-Og)
Once you have ddd running, you will notice it has a console where you
can type commands.
The '?' command will provide help.
To set a breakpoint enter :
break <FILE_NAME>:<LINE_NUMBER>
EXAMPLE:
break my_fortran.f77:123
this will make a breakpoint at line 123 in file 'my_fortran.f77' (if it
is ever run).
Hope that helps.
P
On 02/07/2016 03:12 AM, Christian Brembilla wrote:
Dear all,
I am really new in Fortran and GDB. So sorry if I am asking you some
silly questions but I am stuck.
I want to explain to you every steps so there won´t be misleading.
I am running my program in F77 (Path=\F\G77\bin and library path=
\F\g77\lib slatec)
I have also download GNU but I used G77 since I found some practical
examples on the net.
I am using the prompt from *windows.*
I believe that it can be useful a debugger with breakpoints so I can
understand
where I am doing mistakes.
I download the GDB version gdb-7.10.1 but unfortunately I cannot understand
how can work. I mean in operative way. I looked at the pdf file
/gdb.pdf/ at the paragraph:
/Getting In and Out of GDB./
Unfortunately when I am typing gdb at the prompt I got the
/Gdb is not recognized as an internal or external command/
Do I have to type some path? Which one?
Could you please provide me a practical example?
For instance, I can explain you what I am doing with Fortran in this way
there are no doubts or
misleading.
1.I made a program as the program below:
/File panel.for/
program panel
implicit none
real tin, Qn, tex
read*, n, e, dt, Tmax
do i = 2, Tmax
do j = 1, e
if (j .GT. 1) then
tsu =tex(i,j-1)
end if …
… end do
end do
2.I compiled the program in the prompt by typing
C:\F\Panel>f2exe panel
C:\F\Panel> panel
From here my program start correctly by asking me some values.
But when it solves the nested loop I got some odd values -1IND
A debugger may be useful to understand what is going on.
Best regards,
Christian
- GDB, Christian Brembilla, 2016/02/07