Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > gdb error: Previous frame inner to this frame (corrupt stack?)

Reply
Thread Tools

gdb error: Previous frame inner to this frame (corrupt stack?)

 
 
Sven
Guest
Posts: n/a
 
      11-30-2007
Hello,

I have a crashing application and tried to find out what is going
wrong. So I run this application with the gdb debugger. I found the
position of the crash in a function which searches the id of a
database element by its name. If the database element is not found it
shall throw an exception. This is the related code:

SRC_ID_TYP Source::getId( const std::string& name_ )
throw( XmlDatabaseException ) {
SRC_ID_TYP srcId;
if ( GetSourceId( name_.c_str(), &( srcId ) ) != OLD_PAG ) {
string errMsg( "Source '" );
errMsg += name_ + "' does not exist in the database";
throw XmlDatabaseException( errMsg );
}
return srcId;
} // *** Source::getId() ***

If the id can be resolved correctly the application works fine. But if
not, it crashes when it tries to throw the exception. The message I
get in the debugger then is:
"Previous frame inner to this frame (corrupt stack?)"

But when I look at the backtrace of the stack it looks very ok:

8 xmldb::Source::getId() Source.cpp:398 0x08062e68
7 xmldb::Source::create() Source.cpp:106 0x0805fb3f
6 xmldb::ADSFile:arseDOMTree() ADSFile.cpp:380 0x0805aec0
5 xmldb::ADSFile:arseXML() ADSFile.cpp:312 0x0805a0cb
4 xmldb::ADSFile::read() ADSFile.cpp:104 0x08056fcf
3 ImportExport::importData() ImportExport.cpp:373 0x08051c1b
2 ImportExport::execute() ImportExport.cpp:305 0x08051764
1 main() iet.cpp:56 0x08055fbb

Know I'm at the end of my knowledge.
Can someone tell me, what is the reason for such an error message? And
what can I investigate further to find the mistake?

Thanks,
Sven
 
Reply With Quote
 
 
 
 
Sven
Guest
Posts: n/a
 
      11-30-2007
I found the mistake!

With the usage of a factory method I had to move the search of the id
into this static method. But now the throw() declarations of one
method above does not fit any more.

But I wonder, why this is not caught by the compiler. I did not think
that a wrong throw() declaration of a method causes a runtime error.
Isn't it just for code clearance or use the compiler this information
for optimizing?

Greetz, Sven
 
Reply With Quote
 
 
 
 
tragomaskhalos
Guest
Posts: n/a
 
      11-30-2007
On 30 Nov, 11:19, Sven <s...@ast.dfs.de> wrote:
> I found the mistake!
>
> With the usage of a factory method I had to move the search of the id
> into this static method. But now the throw() declarations of one
> method above does not fit any more.
>
> But I wonder, why this is not caught by the compiler. I did not think
> that a wrong throw() declaration of a method causes a runtime error.
> Isn't it just for code clearance or use the compiler this information
> for optimizing?
>


And the moral of the story is ...
don't use exception specifications.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging with gdb: pystack macro for gdb to show python stack trace Timothy Madden Python 1 09-17-2009 11:47 AM
GDB - no debugging symbols found (GDB Vs GCC?) seba C++ 1 03-22-2007 02:02 PM
failing to instantiate an inner class because of order of inner classes Pyenos Python 2 12-27-2006 11:19 PM
Capturing gdb output in pyhton script using gdb -batch -x arguments Surendra Python 0 03-23-2006 02:47 PM
inner classes in python as inner classes in Java Carlo v. Dango Python 14 10-19-2003 08:49 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57