| /* |
| * (c) Copyright QNX Software Systems Ltd. 2002. |
| * All Rights Reserved. |
| * |
| */ |
| package org.eclipse.cdt.debug.mi.core.cdi; |
| |
| import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; |
| import org.eclipse.cdt.debug.mi.core.MIInferior; |
| import org.eclipse.cdt.debug.mi.core.MISession; |
| import org.eclipse.cdt.utils.spawner.Spawner; |
| |
| /** |
| */ |
| public class Configuration implements ICDIConfiguration { |
| protected boolean fAttached; |
| MISession miSession; |
| |
| public Configuration(MISession s, boolean attached) { |
| fAttached = attached; |
| miSession = s; |
| } |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsBreakpoints() |
| */ |
| public boolean supportsBreakpoints() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsDisconnect() |
| */ |
| public boolean supportsDisconnect() { |
| return fAttached ? true :false; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsExpressionEvaluation() |
| */ |
| public boolean supportsExpressionEvaluation() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsInstructionStepping() |
| */ |
| public boolean supportsInstructionStepping() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsMemoryModification() |
| */ |
| public boolean supportsMemoryModification() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsMemoryRetrieval() |
| */ |
| public boolean supportsMemoryRetrieval() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsRegisterModification() |
| */ |
| public boolean supportsRegisterModification() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsRegisters() |
| */ |
| public boolean supportsRegisters() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsSharedLibrary() |
| */ |
| public boolean supportsSharedLibrary() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsRestart() |
| */ |
| public boolean supportsRestart() { |
| return fAttached ? false : true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsStepping() |
| */ |
| public boolean supportsStepping() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsTerminate() |
| */ |
| public boolean supportsTerminate() { |
| return true; |
| |
| } |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsResume() |
| */ |
| public boolean supportsResume() { |
| return true; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#supportsSuspend() |
| */ |
| public boolean supportsSuspend() { |
| String os = null; |
| try { |
| os = System.getProperty("os.name", ""); |
| } catch (SecurityException e) { |
| } |
| Process gdb = miSession.getGDBProcess(); |
| if (gdb instanceof Spawner) { |
| // If we attached sending a control-c, |
| // seems to alays work. |
| if (fAttached) { |
| return true; |
| } |
| |
| // If we have a pty, sending a control-c will work |
| // except for solaris. |
| if (os.equals("SunOS")) { |
| MIInferior inferior = miSession.getMIInferior(); |
| if (inferior.getPTY() != null) { |
| // FIXME: bug in Solaris gdb when using -tty, sending a control-c |
| // does not work. |
| return false; |
| } else { |
| return true; |
| } |
| } |
| return true; |
| } |
| return false; |
| } |
| |
| /** |
| * @see org.eclipse.cdt.debug.core.cdi.ICDIConfiguration#terminateSessionOnExit() |
| */ |
| public boolean terminateSessionOnExit() { |
| return true; |
| } |
| } |