LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Aborted (core dumped) (https://www.linuxquestions.org/questions/programming-9/aborted-core-dumped-548926/)

ashlesha 04-25-2007 12:28 PM

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)

slzckboy 04-25-2007 01:01 PM

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

dayalan_cse 10-25-2007 09:27 AM

Aborted: core-dumped
 
Quote:

Originally Posted by slzckboy (Post 2725018)
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

orgcandman 11-05-2007 01:09 PM

Quote:

Originally Posted by dayalan_cse (Post 2936418)
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


All times are GMT -5. The time now is 08:54 AM.