From 2fd8cfac1dfa56578670edafc95dd49b5ce7da2a Mon Sep 17 00:00:00 2001 From: John Cortell Date: Thu, 29 Apr 2010 19:17:18 +0000 Subject: [PATCH] Bug 310914: Fix to avoid fallback of obtaining process list natively when debugging remotely --- .../cdt/dsf/gdb/service/GDBProcesses_7_0.java | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java index 4a84a6e776e..19e104fe722 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java @@ -823,19 +823,28 @@ public class GDBProcesses_7_0 extends AbstractDsfService rm.setData(makeProcessDMCAndData(controlDmc, getData().getGroupList())); } else { // Looks like this gdb doesn't truly support - // "-list-thread-groups --available". Resort to - // how we do things with gdb 6.8 - IProcessList list = null; - try { - list = CCorePlugin.getDefault().getProcessList(); - } catch (CoreException e) { + // "-list-thread-groups --available". If we're + // debugging locally, resort to getting the + // list natively (as we do with gdb 6.8). If + // we're debugging remotely, the user is out + // of luck + IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class); + if (backend.getSessionType() == SessionType.LOCAL) { + IProcessList list = null; + try { + list = CCorePlugin.getDefault().getProcessList(); + } catch (CoreException e) { + } + + if (list == null) { + rm.setData(new IProcessDMContext[0]); + } else { + IProcessInfo[] procInfos = list.getProcessList(); + rm.setData(makeProcessDMCAndData(controlDmc, procInfos)); + } } - - if (list == null) { + else { rm.setData(new IProcessDMContext[0]); - } else { - IProcessInfo[] procInfos = list.getProcessList(); - rm.setData(makeProcessDMCAndData(controlDmc, procInfos)); } } rm.done(); @@ -1038,17 +1047,20 @@ public class GDBProcesses_7_0 extends AbstractDsfService else { // Looks like this gdb doesn't truly support // "-list-thread-groups --available". Get the - // process list natively - IProcessList list = null; - try { - list = CCorePlugin.getDefault().getProcessList(); - int groupId_int = Integer.parseInt(finalGroupId); - for (IProcessInfo procInfo : list.getProcessList()) { - if (procInfo.getPid() == groupId_int) { - fDebuggedProcessesAndNames.put(finalGroupId, procInfo.getName()); - } - } - } catch (CoreException e) { + // process list natively if we're debugging locally + IGDBBackend backend = getServicesTracker().getService(IGDBBackend.class); + if (backend.getSessionType() == SessionType.LOCAL) { + IProcessList list = null; + try { + list = CCorePlugin.getDefault().getProcessList(); + int groupId_int = Integer.parseInt(finalGroupId); + for (IProcessInfo procInfo : list.getProcessList()) { + if (procInfo.getPid() == groupId_int) { + fDebuggedProcessesAndNames.put(finalGroupId, procInfo.getName()); + } + } + } catch (CoreException e) { + } } } }