Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365471 - Safer to explicitly set 'target-async off'
Summary: Safer to explicitly set 'target-async off'
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0.2   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 14:23 EST by Marc Khouzam CLA
Modified: 2012-05-09 15:13 EDT (History)
4 users (show)

See Also:
nobody: review+


Attachments
Fix for DSF-GDB for master (10.51 KB, patch)
2011-12-23 10:45 EST, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Fix for DSF-GDB for cdt_8_0 (2.61 KB, patch)
2011-12-23 10:49 EST, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2011-12-02 14:23:49 EST
There is a possibility that GDB will default the target-async setting to enabled, by default in the future, as proposed here:
http://sourceware.org/ml/gdb-patches/2011-11/msg00763.html

target-async was introduced in GDB 7.0 and allows to interact with GDB even while the inferior is running.

DSF-GDB uses target-async on for non-stop mode, but not for all-stop.  I'm pretty sure CDI does not change target-async at all, but needs it to be off.

Until (and if) we decide to use target-async on for all-stop, it is safest to explicitly turn it off when we launch.

This should be part of the cdt_8_0 branch just in case GDB goes ahead with the change in the near future.
Comment 1 Marc Khouzam CLA 2011-12-23 10:45:40 EST
Created attachment 208779 [details]
Fix for DSF-GDB for master

This patch creates a new FinalLaunchSequence_7_0 to handle non-stop and target-async, since the command to set target-async was not available before GDB 7.0.

The patch also explicitly sets target-async to off in all-stop mode.

This patch only addresses DSF-GDB.

Committed to master.
Comment 2 Marc Khouzam CLA 2011-12-23 10:49:35 EST
Created attachment 208780 [details]
Fix for DSF-GDB for cdt_8_0

This fix is for the cdt_8_0 branch.  It is different to avoid adding new APIs.  The solution is actually much simpler but more of a hack.  I think it is still better than nothing so I have committed it to cdt_8_0.
Comment 3 Marc Khouzam CLA 2011-12-23 11:12:49 EST
Mikhail, can you review this fix?

Also, do you have a recommendation for CDI?
If GDB does set target-async on by default, I believe it will cause problems in CDI.  

A workaround is that the user will need to add 
   set target-async off
in their gdbinit file.

Should we put a fix in CDI, or should we wait to see if it is needed?  Is there an easy way to handle the fact that 'set target-async off' will fail for GDBs older than 7.0?  Maybe using the commandFactory?
Comment 4 Nobody - feel free to take it CLA 2011-12-23 12:59:26 EST
(In reply to comment #3)
> Mikhail, can you review this fix?
>

The patch seems to be OK.
 
> Also, do you have a recommendation for CDI?
> If GDB does set target-async on by default, I believe it will cause problems in
> CDI.  
>
> A workaround is that the user will need to add 
>    set target-async off
> in their gdbinit file.
> 
> Should we put a fix in CDI, or should we wait to see if it is needed?  Is there
> an easy way to handle the fact that 'set target-async off' will fail for GDBs
> older than 7.0?  Maybe using the commandFactory?

I added 'set target-async on' to the current CDI launcher and it works fine. I don't see any differences from the previous non-async behavior.
Comment 5 Marc Khouzam CLA 2011-12-23 13:18:57 EST
(In reply to comment #4)

> The patch seems to be OK.

Thanks

> I added 'set target-async on' to the current CDI launcher and it works fine. I
> don't see any differences from the previous non-async behavior.

Try interrupting a running thread.  ^C won't work in async-mode.
Comment 6 Nobody - feel free to take it CLA 2011-12-23 13:57:58 EST
(In reply to comment #5)
> Try interrupting a running thread.  ^C won't work in async-mode.

Yes, that doesn't work.
I think it would be enough just to turn the async mode off for all CDI sessions regardless of the GDB version.
Comment 7 Vladimir Prus CLA 2011-12-23 14:13:44 EST
^C might not work. -exec-interrupt does.
Comment 8 Nobody - feel free to take it CLA 2011-12-23 14:17:00 EST
(In reply to comment #7)
> ^C might not work. -exec-interrupt does.

Thanks Vladimir. I'll look at it after holidays.
Comment 9 Vladimir Prus CLA 2011-12-23 14:18:52 EST
FAOD, -exec-interrupts works *only* in async mode. Also, re the topic, I think that async mode is generally OK these days. While non-stop requires specific per-target support to be fully robust, async mode is a host-side feature, with both Linux and Windows adequately supported.
Comment 10 Marc Khouzam CLA 2012-05-07 14:17:12 EDT
Mikhail, do we want this fixed for CDI for Juno?
Comment 11 Nobody - feel free to take it CLA 2012-05-07 14:39:46 EDT
(In reply to comment #10)
> Mikhail, do we want this fixed for CDI for Juno?

I'll try.
Comment 12 Nobody - feel free to take it CLA 2012-05-09 15:05:54 EDT
Marc, this is fixed for DSF/GDB in 8.0.2, right? If so, we need to reassign it to DSF and close. To track the same issue fro CDI, I created a new bug - https://bugs.eclipse.org/bugs/show_bug.cgi?id=379043.
Comment 13 Marc Khouzam CLA 2012-05-09 15:13:26 EDT
(In reply to comment #12)
> Marc, this is fixed for DSF/GDB in 8.0.2, right? If so, we need to reassign it
> to DSF and close. To track the same issue fro CDI, I created a new bug -
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=379043.

Perfect!  Thanks.