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

Discussion in 'C++' started by Sven, Nov 30, 2007.

  1. Sven

    Sven Guest

    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::parseDOMTree() ADSFile.cpp:380 0x0805aec0
    5 xmldb::ADSFile::parseXML() 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
     
    Sven, Nov 30, 2007
    #1
    1. Advertising

  2. Sven

    Sven Guest

    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
     
    Sven, Nov 30, 2007
    #2
    1. Advertising

  3. On 30 Nov, 11:19, Sven <> 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.
     
    tragomaskhalos, Nov 30, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Surendra
    Replies:
    0
    Views:
    511
    Surendra
    Mar 23, 2006
  2. seba
    Replies:
    1
    Views:
    1,449
    mlimber
    Mar 22, 2007
  3. sturlamolden

    Executing previous stack frame

    sturlamolden, Jan 22, 2009, in forum: Python
    Replies:
    2
    Views:
    397
    sturlamolden
    Jan 22, 2009
  4. Timothy Madden
    Replies:
    1
    Views:
    1,636
    Timothy Madden
    Sep 17, 2009
  5. Mark Wood-Patrick
    Replies:
    0
    Views:
    99
    Mark Wood-Patrick
    Jul 30, 2003
Loading...

Share This Page