LinuxQuestions.org
Review your favorite Linux distribution.
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 05-16-2008, 06:42 AM   #1
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 132

Rep: Reputation: 15
core dump on linux with err variable


hello,

I declared variable called err as int variable. there is function called fun_calculate which returns the status to err variable, when the return type value has being written in err variable it core dumps.

Can any one help me to understand why this core dump if i write value in to err variable?

Is it related with variable name collision?

Please let me know.

Thank you in advance.

Thanks,
Deenadayalan
 
Old 05-16-2008, 07:10 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I think we need to see some code.
 
Old 05-25-2008, 12:58 AM   #3
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 132

Original Poster
Rep: Reputation: 15
core dump on linux with err variable

Quote:
Originally Posted by Nylex View Post
I think we need to see some code.
Hi All,

the core dump is because of my code has global variable called err and the other hand err is function defined in err.h in gcc, it seems that when linker links all the .o files it picks up err definition from the libc.so.6 file instead of from my code (definition err variable) so it causes the core dump when there is write in err global variable (err=2).

here is the log from LD_DEBUG.

main_ml.so to /lib/tls/libc.so.6: normal symbol `err'

Thanks & Regards
Deenadayalan
 
Old 06-01-2008, 12:30 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I haven't a clue about this, I'm afraid. Hopefully someone else will see your thread.
 
Old 06-01-2008, 05:49 AM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
well, try to rename your global variable 'err' to see what happens then. If the problem persists, please post code.
 
Old 06-03-2008, 07:09 AM   #6
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 132

Original Poster
Rep: Reputation: 15
core dump on linux with err variable

Quote:
Originally Posted by Hko View Post
well, try to rename your global variable 'err' to see what happens then. If the problem persists, please post code.
Hi,

If i change my variable name from err to some other name for example myerr then it is not crashing because there is no clash between user code (executable) and with libc.so.6.

the crash is mainly because of err variabel if i change the variable name then there is no core dump.

Thanks,
Deenadayalan
 
  


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
Core Dump on Solaris (Question about core file) dayalan_cse Solaris / OpenSolaris 5 12-29-2014 07:56 AM
Dual system boot err: rootnoverify(hd1,0),but the hd0 err msg existed befor shut down lilipeng24 Linux - General 3 06-25-2005 12:10 PM
Produce core dump in linux 2.6 nirendra Linux - General 0 05-31-2004 12:55 AM
Core Dump MrPotatoHead AIX 3 01-14-2004 09:42 AM
core dump lacrimae Linux - General 3 02-19-2002 01:43 PM

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

All times are GMT -5. The time now is 03:05 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