Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

idb debugger

harbers_a
Beginner
396 Views
Hi,
A very simple question:
How do I get the debugger to stop at the line where the error occurred.
Example program is:
program tmp
integer arr(5)
do i = 1,10
arr(i) = i
print *,arr(i)
enddo
end
In the debugger it should stop at line 4 and tell me that the array is out of bounds.
Compilation:
ifort -g -debug extended -debug-parameters all tmp.f90
Run:
idb a.out
Linux Application Debugger for Intel EM64T-based applications, Version 9.0-12, Build 20050729
------------------
object file name: a.out
Reading symbolic information from /nrs/home/aha/a.out...done
(idb) r
1
2
3
4
5
6
7
8
9
10
Process has exited with status 0
(idb)
What do I do wrong?
Thank you very much,
Arnold
0 Kudos
4 Replies
TimP
Honored Contributor III
396 Views
If you want bounds checking, it is good to have debug, but you need also the -CB option, or equivalent.
0 Kudos
harbers_a
Beginner
396 Views

Compiling with -C option gives:

Reading symbolic information from /nrs/home/aha/a.out...done
(idb) r
1
2
3
4
5
forrtl: severe (408): fort: (2): Subscript #1 of the array ARR has value 6 which is greater than the upper bound of 5

Process has exited with status 152

It is a little bit better, but still the process exits and my expectation was that it would stop at line 5. I want to be able to check the values of certain variables and I can not do that when the process exits.

I am used to the Tru64 ladebug debugger. Output would be:

object file name: a.out
Reading symbolic information ...done
(ladebug) l
4 arr(i) = i
5 print *,arr(i)
6 enddo
7 end
8
(ladebug) r
1
2
3
4
5
Thread received signal TRAP
stopped at [subroutine main$tmp():4 0x120001b3c]
4 arr(i) = i
(ladebug) print i
6
(ladebug) print arr(i)
Bounds error for dimension 1
Subscript 6 is outside the bounds (1:5)

How do I get idb to do the same?

Arnold

0 Kudos
harbers_a
Beginner
396 Views

Everyone,

Intel compiler support's response:

"The Fortran run-time intercepts exceptions. It will provide more information if you compile with -traceback. It doesn't yet pass control to IDB before process exit. We've made a proposal for it to do this and waiting to get that approved for 10.0."

Thought I'd share it with you.

Just hope that 10.0 is released soon.

Arnold

0 Kudos
Keith_R_
Novice
396 Views
There is quite a straightforward way to do this.
Just set a breakpoint in the Intel RTL routine
which prints the message.

stop in for_emit_diagnostic

If you have compiled with -CB the debugger will take control
after detection of the error but before the program is
terminated, so you may examine your variables.

Keith
0 Kudos
Reply