LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-07-2017, 09:20 PM   #1
Jayshankar2017
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
coredump not being generated


Hi,

I have written a snippet of code to generate core dump.

a.c
#include <stdio.h>
main()
{
char **c;
c=10;


}

gcc a.c -o a -g

Run:./a

In fedora 25 after segmentation fault, core dump file is not being created.

ulimit -c unlimited is already set
 
Old 06-08-2017, 12:32 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,317
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
I'd run that under the debugger. I'd also declare that differently, for instance as I have done in my blog about this subject, here. I instead have code showing:
Code:
int main(int argc, char **argv)
{
    int *bad_addr = NULL;  // Address is set to NULL or 0x00000000

    *bad_addr = 12345; // Assigning data to a bad address is a segment violation, note that this is Line 8 of the source file

    return 0;
}
This definitely will cause a segmentation fault due to the attempt to modify address 0x00000000.

The other question I have is do you literally see a report to the terminal of segmentation fault, because I exactly do see this in my case:
Code:
ulimit -c unlimited
./segv
Segmentation fault (core dumped)
If you do not see the report text citing "Segmentation fault" then one is not occurring and probably because the random data stored in the address of that double pointer may represent a valid memory location.

If you do see the report citing "Segmentation Fault", then I have no answer. It absolutely should work, provided you've entered the ulimit in the terminal you are using and have verified that it is correctly accepted.
 
Old 06-09-2017, 12:33 AM   #3
Jayshankar2017
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
core dump not generated in fedora 25. Its generated in other version

#include<stdio.h>
int main()
{
char **a;

printf(" jjgooo \n");
**a = 10;
printf(" %c \n",**a);

return 1;

}

Compilation: gcc a.c -o a -g
Output:
jjgooo
Segmentation fault (core dumped)
The core file is not being created in fedora 25. I appreciate your reply.
 
Old 06-09-2017, 07:44 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,317
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
Recommend you use [code][/code] tags around your code in the future so that it is readable.

As far as the report that a core file has been created, but one did not get created, there are a few possibilities which come to mine:
  1. Are you running in a directory where you don't have write privileges?
  2. How much disk space is left available on this machine?
  3. How much RAM is available on this machine?
Those are some of the reasons why a core file might not be created, i.e. you don't have space or resources available to create a core file, or you don't have permissions in the particular directory where you are currently residing when you run this intentional bad test.
 
Old 06-09-2017, 08:29 AM   #5
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by Jayshankar2017 View Post
The core file is not being created in fedora 25. I appreciate your reply.
Are you looking in the right place?

From here: https://www.freedesktop.org/software...-coredump.html
Quote:
By default, systemd-coredump will log the core dump including a backtrace if possible to the journal and store the core dump itself in an external file in /var/lib/systemd/coredump
 
  


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
analyze coredump joemon83 Linux - Server 2 06-25-2015 11:28 PM
128 bits key generated when 1024 was generated(centos 6.5)using openssl SarahGurung Linux - Security 3 07-29-2014 07:03 AM
coredump files rupendranaidu Linux - Software 1 09-20-2009 10:40 AM
about coredump swift2008 Programming 2 01-07-2009 06:57 AM
coredump in free on solaris dayalan_cse Solaris / OpenSolaris 17 11-25-2007 08:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:00 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration