[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

gdb backtrace only displays frame 0, why can't I see the call stack?

Posted on 2005-04-15
6
Medium Priority
?
328 Views
Last Modified: 2010-04-21
My C++ data server ran for 5 days until it dumped the core
by throwing St9bad_alloc.  When I gdb the core file and enter bt to
trace the call stack, here is what I get:

GNU gdb Red Hat Linux (5.1.90CVS-5)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `./Nqds.exe -P46090 -S nqds.cfg -L nqds.log -E 1'.
Program terminated with signal 6, Aborted.
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /usr/lib/libstdc++.so.4...done.
Loaded symbols for /usr/lib/libstdc++.so.4
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x42028cc1 in kill () from /lib/i686/libc.so.6
(gdb) bt
#0  0x42028cc1 in kill () from /lib/i686/libc.so.6
Error accessing memory address 0xbfffe75c: Invalid argument.
(gdb)  up
Error accessing memory address 0xbfffe75c: Invalid argument.
(gdb)  frame 1
Error accessing memory address 0xbfffe75c: Invalid argument.

So you see that I cannot tell where my code threw the exception.
And the core file is over 200M.  Any ideas?

Steven Katz
0
Comment
Question by:crownskatz
5 Comments
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 13791593
It is highly likely that your code has corrupted the stack,
quite probably a massive overrun of a local buffer on the
stack, trashing the return address to the calling routine.

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13793542
recompile your program with -g option, then start and check if it crashes again
If not it's most likely as brettmjohnson assumed: stack overflow, and as the function name suggests it's not only the stack but the heap also
0
 

Author Comment

by:crownskatz
ID: 13793929
Thanks for your responses.
I am already compiling using the -g option.
I think the error is caused when the application receives a delete transaction.
I coded the delete logic to call erase on the container element holding the data
but not the delete operator.  So after a while, the container still holds the memory for
all deleted elements.  This could run out the memory allocation.  I do not know if
this would corrupt the stack itself.  I still need to do more analysis and testing.
0
 

Author Comment

by:crownskatz
ID: 13885892
I recoded my delete logic to call erase on the container element and then to call
the delete operator.  The program has now been running for 8 days without a core
dump.  I never found out why the backtrace did not work.
When a program exhausts the memory allocator, does that corrupt the stack?
Thanks for your insights.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 14070780
PAQed with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month18 days, 11 hours left to enroll

834 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