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

2004-11-02 Alain Magloire

Refactor ICDIConfiguratio --> ICDISessionConfiguration and ICDITargetConfiguration
	* cdi/org/eclipse/cdt/debug/core/cdi/Session.java
	* cdi/org/eclipse/cdt/debug/core/cdi/SessionConfiguration.java
	* cdi/org/eclipse/cdt/debug/core/cdi/model/Target.java
	* cdi/org/eclipse/cdt/debug/core/cdi/model/TargetConfiguration.java
This commit is contained in:
Alain Magloire 2004-11-02 19:29:59 +00:00
parent 5ce890bd56
commit f93436e891
7 changed files with 97 additions and 28 deletions

View file

@ -1,3 +1,10 @@
2004-11-02 Alain Magloire
Refactor ICDIConfiguratio --> ICDISessionConfiguration and ICDITargetConfiguration
* cdi/org/eclipse/cdt/debug/core/cdi/Session.java
* cdi/org/eclipse/cdt/debug/core/cdi/SessionConfiguration.java
* cdi/org/eclipse/cdt/debug/core/cdi/model/Target.java
* cdi/org/eclipse/cdt/debug/core/cdi/model/TargetConfiguration.java
2004-11-02 Alain Magloire
Tentative fix for PR 77435
* cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java

View file

@ -14,7 +14,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
import java.util.Properties;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
@ -44,11 +44,11 @@ public class Session implements ICDISession, ICDISessionObject {
SharedLibraryManager sharedLibraryManager;
SignalManager signalManager;
SourceManager sourceManager;
ICDIConfiguration configuration;
ICDISessionConfiguration configuration;
public Session(MISession miSession, boolean attach) {
commonSetup();
setConfiguration(new Configuration(miSession, attach));
//setConfiguration(new SessionConfiguration(this));
Target target = new Target(this, miSession);
addTargets(new Target[] { target });
@ -56,19 +56,15 @@ public class Session implements ICDISession, ICDISessionObject {
public Session(MISession miSession) {
commonSetup();
setConfiguration(new CoreFileConfiguration());
//setConfiguration(new CoreFileConfiguration());
Target target = new Target(this, miSession);
addTargets(new Target[] { target });
}
public Session() {
commonSetup();
setConfiguration(new CoreFileConfiguration());
}
private void commonSetup() {
props = new Properties();
setConfiguration(new SessionConfiguration(this));
processManager = new ProcessManager(this);
breakpointManager = new BreakpointManager(this);
@ -165,11 +161,11 @@ public class Session implements ICDISession, ICDISessionObject {
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDISession#getConfiguration()
*/
public ICDIConfiguration getConfiguration() {
public ICDISessionConfiguration getConfiguration() {
return configuration;
}
public void setConfiguration(ICDIConfiguration conf) {
public void setConfiguration(ICDISessionConfiguration conf) {
configuration = conf;
}

View file

@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration;
/**
* @author User
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class SessionConfiguration extends SessionObject implements
ICDISessionConfiguration {
/**
* @param session
*/
public SessionConfiguration(Session session) {
super(session);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration#terminateSessionOnExit()
*/
public boolean terminateSessionOnExit() {
return true;
}
}

View file

@ -18,8 +18,8 @@ import java.util.List;
import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MIFormat;
import org.eclipse.cdt.debug.mi.core.MISession;
@ -92,8 +92,7 @@ public class SharedLibraryManager extends Manager {
public List updateState(Target target) throws CDIException {
MISession miSession = target.getMISession();
Session session = (Session)getSession();
ICDIConfiguration conf = session.getConfiguration();
ICDITargetConfiguration conf = target.getConfiguration();
if (!conf.supportsSharedLibrary()) {
return Collections.EMPTY_LIST; // Bail out early;
}

View file

@ -8,11 +8,18 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi;
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
public class CoreFileConfiguration implements ICDIConfiguration {
public class CoreFileConfiguration extends CObject implements ICDITargetConfiguration {
/**
* @param t
*/
public CoreFileConfiguration(Target t) {
super(t);
}
public boolean supportsTerminate() {
return true;

View file

@ -29,6 +29,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
@ -75,6 +76,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
public class Target extends SessionObject implements ICDITarget {
MISession miSession;
ICDITargetConfiguration fConfiguration;
Thread[] noThreads = new Thread[0];
Thread[] currentThreads;
int currentThreadId;
@ -944,4 +946,22 @@ public class Target extends SessionObject implements ICDITarget {
return regMgr.getRegisterGroups(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getConfiguration()
*/
public ICDITargetConfiguration getConfiguration() {
if (fConfiguration != null) {
if (miSession.isProgramSession()) {
fConfiguration = new TargetConfiguration(this);
} else if (miSession.isAttachSession()){
fConfiguration = new TargetConfiguration(this);
} else if (miSession.isCoreSession()) {
fConfiguration = new CoreFileConfiguration(this);
} else {
fConfiguration = new TargetConfiguration(this);
}
}
return fConfiguration;
}
}

View file

@ -8,22 +8,19 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi;
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
import org.eclipse.cdt.debug.mi.core.MIInferior;
import org.eclipse.cdt.debug.mi.core.MIProcess;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
*/
public class Configuration implements ICDIConfiguration {
protected boolean fAttached;
MISession miSession;
public class TargetConfiguration extends CObject implements ICDITargetConfiguration {
public Configuration(MISession s, boolean attached) {
fAttached = attached;
miSession = s;
public TargetConfiguration(Target target) {
super(target);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsBreakpoints()
@ -36,7 +33,8 @@ public class Configuration implements ICDIConfiguration {
* @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsDisconnect()
*/
public boolean supportsDisconnect() {
return fAttached ? true :false;
MISession miSession = ((Target)getTarget()).getMISession();
return miSession.isAttachSession() ? true : false;
}
/**
@ -92,7 +90,8 @@ public class Configuration implements ICDIConfiguration {
* @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsRestart()
*/
public boolean supportsRestart() {
return fAttached ? false : true;
MISession miSession = ((Target)getTarget()).getMISession();
return miSession.isAttachSession() ? false : true;
}
/**
@ -125,12 +124,14 @@ public class Configuration implements ICDIConfiguration {
os = System.getProperty("os.name", ""); //$NON-NLS-1$ //$NON-NLS-2$
} catch (SecurityException e) {
}
Target target = (Target)getTarget();
MISession miSession = target.getMISession();
MIProcess gdb = miSession.getGDBProcess();
MIInferior inferior = miSession.getMIInferior();
if (gdb.canInterrupt(inferior)) {
// If we attached sending a control-c,
// seems to alays work.
if (fAttached) {
if (miSession.isAttachSession()) {
return true;
}