LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Tags used in this thread
Popular LQ Tags

Reply
 
Thread Tools
Old 03-20-2007, 12:34 PM   #1
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 109
Thanked: 0
how to force a core-dump...segmentation fault


[Log in to get rid of this advertisement]
Hi.

Running Suse 10.1 on an x86_64 machine.

I'm getting a segmentation fault when I run a fortran 90 executable. The fortran code itself compiles fine - I'm using the intel fortran compiler: ifort (IFORT) 9.0 20051201

I have absolutely no idea where this segmentation fault is happening and it's driving me nuts! I've read that I can somehow force a core-dump and then use a debugger to maybe find the problem...neither of which I've ever done.

Would be grateful if anyone could point me in the right direction here - how to force a core-dump...how a debugger works...and if anyone actually thinks that this is an anyway viable course of action...could it work???

Thanks.
johnpaulodonnell is offline     Reply With Quote
Old 03-20-2007, 02:19 PM   #2
asgeirss
Member
 
Registered: Aug 2003
Location: Vancouver, Canada
Distribution: RH, SL
Posts: 37
Thanked: 0
Hi, most linux systems the core dump is default behaviour unless your core file is exceeding the maximum size allowed by the shell. Try doing the following before running the program:

ulimit -c

if it returns 0, or a small number of bytes, then type in the following:

ulimit -c unlimited

this will allow the creation of a core file of unlimited size (in the directory from which you ran the program.

Now, in order to use the debugger properly, you might have to recompile your program with any optimization turned off, and debugging turned on. But you could try it right away without recompiling and see if the debugger finds the necessary symbols in your program.

The easiest way is to run the program from scratch, within the debugger. gdb is default on most linux systems. Just run "gdb myprogram" after a few seconds you will arrive at the gdb prompt, and type "run" , wait until the program crashes, and type "where" it will attempt to give you a trace of the code, showing which subroutines you are in, and hopefully line numbers as well.

If this process doesn't work, look at the compiler man page or help options to see how to turn off optimization and turn on debugging, recompile and try again...

Good luck!
asgeirss is offline     Reply With Quote
Old 10-23-2008, 07:05 AM   #3
chiaretta
LQ Newbie
 
Registered: Oct 2006
Posts: 2
Thanked: 0
Can't get a core dump

Dear all,
I'm writing a mixed C and Fortran90 code, using intel compilers on OpenSuse 10.3 :
ifort (IFORT) 10.1 20080112
icc (ICC) 10.1 20080801

I'm compiling with debugging flags in both cases,
ifort -O0 -g -traceback -check bounds
the same for icc, and using ifort for linking.

Running my code I get a segmentation fault, but core is not dumped even if I set
ulimit -c unlimited.

Any clue?

Thanks in advance for your help,
Chiara
chiaretta is offline  
Tag This Post
Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
segmentation fault (core dumped) - what??? Micro420 Programming 6 12-07-2006 02:03 AM
Segmentation fault (core dumped) eytan *BSD 3 04-27-2005 09:38 PM
Segmentation Fault (core dumped) newuser455 Linux - Software 3 08-28-2004 03:39 PM
Segmentation fault (core dumped) plisken Linux - General 8 09-17-2003 04:32 AM
Segmentation fault (core dumped) hasanaydin Linux - General 0 03-27-2002 08:47 AM


All times are GMT -5. The time now is 12:19 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration