PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

getting a backtrace on crash (signal)

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
ephq



Joined: 09 Feb 2005
Posts: 12

PostPosted: Tue Mar 10, 2009 1:19 pm    Post subject: getting a backtrace on crash (signal) Reply with quote

Hey,

I have a very large program (~1k subroutines) that is mostly fortran, compiled with pgf77, and some c, compiled with gcc. The main subroutine is in c (in main.c) and it calls the initial fortran subroutine that then does all the work.

In the main.c file, I also use feenableexcept to turn on floating point exceptions, and install a signal handler to catch sigsegv & sigpfe. The handler then uses glibc's backtrace() function to get a backtrace of the crash location. I tested this (backtrace stuff) using pure c, and a c/fortran setup using gfortran/gcc, and both produced a backtrace. When I try (with simple test code) with pgf77/gcc, the backtrace doesn't return any info except the address for the signal handler.

Is there a way to get this information? Do I have to have a certain compiler flag? I'm compiling with:
c file:
gcc -g -c file.c
f file:
pgf77 -g -c file.f

and I'm linking with:
pgf77 -g -lm -Mnomain *.o


Also, is there a library I can include to link with gcc? For gfortran I can just link with -lgfortran.

Thanks
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6218
Location: The Portland Group Inc.

PostPosted: Tue Mar 10, 2009 2:28 pm    Post subject: Reply with quote

Hi ephq,

We added back tracing by default to version 7.1 and later (see the flag "-Mtraceback") so your code most likely is compiled with traceback already. To see this information, you need to set the environment variable "PGI_TERM" to "debug", "trace", "signal", or "abort". "trace" will give a backtrace while "debug" will launch the PGI debugger.

Please see the PGI User's Guide for mode details.

Hope this helps,
Mat
Back to top
View user's profile
ephq



Joined: 09 Feb 2005
Posts: 12

PostPosted: Tue Mar 10, 2009 2:37 pm    Post subject: Reply with quote

Ahh nice, unfortunately it looks like the cluster I am using only has 7.0.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group