Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319307 - Remote gdbserver attach does not show thread info right after the attach
Summary: Remote gdbserver attach does not show thread info right after the attach
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.0.1   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-08 15:10 EDT by Andy Jin CLA
Modified: 2010-07-16 13:23 EDT (History)
1 user (show)

See Also:
marc.khouzam: review? (pawel.1.piech)


Attachments
Proposed fix (3.79 KB, patch)
2010-07-15 11:59 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Fix for 7.0.1 (2.95 KB, patch)
2010-07-16 12:34 EDT, 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 Andy Jin CLA 2010-07-08 15:10:20 EDT
Build Identifier: I20100608-0911

When using gdb version lower than 7.0 the "remote gdbserver attach" launch does not show the thread info right after I attach to the remote process. As a result of this most of the debug buttons (step-over, step-in, etc.) are disabled. Manual refresh brings me the tread info but still does not expand to where the current break point is.

This problem does not observed when using gdb 7.0.

Refer to this CDT mailing list post for details. http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg19731.html


Reproducible: Always

Steps to Reproduce:
1. Create a "remote gdbserver attach" using gdb 6.8
2. Attach to a running process.
Comment 1 Marc Khouzam CLA 2010-07-14 11:46:57 EDT
I debugged this and I believe the problem is caused by a missing *stopped event when we attach to the process.  GDB 7.0 has a *stopped, but GDB 6.8 does not, and we need to dispatch one ourselves after the ^done of the attach command.  This should probably be done in MIRunControlEventProcessor#commandDone, where we already do this for stepping operations.
Comment 2 Marc Khouzam CLA 2010-07-15 11:59:24 EDT
Created attachment 174416 [details]
Proposed fix

Working with Andy, we came up with this fix.

I didn't commit it yet because something still puzzles me.
How come this problem does not happen for a local attach session?  I still don't see a *stopped event, but the thread list is shown.

I will also run the JUnit tests with this fix, to be safe.
Comment 3 Marc Khouzam CLA 2010-07-15 12:19:51 EDT
I believe the reason this bug did not happen with a local attach is that the local attach is done as part of the FinalLaunchSequence, which at the end, sends a DataModelInitializedEvent.  For the remote case, the DataModelInitializedEvent has already been sent by the time the user decides to attach to the process, which is why the *stopped event is needed.

This fix will actually trigger the stopped event for the local attach case also, which is technically even better.

The JUnit tests for GDB 6.8 all pass with this fix.

Committed to HEAD.
Comment 4 Marc Khouzam CLA 2010-07-15 12:21:25 EDT
Pawel, can you review?
Comment 6 Andy Jin CLA 2010-07-16 11:18:37 EDT
- I re-tested the fix with my product configuration and it fixes the issue of thread list not showing up in attach session.

However since our product is now based on CDT 7.0 release I can't include this fix because it's only checked in to CDT head. Is it possible to check in the fix to the cdt_7_0 branch so it can be included in the 7.0.1 release?
Comment 7 Marc Khouzam CLA 2010-07-16 12:34:53 EDT
Created attachment 174514 [details]
Fix for 7.0.1

This patch is for the 7_0 branch.  It is slightly different because I added isAttachingOperation() as a private local method to MIRunControlEventProcessor instead of adding it as an API in CLIEventProcessor.  

Committed to 7_0
Comment 8 Andy Jin CLA 2010-07-16 12:38:20 EDT
- Thanks Marc. Working fine for me now.
Comment 9 CDT Genie CLA 2010-07-16 13:23:01 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 319307: Added stopped event when getting an attach.

[*] MIRunControlEventProcessor.java 1.11.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java?root=Tools_Project&r1=1.11&r2=1.11.2.1