Bug 346584 - Unresolved Breakpoint when installing a breakpoint by double clicking the ruler
Summary: Unresolved Breakpoint when installing a breakpoint by double clicking the ruler
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-20 02:40 EDT by Saurabh Singh CLA
Modified: 2020-09-04 15:21 EDT (History)
8 users (show)

See Also:


Attachments
gdb trace - nothing in it even though breakpoint setting was attempted (143.29 KB, text/plain)
2011-06-15 08:46 EDT, Marko Mikkonen CLA
no flags Details
the new trace (133.26 KB, text/plain)
2011-06-15 10:41 EDT, Marko Mikkonen CLA
no flags Details
Qt test case (8.12 KB, application/octet-stream)
2011-09-12 13:34 EDT, Marko Mikkonen CLA
no flags Details
Gdb interruptor (8.04 KB, application/octet-stream)
2011-09-15 03:57 EDT, Marko Mikkonen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Saurabh Singh CLA 2011-05-20 02:40:54 EDT
Build Identifier: Eclipse C/C++ Development Tools  Version: 7.0.2.201010220608 Build id: 201010220608

We generate C++ code from a model.
When the breakpoints are put in the running code, the warning related to Unresolved breakpoints are shown.
However, most of the times, after relaunching the application, the warning disappears and breakpoint is installed in the application.

Reproducible: Always

Steps to Reproduce:
1.Create a CPP project in Eclipse with CDT installed.
2.Create a method with some code in the project
	int i =0 ;
	int k = 90;

	int sum = i + k;
	printf("%d", sum);

Launch the code using C++ debug configuration.
Bring up the Code and put a break point at int sum=i+k;
The the breakpoint has a warning against it, saying "The breakpoint cannot be resolved"
Comment 1 Marko Mikkonen CLA 2011-06-15 06:37:39 EDT
My version of CDT is 7.0.1, but this happens to me to. You can set breakpoints before you launch the debug session or when the debugger has stopped at some breakpoint, but not when the program is running (under debugger). I propose that you lift the importance of this bug to "major". This really should be fixed right away. I'm voting for this one.
Comment 2 Marc Khouzam CLA 2011-06-15 06:43:25 EDT
Can you include the 'gdb traces' of your session?
http://wiki.eclipse.org/CDT/User/FAQ#I.27ve_been_asked_for_.27gdb_traces.27.2C_where_can_I_find_them.3F
Comment 3 Marko Mikkonen CLA 2011-06-15 08:46:56 EDT
Created attachment 198014 [details]
gdb trace - nothing in it even though breakpoint setting was attempted
Comment 4 Marko Mikkonen CLA 2011-06-15 08:47:31 EDT
I can but there's nothing strange about them. I can't see anything in the trace when I'm trying to set the breakpoint while the program is running. There just appears a yellow triangle with exlamation mark on top of the breakpoint "balloon" and then there's this message in the problems window:

Description	Resource	Path	Location	Type
Breakpoint attribute problem: installation failed	network.cpp	/DRMEditor	451	C/C++ Breakpoint Problem

The same note can be seen when hovering the mouse on top of that yellow triangle.

I'm attaching the gdb trace anyway. In this trace the program ran into one breakpoint that was set before the debugging session started. But when I tried setting a breakpoint when the program was running, nothing appeared.
Comment 5 Marc Khouzam CLA 2011-06-15 09:17:39 EDT
(In reply to comment #4)

> I'm attaching the gdb trace anyway. In this trace the program ran into one
> breakpoint that was set before the debugging session started. But when I tried
> setting a breakpoint when the program was running, nothing appeared.

Can you indicate at what time you tried to set the breakpoint?
Also, can you show the traces when you set a breakpoint with the target stopped (you said that worked).

Finally, the very large -environment-directory can affect breakpoints.  This has been removed in the next eclipse release, and may help you issue.
Comment 6 Marko Mikkonen CLA 2011-06-15 10:37:15 EDT
Ok. Here's one session: A breakpoint was encountered. Then I set the next breakpoint a few lines further and continued the debugging. The breakpoint which I just set was encountered. Then I continued the debugging and let the program run. Then I tried to set another breakpoint while the program was running, but there was no output in gdb trace. I'm attaching the trace below.
Comment 7 Marko Mikkonen CLA 2011-06-15 10:41:31 EDT
Created attachment 198030 [details]
the new trace
Comment 8 Marko Mikkonen CLA 2011-06-15 10:50:53 EDT
(In reply to comment #6)
> Ok. Here's one session: A breakpoint was encountered. Then I set the next
> breakpoint a few lines further and continued the debugging. The breakpoint
> which I just set was encountered. Then I continued the debugging and let the
> program run. Then I tried to set another breakpoint while the program was
> running, but there was no output in gdb trace. I'm attaching the trace below.

And the file where I had those breakpoints was network.cpp. There's a lot of those breakpoints in the trace so it may be confusing. The time when I hit the first breakpoint seems to be 013,257. The time when I set the first breakpoint seems to be 024,944. And I hit that breakpoint at 029,935.
Comment 9 Marc Khouzam CLA 2011-06-15 11:39:29 EDT
Are there are error in your workspace .metadata/.log around the time you do that debug session?
Comment 10 Marko Mikkonen CLA 2011-06-15 11:49:12 EDT
Well there this one about a missing log file, but I don' think it's related:

!SUBENTRY 1 org.eclipse.core.filesystem 4 272 2011-06-15 18:46:42.319
!MESSAGE Could not write file: E:\Users\Marko\Documents\workspace\.metadata\.plugins\org.eclipse.cdt.ui\DRMEditor.build.log.
!STACK 0
java.io.FileNotFoundException: E:\Users\Marko\Documents\workspace\.metadata\.plugins\org.eclipse.cdt.ui\DRMEditor.build.log (The system cannot find the path specified)
(and then there's the stack trace, which I'm not putting here.)

The path to the build log seems to point to the directory where I had the workspace earlier, before I moved it to the current directory.
Comment 11 Marko Mikkonen CLA 2011-09-12 08:18:31 EDT
This bug is still present in CDT 8.0. Is it ever going to be fixed? Maybe it's time to raise the importance level of this bug to major?

Here's a really simple test case for whoever will get interested in this (if someone ever will):

Make a cpp "helloworld" project and replace the contents of the file with:

#include <iostream>
using namespace std;

int main() {
	while(1)
	{
		cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	}
	return 0;
}

Debug and try to set breakpoint inside the loop WHILE THE PROGRAM IS RUNNING.
Comment 12 Marc Khouzam CLA 2011-09-12 09:57:23 EDT
Works well on Linux, so I assume this is a Windows problem.  There was a lot of effort trying to get windows interrupting to work properly, as it was quite complicated.  All the details are in Bug 304096.

Which GDB version are you using?

Does it work with CDI?  To try it, follow the instructions here:
http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_choose_another_debugger_integration_for_CDT.3F
and choose "Standard Create Process Launcher"
Comment 13 Laurent Haas CLA 2011-09-12 11:13:09 EDT
I'm currently facing the same issue as Marko (Eclipse 3.7.0.I20110613-1736 and CDT 8.0.0.201106081058 under Windows XP).

> Which GDB version are you using?

GNU gdb (GDB) 7.3.50.20110821-cvs (cygwin-special)

> Does it work with CDI?  To try it, follow the instructions here:
> http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_choose_another_debugger_integration_for_CDT.3F
> and choose "Standard Create Process Launcher"

Doesn't work either here.

Actually, there is no trace in the GDB console when trying to set a breakpoint while the program is running.
Comment 14 Marko Mikkonen CLA 2011-09-12 11:18:53 EDT
(In reply to comment #12)
> Which GDB version are you using?

It's 7.3.

> Does it work with CDI?  To try it, follow the instructions here:
> http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_choose_another_debugger_integration_for_CDT.3F
> and choose "Standard Create Process Launcher"

No, it doesn't.
Comment 15 Marc Khouzam CLA 2011-09-12 11:36:46 EDT
(In reply to comment #13)
> Actually, there is no trace in the GDB console when trying to set a breakpoint
> while the program is running.

Can one of you press the Suspend button while the application is running, with DSF and CDI.  Does that work?  I'm guessing not.

Does anyone have a 7.2 or 7.1 GDB?  I believe this worked with those versions.  I can be downloaded from http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GDB/

BTW, I don't have a Windows machine at the office, so I can't try it myself.
Comment 16 Marko Mikkonen CLA 2011-09-12 12:22:27 EDT
(In reply to comment #15)
> Can one of you press the Suspend button while the application is running, with
> DSF and CDI.  Does that work?  I'm guessing not.
> 
> Does anyone have a 7.2 or 7.1 GDB?  I believe this worked with those versions. 
> I can be downloaded from
> http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GDB/

I tried that with 7.1, 7.2 and 7.3, all both with DSF and CDI and none of them worked. However I came across a discovery. If you change the code to:

#include <iostream>
using namespace std;

int main() {
    int i = 0;
    while(1)
    {
        i++;
    }
    return 0;
}

i.e. you don't print anything, then you can set a breakpoint while the program is running. Also in gdb 7.3, with both DSF and CDI.

I have a couple of Qt GUI applications and setting a breakpoint in them does not work. They don't print anything to the standard output.
Comment 17 Marc Khouzam CLA 2011-09-12 12:53:37 EDT
(In reply to comment #16)

Out of curiousity, what if you had

#include <iostream>
using namespace std;

int main() {
int i =0;
    while(1)
    {
        cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
        i++;
    }
    return 0;
}

Can you interrupt that?
Comment 18 Marko Mikkonen CLA 2011-09-12 13:12:13 EDT
> (In reply to comment #16)
> 
> Out of curiousity, what if you had
> 
> #include <iostream>
> using namespace std;
> 
> int main() {
> int i =0;
>     while(1)
>     {
>         cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
>         i++;
>     }
>     return 0;
> }
> 
> Can you interrupt that?

No, I can't. But I can interrupt this:


#include <iostream>
#include <windows.h>
#define sleep(n) Sleep(1000 * n)

using namespace std;

int main() {
    while(1)
    {
        cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
        sleep(5);
    }
    return 0;
}
Comment 19 Marko Mikkonen CLA 2011-09-12 13:34:32 EDT
Created attachment 203176 [details]
Qt test case

Trying to set a breakpoint in button handler test_qt::doClicked() doesn't work.
Comment 20 Marc Khouzam CLA 2011-09-13 14:25:57 EDT
I suggest to try out the test with GDB only, no eclipse:

  > gdb <path to project>\Debug\hello
  run
  ^C

This should not work since it seems to be the interrupting ability of GDB that is failing.

Until we find a way to get GDB to interrupt in those cases, there is nothing we can do in Eclipse.

If you agree, I will mark as NOT_ECLIPSE, but we can re-open if there is a workaround Eclipse could use.
Comment 21 Marko Mikkonen CLA 2011-09-13 15:15:56 EDT
(In reply to comment #20)
> I suggest to try out the test with GDB only, no eclipse:
> 
>   > gdb <path to project>\Debug\hello
>   run
>   ^C

It didn't work either.

> This should not work since it seems to be the interrupting ability of GDB that
> is failing.
> 
> Until we find a way to get GDB to interrupt in those cases, there is nothing we
> can do in Eclipse.
> 
> If you agree, I will mark as NOT_ECLIPSE, but we can re-open if there is a
> workaround Eclipse could use.

Here's a workaround:

http://cygwin.com/ml/cygwin/2006-06/msg00321.html

The workaround uses DebugBreakProcess function. I compiled the program under the link and was able to interrupt gdb (running under Eclipse). Then I was able to set a breakpoint. I suggest that something similar is done with Eclipse.
Comment 22 Marko Mikkonen CLA 2011-09-15 03:57:46 EDT
Created attachment 203389 [details]
Gdb interruptor

I made an attachment of the gdb interrupt program presented in the link I supplied earlier for study and testing. The zip contains the source and compiled program. Just try it.

Usage:
-Start debugging session within Eclipse.
-Look up the PID of the program you're debugging from task manager, for example.
-Run command "debugbreak.exe [PID]"
-The program should stop now somewhere in Eclipse. Now you can set a breakpoint in  the code where you want. Then you can continue debugging and the next time the breakpoint you just set is met, the debugger should stop there.

The only thing that should be added to the program is the lookup of the PID.

There it is, on a golden plate for you. Now only thing left is to someone implement this in Eclipse.
Comment 23 Praveen Bahl CLA 2012-06-04 09:46:17 EDT
One of our Client is also facing this similar issue . Is it possible to let us know by when this issue can be resolved and implemented in eclipse