Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346809

Summary: Cannot install breakpoint in dynamic loaded library
Product: [Tools] CDT Reporter: Alexander <a.broekhuis>
Component: cdt-debugAssignee: cdt-debug-inbox <cdt-debug-inbox>
Status: CLOSED DUPLICATE QA Contact: Ken Ryall <ken.ryall>
Severity: major    
Priority: P3 CC: a.broekhuis, cdtdoug, marc.khouzam, pawel.1.piech
Version: 8.0   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Alexander CLA 2011-05-22 07:36:18 EDT
Build Identifier: 201105160958

Setting a breakpoint in code that is loaded dynamically does not work. Eclipse gives the warning: "breakpoint not installed".

Using the command line GDB and setting breakpoints there does work.

Reproducible: Always

Steps to Reproduce:
1. Create a simple project that uses dlopen() to load a library
2. Set a breakpoint in the library code
3. Start a debug session, Eclipse immediately adds a warning to the breakpoint
Comment 1 Alexander CLA 2011-05-22 07:37:20 EDT
As an additional comment, using these steps on a Linux installation does work as expected. The breakpoint is installed and used correctly.
Comment 2 Marc Khouzam CLA 2011-05-23 20:51:34 EDT
The solution to breakpoints in dynamically loaded libraries was to use GDB support for pending breakpoints, which was introduced in GDB 6.8.

The work was done in Bug 248595

My guess is that apple's gdb does not support it.  If that is the case, then we are dealing with a duplicate of Bug 323748
Comment 3 Alexander CLA 2011-05-24 02:19:43 EDT
Hi,

Mac is indeed using an older GDB, but what I don't understand is why on a linux installation with GDB 6.5 (Centos 5.2) it does work. 

Either way, the Mac GDB version differs to much from the "default" GDB. And I don't see an update coming anytime soon. I already tried using GDB 7 from MacPorts, but that doesn't work because of library compatibility problems with the Mac dylibs.

Not solving this for the Mac 6.3 GDB effectively breaks Mac support, which would be a real shame since I really like the CDT on my Mac.

But I do agree this is probably a duplicate, with the big difference being the Mac platform, which basically has no support for a newer GDB version.
Comment 4 Marc Khouzam CLA 2011-05-24 09:14:09 EDT
(In reply to comment #3)
> Hi,
> 
> Mac is indeed using an older GDB, but what I don't understand is why on a linux
> installation with GDB 6.5 (Centos 5.2) it does work. 

It shouldn't, unless you are using the older CDT debugger integration which had a solution for older GDBs.

> Either way, the Mac GDB version differs to much from the "default" GDB. And I
> don't see an update coming anytime soon. I already tried using GDB 7 from
> MacPorts, but that doesn't work because of library compatibility problems with
> the Mac dylibs.

GDB 7 and higher is supposed to work on Mac, according to the GDB community.  But I haven't gotten any Mac user to actually confirm this.  It would be a great step for Mac and CDT Debug to get this to work.

> Not solving this for the Mac 6.3 GDB effectively breaks Mac support, which
> would be a real shame since I really like the CDT on my Mac.

If this is a show-stopper for you, you can fall back to the older GDB integration in CDT.  In you launch UI, at the bottom of the Main tab, there is a hyperlink that allows you to change the GDB integration you use.  Click on it and choose the "Standard....." integration.  I don't recall how well it will do on Mac, but it does support breakpoints on dynamically loaded libs.

We can mimic this solution for the DSF-GDB integration, but I don't have any time for that.  A contribution from someone with interest would help.  The solution is basically to have GDB stop every time a new library is loaded, and then try to reset all breakpoints that have failed.  It is not very complicated.

> But I do agree this is probably a duplicate, with the big difference being the
> Mac platform, which basically has no support for a newer GDB version.

I'll rename the other bug and mark as a duplicate.
Comment 5 Marc Khouzam CLA 2011-05-24 09:15:02 EDT

*** This bug has been marked as a duplicate of bug 323748 ***
Comment 6 Alexander CLA 2011-05-24 09:28:59 EDT
Thx for the reply. If I have some time left I will try and see if I can get a newer gdb working on my mac.

Using the standard debugger seems to work, I will use that one for now.