1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 335235 - Deadlock when pressing trace var button in Trace Control view when GDB is running

This commit is contained in:
Marc Khouzam 2011-05-18 18:09:23 +00:00
parent 9822a07fe2
commit 5af284cece
4 changed files with 28 additions and 20 deletions

View file

@ -14,10 +14,13 @@ import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable; import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.concurrent.Query; import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
@ -282,25 +285,16 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
return; return;
} }
Query<Object> query = new Query<Object>() { getSession().getExecutor().execute(
@Override new DsfRunnable() {
protected void execute(DataRequestMonitor<Object> rm) { public void run() {
final IGDBTraceControl traceControl = getService(IGDBTraceControl.class); final IGDBTraceControl traceControl = getService(IGDBTraceControl.class);
if (traceControl != null) { if (traceControl != null) {
ITraceRecordDMContext emptyDmc = traceControl.createTraceRecordContext(ctx, "-1"); //$NON-NLS-1$ ITraceRecordDMContext emptyDmc = traceControl.createTraceRecordContext(ctx, "-1"); //$NON-NLS-1$
traceControl.selectTraceRecord(emptyDmc, rm); traceControl.selectTraceRecord(emptyDmc, new RequestMonitor(ImmediateExecutor.getInstance(), null));
} else { }
rm.setData(null); }
rm.done(); });
}
}
};
try {
getSession().getExecutor().execute(query);
query.get();
} catch (InterruptedException exc) {
} catch (ExecutionException exc) {
}
} }
protected void updateDebugContext() { protected void updateDebugContext() {
@ -513,9 +507,10 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
}; };
try { try {
getSession().getExecutor().execute(query); getSession().getExecutor().execute(query);
return query.get(); return query.get(1, TimeUnit.SECONDS);
} catch (InterruptedException exc) { } catch (InterruptedException exc) {
} catch (ExecutionException exc) { } catch (ExecutionException exc) {
} catch (TimeoutException e) {
} }
return null; return null;

View file

@ -250,6 +250,17 @@ public final class TraceVarDetailsDialog extends Dialog {
protected void handleRefresh() { protected void handleRefresh() {
ITraceVariableDMData[] vars = fView.getTraceVarList(); ITraceVariableDMData[] vars = fView.getTraceVarList();
if (vars == null) {
setWarningVisible(TracepointsMessages.TraceControlView_refresh_variable_error);
createButton.setEnabled(false);
return;
}
// Remove the warning and re-enable the create button, since we now
// have a list of trace variables.
setWarningVisible(false);
createButton.setEnabled(true);
table.removeAll(); table.removeAll();
for (ITraceVariableDMData var : vars) { for (ITraceVariableDMData var : vars) {
String currentVal = var.getValue(); String currentVal = var.getValue();

View file

@ -37,6 +37,7 @@ public final class TracepointsMessages extends NLS {
public static String TraceControlView_create_variable_error; public static String TraceControlView_create_variable_error;
public static String TraceControlView_create_variable_empty_name_error; public static String TraceControlView_create_variable_empty_name_error;
public static String TraceControlView_action_exit_visualization_mode; public static String TraceControlView_action_exit_visualization_mode;
public static String TraceControlView_refresh_variable_error;
static { static {
NLS.initializeMessages(TracepointsMessages.class.getName(), TracepointsMessages.class); NLS.initializeMessages(TracepointsMessages.class.getName(), TracepointsMessages.class);

View file

@ -25,3 +25,4 @@ TraceControlView_trace_variable_details_value_label=Value:
TraceControlView_create_variable_error=Error creating trace variable TraceControlView_create_variable_error=Error creating trace variable
TraceControlView_create_variable_empty_name_error=Cannot create variable with empty name TraceControlView_create_variable_empty_name_error=Cannot create variable with empty name
TraceControlView_action_exit_visualization_mode=Exit Visualization Mode TraceControlView_action_exit_visualization_mode=Exit Visualization Mode
TraceControlView_refresh_variable_error=Unable to retrieve trace variables