Solved

Why there is no core file when a Segmentation fault occured!

Posted on 2001-09-09
5
470 Views
Last Modified: 2012-08-14
I have a program, i can debug with the core file  when a segmenttation fault occured, but how can i debug when there is no core file?
0
Comment
Question by:sandy_wu
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:BlackDiamond
ID: 6472524
If you're using gdb, you can step through the program line by line to see where it bombs.  You can also use breakpoints if it is a large app (to narrow down the location).  

Also, a good practice is to write wrappers around anything that deals with memory (malloc, calloc, realloc, etc.) that do error checking and give useful errors.

If your wrappers don't catch the errors, then you can narrow it down to pointer math errors.  Then use a debugger (or print statements if you have to) to pinpoint the location in your app.
0
 

Author Comment

by:sandy_wu
ID: 6473086
Thank U BlackDiamond, but what I mean is Why there is no core file when a Segmentation fault occured? and sometime it has!
0
 
LVL 5

Accepted Solution

by:
BlackDiamond earned 50 total points
ID: 6475105
Sorry, I didn't look at the question in the header.  It is probably because the core file generated would be larger than your ulimit.  Try the command "ulimit -c unlimited", and see if it generates the cores consistently.

Also, another useful program for debugging is "strace".
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6475917
use following syntax:

bash% ulimit -c unlimited
 ksh% ulimit -c unlimited
  sh% ulimit -c unlimited
tcsh% limit coredumpsize unlimited
 csh% limit coredumpsize unlimited
keep in mind that this may produce huge core files, which also may take sevaral minutes to complete
0
 

Author Comment

by:sandy_wu
ID: 6475955
Thank U BlackDiamond, and thank U ahoffmann, both of U are right, and ahoffmann is more detail.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
File system unmounted 3 155
„dd“ vs „ddrescue“ 28 214
Unix / Linux grid computing 5 148
Shell script for mvn build 2 69
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now