Solved

Core dump when calling a library

Posted on 2006-06-26
3
570 Views
Last Modified: 2012-06-27
Hello,

I keep getting a core dump when running a C++ application on Linux. Here is part of the result upon checking the core file:

gdb someapp core.1234
GNU gdb 6.0-2mdk (Mandrake Linux)
.....
Core was generated by `/home/someone/someapp'.
Program terminated with signal 11, Segmentation fault.
......
(gdb) bt
#0  0x40bfeee1 in posix_memalign () from /lib/tls/libc.so.6
#1  0x40bfc777 in mallopt () from /lib/tls/libc.so.6
#2  0x40bfb9be in calloc () from /lib/tls/libc.so.6
#3  0x4050ad05 in QImage::setNumColors(int) () from /usr/lib/qt3/lib/libqt-mt.so.3
#4  0x00000400 in ?? ()
#5  0x00000001 in ?? ()

What do frames #4 & #5 really mean? The memory is corrupted? Because when I ran:
(gdb) x 0x00000400
I got:
0x400:  Cannot access memory at address 0x400

What might have caused the core dump? Can anyone shed some light on this? Thanks.

0
Comment
Question by:minjiezen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16990138
there is a function (probably QImage::setNumColors(int)) which write to an address which is invalid, either 'cause it gets a wrong pointer to it, or 'cause the data written was to large.
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 50 total points
ID: 16990680
You have trashed the arena (i.e. you have written off the end or start of an area of memory obtained with calloc / malloc. Or you may ahve called free() on a poiter that was not obtained from the first 2 functions. Or written to memory after it was freed.
The problem is quite likely not with the library - programs can often carry on for a while after the arena has been corrupted.
Problems like this can be a little awkward to find - there are free tools like Electric Fence http://freshmeat.net/redir/efence/2277/url_homepage/efence.php or I myself use the memory debug package from tcl - but that requires one to recompile everything. There are non-free tools too, like IBM/Rational (it's very good).
0
 

Author Comment

by:minjiezen
ID: 16995201
Hello guys, thank you very much for your info!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question