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

interplay of -fpp, -save-temps and gdb across the latest ifort versions

Michael_F_4
Beginner
1,022 Views

Hello,

I do most Fortran development mostly on Linux but previously still relied on Visual Studio for debugging.
While trying to get familiar with debugging using gdb on Linux I came across some technical issues which I would like to get confirmed.
See short version at the end of this post.

Long version:
Our production code uses a lot of pre-processor statements for conditional compilation.
Thus it is fed through the pre-processor using command line option "-fpp".
We are currently using ifort14 (XE 2013 SP1 Update4) for our releases.

I also reproduced my issues using a small demo test case, which only uses the following compilation line
 

ifort -fpp -D_TEST -O0 -g -o main main.f90

When trying to debug this using gdb (either gdb 7.10 or the Intel variant gdb-ia with versions 7.8-8.0.33 or 7.8-16.0.458) I could not get a proper listing for the source code.
I got error like the following one:

Breakpoint 1, 0x0000000000402d44 in main ()
(gdb) list
1       /tmp/ifortuB6RH0.i90: No such file or directory.
(gdb)

Thus it is obviously referencing one of the intermediate files generated by the pre-processor.
By default these get discarded.
When I use the additional compiler option "-save-temps" they are kept and I can get a proper source listing in gdb.
Unfortunately this is based on the pre-processed file (not on the original one containing the pre-processor statements) and this is not always desirable.

I noticed this behaviour with both ifort14 and ifort15.


Then I tried the latest compiler ifort16 (XE 2016 InitialRelease).
And to my surprise, it correctly could display the original source file in gdb without using "-save-temps".
Unfortunately it took me some hours to get to that point - but it seems that migrating our production system to ifort16 might solve my issues.

I know that using the latest and greatest versions often is desirable. But normally we don't immediately migrate to the newest versions as long as there has not been one or two bug fix releases. Thus before doing all necessary changes on our side, I would like to now if it is really desirable due to major improvements in ifort16 in interplay with gdb.

 


TL;DR:
What I would like to get clarified:
- when using ifort14 and ifort15: is it really necessary to use "-save-temps" when using "-fpp" for proper debugging in GDB?
- has the debug format in ifort16 really changed in some way that improves the ways pre-processed files references are stored in the debug section?


Thanks very much in advance for your answer.


Regards,
Michael

0 Kudos
3 Replies
Kevin_D_Intel
Employee
1,022 Views

Just FYI, the Debug Solution improvements (which is more about what’s improved in the debuggers, FEE, etc.) are discussed here, https://software.intel.com/en-us/articles/intel-parallel-studio-xe-2016-composer-edition-fortran-debug-solutions-release-notes.

From your experience, whatever changed in your case does sound specific to the compiler; however, I’m not aware of specific changes/features in either pre-processing or debug emissions with any advertised improvement with debugging. Perhaps some bug fix content in the newer release in related areas is leading to the change in behavior. The PSXE 2016 release added DWARF Fission Support (e.g. -gsplit-dwarf) but that is not enabled by default.

To my knowledge, nothing has been suggested as having changed any behavior/requirement related to -save-temps and what it provides in terms of preserving temporary files and aiding debugging; however, my experience with that was an aid in debugging is on OS X* not Linux.

I will make some inquires to see what additional information I might be able to find related to your questions/experience.

0 Kudos
Michael_F_4
Beginner
1,022 Views

Thanks for your reply.

I had found that information about Debug Solution improvements before - but I could not find anything mentioned there about what I encountered

I'll attach here my small demo case.
These are the compiler versions that I currently have available here:

  • 2013_sp1.4.211 (ifort14)
  • 2015.2.164 (ifort15)
  • 2016.1.0.424694 (ifort16)

The steps I do on the command line are:

  1. make
  2. gdb-ia main

in gdb:

  1. break main
  2. run
  3. list

As I mentioned before, listing the source code works in ifort14 and ifort15 only with the `-save-temps` options and it then of course only shows the already pre-processed intermediate file.

I'll might also try the latest versions of ifort14 and ifort15 tomorrow and look how they behave.
But I think I should really hurry up to migrate and compile our production code with ifort16.

Regards,
Michael

0 Kudos
Michael_F_4
Beginner
1,022 Views

ok - I have done some further testing with the latest ifort14 & ifort15 compilers.

  • 2013_sp1.5.212 shows the same behaviour (that '-save-temps' seems to be necessary)
  • in 2015.5.223 it seems already to be fixed/changed and it has the desirable behaviour

Seems to be something, that got fixed during this year.

Regards,
Michael

0 Kudos
Reply