Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353423 - [run control][nonstop] Need a way to refresh the thread list and state in the run control service
Summary: [run control][nonstop] Need a way to refresh the thread list and state in the...
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.1   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-29 10:59 EDT by Marc Khouzam CLA
Modified: 2011-08-02 15:23 EDT (History)
2 users (show)

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


Attachments
Fix to ask GDB about all threads state and update our own structures (16.86 KB, patch)
2011-07-29 16:09 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Simpler fix for cdt_8_0 (6.22 KB, patch)
2011-08-01 11:24 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Update for master to use -thread-info instead (5.92 KB, patch)
2011-08-01 11:33 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Move refresh from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS for master (9.46 KB, patch)
2011-08-02 14:03 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Move refresh from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS for cdt_8_0 (9.29 KB, patch)
2011-08-02 14:13 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 Marc Khouzam CLA 2011-07-29 10:59:10 EDT
The run control service bases its knowledge of thread list and thread state on Suspended and Resumed event.  We currently have no way to refresh that information.

We should be able to update that entire information.

GDB has the command 
  -list-thread-groups --recurse 1 
which gives the list of threads and their state for all processes.
Comment 1 Marc Khouzam CLA 2011-07-29 16:05:34 EDT
This refreshing is valuable in non-stop mode where some threads could get out-of-sync between CDT and GDB.

In all-stop mode, either all threads are running or all of them are stopped, so the chance of getting out-of-sync is much smaller.
Comment 2 Marc Khouzam CLA 2011-07-29 16:09:27 EDT
Created attachment 200614 [details]
Fix to ask GDB about all threads state and update our own structures

When pressing the refresh button, we will send "-list-thread-groups --recurse 1" and compare the GDB thread states with our own structures.  For each difference we will send the Suspended/Resumed event that we missed.

I've only made this change starting with GDB 7.2 to keep things simpler.  GDB 7.3 is out, so I don't see the value in adding complexity to add this fix for GDB 7.1 (which is the earliest version that supports the --recurse option).

Committed to master.
Comment 3 CDT Genie CLA 2011-07-29 16:23:02 EDT
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 353423: Need a way to refresh the thread list and state in the run control service

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d2c51aec89dfaf71d8f4f0ff41c162861f8dc9af
Comment 4 Marc Khouzam CLA 2011-08-01 11:24:14 EDT
Created attachment 200660 [details]
Simpler fix for cdt_8_0

While trying to do the fix for cdt_8_0, I found that -thread-info with no arguments gave the information I needed.  No need to use the more obscure -list-thread-groups --recurse 1

So, this patch needs no API changes, which is what I needed for the maintenance branch.

Committed to cdt_8_0

For consistency and simplicity, I will change master to use -thread-info as well.
Comment 5 Marc Khouzam CLA 2011-08-01 11:33:49 EDT
Created attachment 200661 [details]
Update for master to use -thread-info instead

Here is the patch to make master use -thread-info instead of -list-thread-groups --recurse 1, which is more obscure.
Comment 6 Marc Khouzam CLA 2011-08-01 11:37:03 EDT
I committed the last patch to master.

BTW, another value in this fix, and my true motivation, was to show the correct threads when we stop thread visualization(see Bug 347514 comment 4).

Pawel, can you review?
Comment 7 CDT Genie CLA 2011-08-01 12:23:03 EDT
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 353423: Need a way to refresh the thread list and state in the run control service

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d2e7a581bcaa0f2473f64e38273cd770108bc300
Comment 8 CDT Genie CLA 2011-08-01 12:23:05 EDT
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 353423: Simpler solution using -thread-info instead of -list-thread-groups --recurse 1

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=fd690737ac882933c09e3217efe5863e3dd94f16
Comment 9 Marc Khouzam CLA 2011-08-02 13:50:28 EDT
Since the final solution uses -thread-info, we can use it as early as GDB 7.0.  I'm re-opening the bug to move the code from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS.
Comment 10 Marc Khouzam CLA 2011-08-02 14:03:17 EDT
Created attachment 200752 [details]
Move refresh from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS for master

Move refresh logic from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS for the master branch
Comment 11 Marc Khouzam CLA 2011-08-02 14:13:16 EDT
Created attachment 200753 [details]
Move refresh from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS for cdt_8_0

Move refresh logic from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS for the
cdt_8_0 branch.

I will commit both patches (master and cdt_8_0)
Comment 12 Marc Khouzam CLA 2011-08-02 14:14:30 EDT
Back to fixed
Comment 13 CDT Genie CLA 2011-08-02 14:23:10 EDT
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 353423: Move refreshing of thread states from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS since -thread-info is available since GDB 7.0

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=dba1e9d2bfb0c8fd08581b483f4fccc44a229205
Comment 14 CDT Genie CLA 2011-08-02 15:23:05 EDT
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 353423: Move refreshing of thread states from GDBRunControl_7_2_NS to GDBRunControl_7_0_NS since -thread-info is available since GDB 7.0

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=fc7775773ba515c894226f35ef1e3c09d35d775d