1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[213657] Left over string changes.

This commit is contained in:
Pawel Piech 2008-02-14 21:49:28 +00:00
parent 4a5303b056
commit f001078afe
18 changed files with 456 additions and 56 deletions

View file

@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.debug.core,
org.eclipse.dd.dsf;bundle-version="1.0.0",
org.eclipse.dd.dsf.debug;bundle-version="1.0.0",
org.junit4;bundle-version="4.3.1"
org.junit4;bundle-version="4.3.1",
org.eclipse.cdt.core;bundle-version="5.0.0"
Eclipse-LazyStart: true
Export-Package: org.eclipse.dd.examples.pda,
org.eclipse.dd.examples.pda.breakpoints,

View file

@ -19,6 +19,7 @@ import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpointAttributeTra
import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpoints;
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
import org.eclipse.dd.examples.pda.service.runcontrol.PDARunControl;
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
import org.eclipse.debug.examples.core.pda.sourcelookup.PDASourceLookupDirector;
public class PDAServicesInitSequence extends Sequence {
@ -65,19 +66,12 @@ public class PDAServicesInitSequence extends Sequence {
});
}
},
new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
new PDAStack(fSession).initialize(requestMonitor);
}
},
/*new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
new MIMemory(fSession).initialize(requestMonitor);
}},
new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
new MIModules(fSession).initialize(requestMonitor);
}},
new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
new MIStack(fSession).initialize(requestMonitor);
}},
new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
new ExpressionService(fSession).initialize(requestMonitor);
}},

View file

@ -23,6 +23,7 @@ import org.eclipse.dd.examples.pda.PDAPlugin;
import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpoints;
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
import org.eclipse.dd.examples.pda.service.runcontrol.PDARunControl;
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
public class PDAServicesShutdownSequence extends Sequence {
@ -79,23 +80,13 @@ public class PDAServicesShutdownSequence extends Sequence {
public void execute(RequestMonitor requestMonitor) {
shutdownService(ExpressionService.class, requestMonitor);
}
}, new Step() {
@Override
public void execute(RequestMonitor requestMonitor) {
shutdownService(MIStack.class, requestMonitor);
}
}, new Step() {
@Override
public void execute(RequestMonitor requestMonitor) {
shutdownService(MIModules.class, requestMonitor);
}
},
},*/
new Step() {
@Override
public void execute(RequestMonitor requestMonitor) {
shutdownService(MIMemory.class, requestMonitor);
shutdownService(PDAStack.class, requestMonitor);
}
}, */
},
new Step() {
@Override
public void execute(RequestMonitor requestMonitor) {

View file

@ -51,7 +51,6 @@ import org.osgi.framework.BundleContext;
public class PDARunControl extends AbstractDsfService
implements IRunControl, IEventListener
{
private PDACommandControl fCommandControl;
private CommandCache fCommandCache;
@ -66,6 +65,11 @@ public class PDARunControl extends AbstractDsfService
super(session);
}
@Override
protected BundleContext getBundleContext() {
return PDAPlugin.getBundleContext();
}
@Override
public void initialize(final RequestMonitor rm) {
super.initialize(
@ -97,8 +101,6 @@ public class PDARunControl extends AbstractDsfService
super.shutdown(rm);
}
public boolean isValid() { return true; }
@SuppressWarnings("unchecked")
public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) {
if (dmc instanceof IExecutionDMContext) {
@ -109,9 +111,6 @@ public class PDARunControl extends AbstractDsfService
}
}
public CommandCache getCache() { return fCommandCache; }
public void eventReceived(Object output) {
if (!(output instanceof String)) return;
String event = (String)output;
@ -142,7 +141,6 @@ public class PDARunControl extends AbstractDsfService
fResumePending = false;
fStateChangeReason = e.getReason();
fCommandCache.setTargetAvailable(false);
//fStateChangeTriggeringContext = e.getTriggeringContext();
if (e.getReason().equals(StateChangeReason.STEP)) {
fStepping = true;
} else {
@ -162,15 +160,6 @@ public class PDARunControl extends AbstractDsfService
}
///////////////////////////////////////////////////////////////////////////
// AbstractService
@Override
protected BundleContext getBundleContext() {
return PDAPlugin.getBundleContext();
}
///////////////////////////////////////////////////////////////////////////
// IRunControl
public boolean canResume(IExecutionDMContext context) {
return isSuspended(context) && !fResumePending;
}

View file

@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems 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:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.examples.pda.service.stack;
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.examples.pda.service.stack.PDAStack.PDAFrame;
/**
*
*/
class FrameDMContext extends AbstractDMContext implements IFrameDMContext {
private final int fLevel;
private final PDAFrame fFrame;
FrameDMContext(String sessionId, IExecutionDMContext execDmc, int level, PDAFrame frame) {
super(sessionId, new IDMContext[] { execDmc });
fLevel = level;
fFrame = frame;
}
PDAFrame getFrame() { return fFrame; }
public int getLevel() { return fLevel; }
@Override
public boolean equals(Object other) {
return super.baseEquals(other) && ((FrameDMContext)other).fLevel == fLevel;
}
@Override
public int hashCode() {
return super.baseHashCode() ^ fLevel;
}
@Override
public String toString() {
return baseToString() + ".frame[" + fLevel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
}

View file

@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems 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:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.examples.pda.service.stack;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMData;
import org.eclipse.dd.examples.pda.service.stack.PDAStack.PDAFrame;
/**
*
*/
public class FrameDMData implements IFrameDMData {
final private PDAFrame fFrame;
FrameDMData(PDAFrame frame) {
fFrame = frame;
}
public String getFile() {
return fFrame.fFilePath;
}
public String getFunction() {
return fFrame.fFunction;
}
public int getLine() {
return fFrame.fLine;
}
public int getColumn() {
return 0;
}
public IAddress getAddress() {
return null;
}
}

View file

@ -0,0 +1,248 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems 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:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.examples.pda.service.stack;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
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.IRunControl;
import org.eclipse.dd.dsf.debug.service.IStack;
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.IResumedDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
import org.eclipse.dd.dsf.service.AbstractDsfService;
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.dsf.service.IDsfService;
import org.eclipse.dd.examples.pda.PDAPlugin;
import org.eclipse.dd.examples.pda.service.command.PDACommand;
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
import org.osgi.framework.BundleContext;
/**
*
*/
public class PDAStack extends AbstractDsfService implements IStack {
private PDACommandControl fCommandControl;
private IRunControl fRunControl;
private CommandCache fCommandCache;
public PDAStack(DsfSession session) {
super(session);
}
@Override
protected BundleContext getBundleContext() {
return PDAPlugin.getBundleContext();
}
@Override
public void initialize(final RequestMonitor rm) {
super.initialize(
new RequestMonitor(getExecutor(), rm) {
@Override
protected void handleOK() {
doInitialize(rm);
}});
}
private void doInitialize(final RequestMonitor rm) {
fCommandControl = getServicesTracker().getService(PDACommandControl.class);
fRunControl = getServicesTracker().getService(IRunControl.class);
fCommandCache = new CommandCache(fCommandControl);
getSession().addServiceEventListener(this, null);
register(new String[]{IStack.class.getName(), PDAStack.class.getName()}, new Hashtable<String,String>());
rm.done();
}
@Override
public void shutdown(final RequestMonitor rm) {
getSession().removeServiceEventListener(this);
fCommandCache.reset();
super.shutdown(rm);
}
public void getArguments(IFrameDMContext frameCtx, DataRequestMonitor<IVariableDMContext[]> rm) {
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.NOT_SUPPORTED, "PDA debugger does not support function arguments.", null)); //$NON-NLS-1$
rm.done();
}
public void getFrameData(IFrameDMContext frameCtx, DataRequestMonitor<IFrameDMData> rm) {
if ( !(frameCtx instanceof FrameDMContext) ) {
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
rm.done();
return;
}
PDAFrame pdaFrame = ((FrameDMContext)frameCtx).getFrame();
rm.setData(new FrameDMData(pdaFrame));
rm.done();
}
public void getFrames(IDMContext context, final DataRequestMonitor<IFrameDMContext[]> rm) {
final IExecutionDMContext execCtx = DMContexts.getAncestorOfType(context, IExecutionDMContext.class);
if (execCtx == null) {
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + context, null)); //$NON-NLS-1$
rm.done();
return;
}
fCommandControl.queueCommand(
new PDACommand(execCtx, "stack"),
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
@Override
protected void handleOK() {
PDAFrame[] frames = parseStackResponse(getData().fResponseText);
IFrameDMContext[] frameCtxs = new IFrameDMContext[frames.length];
for (int i = 0; i < frames.length; i++) {
frameCtxs[i] = new FrameDMContext(getSession().getId(), execCtx, i, frames[i]);
}
rm.setData(frameCtxs);
rm.done();
}
});
}
public void getLocals(IFrameDMContext frameCtx, DataRequestMonitor<IVariableDMContext[]> rm) {
if ( !(frameCtx instanceof FrameDMContext) ) {
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
rm.done();
return;
}
PDAFrame pdaFrame = ((FrameDMContext)frameCtx).getFrame();
IVariableDMContext[] variableCtxs = new IVariableDMContext[pdaFrame.fVariables.length];
for (int i = 0; i < pdaFrame.fVariables.length; i++) {
variableCtxs[i] = new VariableDMContext(getSession().getId(), frameCtx, pdaFrame.fVariables[i]);
}
rm.setData(variableCtxs);
rm.done();
}
public void getStackDepth(IDMContext context, int maxDepth, final DataRequestMonitor<Integer> rm) {
getFrames(
context,
new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
@Override
protected void handleOK() {
rm.setData(getData().length);
rm.done();
}
});
}
public void getTopFrame(IDMContext context, final DataRequestMonitor<IFrameDMContext> rm) {
getFrames(
context,
new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
@Override
protected void handleOK() {
rm.setData(getData()[0]);
rm.done();
}
});
}
public void getVariableData(IVariableDMContext variableCtx, DataRequestMonitor<IVariableDMData> rm) {
if ( !(variableCtx instanceof VariableDMContext) ) {
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + variableCtx, null)); //$NON-NLS-1$
rm.done();
return;
}
String variable = ((VariableDMContext)variableCtx).getVariable();
rm.setData(new VariableDMData(variable));
rm.done();
}
public boolean isStackAvailable(IDMContext context) {
IExecutionDMContext execCtx = DMContexts.getAncestorOfType(context, IExecutionDMContext.class);
return execCtx != null && (fRunControl.isSuspended(execCtx) || (fRunControl.isStepping(execCtx)));
}
@Deprecated
public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) {
if (dmc instanceof IFrameDMContext) {
getFrameData((IFrameDMContext)dmc, (DataRequestMonitor<IFrameDMData>)rm);
// getFrameData invokes rm
} else if (dmc instanceof IVariableDMContext) {
getVariableData((IVariableDMContext)dmc, (DataRequestMonitor<IVariableDMData>)rm);
// getVariablesData invokes rm
} else {
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Unknown context type", null)); //$NON-NLS-1$
rm.done();
}
}
@DsfServiceEventHandler
public void eventDispatched(IResumedDMEvent e) {
fCommandCache.setTargetAvailable(false);
if (!e.getReason().equals(StateChangeReason.STEP)) {
fCommandCache.reset();
}
}
@DsfServiceEventHandler
public void eventDispatched(ISuspendedDMEvent e) {
fCommandCache.setTargetAvailable(true);
fCommandCache.reset();
}
public static class PDAFrame {
PDAFrame(String frameString) {
StringTokenizer st = new StringTokenizer(frameString, "|");
fFilePath = st.nextToken();
fLine = Integer.parseInt(st.nextToken());
fFunction = st.nextToken();
List<String> variablesList = new ArrayList<String>();
while (st.hasMoreTokens()) {
variablesList.add(st.nextToken());
}
fVariables = variablesList.toArray(new String[variablesList.size()]);
}
final public String fFilePath;
final public int fLine;
final public String fFunction;
final public String[] fVariables;
}
private PDAFrame[] parseStackResponse(String response) {
StringTokenizer st = new StringTokenizer(response, "#");
List<PDAFrame> framesList = new ArrayList<PDAFrame>();
while (st.hasMoreTokens()) {
framesList.add(new PDAFrame(st.nextToken()));
}
return framesList.toArray(new PDAFrame[framesList.size()]);
}
}

View file

@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems 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:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.examples.pda.service.stack;
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.dsf.debug.service.IStack.IVariableDMContext;
/**
*
*/
class VariableDMContext extends AbstractDMContext implements IVariableDMContext {
private final String fVariable;
VariableDMContext(String sessionId, IFrameDMContext frameCtx, String variable) {
super(sessionId, new IDMContext[] { frameCtx });
fVariable = variable;
}
String getVariable() { return fVariable; }
@Override
public boolean equals(Object other) {
return super.baseEquals(other) && ((VariableDMContext)other).fVariable.equals(fVariable);
}
@Override
public int hashCode() {
return super.baseHashCode() + fVariable.hashCode();
}
@Override
public String toString() {
return baseToString() + ".variable(" + fVariable + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
}

View file

@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems 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:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.examples.pda.service.stack;
import org.eclipse.dd.dsf.debug.service.IStack.IVariableDMData;
/**
*
*/
public class VariableDMData implements IVariableDMData {
final private String fVariable;
VariableDMData(String variable) {
fVariable = variable;
}
public String getName() {
return fVariable;
}
public String getValue() {
return null;
}
}

View file

@ -42,9 +42,9 @@
<extension point="org.eclipse.ui.propertyPages">
<page class="org.eclipse.dd.gdb.internal.ui.breakpoints.CBreakpointGdbThreadFilterPage"
id="org.eclipse.dd.dsf.gdb.breakpoint.filtering"
id="org.eclipse.dd.gdb.breakpoint.filtering"
name="Filter">
<filter name="debugModelId" value="org.eclipse.dd.dsf.gdb"/>
<filter name="debugModelId" value="org.eclipse.dd.gdb"/>
<enabledWhen>
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
</enabledWhen>

View file

@ -17,8 +17,8 @@
point="org.eclipse.cdt.debug.core.BreakpointExtension">
<breakpointExtension
class="org.eclipse.dd.gdb.breakpoints.CBreakpointGdbThreadsFilterExtension"
debugModelId="org.eclipse.dd.dsf.gdb"
id="org.eclipse.dd.dsf.gdb.threadFilter"
debugModelId="org.eclipse.dd.gdb"
id="org.eclipse.dd.gdb.threadFilter"
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker">
</breakpointExtension>
</extension>

View file

@ -57,7 +57,7 @@ import org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2;
public class GdbLaunchDelegate extends AbstractCLaunchDelegate
implements ILaunchConfigurationDelegate2
{
public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.dd.dsf.gdb"; //$NON-NLS-1$
public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.dd.gdb"; //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)

View file

@ -79,7 +79,7 @@ import org.osgi.framework.BundleContext;
public class MIBreakpointsManager extends AbstractDsfService implements IBreakpointManagerListener, IBreakpointListener
{
// Note: Find a way to import this (careful of circular dependencies)
public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.dd.dsf.gdb"; //$NON-NLS-1$
public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.dd.gdb"; //$NON-NLS-1$
// Extra breakpoint attributes
private static final String ATTR_DEBUGGER_PATH = MIPlugin.PLUGIN_ID + ".debuggerPath"; //$NON-NLS-1$

View file

@ -6,13 +6,13 @@
point="org.eclipse.ui.views">
<category
name="DSF Tests"
id="org.eclipse.dd.dsf.tests.model">
id="org.eclipse.dd.tests.dsf.model">
</category>
<view
name="Model Test View"
category="org.eclipse.dd.dsf.tests.model"
class="org.eclipse.dd.dsf.tests.model.ModelTestsView"
id="org.eclipse.dd.dsf.tests.model.ModelTestView">
category="org.eclipse.dd.tests.dsf.model"
class="org.eclipse.dd.tests.dsf.model.ModelTestsView"
id="org.eclipse.dd.tests.dsf.model.ModelTestView">
</view>
</extension>
</plugin>

View file

@ -35,7 +35,7 @@ public class EventTest {
fExecutor = new TestDsfExecutor();
fExecutor.submit(new DsfRunnable() { public void run() {
fSession = DsfSession.startSession(fExecutor, "org.eclipse.dd.dsf.tests"); //$NON-NLS-1$
fSession = DsfSession.startSession(fExecutor, "org.eclipse.dd.tests.dsf"); //$NON-NLS-1$
}}).get();
StartupSequence startupSeq = new StartupSequence(fSession);

View file

@ -8,7 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.tests.service;
package org.eclipse.dd.tests.dsf.service;
import java.util.Hashtable;

View file

@ -8,7 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.tests.service;
package org.eclipse.dd.tests.dsf.service;
import java.lang.reflect.Constructor;
import java.util.concurrent.ExecutionException;

View file

@ -8,7 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.tests.service;
package org.eclipse.dd.tests.dsf.service;
import java.util.Hashtable;