Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debug Shared Libraries
Debug Shared Libraries [message #557592] Wed, 08 September 2010 08:41 Go to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: September 2010
Junior Member
Hello,

I am using Linux and Eclipse CDT Helios (newest version). I can debug normal code and code in shared libraries which are linked at link time. But when I set a breakpoint in code from a shared library that is dynamically loaded at runtime, program execution does not stop at the breakpoint. Even though the program execution definitelly passes the breakpoint.

Does anyknow know this problem? What I have to do to debug shared libraries?
Re: Debug Shared Libraries [message #557628 is a reply to message #557592] Wed, 08 September 2010 11:53 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
You have to set a so-called "pending breakpoint" in your shared library.
At the moment this is not possible in the GUI. You need to set the breakpoint in the library _after_ it is has been loaded. To stop GDB on load library events you have to enter "stop-on-solib-events" in the gdb console in Eclipse or insert it in your gdbinit. Then you can set the breakpoint.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debug Shared Libraries [message #557658 is a reply to message #557592] Wed, 08 September 2010 12:59 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: September 2010
Junior Member
When I type "stop-on-solib-events" into the console window why I am in the debug perspective I just get this message: "Undefined command: "stop-on-solib-events". Try "help".

Seems like my gdb does not recognize this command. You have an idea why?

Edit: I entered "set stop-on-solib-events 1" and gdb did not print any error message. Is this syntax correct?
When I enter this command in the debug console the program stops at _dl_debug_state() and says:
"No source available for _dl_debug_state() at 0x7ffff7dede20"

Anyone knows what I am doing wrong?

[Updated on: Wed, 08 September 2010 13:20]

Report message to a moderator

Re: Debug Shared Libraries [message #557681 is a reply to message #557658] Wed, 08 September 2010 13:58 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
Edit: I entered "set stop-on-solib-events 1" and gdb did not print any error message. Is this syntax correct?

Yes. I forgot the set command.

Quote:
When I enter this command in the debug console the program stops at _dl_debug_state() and says:
"No source available for _dl_debug_state() at 0x7ffff7dede20"

That's OK. It just means that the debugher has stopped in the function at _dl_debug_state(). We forced him to do so by setting stop-on-solib-events which means gdb should stop the program when a shared library is loaded. You can ignore the "No source available" message. It just says that you don't have debug symbols for this function which is part of glibc. I guess you are not interested in debugging glibc Smile

The more interesting question now is if you can set the breakpoint in your shared lib after the program was halted in at _dl_debug_state()?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debug Shared Libraries [message #557719 is a reply to message #557681] Wed, 08 September 2010 15:20 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: September 2010
Junior Member
Axel Mueller wrote on Wed, 08 September 2010 09:58
I guess you are not interested in debugging glibc Smile

Hehe, indeed =)

Axel Mueller wrote on Wed, 08 September 2010 09:58

The more interesting question now is if you can set the breakpoint in your shared lib after the program was halted in at _dl_debug_state()?

Unfortunately not;(
After the program halted at this _dl_debug_state() I set a breakpoint in my shared lib code and pressed F8, but the breakpoint was never hit and just seems to be ignored. Any ideas what I could do?
Re: Debug Shared Libraries [message #557824 is a reply to message #557719] Thu, 09 September 2010 06:46 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
Unfortunately not;(
After the program halted at this _dl_debug_state() I set a breakpoint in my shared lib code and pressed F8, but the breakpoint was never hit and just seems to be ignored. Any ideas what I could do?

After setting your breakpoint did it halt again in _dl_debug_state()? This would indicate that you load several shared libs.
As a workaround you can use the old CDI debugger interface. At the bottom of the Debug Launch Configuration it says "Use GDB (DSF) Create Process Launcher". Click "Select other" and choose then "Standard Create Process Launcher". AFAIK, the old debug interface supports pending breakpoints.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debug Shared Libraries [message #557840 is a reply to message #557824] Thu, 09 September 2010 07:47 Go to previous message
No real name is currently offline No real nameFriend
Messages: 12
Registered: September 2010
Junior Member
Axel Mueller wrote on Thu, 09 September 2010 02:46

After setting your breakpoint did it halt again in _dl_debug_state()? This would indicate that you load several shared libs.


Yes, it seems like the debugger stops several times in _dl_debug_state()

Axel Mueller wrote on Thu, 09 September 2010 02:46

As a workaround you can use the old CDI debugger interface. At the bottom of the Debug Launch Configuration it says "Use GDB (DSF) Create Process Launcher". Click "Select other" and choose then "Standard Create Process Launcher". AFAIK, the old debug interface supports pending breakpoints.

Changing the debugger to "Standard Create Process Launcher" gives me this message (several times) on the console (I selected the checkbox "Stop on shared library events"):
"Stopped due to shared library event"

So the debugger really seems to halt several times in _dl_debug_state. Unfortunately the debugger still does not halt on my shared lib breakpoint. Another strange thing is: When I use the Standard Create Process Launcher and order him to stop on shared lib events my program does not work. I have a render application and when I activate stop on shared libs my render window just stays black and I have to quit the application.

I hope you still have some ideas Smile

[Updated on: Thu, 09 September 2010 07:50]

Report message to a moderator

Previous Topic:MinGW path issues
Next Topic:Treating .C as C source file
Goto Forum:
  


Current Time: Fri Apr 26 21:46:27 GMT 2024

Powered by FUDForum. Page generated in 0.03057 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top