1
/*******************************************************************************
2
* Copyright (c) 2008, 2010 Nokia Corporation.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Nokia - initial version
10
* Ericsson - Minor cleanup
11
*******************************************************************************/
12
package org.eclipse.cdt.dsf.gdb.service;
14
import java.util.List;
15
import java.util.Properties;
17
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
18
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
19
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.IPath;
23
* Service that manages back end GDB process, such as launching and monitoring
24
* GDB process, managing certain GDB parameters/options. This service makes it
25
* easy for debugger implementations to customize the way to start GDB process
26
* and convert some parameters if needed. See bug 240092 for more.<br>
28
* A base implementation {@link GDBBackend} is provided that should be
29
* sufficient for most cases. But if you have special needs, it's recommended to
30
* subclass the base implementation. <br>
32
* Here are some special cases: <br>
33
* Example #1: GDB is usually launched on the host machine where Eclipse is
34
* running, but it can also be launched on a remote machine through, say, SSH. <br>
35
* Example #2: GDB is usually launched in the host file system, but it can also
36
* be launched in a chroot'ed file system such as Scratchbox (see
37
* http://www.scratchbox.org)<br>
41
public interface IGDBBackend extends IMIBackend {
44
* ID to use when requesting that the interruptAndWait call wait for an
45
* implementation-specific default.
47
public final static int INTERRUPT_TIMEOUT_DEFAULT = 0;
50
* Get path of the debugged program on host.
54
public IPath getProgramPath();
57
* Get init file for GDB.
59
* @return file name, may have relative or absolute path, or empty string ("")
60
* indicating an init file is not specified.
61
* @throws CoreException
62
* - error in getting the option.
64
public String getGDBInitFile() throws CoreException;
67
* get arguments for the debugged program.
70
* @throws CoreException
71
* - error in getting the option.
73
public String getProgramArguments() throws CoreException;
76
* Get working directory for GDB.
78
* @return IPath - null if no meaningful value found.
79
* @throws CoreException
80
* - if any error occurs.
82
public IPath getGDBWorkingDirectory() throws CoreException;
85
* @throws CoreException
86
* - error in getting the option.
88
public List<String> getSharedLibraryPaths() throws CoreException;
91
* Returns the list of user-specified variables.
92
* If no variables are specified, should return an empty list.
93
* Should not return null.
97
public Properties getEnvironmentVariables() throws CoreException;
100
* Returns whether the native environment should be cleared before
101
* setting the user-specified environment variables.
104
public boolean getClearEnvironment() throws CoreException;
107
* Sends an interrupt signal to the GDB process.
109
public void interrupt();
112
* Interrupts the backend and wait to confirm the interrupt
113
* succeeded. The request monitor indicates to the caller if
114
* the interrupt succeeded or not.
116
* @param timeout Maximum number of milliseconds to wait to confirm
117
* that the backend has been interrupted. A value
118
* of INTERRUPT_TIMEOUT_DEFAULT specifies to use an
119
* implementation-specific default value.
120
* Using a value of 0 or a negative value has unspecified
125
public void interruptAndWait(int timeout, RequestMonitor rm);
128
* Same as {@link #interruptAndWait(int, RequestMonitor)}, except the
129
* inferior process is directly interrupted.
131
* @param pid the PID of the inferior
134
public void interruptInferiorAndWait(long pid, int timeout, RequestMonitor rm);
137
* @return The type of the session currently ongoing with the backend
139
public SessionType getSessionType();
142
* @return true if the ongoing session is attaching to a program locally or remotely.
144
public boolean getIsAttachSession();
147
* Indicates whether the CDT debugger should ask gdb for the target
148
* program's thread list on each suspend event (breakpoint-hit, step, etc).
149
* Normally, this isn't necessary, as GDB sends notifications in realtime
150
* when a thread is created or destroyed. However, some lightweight GDB
151
* remote stubs won't send these notifications. As such, the CDT debugger
152
* doesn't find out about new or destroyed threads unless it polls gdb. The
153
* user will enable this behavior if he is debugging such a target
154
* (typically an embedded one)
158
public boolean getUpdateThreadListOnSuspend() throws CoreException;