Author Topic: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response  (Read 5795 times)

Offline yankes

  • Single posting newcomer
  • *
  • Posts: 5
Hello all,

I am experiencing some trouble while debugging on CodeBlocks 12.11 for Linux (Ubuntu). I have both installed CB under Windows and Linux. Under Windows the debugger seems to work just fine, however on Linux I am experiencing the following problem:

I start the debugging normally without any problems. But on a line where I have a dynamic shared library loading, the debugger seems to freeze and gives no more response. So basically I can't debug my application.
The line when it stops is the following:

cs_demo   = dlopen("content_supplier.so", RTLD_LAZY);

On Windows, though, the similar line of LoadLibrary let's me continue my debugging without any problem. This is not a question of wrong filename or something, because if it would be the function dlopen would just return 0 and on a call for dlerror() I would just get the string with the error, so the question is: Why Debugger stops responding ? Is it a BUG? Or am I forgetting to do something on Debugger Options?

Thank you very much in advance.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #1 on: March 08, 2013, 11:46:44 am »
Does it work, if you do not debug ?

You can run into a deadlock when doing thread related stuff in the init-routine/constructor of the shared library.
See: https://bugzilla.redhat.com/show_bug.cgi?id=661676 .

And the behaviour might be different on linux and windows (as always).

Did you turn on the debuggers debug-log to see if you get some information ("Settings -> Debugger -> Common -> Full (debug) log") ?
Can you stop the debugger and get a backtrace ?
What happens if you debug from commandline ?

Offline yankes

  • Single posting newcomer
  • *
  • Posts: 5
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #2 on: March 08, 2013, 12:22:05 pm »
Thanks for such quick answer.
Well actually I am quite confused if am running into a deadlock or not. This is the message returned by the debugger and I have full log enabled.

[debug]>>>>>>cb_gdb:
[debug]> next
[debug]Cannot find new threads: generic error
[debug][Thread debugging using libthread_db enabled]

I am also getting on console a GDB warning:
warning: GDB: Failed to set controlling terminal: Operation not permitted

About the backtrade, shouldn't I be expecting that a box should have popped up offering to show me a "backtrace" after stopping debugger?

What it seems to me is that the Debugger NEVER returns from the dlopen call, I can stop it without any problems.

Thanks in advance for your support


Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #3 on: March 08, 2013, 12:39:26 pm »
Thanks for such quick answer.
Well actually I am quite confused if am running into a deadlock or not. This is the message returned by the debugger and I have full log enabled.

[debug]>>>>>>cb_gdb:
[debug]> next
[debug]Cannot find new threads: generic error
[debug][Thread debugging using libthread_db enabled]

I am also getting on console a GDB warning:
warning: GDB: Failed to set controlling terminal: Operation not permitted

About the backtrade, shouldn't I be expecting that a box should have popped up offering to show me a "backtrace" after stopping debugger?

What it seems to me is that the Debugger NEVER returns from the dlopen call, I can stop it without any problems.

Thanks in advance for your support


To get a backtrace if the debugger is paused (not if the debugger hangs), you need to open the "call stack" window ("Debug -> Debugging windows -> Call stack") or type "bt" (or "bt full" to get more information) in the input field of the debug log and press enter or the execute button (assuming you use gdb).
There is a "Break debugger"-button in the toolbar (and a similar menu-entry).

The warning about the controlling terminal can be ignored (it's a gdb issue).

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #4 on: March 08, 2013, 12:42:25 pm »
By the way searching the web for "Cannot find new threads: generic error" might be helpful.

Offline yankes

  • Single posting newcomer
  • *
  • Posts: 5
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #5 on: March 08, 2013, 01:04:25 pm »
Thanks for the help.

Well I can't pause the debug when he is hanging on the loading library function, so I can't get a backtrace on that line unfortunately. I will search the internet for such problems and eventually post solution here if I find it. If you have any further suggestions they will be really appreciated. 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #6 on: March 08, 2013, 03:57:27 pm »
Unfortunately this is a C::B bug :(
(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!]

Offline yankes

  • Single posting newcomer
  • *
  • Posts: 5
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #7 on: March 12, 2013, 02:07:47 pm »
Any preview about when it will be fixed? Just wondering

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #8 on: March 12, 2013, 02:54:25 pm »
You should run your app through gdb on the commandline and see if the hanag appears also.

I think the hanging debugger is possibly caused by a missing thread-library (search the web for the error), that is (probably) linked against your shared lib, but not against your app (what is normally not needed, but causes gdb to hang).

The C::B bug in this case is (most likely) the fact, that you can not pause/stop the debugger, but not the hanging debugger itself.

Offline yankes

  • Single posting newcomer
  • *
  • Posts: 5
Re: CodeBlocks Debugger on Loading Dynamic/Shared Libraries No Response
« Reply #9 on: March 25, 2013, 01:26:21 pm »
I Solved the problem. It has nothing to do with the debugger. I had the latest version of GCC 4.6.1 after some update of Ubuntu.

Basically i downgraded GCC to 4.4 version and now it works perfectly. So, I can't yet understand why the latest version didn't work, but anyway, it is a GCC related problem and not a CodeBlocks related problem.

Thank you all for your efforts and help