Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 180123 Details for
Bug 317500
[processes] The id reported by -list-thread-groups has changed in GDB 7.2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix for 7_0
zpatch.txt (text/plain), 11.60 KB, created by
Marc Khouzam
on 2010-10-03 23:50:07 EDT
(
hide
)
Description:
Fix for 7_0
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2010-10-03 23:50:07 EDT
Size:
11.60 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java,v >retrieving revision 1.21.2.3 >diff -u -r1.21.2.3 GDBProcesses_7_0.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 20 Aug 2010 18:04:21 -0000 1.21.2.3 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 4 Oct 2010 03:19:09 -0000 >@@ -375,6 +375,10 @@ > * A map of thread id to thread group id. We use this to find out to which threadGroup a thread belongs. > */ > private Map<String, String> fThreadToGroupMap = new HashMap<String, String>(); >+ /** >+ * A map of thread group id to process id. We use this to find out to which pid a group refers. >+ */ >+ private Map<String, String> fGroupToPidMap = new HashMap<String, String>(); > > private IGDBControl fCommandControl; > private IGDBBackend fBackend; >@@ -532,10 +536,19 @@ > } > } > } >- IProcessDMContext processDmc = createProcessContext(controlDmc, groupId); >- return createContainerContext(processDmc, groupId); >+ >+ return createContainerContextFromGroupId(controlDmc, groupId); > } > >+ private IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) { >+ String pid = fGroupToPidMap.get(groupId); >+ if (pid == null) { >+ pid = groupId; >+ } >+ IProcessDMContext processDmc = createProcessContext(controlDmc, pid); >+ return createContainerContext(processDmc, groupId); >+ } >+ > public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) { > String groupId = containerDmc.getGroupId(); > List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>(); >@@ -748,11 +761,10 @@ > @Override > protected void handleFailure() { > // If the target is not available, generate the list ourselves >- IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[fDebuggedProcessesAndNames.size()]; >+ IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[fGroupToPidMap.size()]; > int i = 0; >- for (String groupId : fDebuggedProcessesAndNames.keySet()) { >- IProcessDMContext processDmc = createProcessContext(controlDmc, groupId); >- containerDmcs[i++] = createContainerContext(processDmc, groupId); >+ for (String groupId : fGroupToPidMap.keySet()) { >+ containerDmcs[i++] = createContainerContextFromGroupId(controlDmc, groupId); > } > rm.setData(containerDmcs); > rm.done(); >@@ -791,9 +803,7 @@ > // code can be removed when GDB 7.2 is released > // START OF WORKAROUND > if (groups.length == 0 && fBackend.getSessionType() == SessionType.CORE) { >- String groupId = MIProcesses.UNIQUE_GROUP_ID; >- IProcessDMContext processDmc = createProcessContext(controlDmc, groupId); >- return new IMIContainerDMContext[] {createContainerContext(processDmc, groupId)}; >+ return new IMIContainerDMContext[] {createContainerContextFromGroupId(controlDmc, MIProcesses.UNIQUE_GROUP_ID)}; > } > // END OF WORKAROUND to be removed when GDB 7.2 is available > >@@ -811,8 +821,7 @@ > continue; > } > String groupId = group.getGroupId(); >- IProcessDMContext procDmc = createProcessContext(controlDmc, groupId); >- containerDmcs.add(createContainerContext(procDmc, groupId)); >+ containerDmcs.add(createContainerContextFromGroupId(controlDmc, groupId)); > } > return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]); > } >@@ -1020,6 +1029,7 @@ > "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ > > String groupId = null; >+ String pId = null; > > MIResult[] results = exec.getMIResults(); > for (int i = 0; i < results.length; i++) { >@@ -1029,19 +1039,32 @@ > if (val instanceof MIConst) { > groupId = ((MIConst) val).getString().trim(); > } >+ } else if (var.equals("pid")) { //$NON-NLS-1$ >+ // Available starting with GDB 7.2 >+ if (val instanceof MIConst) { >+ pId = ((MIConst) val).getString().trim(); >+ } > } > } > >+ if (pId == null) { >+ // Before GDB 7.2, the groupId was the pid of the process >+ pId = groupId; >+ } >+ > if (groupId != null) { > if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$ >- fDebuggedProcessesAndNames.put(groupId, ""); //$NON-NLS-1$ >+ >+ fGroupToPidMap.put(groupId, pId); >+ >+ fDebuggedProcessesAndNames.put(pId, ""); //$NON-NLS-1$ > > // GDB is debugging a new process. Let's fetch its > // name and remember it. In order to get the name, > // we have to request all running processes, not > // just the ones being debugged. We got a lot more > // information when we request all processes. >- final String finalGroupId = groupId; >+ final String finalPId = pId; > fListThreadGroupsAvailableCache.execute( > fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true), > new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) { >@@ -1052,10 +1075,12 @@ > // sending of this command. > fListThreadGroupsAvailableCache.reset(); > >+ // Note that the output of the "-list-thread-groups --available" command >+ // still shows the pid as a groupId, even for GDB 7.2. > if (isSuccess()) { > for (IThreadGroupInfo groupInfo : getData().getGroupList()) { >- if (groupInfo.getPid().equals(finalGroupId)) { >- fDebuggedProcessesAndNames.put(finalGroupId, groupInfo.getName()); >+ if (groupInfo.getPid().equals(finalPId)) { >+ fDebuggedProcessesAndNames.put(finalPId, groupInfo.getName()); > } > } > } >@@ -1068,10 +1093,11 @@ > IProcessList list = null; > try { > list = CCorePlugin.getDefault().getProcessList(); >- int groupId_int = Integer.parseInt(finalGroupId); >+ int pId_int = Integer.parseInt(finalPId); > for (IProcessInfo procInfo : list.getProcessList()) { >- if (procInfo.getPid() == groupId_int) { >- fDebuggedProcessesAndNames.put(finalGroupId, procInfo.getName()); >+ if (procInfo.getPid() == pId_int) { >+ fDebuggedProcessesAndNames.put(finalPId, procInfo.getName()); >+ break; > } > } > } catch (CoreException e) { >@@ -1081,8 +1107,11 @@ > } > }); > } else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ >+ >+ fGroupToPidMap.remove(groupId); >+ > // GDB is no longer debugging this process. Remove it from our list. >- fDebuggedProcessesAndNames.remove(groupId); >+ fDebuggedProcessesAndNames.remove(pId); > > // Remove any entries for that group from our thread to group map > // When detaching from a group, we won't have received any thread-exited event >Index: src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java,v >retrieving revision 1.10.2.1 >diff -u -r1.10.2.1 MIRunControlEventProcessor_7_0.java >--- src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java 18 Aug 2010 12:20:53 -0000 1.10.2.1 >+++ src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java 4 Oct 2010 03:19:09 -0000 >@@ -11,8 +11,10 @@ > *******************************************************************************/ > package org.eclipse.cdt.dsf.mi.service.command; > >+import java.util.HashMap; > import java.util.LinkedList; > import java.util.List; >+import java.util.Map; > > import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; > import org.eclipse.cdt.dsf.datamodel.DMContexts; >@@ -89,7 +91,12 @@ > private final ICommandControlDMContext fControlDmc; > > private final DsfServicesTracker fServicesTracker; >- >+ >+ /** >+ * A map of thread group id to process id. We use this to find out to which pid a group refers. >+ */ >+ private Map<String, String> fGroupToPidMap = new HashMap<String, String>(); >+ > /** > * Creates the event processor and registers it as listener with the debugger > * control. >@@ -197,7 +204,11 @@ > IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class); > > if (procService != null) { >- IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId); >+ String pid = fGroupToPidMap.get(groupId); >+ if (pid == null) { >+ pid = groupId; >+ } >+ IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, pid); > IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId); > > MIEvent<?> event = null; >@@ -216,6 +227,7 @@ > "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ > > String groupId = null; >+ String pId = null; > > MIResult[] results = exec.getMIResults(); > for (int i = 0; i < results.length; i++) { >@@ -225,17 +237,31 @@ > if (val instanceof MIConst) { > groupId = ((MIConst) val).getString().trim(); > } >+ } else if (var.equals("pid")) { //$NON-NLS-1$ >+ // Available starting with GDB 7.2 >+ if (val instanceof MIConst) { >+ pId = ((MIConst) val).getString().trim(); >+ } > } > } >+ >+ if (pId == null) { >+ // Before GDB 7.2, the groupId was the pid of the process >+ pId = groupId; >+ } > > IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class); >- if (groupId != null && procService != null) { >- IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId); >+ if (pId != null && procService != null) { >+ IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, pId); > > MIEvent<?> event = null; > if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$ >+ fGroupToPidMap.put(groupId, pId); >+ > event = new MIThreadGroupCreatedEvent(procDmc, exec.getToken(), groupId); > } else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ >+ fGroupToPidMap.remove(groupId); >+ > event = new MIThreadGroupExitedEvent(procDmc, exec.getToken(), groupId); > } > >@@ -295,7 +321,12 @@ > procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class); > } else { > // This code would only trigger if the groupId was provided by MI >- procDmc = procService.createProcessContext(fControlDmc, groupId); >+ String pid = fGroupToPidMap.get(groupId); >+ if (pid == null) { >+ pid = groupId; >+ } >+ >+ procDmc = procService.createProcessContext(fControlDmc, pid); > containerDmc = procService.createContainerContext(procDmc, groupId); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
marc.khouzam
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 317500
:
180122
| 180123