Bug 124057 - Breakpoints problems if another instance of debug session already running.
Summary: Breakpoints problems if another instance of debug session already running.
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-16 19:25 EST by PalmSource Eclipse Bug Tracker CLA
Modified: 2020-09-04 15:22 EDT (History)
0 users

See Also:


Attachments
Testcase to reproduce the problem. (14.40 KB, application/x-gzip)
2006-01-16 19:27 EST, PalmSource Eclipse Bug Tracker CLA
no flags Details
Screenshot of debug session in running state. (80.02 KB, image/png)
2006-01-19 14:25 EST, PalmSource Eclipse Bug Tracker CLA
no flags Details
Screenshot of debug session stopped on disabled breakpoint. (108.69 KB, image/png)
2006-01-19 14:26 EST, PalmSource Eclipse Bug Tracker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description PalmSource Eclipse Bug Tracker CLA 2006-01-16 19:25:38 EST
Hi,

I'm  on a Linux system using Eclipse 3.1.1 with CDT 3.0.

The problem is that when a program is being debugged and it's breakpoints are disabled during that debug session, the changes to the breakpoints are not propagated through when the program is "Restarted" (using the button in the Debug view).

I'm attaching a very simple testcase - just a helloWorld.

To reproduce the problem:

1. Import and build the attached helloWorld project.
2. Set a breakpoint at hello.c:6.
3. Create a debug session with the "Connect process input & output to a terminal" off.  (This is necessary to bypass bug#37989).
4. Reach the breakpoint at hello.c:6.
5. Disable the breakpoint at hello.c:6 in the Breakpoint View by clicking on the check box.
6. Click the "Restart" button in the Debug View.
7. Continue execution and notice that execution stops at the disabled breakpoint.


Thank You,
Ewa Matejska.
PalmSouce
Comment 1 PalmSource Eclipse Bug Tracker CLA 2006-01-16 19:27:39 EST
Created attachment 33114 [details]
Testcase to reproduce the problem.
Comment 2 Nobody - feel free to take it CLA 2006-01-17 13:33:02 EST
Works for me. Tried both Linux and Windows.
Comment 3 PalmSource Eclipse Bug Tracker CLA 2006-01-19 14:24:48 EST
Hi Mikhail,

Previously, I did not notice that while following my own steps in the testcase, I had another session in the "Debug View" in the running state.  Sorry about that.  I renamed the bug because it seems that the breakpoint problems stem from having another instance of the same debug session already in the running state.

I replaced the testcase with another one with a while(1) loop to ensure continued running.

Please do the following:
1. Build the testcase.
2. IMPORTANT:  Create a debug session with the "Connect process input & output to a terminal" option turned off. Continue running the program. The result should be a debug session in the Debug View in the "running" state.  See ScreenshotDebug1.png.
3. Set breakpoint at hello.c:6.
4. Start another debug session of the same kind as in #2 and stop at the first line of main.
5. Disable the breakpoint at hello.c:6.
6. Continue running and notice that the breakpoint is hit even though it's disabled.  See ScreenshotDebug2.png.

Please let me know if you can see this.

Thank You,
Ewa.
Comment 4 PalmSource Eclipse Bug Tracker CLA 2006-01-19 14:25:59 EST
Created attachment 33285 [details]
Screenshot of debug session in running state.
Comment 5 PalmSource Eclipse Bug Tracker CLA 2006-01-19 14:26:53 EST
Created attachment 33286 [details]
Screenshot of debug session stopped on disabled breakpoint.
Comment 6 PalmSource Eclipse Bug Tracker CLA 2006-01-19 14:30:30 EST
Actually, please just modify the original testcase hello.c file to look like:

#include <stdio.h>

int main()
{
	printf("Hello World!\n");
        printf("hello again\n");
        while(1);
	return 0;
}

I don't want to litter the eclipse bug tracker.

Thanks,
Ewa.
Comment 7 Nobody - feel free to take it CLA 2006-01-19 14:58:32 EST
Ewa,
Can you suspend the running session? 
I believe that one of the reasons to use pty is to be able to break the running application. Unfortunately, with pty we have problems restarting the session.
Comment 8 PalmSource Eclipse Bug Tracker CLA 2006-01-19 17:32:22 EST
Hi Mikhail,

Yes, I can suspend the running session. 

I'm not sure I understand your response.  I'm only seeing this problem if my debug   launches have the "Connect process input & output to a terminal" option turned off.  You expected that I would not be able to Suspend because this option was off?

Also in the most recent example, I did not have to restart to see the problem but I simply disabled a breakpoint after the execution of the program already started.

Do you think this is a limitation of having that option turned off?

Thank You,
Ewa.
Comment 9 Nobody - feel free to take it CLA 2006-01-19 18:20:54 EST
Ok, I'll investigate this on Monday. Thank you for looking at it.
Comment 10 Nobody - feel free to take it CLA 2006-01-30 15:33:01 EST
Ewa,

I have tried your example, but I can not set a breakpoint after "while(1)", code seems to be optimized even if I use the -O0 option. The error message from gdb is "no line x in file hello.c".
If I set a breakpoint somewhere else everything works fine.

Mikhail
Comment 11 PalmSource Eclipse Bug Tracker CLA 2006-01-30 15:57:24 EST
Hi Mikhail,

The problem reproduces for me when I set the breakpoint at the "printf("hello again\n")" line (the second printf statement in the example which is hello:6 for me).

Can you verify that you,
1. Turned _off_ the  "Connect process input & output to a
terminal" option.  It doesn't reproduce with that option on.
2. There is one debug session of the same kind in the running state already when you try to see the problem.
3. You set the breakpoint before execution started and you disabled the breakpoint after execution started (disable when stopped at first line of main in the example).

If that doesn't work for you, the next step for me will be to look through the source code.   

Thank You,
Ewa.
Comment 12 Nobody - feel free to take it CLA 2006-01-30 16:58:55 EST
Yes, I have been able to reproduce it.
The suspend command works much faster if the "Connect process input & output to a terminal" option is on, because it uses the terminal specific commands (Ctrl-C, I believe) to suspend a running program. If this option is off, we use different mechanism to suspend a debug session.
When you set, delete or modify a breakpoint in UI the corresponding commands are sent to all active gdb sessions. If a session is in the running state, it has to be suspended first. And suspend takes a long time in this case.
If you wait for some time after breakpoint is disabled, it would work as expected.
I'll check why the delay in one session affects the other.
Thanks.