Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Breakpoints in shared libraries loaded at runtime(Breakpoints in shared libraried loaded at runtime remain disabled.)
Breakpoints in shared libraries loaded at runtime [message #1018331] Wed, 13 March 2013 16:12 Go to next message
Catalin Doras is currently offline Catalin DorasFriend
Messages: 7
Registered: July 2009
Junior Member
Hello,

Trying to debug a shared library I ran into the following problem:

I start my debug session, load the shared library, insert breakpoints in it and debug. I end the session and restart it. The breakpoints that were in the shared library are not enabled after I load the shared library again.

Debugging this I noticed that for the shared libraries that are linked, Eclipse would issue a break insert comamnd to GDB for those breakpoints, but for the library I load at runtime, there is no break insert command.

When I load the library, I issue an shared library event, but it doesn't result in an attempt from GDB to insert the breakpoints. I am using CDT/CDI.

Is this a known Eclipse CDT issue, or there is another event type that I need to trigger when adding shared libraries at runtime. (The corresponding GDB action for loading this library is to issue an add-symbol-file command).

The codes that fires the event looks like this:

MIShared shared = new MIShared(from, to, true, file);
SharedLibrary library = new SharedLibrary(target, shared);
Session session = (Session)target.getSession();
ICDIEvent event = new CreatedEvent(session, library);
EventManager eventManager = (EventManager) session.getEventManager();
eventManager.fireEvents(new ICDIEvent[] {event});

Thank you,
Catalin


Re: Breakpoints in shared libraries loaded at runtime [message #1018764 is a reply to message #1018331] Thu, 14 March 2013 12:32 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
This should work. Eclipse will insert pending breakpoint. Which version of CDT and gdb are you using? And why are you using CDT/CDI and not DSF?

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Breakpoints in shared libraries loaded at runtime [message #1018776 is a reply to message #1018764] Thu, 14 March 2013 13:04 Go to previous messageGo to next message
Catalin Doras is currently offline Catalin DorasFriend
Messages: 7
Registered: July 2009
Junior Member
Hello Axel,

Thank you for the reply.
I'm using Eclipse CDT 8.1.1 (also C/C++ Remote Debug Launch version is 6.0.0(org.eclipse.cdt.launch.remote) and GDB Common version is 7.0.0 (org.eclipse.cdt.gdb)
GDB version is 7.4. Using mi interpreter.
The reason I use CDT/CDI is some legacy code not ported to DSF.

CDT doesn't seem to try to insert a pending breakpoint.

17-break-insert pong.c:40
17^error,msg="No source file named pong.c."

Then for every shared library linked with the image

21 info sharedlibrary
&"info sharedlibrary\n"
~"From To Syms Read Shared Object Library\n"
~"0xb7fdf830 0xb7ff792f Yes /lib/ld-linux.so.2\n"
21^done
(gdb)
22-break-insert pong.c:40
22^error,msg="No source file named pong.c."

When later on I load a shared library at runtime, there is no attempt to re-insert the breakpoint. I was thinking if there was a way to make it trigger the re-insert attempt or maybe I should trigger an additional event.

My understanding is that instead of trying the above mechanics, CDT should specify the "-f" option to the gdb mi command.

Catalin
Re: Breakpoints in shared libraries loaded at runtime [message #1031342 is a reply to message #1018331] Mon, 01 April 2013 15:48 Go to previous message
Catalin Doras is currently offline Catalin DorasFriend
Messages: 7
Registered: July 2009
Junior Member
Hello again.

In fact, it seems that the

org.eclipse.cdt.debug.mi.core plugin doesn't have this functionality. My version is 7.2.0.201209170703.

at org.eclipse.cdt.debug.mi.core.command.MIBreakInsert the -f flag that is available from gdb6.5 is not implemented/supported.

Unfortunately the "set breakpoint pending on" command in GDB only affects the CLI break command so there was no way out for me.

I think the way out would be for CDT to set -f by default for -break-insert.







Previous Topic:Problem in Compiling (G++ parameters)
Next Topic:Error Parser Plugin within .cproject settings
Goto Forum:
  


Current Time: Tue May 07 14:20:48 GMT 2024

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

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

Back to the top