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

Reply
 
Search this Thread
Old 03-22-2007, 07:25 AM   #1
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Rep: Reputation: 15
Any way to jump to program crash point?


Hi.

When I run an executable I have I am getting a segmentation fault - code itself (fortran 90) compiles fine with intel fortran compiler...

I am trying out various things to fix this segmentation fault, but thing is I have to wait about 90 minutes each time I change something to see if fault is still there (which it invariably is!), as this is when the crash occurs...

Also I cannot run multiple versions at the same time as ~ 1Gb is required to run the code at all...

So as a question is there any known general way to get around this waiting?

thanks
 
Old 03-22-2007, 10:29 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
I think the answer to the actual question is "No, there is nothing you can do."

But there's more to this. I've had stuff like this happen, and rather than "trying out various things" to see if the problem goes away, it's usually best to understand the underlying problem thoroughly.

To do this, copy to one side the current version of what you're running. Then do a split-the-difference sort of simplification.

The first step is to rip out half of the program and throw it away. Run what's left and see if you still get the problem.

If you do, then rip out half of what remains.

If the problem went away, take the original program and either rip out just a quarter of it, or find another way to rip it in half (some other code that comprises half of the source), and rerun it.

Keep going until you have the simplest possible program which reproduces the bug. It will be much easier to find the problem.

It sounds tedious. But:
  1. Simplifying the program until you understand the problem is likely to take maybe a week or two, rather than months (if not forever).
  2. Even if you did "try out various things" and found something that caused the symptom to go away, but you don't know exactly why, it's very likely that the underlying problem is still there, and is manifesting itself elsehow, including the possibility of outputting results that look reasonable but are wrong.

In your case, perhaps the best half to remove first is the half which, when removed, causes your execution time to drop dramatically, so you don't spend so much time waiting for a test to complete. (grin)

Hope this helps.

Last edited by wjevans_7d1@yahoo.co; 03-22-2007 at 10:30 AM.
 
Old 03-22-2007, 10:51 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
do you get a core dump?

can you use gdb?

with a core dump you can read where the dump occured.
 
Old 03-22-2007, 10:57 AM   #4
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Original Poster
Rep: Reputation: 15
learning how to use gdb at the minute...very basic commands though.

Do I need to produce a core dump? Can gdb obtain more info from the core dump than it can form just passing it the executable?

I don't know alot about this stuff!
 
Old 03-22-2007, 11:00 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
yeah, I can't remember exactly but
something like
gdb executable corefile

then type where (i think)
and it takes you directly to where the crash occurred.
easy-peasie lemon squeezy.

try using ddd which is a lovely graphical interface to gdb.
really nice.

Last edited by bigearsbilly; 03-22-2007 at 11:02 AM.
 
Old 03-22-2007, 11:03 AM   #6
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Original Poster
Rep: Reputation: 15
Thanks Billy.

Will give it a shot
 
Old 03-27-2007, 06:32 AM   #7
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Original Poster
Rep: Reputation: 15
intel debugger (idb) has a facility that allows you to take a 'snapshot' of the process at a chosen place...then if you accidentally move the process forward beyond where the crash occurs, you can revert to the position of the 'snapshot', and debug further...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Any program to setup laptop as access point ?? wahaha Linux - Wireless Networking 5 03-11-2007 08:23 PM
Can anyone point me to a good All in one IM program? BlackDogg Linux - Software 13 02-16-2006 03:21 PM
This causes my program to crash/hang in C... Scrag Programming 1 12-18-2004 04:53 PM
How could a program crash between 2 printf() 's? paul76 Programming 12 09-11-2003 12:17 PM
why/where to point in C program chens_83 Programming 5 01-30-2003 01:50 PM


All times are GMT -5. The time now is 11:18 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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration