Author Topic: Debugging C++ Exceptions does not work  (Read 6143 times)

Offline dschornack

  • Single posting newcomer
  • *
  • Posts: 3
Debugging C++ Exceptions does not work
« on: August 07, 2011, 04:59:43 pm »
Hello,

I am experiencing a problem debugging C++ Exceptions.  From reading through the post, this is an old subject from what I have read and was fixed, but ...

CodeBlocks is not catching C++ Exceptions properly.  My Environment is the following ...

Fedora 14  (x86_x64)
Code::Blocks - Aug 30 2010, 10:53:58 - wx2.8.11 (Linux, unicode) - 64 bit
gcc-c++-4.5.1-4.fc14 (x86_64)
gdb-7.2.51.fc14 (x86_64)
and I do have Catch C++ Exceptions turned on in the Debugger Settings

Are there any Debugger initialization commands?

Here is a simple example ...

#include <iostream>
using namespace std;

int main () {
    try {
        throw 20;
    } catch (int e) {
        cout << "Just testing ... " << e << endl;
    }

    return 0;
}

I set the break point on the cout and when the exception is thrown, CodeBlocks appears to hang.   If I set my cursor on the cout line and click on "run to cursor", CodeBlocks will stop on the cout line.   

I have tried the same code in NetBeans and Netbeans stops on the break point so the problem is not gdb.

Am I missing anything?  Is this still a problem with CodeBlocks?  I like CodeBlocks and do not want to switch back to Netbeans but ...

Thank you in advance for any help you can provide!

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Debugging C++ Exceptions does not work
« Reply #1 on: August 07, 2011, 06:48:36 pm »
It works here on debian with the debugger-branch, but not with trunk, even if "auto-switch to first frame with valid code" (or however it is called exactly) is set.
Because gdb stops at __cxa_throw in libstdc++.so.6, b ut no source is available.

But I can just click on "next line"and I am on the line with the throw-statement.
Alternatively executing "frame 1" in the command-textctrl in the debugger's log-window switches to the next frame (in this case the frame which  has thrown the exception).

Offline dschornack

  • Single posting newcomer
  • *
  • Posts: 3
Re: Debugging C++ Exceptions does not work
« Reply #2 on: August 07, 2011, 07:11:32 pm »
Hello Jens,

Can you be more specific as to the debugger-branch?  Is it the wxpropgrid_debugger under branches in SVN? 

Thanks,
David

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Debugging C++ Exceptions does not work
« Reply #3 on: August 07, 2011, 07:34:10 pm »
Hello Jens,

Can you be more specific as to the debugger-branch?  Is it the wxpropgrid_debugger under branches in SVN? 

Thanks,
David
Yes !

Offline dschornack

  • Single posting newcomer
  • *
  • Posts: 3
Re: Debugging C++ Exceptions does not work
« Reply #4 on: August 08, 2011, 10:39:08 pm »
Hello Jens,

That appears to take care of my problem with C++ Exceptions, however is there an easy way to get back my plugins?

From the Fedora 14 repository, has the following:

codeblocks-10.05
codeblocks-libs-10.05
codeblocks-contrib-10.05 (plugins)
codeblocks-contrib-libs-10.05 (plugins)

I assume the build added codeblocks-10.05 and codeblocks-libs-10.05.  From your experience, would it be better to work with
the contrib (plugins) from SVN or from the Fedora repository?

Thanks in advance.

David

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging C++ Exceptions does not work
« Reply #5 on: August 08, 2011, 11:08:14 pm »
You cannot mix codeblocks and codeblock-contrib packages. If you do so you'll get random crashes or if you're lucky non loading plugins.

The only way to get a working debugger is to build it your self from the debugger branch.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]