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 178929 Details for
Bug 237306
[multicore][multi-process] Support for Multi-Process debugging
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]
multi process debug(gdbserver)
15sep2010multiproc.txt (text/plain), 38.94 KB, created by
Onur Akdemir
on 2010-09-15 09:47:16 EDT
(
hide
)
Description:
multi process debug(gdbserver)
Filename:
MIME Type:
Creator:
Onur Akdemir
Created:
2010-09-15 09:47:16 EDT
Size:
38.94 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.dsf >Index: src/org/eclipse/cdt/dsf/debug/service/IProcesses.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IProcesses.java,v >retrieving revision 1.5 >diff -u -r1.5 IProcesses.java >--- src/org/eclipse/cdt/dsf/debug/service/IProcesses.java 3 Jun 2010 00:11:48 -0000 1.5 >+++ src/org/eclipse/cdt/dsf/debug/service/IProcesses.java 15 Sep 2010 07:03:16 -0000 >@@ -101,6 +101,15 @@ > * debugging IDMContexts through {@link #getProcessesBeingDebugged(IDMContext, DataRequestMonitor) > */ > void attachDebuggerToProcess(IProcessDMContext procCtx, DataRequestMonitor<IDMContext> rm); >+ >+ /** >+ * Attaches debugger to the given process. >+ * When attaching to a process, a debugging context can now be used to characterize the process. >+ * This method can optionally choose to return this IDMContext inside the DataRequestMonitor. >+ * This can be useful for backends that do not have the ability to obtain the different >+ * debugging IDMContexts through {@link #getProcessesBeingDebugged(IDMContext, DataRequestMonitor) >+ */ >+ void attachDebuggerToProcess(IProcessDMContext procCtx, String executableFile , DataRequestMonitor<IDMContext> rm); > > /** > * Checks whether it is possible to detach the debugger from the specified process. >@@ -123,7 +132,7 @@ > * @param rm Return if it is possible to run a new process. > */ > void isRunNewProcessSupported(IDMContext dmc, DataRequestMonitor<Boolean> rm); >- >+ > /** > * Starts a new process. > * @param dmc The processor or core on which we want to run a new process. >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/gdb/actions/ISelectInferior.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/actions/ISelectInferior.java >diff -N src/org/eclipse/cdt/dsf/gdb/actions/ISelectInferior.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/actions/ISelectInferior.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+/******************************************************************************* >+ * 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.cdt.dsf.gdb.actions; >+ >+ >+/** >+ * @since 1.1 >+ */ >+public interface ISelectInferior { >+ /** >+ * Causes this element to attempt to select a new process >+ */ >+ public void selectInferior(Object object); >+} >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.26 >diff -u -r1.26 GDBProcesses_7_0.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 20 Aug 2010 18:01:44 -0000 1.26 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java 15 Sep 2010 07:03:18 -0000 >@@ -1130,4 +1130,10 @@ > } > } > } >+ >+ public void attachDebuggerToProcess(IProcessDMContext procCtx, >+ String executableFile, DataRequestMonitor<IDMContext> rm) { >+ // TODO Auto-generated method stub >+ >+ } > } >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java >diff -N src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,322 @@ >+package org.eclipse.cdt.dsf.gdb.service; >+ >+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; >+import org.eclipse.cdt.dsf.concurrent.RequestMonitor; >+import org.eclipse.cdt.dsf.datamodel.DMContexts; >+import org.eclipse.cdt.dsf.datamodel.IDMContext; >+import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl; >+import org.eclipse.cdt.dsf.debug.service.command.CommandCache; >+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; >+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; >+import org.eclipse.cdt.dsf.gdb.service.command.GDBControlDMContext; >+import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; >+import org.eclipse.cdt.dsf.mi.service.IMICommandControl; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; >+import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext; >+import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; >+import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo; >+import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; >+import org.eclipse.cdt.dsf.service.DsfSession; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+ >+public class GDBProcesses_7_2 extends GDBProcesses_7_1{ >+ >+ private CommandFactory fCommandFactory; >+ // This cache is used when we send command to get the cores. >+ // The value of the cores can change at any time, but we provide >+ // an updated value whenever there is a suspended event. >+ private CommandCache fCommandForCoresCache; >+ private IGDBControl fCommandControl; >+ >+ // A cache for commands about the threadGroups >+ private CommandCache fContainerCommandCache; >+ >+ >+ public GDBProcesses_7_2(DsfSession session) { >+ super(session); >+ } >+ >+ @Override >+ public void initialize(final RequestMonitor requestMonitor) { >+ super.initialize(new RequestMonitor(getExecutor(), requestMonitor) { >+ @Override >+ protected void handleSuccess() { >+ doInitialize(requestMonitor); >+ } >+ }); >+ } >+ >+ /** >+ * This method initializes this service after our superclass's initialize() >+ * method succeeds. >+ * >+ * @param requestMonitor >+ * The call-back object to notify when this service's >+ * initialization is done. >+ */ >+ private void doInitialize(RequestMonitor requestMonitor) { >+ fCommandControl = getServicesTracker().getService(IGDBControl.class); >+ >+ BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fCommandControl, getExecutor(), 2); >+ >+ // This caches stores the result of a command when received; also, this cache >+ // is manipulated when receiving events. Currently, events are received after >+ // three scheduling of the executor, while command results after only one. This >+ // can cause problems because command results might be processed before an event >+ // that actually arrived before the command result. >+ // To solve this, we use a bufferedCommandControl that will delay the command >+ // result by two scheduling of the executor. >+ // See bug 280461 >+ fCommandForCoresCache = new CommandCache(getSession(), >+ new BufferedCommandControl(fCommandControl, getExecutor(), 2)); >+ fCommandForCoresCache.setContextAvailable(fCommandControl.getContext(), true); >+ >+ fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); >+ >+ fContainerCommandCache = new CommandCache(getSession(), bufferedCommandControl); >+ fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true); >+ >+ getSession().addServiceEventListener(this, null); >+ >+ requestMonitor.done(); >+ } >+ >+ @Override >+ public void shutdown(RequestMonitor requestMonitor) { >+ getSession().removeServiceEventListener(this); >+ >+ super.shutdown(requestMonitor); >+ } >+ >+ /* * inferior x >+ * (gdb) >+ */ >+ >+ public void switchInferior(IDMContext dmc, Object selection , final DataRequestMonitor<IProcessDMContext> rm ) { >+ char inferiorId = (char) -1; >+ if (dmc instanceof GDBControlDMContext) { //regular expressions ile yap >+ int start = (selection.toString()).indexOf("["); >+ int len = "[".length(); >+ int count = 1; >+ while (start != -1) { >+ start = (selection.toString()).indexOf("[", start+len); >+ count++; >+ if ( count == 3){ >+ inferiorId = (selection.toString()).charAt(start+2); // sadece tek rakamları parse eder 11 , 101 ???? >+ } >+ } >+ >+ if ( inferiorId != -1 && isInteger(String.valueOf(inferiorId)) ){ >+ ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class); >+ fCommandControl.queueCommand(fCommandFactory.createCLISwitchInferior(controlDmc ,String.valueOf(inferiorId)), >+ new DataRequestMonitor<MIInfo>(getExecutor(), rm) { >+ @Override >+ protected void handleSuccess() { >+ // BUraya sonucu dogrulugu icin info eklenmelidir. >+ rm.done(); >+ } >+ }); >+ } >+ } else { >+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$ >+ rm.done(); >+ } >+ } >+ >+ public boolean isInteger( String input ) >+ { >+ try >+ { >+ Integer.parseInt( input ); >+ return true; >+ } >+ catch( Exception e) >+ { >+ return false; >+ } >+ } >+ >+ @Override >+ public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String file , DataRequestMonitor<IDMContext> rm) { >+ final IProcessDMContext procDmc = procCtx; >+ final DataRequestMonitor<IDMContext> requestmonitor = rm; >+ final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procDmc, ICommandControlDMContext.class); >+ fCommandControl.queueCommand(fCommandFactory.createMIAddInferior(controlDmc), >+ new DataRequestMonitor<MIAddInferiorInfo>(getExecutor(), requestmonitor) { >+ @Override >+ protected void handleSuccess() { >+ if ( getData().getGroupId() != null ){ >+ fCommandControl.queueCommand(fCommandFactory.createCLISwitchInferior(controlDmc ,getData().getGroupId().substring(1, 2)), >+ new DataRequestMonitor<MIInfo>(getExecutor(), requestmonitor) { >+ @Override >+ protected void handleSuccess() { >+ if (procCtx instanceof IMIProcessDMContext) { >+ DataRequestMonitor<Boolean> rm_bool = new DataRequestMonitor<Boolean>(getExecutor(), requestmonitor); >+ isDebuggerAttachSupported(null, rm_bool); >+ if (!rm_bool.getData()) { >+ requestmonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Attach not supported.", null)); //$NON-NLS-1$ >+ requestmonitor.done(); >+ return; >+ } >+ >+ final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class); >+ fCommandControl.queueCommand( >+ fCommandFactory.createMITargetAttach(controlDmc, ((IMIProcessDMContext)procCtx).getProcId()), >+ new DataRequestMonitor<MIInfo>(getExecutor(), requestmonitor) { >+ @Override >+ protected void handleSuccess() { >+ fCommandControl.queueCommand( >+ fCommandFactory.createMIFileExecAndSymbols(controlDmc, file) , >+ >+ new DataRequestMonitor<MIInfo>(getExecutor(), requestmonitor)); >+ >+ IMIContainerDMContext containerDmc = createContainerContext(procCtx, >+ ((IMIProcessDMContext)procCtx).getProcId()); >+ requestmonitor.setData(containerDmc); >+ requestmonitor.done(); >+ } >+ }); >+ >+ } else { >+ requestmonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid process context.", null)); //$NON-NLS-1$ >+ requestmonitor.done(); >+ } >+ } >+ }); >+ >+ } >+ >+ } >+ }); >+ rm.done(); >+ >+ } >+ >+/* >+ public void eventReceived(Object output) { >+ for (MIOOBRecord oobr : ((MIOutput)output).getMIOOBRecords()) { >+ if (oobr instanceof MINotifyAsyncOutput) { >+ MINotifyAsyncOutput exec = (MINotifyAsyncOutput) oobr; >+ String miEvent = exec.getAsyncClass(); >+ if ("thread-created".equals(miEvent) || "thread-exited".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$ >+ String threadId = null; >+ String groupId = null; >+ >+ MIResult[] results = exec.getMIResults(); >+ for (int i = 0; i < results.length; i++) { >+ String var = results[i].getVariable(); >+ MIValue val = results[i].getMIValue(); >+ if (var.equals("group-id")) { //$NON-NLS-1$ >+ if (val instanceof MIConst) { >+ groupId = ((MIConst) val).getString(); >+ } >+ } else if (var.equals("id")) { //$NON-NLS-1$ >+ if (val instanceof MIConst) { >+ threadId = ((MIConst) val).getString(); >+ } >+ } >+ } >+ >+ if ("thread-created".equals(miEvent)) { //$NON-NLS-1$ >+ // Update the thread to groupId map with the new groupId >+ fThreadToGroupMap.put(threadId, groupId); >+ } else { >+ fThreadToGroupMap.remove(threadId); >+ } >+ } else if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent) || //$NON-NLS-1$ //$NON-NLS-2$ >+ "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ >+ >+ String groupId = null; >+ String infNo = null; >+ >+ MIResult[] results = exec.getMIResults(); >+ for (int i = 0; i < results.length; i++) { >+ String var = results[i].getVariable(); >+ MIValue val = results[i].getMIValue(); >+ if (var.equals("pid")) { //$NON-NLS-1$ >+ if (val instanceof MIConst) { >+ groupId = ((MIConst) val).getString().trim(); >+ } >+ } >+ if (var.equals("id")) { //$NON-NLS-1$ >+ if (val instanceof MIConst) { >+ infNo = ((MIConst) val).getString().trim(); >+ } >+ } >+ } >+ >+ 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$ >+ >+ // 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 finalInfNo = infNo; >+ fListThreadGroupsAvailableCache.execute( >+ fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true), >+ new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) { >+ @Override >+ protected void handleCompleted() { >+ // We cannot actually cache this command since the process >+ // list may change. But this cache allows to avoid overlapping >+ // sending of this command. >+ fListThreadGroupsAvailableCache.reset(); >+ >+ if (isSuccess()) { >+ for (IThreadGroupInfo groupInfo : getData().getGroupList()) { >+ if (groupInfo.getPid().equals(finalGroupId)) { >+ fDebuggedProcessesAndNames.put(finalInfNo, groupInfo.getDesciption()); >+ } >+ } >+ } >+ else { >+ // Looks like this gdb doesn't truly support >+ // "-list-thread-groups --available". Get the >+ // 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) { >+ } >+ } >+ } >+ } >+ }); >+ } else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$ >+ // GDB is no longer debugging this process. Remove it from our list. >+ fDebuggedProcessesAndNames.remove(groupId); >+ >+ // 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 >+ // but we don't want to keep those entries. >+ if (fThreadToGroupMap.containsValue(groupId)) { >+ Iterator<Map.Entry<String, String>> iterator = fThreadToGroupMap.entrySet().iterator(); >+ while (iterator.hasNext()){ >+ if (iterator.next().getValue().equals(groupId)) { >+ iterator.remove(); >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ */ >+ >+} >+ >Index: src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java,v >retrieving revision 1.13 >diff -u -r1.13 GdbDebugServicesFactory.java >--- src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java 26 Aug 2010 17:58:46 -0000 1.13 >+++ src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java 15 Sep 2010 07:03:21 -0000 >@@ -139,6 +139,9 @@ > > @Override > protected IProcesses createProcessesService(DsfSession session) { >+ if (GDB_7_2_VERSION.compareTo(fVersion) <= 0) { >+ return new GDBProcesses_7_2(session); >+ } > if (GDB_7_1_VERSION.compareTo(fVersion) <= 0) { > return new GDBProcesses_7_1(session); > } >@@ -147,7 +150,7 @@ > } > return new GDBProcesses(session); > } >- >+ > @Override > protected IRegisters createRegistersService(DsfSession session) { > return new MIRegisters(session); >Index: src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java,v >retrieving revision 1.8 >diff -u -r1.8 MIProcesses.java >--- src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java 3 Jun 2010 00:09:36 -0000 1.8 >+++ src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java 15 Sep 2010 07:03:21 -0000 >@@ -682,4 +682,10 @@ > public void flushCache(IDMContext context) { > fContainerCommandCache.reset(context); > } >+ >+ public void attachDebuggerToProcess(IProcessDMContext procCtx, >+ String executableFile, DataRequestMonitor<IDMContext> rm) { >+ // TODO Auto-generated method stub >+ >+ } > } >Index: src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java,v >retrieving revision 1.16 >diff -u -r1.16 CommandFactory.java >--- src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java 2 Sep 2010 12:34:31 -0000 1.16 >+++ src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java 15 Sep 2010 07:03:21 -0000 >@@ -39,6 +39,7 @@ > import org.eclipse.cdt.dsf.mi.service.command.commands.CLIPasscount; > import org.eclipse.cdt.dsf.mi.service.command.commands.CLIRecord; > import org.eclipse.cdt.dsf.mi.service.command.commands.CLISource; >+import org.eclipse.cdt.dsf.mi.service.command.commands.CLISwicthInferior; > import org.eclipse.cdt.dsf.mi.service.command.commands.CLIThread; > import org.eclipse.cdt.dsf.mi.service.command.commands.CLITrace; > import org.eclipse.cdt.dsf.mi.service.command.commands.CLIUnsetEnv; >@@ -241,6 +242,10 @@ > return new CLISource(ctx, file); > } > >+ public ICommand<MIInfo> createCLISwitchInferior(ICommandControlDMContext ctx , String groupId) { >+ return new CLISwicthInferior(ctx, groupId); >+ } >+ > public ICommand<CLIThreadInfo> createCLIThread(IContainerDMContext ctx) { > return new CLIThread(ctx); > } >Index: src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISwicthInferior.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISwicthInferior.java >diff -N src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISwicthInferior.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/mi/service/command/commands/CLISwicthInferior.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 TUBITAK-UEKAE. >+ * 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: >+ * TUBITAK-UEKAE - Initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.cdt.dsf.mi.service.command.commands; >+ >+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; >+import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; >+ >+/** >+ * inferior GROUPID >+ * ^done >+ * >+ * switch the specified inferior. >+ * >+ */ >+public class CLISwicthInferior extends MICommand<MIInfo> >+{ >+ public CLISwicthInferior(ICommandControlDMContext dmc, String groupId) { >+ super(dmc, "inferior ", new String[] { groupId }); //$NON-NLS-1$ >+ } >+} >#P org.eclipse.cdt.dsf.gdb.ui >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java,v >retrieving revision 1.15 >diff -u -r1.15 GdbAdapterFactory.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java 29 Apr 2010 22:45:45 -0000 1.15 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java 15 Sep 2010 07:03:24 -0000 >@@ -40,12 +40,14 @@ > import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.IRefreshAllTarget; > import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory; > import org.eclipse.cdt.dsf.gdb.actions.IConnect; >+import org.eclipse.cdt.dsf.gdb.actions.ISelectInferior; > import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectNextTraceRecordHandler; > import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectPrevTraceRecordHandler; > import org.eclipse.cdt.dsf.gdb.internal.ui.actions.DsfTerminateCommand; > import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbConnectCommand; > import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbDisconnectCommand; > import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand; >+import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbSelectInferiorCommand; > import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbSteppingModeTarget; > import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbResumeWithoutSignalCommand; > import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseResumeCommand; >@@ -113,6 +115,7 @@ > final GdbRestartCommand fRestartCommand; > final DsfTerminateCommand fTerminateCommand; > final GdbConnectCommand fConnectCommand; >+ final GdbSelectInferiorCommand fSelectInferiorCommand; > final GdbDisconnectCommand fDisconnectCommand; > final IDebugModelProvider fDebugModelProvider; > final GdbSuspendTrigger fSuspendTrigger; >@@ -160,6 +163,7 @@ > fRestartCommand = new GdbRestartCommand(session, fLaunch); > fTerminateCommand = new DsfTerminateCommand(session); > fConnectCommand = new GdbConnectCommand(session); >+ fSelectInferiorCommand = new GdbSelectInferiorCommand(session); > fDisconnectCommand = new GdbDisconnectCommand(session); > fSuspendTrigger = new GdbSuspendTrigger(session, fLaunch); > fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory(); >@@ -185,6 +189,7 @@ > session.registerModelAdapter(IRestartHandler.class, fRestartCommand); > session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand); > session.registerModelAdapter(IConnect.class, fConnectCommand); >+ session.registerModelAdapter(ISelectInferior.class, fSelectInferiorCommand); > session.registerModelAdapter(IDisconnectHandler.class, fDisconnectCommand); > session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory); > session.registerModelAdapter(IRefreshAllTarget.class, fRefreshAllTarget); >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ConnectActionDelegate.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ConnectActionDelegate.java,v >retrieving revision 1.2 >diff -u -r1.2 ConnectActionDelegate.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ConnectActionDelegate.java 3 Jun 2010 00:11:22 -0000 1.2 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/ConnectActionDelegate.java 15 Sep 2010 07:03:24 -0000 >@@ -12,11 +12,13 @@ > > import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.AbstractVMProviderActionDelegate; > import org.eclipse.cdt.dsf.gdb.actions.IConnect; >+import org.eclipse.cdt.dsf.gdb.actions.ISelectInferior; > import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; > import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext; > import org.eclipse.debug.ui.contexts.DebugContextEvent; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.TreeSelection; > import org.eclipse.ui.IViewPart; > > /* >@@ -54,10 +56,35 @@ > > @Override > public void selectionChanged(IAction action, ISelection selection) { >+ // DUMMY USAGE FOR MULTI PROCESS DEBUG >+ >+ final ISelectInferior selectInferiorCommand = getSelectInferiorCommand(); >+ >+ if (selectInferiorCommand != null) { >+ selectInferiorCommand.selectInferior( ((TreeSelection)selection).getFirstElement()); >+ } >+ >+ // DUMMY USAGE FOR MULTI PROCESS DEBUG > super.selectionChanged(action, selection); > updateEnablement(); > } > >+ // DUMMY USAGE FOR MULTI PROCESS DEBUG >+ private ISelectInferior getSelectInferiorCommand() { >+ ISelectInferior command = null; >+ Object element = getViewerInput(); >+ if (element instanceof IDMVMContext) { >+ IDMVMContext dmc = (IDMVMContext)element; >+ command = (ISelectInferior)dmc.getAdapter(ISelectInferior.class); >+ } else if (element instanceof GdbLaunch) { >+ GdbLaunch launch = (GdbLaunch)element; >+ command = (ISelectInferior)launch.getSession().getModelAdapter(ISelectInferior.class); >+ } >+ >+ return command; >+ } >+ // DUMMY USAGE FOR MULTI PROCESS DEBUG >+ > private void updateEnablement() { > boolean enabled = false; > final IConnect connectCommand = getConnectCommand(); >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java,v >retrieving revision 1.4 >diff -u -r1.4 GdbConnectCommand.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java 30 Jul 2010 17:45:37 -0000 1.4 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbConnectCommand.java 15 Sep 2010 07:03:24 -0000 >@@ -11,6 +11,7 @@ > package org.eclipse.cdt.dsf.gdb.internal.ui.actions; > > import java.util.ArrayList; >+import java.util.HashMap; > import java.util.List; > import java.util.concurrent.ExecutionException; > import java.util.concurrent.RejectedExecutionException; >@@ -89,9 +90,9 @@ > > // The list of processes used in the case of an ATTACH session > IProcessExtendedInfo[] fProcessList = null; >- DataRequestMonitor<Integer> fRequestMonitor; >+ DataRequestMonitor<HashMap<String, String>> fRequestMonitor; > >- public PromptForPidJob(String name, IProcessExtendedInfo[] procs, DataRequestMonitor<Integer> rm) { >+ public PromptForPidJob(String name, IProcessExtendedInfo[] procs, DataRequestMonitor<HashMap<String, String>> rm) { > super(name); > fProcessList = procs; > fRequestMonitor = rm; >@@ -116,8 +117,8 @@ > > try { > Object result = prompter.handleStatus(processPromptStatus, fProcessList); >- if (result instanceof Integer) { >- fRequestMonitor.setData((Integer)result); >+ if (result instanceof HashMap<?, ?>) { >+ fRequestMonitor.setData((HashMap<String, String>)result); > } else { > fRequestMonitor.setStatus(NO_PID_STATUS); > } >@@ -130,6 +131,7 @@ > } > }; > >+ > public void connect(RequestMonitor requestMonitor) > { > // Create a fake rm to avoid null pointer exceptions >@@ -166,15 +168,19 @@ > protected void handleSuccess() { > new PromptForPidJob( > "Prompt for Process", procInfoList.toArray(new IProcessExtendedInfo[0]), //$NON-NLS-1$ >- new DataRequestMonitor<Integer>(fExecutor, rm) { >+ new DataRequestMonitor<HashMap<String, String>>(fExecutor, rm) { > @Override > protected void handleSuccess() { >+ // ONUR ONUR DUMMY CALL >+ String pid = getData().get("1"); >+ String file = getData().get("2"); >+ > // New cycle, look for service again > final IMIProcesses procService = fTracker.getService(IMIProcesses.class); > if (procService != null) { >- IProcessDMContext procDmc = procService.createProcessContext(controlCtx, >- Integer.toString(getData())); >- procService.attachDebuggerToProcess(procDmc, new DataRequestMonitor<IDMContext>(fExecutor, rm)); >+ IProcessDMContext procDmc = procService.createProcessContext(controlCtx,pid); >+ //Integer.toString(getData())); >+ procService.attachDebuggerToProcess(procDmc,file, new DataRequestMonitor<IDMContext>(fExecutor, rm)); > } > } > }).schedule(); >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSelectInferiorCommand.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSelectInferiorCommand.java >diff -N src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSelectInferiorCommand.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/GdbSelectInferiorCommand.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,59 @@ >+/******************************************************************************* >+ * 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.cdt.dsf.gdb.internal.ui.actions; >+ >+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; >+import org.eclipse.cdt.dsf.concurrent.DsfExecutor; >+import org.eclipse.cdt.dsf.concurrent.RequestMonitor; >+import org.eclipse.cdt.dsf.debug.service.IProcesses; >+import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; >+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; >+import org.eclipse.cdt.dsf.gdb.actions.ISelectInferior; >+import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; >+import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_2; >+import org.eclipse.cdt.dsf.service.DsfServicesTracker; >+import org.eclipse.cdt.dsf.service.DsfSession; >+ >+public class GdbSelectInferiorCommand implements ISelectInferior { >+ >+ private final DsfExecutor fExecutor; >+ private final DsfServicesTracker fTracker; >+ >+ public GdbSelectInferiorCommand(DsfSession session) { >+ fExecutor = session.getExecutor(); >+ fTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), session.getId()); >+ } >+ >+ public void dispose() { >+ fTracker.dispose(); >+ } >+ >+ public void selectInferior(Object object) { >+ // Create a fake rm to avoid null pointer exceptions >+ final RequestMonitor rm = new RequestMonitor(fExecutor, null); >+ >+ final IProcesses procService = fTracker.getService(IProcesses.class); >+ final ICommandControlService commandControl = fTracker.getService(ICommandControlService.class); >+ >+ //final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class); >+ if (procService != null && commandControl != null) { >+ >+ ((GDBProcesses_7_2)procService).switchInferior(commandControl.getContext(), object, >+ new DataRequestMonitor<IProcessDMContext>(fExecutor, rm) { >+ @Override >+ protected void handleSuccess() { >+ rm.done(); >+ } >+ }); >+ } >+ } >+ >+} >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java,v >retrieving revision 1.3 >diff -u -r1.3 ProcessPrompter.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java 30 Jul 2010 17:45:37 -0000 1.3 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/ProcessPrompter.java 15 Sep 2010 07:03:26 -0000 >@@ -11,6 +11,9 @@ > *******************************************************************************/ > package org.eclipse.cdt.dsf.gdb.internal.ui.launching; > >+import java.io.File; >+import java.util.HashMap; >+ > import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; > import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; > import org.eclipse.cdt.dsf.gdb.launching.IProcessExtendedInfo; >@@ -21,12 +24,14 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Status; > import org.eclipse.debug.core.IStatusHandler; >+import org.eclipse.jface.dialogs.ErrorDialog; > import org.eclipse.jface.dialogs.InputDialog; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.ILabelProvider; > import org.eclipse.jface.viewers.LabelProvider; > import org.eclipse.jface.window.Window; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.FileDialog; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.dialogs.TwoPaneElementSelector; > >@@ -62,13 +67,36 @@ > LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to"), //$NON-NLS-1$ > null, null); > >+ String pidStr = null; >+ > if (dialog.open() == Window.OK) { >- String pidStr = dialog.getValue(); >- try { >+ pidStr = dialog.getValue(); >+ /*try { > return Integer.parseInt(pidStr); > } catch (NumberFormatException e) { >+ }*/ >+ } >+ >+ FileDialog fdialog = new FileDialog(shell); >+ fdialog.setText(LaunchMessages.getString("CoreFileLaunchDelegate.Select_Corefile")); //$NON-NLS-1$ >+ String res = fdialog.open(); >+ if (res != null) { >+ File file = new File(res); >+ if (!file.exists() || !file.canRead()) { >+ ErrorDialog.openError(shell, LaunchMessages.getString("CoreFileLaunchDelegate.postmortem_debugging_failed"), //$NON-NLS-1$ >+ LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_accessible"), //$NON-NLS-1$ >+ new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(), >+ ICDTLaunchConfigurationConstants.ERR_NO_COREFILE, >+ LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_readable"), null)); //$NON-NLS-1$ > } >+ //return res; > } >+ >+ // ONUR ONUR DUMMY RETURN VALUE >+ HashMap<String, String> params = new HashMap<String, String>(); >+ params.put("1", pidStr); >+ params.put("2", res); >+ return params; > } else { > ILabelProvider provider = new LabelProvider() { > /* >@@ -138,15 +166,39 @@ > dialog.setMessage(LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to")); //$NON-NLS-1$ > > dialog.setElements(plist); >+ >+ IProcessExtendedInfo info = null; >+ > if (dialog.open() == Window.OK) { >- IProcessExtendedInfo info = (IProcessExtendedInfo)dialog.getFirstResult(); >- if (info != null) { >- return new Integer(info.getPid()); >+ info = (IProcessExtendedInfo)dialog.getFirstResult(); >+ //if (info != null) { >+ // return new Integer(info.getPid()); >+ //} >+ } >+ FileDialog fdialog = new FileDialog(shell); >+ fdialog.setText(LaunchMessages.getString("CoreFileLaunchDelegate.Select_Corefile")); //$NON-NLS-1$ >+ String res = fdialog.open(); >+ if (res != null) { >+ File file = new File(res); >+ if (!file.exists() || !file.canRead()) { >+ ErrorDialog.openError(shell, LaunchMessages.getString("CoreFileLaunchDelegate.postmortem_debugging_failed"), //$NON-NLS-1$ >+ LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_accessible"), //$NON-NLS-1$ >+ new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(), >+ ICDTLaunchConfigurationConstants.ERR_NO_COREFILE, >+ LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_readable"), null)); //$NON-NLS-1$ > } >+ //return res; > } >+ >+ // ONUR ONUR DUMMY RETURN VALUE >+ HashMap<String, String> params = new HashMap<String, String>(); >+ params.put("1", String.valueOf(info.getPid())); >+ params.put("2", res); >+ return params; >+ > } > >- return null; >+ //return null; > } > > }
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 237306
:
166478
|
167440
|
168092
|
168093
|
168510
|
176501
|
178929
|
179595
|
179596
|
179913
|
182593
|
184318
|
185285
|
185617
|
185691
|
186266
|
187326
|
187357
|
190931
|
190997