LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-10-2010, 09:43 PM   #1
liunxlq
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Rep: Reputation: -1
Unhappy How to produce a ill legal fault?


hello,
i encounter a problem with my program recently, i get the core dump of my
program, and it produced by a segill signal, i wondered that how my program can happen to generate this error, and i never write a "0 divide"
code, i have no ideas, help me please!
 
Old 10-11-2010, 01:59 AM   #2
murugesan
Member
 
Registered: May 2003
Location: Bangalore ,Karnataka, India, Asia, Earth, Solar system, milky way galaxy, black hole
Distribution: murugesan openssl
Posts: 181

Rep: Reputation: 29
It requires the following:
Code:
ulimit -c unlimited
a.out
gdb -q coreFileName
where
frame LineNumber
print variableName

http://www.geocities.ws/murugesan/te...reExample.html

Last edited by murugesan; 10-11-2010 at 02:01 AM. Reason: for mentioning the commands using code
 
1 members found this post helpful.
Old 10-11-2010, 06:52 AM   #3
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Quote:
Originally Posted by liunxlq View Post
it produced by a segill signal, i wondered that how my program can happen to generate this error, and i never write a "0 divide"
The SIGILL is caused by the execution of an illegal instruction, which is not the same as a divide by zero error.

Typically this is caused by a stack corruption (eg writing off the end of an array that is a local variable) which corrupts the return address. There are other ways it can happen too (eg a function pointer that is not initialized).
 
1 members found this post helpful.
Old 10-14-2010, 03:29 AM   #4
liunxlq
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: -1
Thanks very much!
 
Old 10-14-2010, 07:17 AM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
In the RAM, there is nothing that says whether a byte is an instruction or data. The CPU simply executes them one after another, jumping to a different location if that's what that certain byte happened to mean.

What happened is that you CPU tried to execute a byte that wasn't assigned any instruction hard-wired into the CPU.
 
  


Reply



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
"Legal" or "ILL-Eagle?" BuckNekkid General 14 07-27-2007 07:51 PM
Just a yes or no and ill leave you all alone :) Mistro116@yahoo.com Programming 4 11-07-2005 09:44 AM
My Qt App Produce A Segmentation Fault andresbm3 Programming 1 01-16-2004 10:41 AM
i feel ill AngelLucifer Linux - General 2 11-08-2003 09:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:22 AM.

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