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 190539 Details for
Bug 338136
[debug view] Don't show the inferior process in the debug view
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 Patch to make the right console show 2
zpatch.txt (text/plain), 16.67 KB, created by
Marc Khouzam
on 2011-03-07 06:35:21 EST
(
hide
)
Description:
Fix for Patch to make the right console show 2
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2011-03-07 06:35:21 EST
Size:
16.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java >diff -N src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/IGdbDebugConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.dsf.gdb; >+ >+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; >+ >+ >+ >+/** >+ * @noimplement This interface is not intended to be implemented by clients. >+ * @since 4.0 >+ */ >+public interface IGdbDebugConstants { >+ >+ public static final String PREFIX = GdbPlugin.PLUGIN_ID + "."; //$NON-NLS-1$ >+ >+ /** >+ * Attribute key to be added to the IProcess associated with an IMIContainerDMContext. >+ * The value should be the groupId as returned by {@link IMIContainerDMContext#getGroupId()} >+ */ >+ public static final String INFERIOR_GROUPID_ATTR = PREFIX + "inferiorGroupId"; //$NON-NLS-1$ >+ >+ >+} >+ >Index: src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java,v >retrieving revision 1.13 >diff -u -r1.13 GdbLaunch.java >--- src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java 25 Feb 2011 20:08:11 -0000 1.13 >+++ src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java 7 Mar 2011 11:30:24 -0000 >@@ -52,7 +52,6 @@ > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.model.IDisconnect; > import org.eclipse.debug.core.model.IMemoryBlockRetrieval; >-import org.eclipse.debug.core.model.IProcess; > import org.eclipse.debug.core.model.ISourceLocator; > import org.eclipse.debug.core.model.ITerminate; > >@@ -171,18 +170,6 @@ > > GDBProcess gdbProcess = new GDBProcess(this, cliProc, label, null); > addProcess(gdbProcess); >- >- Object existingAdapter = getSession().getModelAdapter(IProcess.class); >- if (existingAdapter == null) { >- // Register the model adapter to the gdbProcess only if there is no other one >- // registered already; if there is already one, it is from our inferior process >- // and it takes precedence because we want the inferior console to show >- // when we select a debug context of this debug session. >- // If the inferior process is added later, it will properly overwrite this model adapter. >- // Note that we don't always have an inferior console, so it is important to register >- // this adapter for those cases. >- getSession().registerModelAdapter(IProcess.class, gdbProcess); >- } > } catch (InterruptedException e) { > throw new CoreException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, 0, "Interrupted while waiting for get process callable.", e)); //$NON-NLS-1$ > } catch (ExecutionException e) { >Index: src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java >diff -N src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/launching/InferiorRuntimeProcess.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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.launching; >+ >+import java.util.Map; >+ >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.model.RuntimeProcess; >+ >+/** >+ * A process for the inferior to know it belongs to a DSF-GDB session >+ * >+ * @since 4.0 >+ */ >+public class InferiorRuntimeProcess extends RuntimeProcess { >+ >+ public InferiorRuntimeProcess(ILaunch launch, Process process, String name, >+ Map<String, String> attributes) { >+ super(launch, process, name, attributes); >+ } >+ >+} >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java,v >retrieving revision 1.17 >diff -u -r1.17 GDBProcesses.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java 7 Mar 2011 04:11:20 -0000 1.17 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java 7 Mar 2011 11:30:25 -0000 >@@ -34,9 +34,10 @@ > import org.eclipse.cdt.dsf.debug.service.IRunControl.IStartedDMEvent; > import org.eclipse.cdt.dsf.debug.service.command.ICommand; > import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; >+import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants; > import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; > import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; >-import org.eclipse.cdt.dsf.gdb.launching.GDBProcess; >+import org.eclipse.cdt.dsf.gdb.launching.InferiorRuntimeProcess; > 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; >@@ -463,7 +464,7 @@ > IProcess[] launchProcesses = launch.getProcesses(); > for (IProcess p : launchProcesses) { > // We know there is only one inferior, so just find it. >- if ((p instanceof GDBProcess) == false) { >+ if (p instanceof InferiorRuntimeProcess) { > launch.removeProcess(p); > break; > } >@@ -471,11 +472,10 @@ > } > > // Add the inferior >- IProcess process = DebugPlugin.newProcess(launch, inferior, label); >+ InferiorRuntimeProcess runtimeInferior = new InferiorRuntimeProcess(launch, inferior, label, null); >+ runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, MIProcesses.UNIQUE_GROUP_ID); >+ launch.addProcess(runtimeInferior); > >- // Register as an IProcess so that the console is brought to the front >- // when the inferior is selected >- getSession().registerModelAdapter(IProcess.class, process); > rm.done(); > } > }); >Index: src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java,v >retrieving revision 1.5 >diff -u -r1.5 StartOrRestartProcessSequence_7_0.java >--- src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java 2 Mar 2011 11:06:15 -0000 1.5 >+++ src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java 7 Mar 2011 11:30:25 -0000 >@@ -26,7 +26,9 @@ > import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; > import org.eclipse.cdt.dsf.debug.service.command.ICommand; > import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; >+import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants; > import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; >+import org.eclipse.cdt.dsf.gdb.launching.InferiorRuntimeProcess; > 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; >@@ -53,9 +55,7 @@ > * @since 4.0 > */ > public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence { >- >- private static final String GROUP_ATTR = GdbPlugin.PLUGIN_ID + "groupId"; //$NON-NLS-1$ >- >+ > private IGDBControl fCommandControl; > private CommandFactory fCommandFactory; > private IGDBProcesses fProcService; >@@ -290,7 +290,7 @@ > // For a restart, remove the old inferior > IProcess[] launchProcesses = launch.getProcesses(); > for (IProcess process : launchProcesses) { >- String groupAttribute = process.getAttribute(GROUP_ATTR); >+ String groupAttribute = process.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR); > if (groupId.equals(groupAttribute)) { > launch.removeProcess(process); > // Use the exact same label as before >@@ -301,12 +301,10 @@ > } > > // Add the inferior >- IProcess process = DebugPlugin.newProcess(launch, inferior, label); >- process.setAttribute(GROUP_ATTR, groupId); >- >- // Register as an IProcess so that the console is brought to the front >- // when the inferior is selected >- session.registerModelAdapter(IProcess.class, process); >+ InferiorRuntimeProcess runtimeInferior = new InferiorRuntimeProcess(launch, inferior, label, null); >+ runtimeInferior.setAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR, groupId); >+ launch.addProcess(runtimeInferior); >+ > rm.done(); > } > }); >#P org.eclipse.cdt.dsf.gdb.ui >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java,v >retrieving revision 1.1 >diff -u -r1.1 ConsolePageParticipant.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java 12 Apr 2010 18:52:50 -0000 1.1 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/console/ConsolePageParticipant.java 7 Mar 2011 11:30:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2010 Marc-Andre Laperle and others. >+ * Copyright (c) 2010, 2011 Marc-Andre Laperle 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 >@@ -10,25 +10,52 @@ > *******************************************************************************/ > package org.eclipse.cdt.dsf.gdb.internal.ui.console; > >+import org.eclipse.cdt.dsf.datamodel.DMContexts; >+import org.eclipse.cdt.dsf.datamodel.IDMContext; >+import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants; > import org.eclipse.cdt.dsf.gdb.launching.GDBProcess; >+import org.eclipse.cdt.dsf.gdb.launching.InferiorRuntimeProcess; >+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.debug.ui.contexts.DebugContextEvent; >+import org.eclipse.debug.ui.contexts.IDebugContextListener; > import org.eclipse.jface.action.IToolBarManager; > import org.eclipse.jface.action.Separator; > import org.eclipse.ui.console.IConsole; > import org.eclipse.ui.console.IConsoleConstants; > import org.eclipse.ui.console.IConsolePageParticipant; >+import org.eclipse.ui.console.IConsoleView; > import org.eclipse.ui.console.TextConsole; > import org.eclipse.ui.part.IPageBookViewPage; > > /** >- * A console page participant for both the gdb tracing console and the gdb CLI console >+ * A console page participant for DSF-GDB. >+ * It adds a save button to both the gdb tracing console and the gdb CLI console. >+ * It also brings to the front the proper inferior console when a container is selected. > * > * @since 2.1 > */ >-public class ConsolePageParticipant implements IConsolePageParticipant{ >+public class ConsolePageParticipant implements IConsolePageParticipant, IDebugContextListener { > >+ private IConsole fConsole; >+ private IPageBookViewPage fPage; >+ private IConsoleView fView; >+ > public void init(IPageBookViewPage page, IConsole console) { >- if(console instanceof TracingConsole || isConsoleGdbCli(console)) >- { >+ fPage = page; >+ fConsole = console; >+ fView = (IConsoleView)fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW); >+ >+ if (isConsoleInferior(console) || isConsoleGdbCli(console)) { >+ // This console participant will affect all consoles, even those not for DSF-GDB. >+ // Only consoles for GDBProcess or InferiorRuntimeProcess are what we care about for DSF-GDB >+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this); >+ } >+ >+ if(console instanceof TracingConsole || isConsoleGdbCli(console)) { > TextConsole textConsole = (TextConsole) console; > > // Add the save console action >@@ -55,12 +82,30 @@ > return false; > } > >+ /** >+ * Checks if the the console is for an inferior. >+ * >+ * @param console The console to check >+ * @return true if the the console is for an inferior >+ */ >+ private boolean isConsoleInferior(IConsole console) { >+ if(console instanceof org.eclipse.debug.ui.console.IConsole) { >+ org.eclipse.debug.ui.console.IConsole debugConsole = (org.eclipse.debug.ui.console.IConsole)console; >+ return (debugConsole.getProcess() instanceof InferiorRuntimeProcess); >+ } >+ return false; >+ } >+ > @SuppressWarnings("rawtypes") > public Object getAdapter(Class adapter) { > return null; > } > > public void dispose() { >+ if (isConsoleInferior(fConsole) || isConsoleGdbCli(fConsole)) { >+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this); >+ } >+ fConsole = null; > } > > public void activated() { >@@ -69,4 +114,68 @@ > public void deactivated() { > } > >+ protected IProcess getConsoleProcess() { >+ if (fConsole instanceof org.eclipse.debug.ui.console.IConsole) { >+ return ((org.eclipse.debug.ui.console.IConsole)fConsole).getProcess(); >+ } >+ return null; >+ } >+ >+ protected IProcess getCurrentProcess() { >+ IAdaptable context = DebugUITools.getDebugContext(); >+ >+ // If the launch is selected, we should choose the first inferior being debugged >+ if (context instanceof ILaunch) { >+ ILaunch launch = (ILaunch)context; >+ >+ IProcess[] processes = launch.getProcesses(); >+ if (processes != null && processes.length > 0) { >+ for (IProcess process : processes) { >+ if (process instanceof InferiorRuntimeProcess) { >+ return process; >+ } >+ } >+ >+ // No inferior? return the gdb process >+ // We have to check that the process is actually from a DSF-GDB session, >+ // since the current context could be for any debug session >+ if (processes[0] instanceof GDBProcess) { >+ return launch.getProcesses()[0]; >+ } >+ } >+ >+ return null; >+ } >+ >+ if (context != null) { >+ // Look for the process that this context refers to, so we can select its console >+ IDMContext dmc = (IDMContext)context.getAdapter(IDMContext.class); >+ IMIContainerDMContext container = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class); >+ if (container != null) { >+ ILaunch launch = (ILaunch)context.getAdapter(ILaunch.class); >+ if (launch != null) { >+ for (IProcess process : launch.getProcesses()) { >+ String groupId = process.getAttribute(IGdbDebugConstants.INFERIOR_GROUPID_ATTR); >+ if (container.getGroupId().equals(groupId)) { >+ return process; >+ } >+ } >+ } >+ } >+ } >+ >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent) >+ */ >+ public void debugContextChanged(DebugContextEvent event) { >+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) { >+ IProcess consoleProcess = getConsoleProcess(); >+ if (fView != null && consoleProcess != null && consoleProcess.equals(getCurrentProcess())) { >+ fView.display(fConsole); >+ } >+ } >+ } > }
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 338136
:
189768
|
189886
|
189966
| 190539 |
190561
|
190695