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 04-25-2007, 12:28 PM   #1
ashlesha
Member
 
Registered: May 2005
Location: PA
Distribution: Ubuntu
Posts: 204

Rep: Reputation: 30
Aborted (core dumped)


Hi,

I m running a program where I m assigning values to an array which i have statically declared to be 126976 bytes long. I get a core dump which I have pasted below :- I looked at the output of the readelf -a for my executable -- but couldnt debug much --

can someone suggest how i should go about debugging this error?
Thanks,
Ashlesha.

Quote:
*** glibc detected *** ./server.o: double free or corruption (top): 0x08089008 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7d968bd]
/lib/tls/i686/cmov/libc.so.6(__libc_free+0x84)[0xb7d96a44]
/lib/tls/i686/cmov/libc.so.6(fclose+0x14d)[0xb7d85dbd]
./server.o[0x8048acd]
./server.o[0x80488cc]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xdc)[0xb7d458cc]
./server.o[0x8048791]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:07 163672 /home/ashlesha/researchday/udp/server.o
0804a000-0804b000 rw-p 00001000 08:07 163672 /home/ashlesha/researchday/udp/server.o
0804b000-080aa000 rw-p 0804b000 00:00 0 [heap]
b7b00000-b7b21000 rw-p b7b00000 00:00 0
b7b21000-b7c00000 ---p b7b21000 00:00 0
b7cf1000-b7cf2000 rw-p b7cf1000 00:00 0
b7cf2000-b7d01000 r-xp 00000000 08:07 422745 /lib/tls/i686/cmov/libpthread-2.4.so
b7d01000-b7d03000 rw-p 0000f000 08:07 422745 /lib/tls/i686/cmov/libpthread-2.4.so
b7d03000-b7d05000 rw-p b7d03000 00:00 0
b7d05000-b7d07000 r-xp 00000000 08:07 422734 /lib/tls/i686/cmov/libdl-2.4.so
b7d07000-b7d09000 rw-p 00001000 08:07 422734 /lib/tls/i686/cmov/libdl-2.4.so
b7d09000-b7d0a000 rw-p b7d09000 00:00 0
b7d0a000-b7d2e000 r-xp 00000000 08:07 422735 /lib/tls/i686/cmov/libm-2.4.so
b7d2e000-b7d30000 rw-p 00023000 08:07 422735 /lib/tls/i686/cmov/libm-2.4.so
b7d30000-b7e5d000 r-xp 00000000 08:07 422731 /lib/tls/i686/cmov/libc-2.4.so
b7e5d000-b7e5f000 r--p 0012c000 08:07 422731 /lib/tls/i686/cmov/libc-2.4.so
b7e5f000-b7e61000 rw-p 0012e000 08:07 422731 /lib/tls/i686/cmov/libc-2.4.so
b7e61000-b7e64000 rw-p b7e61000 00:00 0
b7e64000-b7f17000 r-xp 00000000 08:07 293925 /usr/lib/libasound.so.2.0.0
b7f17000-b7f1c000 rw-p 000b2000 08:07 293925 /usr/lib/libasound.so.2.0.0
b7f21000-b7f2b000 r-xp 00000000 08:07 390211 /lib/libgcc_s.so.1
b7f2b000-b7f2c000 rw-p 00009000 08:07 390211 /lib/libgcc_s.so.1
b7f2c000-b7f31000 rw-p b7f2c000 00:00 0
b7f31000-b7f4a000 r-xp 00000000 08:07 390148 /lib/ld-2.4.so
b7f4a000-b7f4c000 rw-p 00018000 08:07 390148 /lib/ld-2.4.so
bfc8b000-bfca0000 rw-p bfc8b000 00:00 0 [stack]
ffffe000-fffff000 ---p 00000000 00:00 0 [vdso]
Aborted (core dumped)
 
Old 04-25-2007, 01:01 PM   #2
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
if your program was compiled with the gcc -g switch
then you can do gdb -c core prog_name to view the core file and see which lines of code caused the problem
 
Old 10-25-2007, 09:27 AM   #3
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 132

Rep: Reputation: 15
Aborted: core-dumped

Quote:
Originally Posted by slzckboy View Post
if your program was compiled with the gcc -g switch
then you can do gdb -c core prog_name to view the core file and see which lines of code caused the problem
Hello,


I think you are freeing twice (exactly you might allocated a memory and freed some where in the code after freed pointer again you are using free to that pointer) the same pointer variable.

Ok, to re-solve this issue if you are using C shell use the following command to fix this.

setenv MALLOC_CHECK 0

Or if you use Bash Shell

export MALLOC_CHECK=0

now run you executable, i hope it will work.

Thanks,
Dayalan
 
Old 11-05-2007, 01:09 PM   #4
orgcandman
Member
 
Registered: May 2002
Location: new hampshire
Distribution: Fedora, RHEL
Posts: 600

Rep: Reputation: 110Reputation: 110
Quote:
Originally Posted by dayalan_cse View Post
Hello,


I think you are freeing twice (exactly you might allocated a memory and freed some where in the code after freed pointer again you are using free to that pointer) the same pointer variable.

Ok, to re-solve this issue if you are using C shell use the following command to fix this.

setenv MALLOC_CHECK 0

Or if you use Bash Shell

export MALLOC_CHECK=0

now run you executable, i hope it will work.

Thanks,
Dayalan
This does not solve the issue. It just hides it. In general, it's better to catch double free's with a segv, and fix the problem, rather than accepting a double-free.

-Aaron
 
  


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
cpio Signal 31 - core dumped GraemeK Linux - Software 0 12-07-2005 06:06 AM
Segmentation fault (core dumped) eytan *BSD 3 04-27-2005 08:38 PM
urpmi - core dumped ashamril Mandriva 0 02-26-2004 08:41 PM
Segmentation fault (core dumped) hasanaydin Linux - General 0 03-27-2002 07:47 AM
Core Dumped Nezar Linux - General 4 07-18-2001 02:29 AM

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

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