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 114481 Details for
Bug 248636
[memory] Memory service does not properly use the MemoryContext to select the proper process
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]
Propposed fix
zpatch.txt (text/plain), 14.77 KB, created by
Marc Khouzam
on 2008-10-07 16:29:57 EDT
(
hide
)
Description:
Propposed fix
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2008-10-07 16:29:57 EDT
Size:
14.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.dd.mi >Index: src/org/eclipse/dd/mi/service/MIMemory.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.dd.dsf/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIMemory.java,v >retrieving revision 1.17 >diff -u -r1.17 MIMemory.java >--- src/org/eclipse/dd/mi/service/MIMemory.java 7 Oct 2008 18:48:29 -0000 1.17 >+++ src/org/eclipse/dd/mi/service/MIMemory.java 7 Oct 2008 20:21:28 -0000 >@@ -13,7 +13,6 @@ > *******************************************************************************/ > package org.eclipse.dd.mi.service; > >-import java.util.Hashtable; > import java.util.LinkedList; > import java.util.ListIterator; > >@@ -112,8 +111,8 @@ > */ > private void doInitialize(final RequestMonitor requestMonitor) { > >- // Register this service >- register(new String[] { MIMemory.class.getName(), IMemory.class.getName() }, new Hashtable<String, String>()); >+// // Register this service >+// register(new String[] { MIMemory.class.getName(), IMemory.class.getName() }, new Hashtable<String, String>()); > > // Create the memory requests cache > fMemoryCache = new MIMemoryCache(); >@@ -131,8 +130,8 @@ > @Override > public void shutdown(final RequestMonitor requestMonitor) { > >- // Unregister this service >- unregister(); >+// // Unregister this service >+// unregister(); > > // Remove event listener > getSession().removeServiceEventListener(this); >@@ -149,6 +148,17 @@ > return MIPlugin.getBundleContext(); > } > >+ /** >+ * @since 1.1 >+ */ >+ protected CommandCache getCommandCache() { return fMemoryCache.fCommandCache; } >+ >+ /** >+ * @since 1.1 >+ */ >+ protected void setMemoryCache(MIMemoryCache cache) { fMemoryCache = cache; } >+ >+ > /////////////////////////////////////////////////////////////////////////// > // IMemory > /////////////////////////////////////////////////////////////////////////// >@@ -440,7 +450,10 @@ > // MIMemoryCache > /////////////////////////////////////////////////////////////////////////// > >- private class MIMemoryCache { >+ /** >+ * @since 1.1 >+ */ >+ protected class MIMemoryCache { > > // Back-end commands cache > private CommandCache fCommandCache; >@@ -848,7 +861,7 @@ > * @param count > * @param drm > */ >- private void readMemoryBlock(IMemoryDMContext memoryDMC, IAddress address, final long offset, >+ protected void readMemoryBlock(IDMContext dmc, IAddress address, final long offset, > final int word_size, final int count, final DataRequestMonitor<MemoryByte[]> drm) > { > /* To simplify the parsing of the MI result, we request the output to >@@ -860,7 +873,7 @@ > Character asChar = null; > > fCommandCache.execute( >- new MIDataReadMemory(memoryDMC, offset, address.toString(), mode, word_size, nb_rows, nb_cols, asChar), >+ new MIDataReadMemory(dmc, offset, address.toString(), mode, word_size, nb_rows, nb_cols, asChar), > new DataRequestMonitor<MIDataReadMemoryInfo>(getExecutor(), drm) { > @Override > protected void handleSuccess() { >@@ -890,7 +903,7 @@ > * @param buffer > * @param rm > */ >- private void writeMemoryBlock(final IMemoryDMContext memoryDMC, final IAddress address, final long offset, >+ protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, > final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) > { > // Each byte is written individually (GDB power...) >@@ -906,7 +919,7 @@ > for (int i = 0; i < count; i++) { > String value = new Byte(buffer[i]).toString(); > fCommandCache.execute( >- new MIDataWriteMemory(memoryDMC, offset + i, baseAddress, format, word_size, value), >+ new MIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), > new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM) > ); > } >#P org.eclipse.dd.gdb >Index: src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.dd.dsf/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java,v >retrieving revision 1.17 >diff -u -r1.17 GDBProcesses_7_0.java >--- src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java 6 Oct 2008 18:39:30 -0000 1.17 >+++ src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java 7 Oct 2008 20:21:28 -0000 >@@ -10,9 +10,11 @@ > *******************************************************************************/ > package org.eclipse.dd.gdb.internal.provisional.service; > >+import java.util.ArrayList; > import java.util.HashMap; > import java.util.Hashtable; > import java.util.Iterator; >+import java.util.List; > import java.util.Map; > > import org.eclipse.core.runtime.IStatus; >@@ -75,7 +77,7 @@ > * > */ > public class GDBProcesses_7_0 extends AbstractDsfService >- implements IMIProcesses, ICachingService, IEventListener { >+ implements IGDBProcesses, ICachingService, IEventListener { > > // Below is the context hierarchy that is implemented between the > // MIProcesses service and the MIRunControl service for the MI >@@ -393,6 +395,7 @@ > // Register this service. > register(new String[] { IProcesses.class.getName(), > IMIProcesses.class.getName(), >+ IGDBProcesses.class.getName(), > GDBProcesses_7_0.class.getName() }, > new Hashtable<String, String>()); > >@@ -448,6 +451,24 @@ > return createContainerContext(processDmc, groupId); > } > >+ public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) { >+ String groupId = containerDmc.getGroupId(); >+ List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>(); >+ Iterator<Map.Entry<String, String>> iterator = fThreadToGroupMap.entrySet().iterator(); >+ while (iterator.hasNext()){ >+ Map.Entry<String, String> entry = iterator.next(); >+ if (entry.getValue().equals(groupId)) { >+ String threadId = entry.getKey(); >+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class); >+ IMIExecutionDMContext execDmc = createExecutionContext(containerDmc, >+ createThreadContext(procDmc, threadId), >+ threadId); >+ execDmcList.add(execDmc); >+ } >+ } >+ return execDmcList.toArray(new IMIExecutionDMContext[0]); >+ } >+ > /** > * This method obtains the model data for a given IThreadDMContext object > * which can represent a thread or a process. >Index: src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.dd.dsf/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java,v >retrieving revision 1.9 >diff -u -r1.9 GdbDebugServicesFactory.java >--- src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java 11 Sep 2008 19:36:53 -0000 1.9 >+++ src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java 7 Oct 2008 20:21:28 -0000 >@@ -31,7 +31,6 @@ > import org.eclipse.dd.mi.service.MIBreakpoints; > import org.eclipse.dd.mi.service.MIBreakpointsManager; > import org.eclipse.dd.mi.service.MIDisassembly; >-import org.eclipse.dd.mi.service.MIMemory; > import org.eclipse.dd.mi.service.MIModules; > import org.eclipse.dd.mi.service.MIRegisters; > import org.eclipse.dd.mi.service.MIStack; >@@ -92,7 +91,11 @@ > > @Override > protected IMemory createMemoryService(DsfSession session) { >- return new MIMemory(session); >+ if ("6.8".compareTo(fVersion) < 0) { //$NON-NLS-1$ >+ return new GDBMemory_7_0(session); >+ } >+ >+ return new GDBMemory(session); > } > > @Override >Index: src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory.java >=================================================================== >RCS file: src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory.java >diff -N src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+package org.eclipse.dd.gdb.internal.provisional.service; >+ >+import java.util.Hashtable; >+ >+import org.eclipse.dd.dsf.concurrent.RequestMonitor; >+import org.eclipse.dd.dsf.debug.service.IMemory; >+import org.eclipse.dd.dsf.service.DsfSession; >+import org.eclipse.dd.mi.service.MIMemory; >+ >+public class GDBMemory extends MIMemory { >+ >+ public GDBMemory(DsfSession session) { >+ super(session); >+ } >+ >+ @Override >+ public void initialize(final RequestMonitor requestMonitor) { >+ super.initialize( >+ new RequestMonitor(getExecutor(), requestMonitor) { >+ @Override >+ public void handleSuccess() { >+ doInitialize(requestMonitor); >+ }}); >+ } >+ >+ private void doInitialize(final RequestMonitor requestMonitor) { >+ register(new String[] { MIMemory.class.getName(), IMemory.class.getName(), GDBMemory.class.getName()}, >+ new Hashtable<String, String>()); >+ requestMonitor.done(); >+ } >+ >+ @Override >+ public void shutdown(final RequestMonitor requestMonitor) { >+ unregister(); >+ super.shutdown(requestMonitor); >+ } >+ >+ >+} >Index: src/org/eclipse/dd/gdb/internal/provisional/service/IGDBProcesses.java >=================================================================== >RCS file: src/org/eclipse/dd/gdb/internal/provisional/service/IGDBProcesses.java >diff -N src/org/eclipse/dd/gdb/internal/provisional/service/IGDBProcesses.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dd/gdb/internal/provisional/service/IGDBProcesses.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Ericsson and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Ericsson - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.dd.gdb.internal.provisional.service; >+ >+import org.eclipse.dd.mi.service.IMIContainerDMContext; >+import org.eclipse.dd.mi.service.IMIExecutionDMContext; >+import org.eclipse.dd.mi.service.IMIProcesses; >+ >+public interface IGDBProcesses extends IMIProcesses { >+ /** >+ * Get a list of all execution contexts belonging to a container. This call is synchronous, >+ * unlike the call to getProcessesBeingDebugged(). However, some services may not be able >+ * to fulfill this request synchronously and will have to rely on getProcessesBeingDebugged(). >+ * >+ * @param containerDmc The container for which we want to get the execution contexts >+ */ >+ IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc); >+ >+} >Index: src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory_7_0.java >=================================================================== >RCS file: src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory_7_0.java >diff -N src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory_7_0.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/dd/gdb/internal/provisional/service/GDBMemory_7_0.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,103 @@ >+package org.eclipse.dd.gdb.internal.provisional.service; >+ >+import java.util.Hashtable; >+ >+import org.eclipse.cdt.core.IAddress; >+import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; >+import org.eclipse.dd.dsf.concurrent.RequestMonitor; >+import org.eclipse.dd.dsf.datamodel.DMContexts; >+import org.eclipse.dd.dsf.datamodel.IDMContext; >+import org.eclipse.dd.dsf.debug.service.IMemory; >+import org.eclipse.dd.dsf.service.DsfSession; >+import org.eclipse.dd.mi.service.IMIContainerDMContext; >+import org.eclipse.dd.mi.service.IMIExecutionDMContext; >+import org.eclipse.dd.mi.service.MIMemory; >+import org.eclipse.debug.core.model.MemoryByte; >+ >+public class GDBMemory_7_0 extends MIMemory { >+ >+ public GDBMemory_7_0(DsfSession session) { >+ super(session); >+ } >+ >+ @Override >+ public void initialize(final RequestMonitor requestMonitor) { >+ super.initialize( >+ new RequestMonitor(getExecutor(), requestMonitor) { >+ @Override >+ public void handleSuccess() { >+ doInitialize(requestMonitor); >+ }}); >+ } >+ >+ private void doInitialize(final RequestMonitor requestMonitor) { >+ register(new String[] { MIMemory.class.getName(), IMemory.class.getName(), GDBMemory_7_0.class.getName()}, >+ new Hashtable<String, String>()); >+ >+ setMemoryCache(new GDBMemoryCache()); >+ >+ requestMonitor.done(); >+ } >+ >+ @Override >+ public void shutdown(final RequestMonitor requestMonitor) { >+ unregister(); >+ super.shutdown(requestMonitor); >+ } >+ >+ protected class GDBMemoryCache extends MIMemoryCache { >+ @Override >+ protected void readMemoryBlock(IDMContext dmc, IAddress address, final long offset, >+ final int word_size, final int count, final DataRequestMonitor<MemoryByte[]> drm) >+ { >+ IDMContext threadOrMemoryDmc = dmc; >+ >+ IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class); >+ if(containerCtx != null) { >+ IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class); >+ >+ if (procService != null) { >+ IMIExecutionDMContext[] execCtxs = procService.getExecutionContexts(containerCtx); >+ // Return any thread... let's take the first one. >+ if (execCtxs != null && execCtxs.length > 0) { >+ threadOrMemoryDmc = execCtxs[0]; >+ } >+ } >+ } >+ >+ super.readMemoryBlock(threadOrMemoryDmc, address, offset, word_size, count, drm); >+ } >+ >+ /** >+ * @param memoryDMC >+ * @param address >+ * @param offset >+ * @param word_size >+ * @param count >+ * @param buffer >+ * @param rm >+ */ >+ @Override >+ protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, >+ final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) >+ { >+ IDMContext threadOrMemoryDmc = dmc; >+ >+ IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class); >+ if(containerCtx != null) { >+ IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class); >+ >+ if (procService != null) { >+ IMIExecutionDMContext[] execCtxs = procService.getExecutionContexts(containerCtx); >+ // Return any thread... let's take the first one. >+ if (execCtxs != null && execCtxs.length > 0) { >+ threadOrMemoryDmc = execCtxs[0]; >+ } >+ } >+ } >+ >+ super.writeMemoryBlock(threadOrMemoryDmc, address, offset, word_size, count, buffer, rm); >+ } >+ } >+ >+}
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
Actions:
View
|
Diff
Attachments on
bug 248636
:
114416
|
114481
|
114708
|
114833