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

GDB does not step into subroutine (ifx)

Cook__Gordon
Beginner
347 Views

When debugging application compiled with ifx, GDB steps over subroutine calls when issued a "step" command. If the code is compiled with ifort, GDB correctly steps into subroutine calls.

ifx:

$ ifx --version
ifx (IFORT) 2022.1.0 20220316
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.

$ ifx -g -O0 -c hello.f90 -o hello.o
$ ifx -g -O0 test.f90 -o test hello.o
$ gdb -ex 'break 2' -ex 'run' -ex 'step' ./test
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-16.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...done.
Breakpoint 1 at 0x403cd2: file test.f90, line 2.
Starting program: /home/kenche03/code/test 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, test () at test.f90:2
2       call print_hello
 hello from subroutine
3       print *,"finished test"

ifort:

$ ifort --version
ifort (IFORT) 2021.6.0 20220226
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

$ ifort -g -O0 -c hello.f90 -o hello.o
$ ifort -g -O0 test.f90 -o test hello.o
$ gdb -ex 'break 2' -ex 'run' -ex 'step' ./test
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-16.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...done.
Breakpoint 1 at 0x402d99: file test.f90, line 2.
Starting program: /home/kenche03/code/test 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, test () at test.f90:2
2       call print_hello
print_hello () at hello.f90:2
2       print *,"hello from subroutine"

It's possible to eventually step into the subroutine with code compiled with ifx, e.g. with multiple "stepi" or "set step-mode on", but ideally a single "step" command would do it.

 

Source code:

$ cat test.f90 
program test
call print_hello
print *,"finished test"
end program test
$ cat hello.f90 
subroutine print_hello
print *,"hello from subroutine"
end subroutine print_hello

 

Labels (1)
0 Kudos
0 Replies
Reply