You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/04/26 06:29:14 UTC
[22/63] [abbrv] [partial] git commit: [flex-falcon]
[refs/heads/develop] - move stuff to where I think Maven wants it
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/DefaultDebuggerCallbacks.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/DefaultDebuggerCallbacks.java b/debugger/src/main/java/flash/tools/debugger/DefaultDebuggerCallbacks.java
new file mode 100644
index 0000000..d94ae46
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/DefaultDebuggerCallbacks.java
@@ -0,0 +1,431 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import flash.util.Trace;
+
+/**
+ * @author mmorearty
+ */
+public class DefaultDebuggerCallbacks implements IDebuggerCallbacks
+{
+ private boolean m_computedExeLocations;
+ private File m_httpExe;
+ private File m_playerExe;
+
+ private static final String UNIX_DEFAULT_BROWSER = "firefox"; //$NON-NLS-1$
+ private static final String UNIX_FLASH_PLAYER = "flashplayer"; //$NON-NLS-1$
+
+ private static final int WINDOWS = 0;
+ private static final int MAC = 1;
+ private static final int UNIX = 2;
+
+ // A pattern for a value that was output by reg.exe. Warning,
+ // Windows XP and Windows Vista have different output; the following
+ // pattern needs to work for both.
+ private static final Pattern registryValuePattern = Pattern.compile("\\sREG_[^ \t]+\\s+(.*)$"); //$NON-NLS-1$
+
+ /**
+ * Returns WINDOWS, MAC, or UNIX
+ */
+ private static int getOS() {
+ String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
+ if (osName.startsWith("windows")) //$NON-NLS-1$
+ return WINDOWS;
+ else if (osName.startsWith("mac os x")) // as per http://developer.apple.com/technotes/tn2002/tn2110.html //$NON-NLS-1$
+ return MAC;
+ else
+ return UNIX;
+ }
+
+ /*
+ * @see flash.tools.debugger.IDebuggerCallbacks#getHttpExe()
+ */
+ public synchronized File getHttpExe()
+ {
+ if (!m_computedExeLocations)
+ recomputeExeLocations();
+ return m_httpExe;
+ }
+
+ /*
+ * @see flash.tools.debugger.IDebuggerCallbacks#getPlayerExe()
+ */
+ public synchronized File getPlayerExe()
+ {
+ if (!m_computedExeLocations)
+ recomputeExeLocations();
+ return m_playerExe;
+ }
+
+ /*
+ * @see flash.tools.debugger.IDebuggerCallbacks#recomputeExeLocations()
+ */
+ public synchronized void recomputeExeLocations()
+ {
+ int os = getOS();
+ if (os == WINDOWS)
+ {
+ m_httpExe = getDefaultWindowsBrowser();
+ m_playerExe = determineExeForType("ShockwaveFlash.ShockwaveFlash"); //$NON-NLS-1$
+ }
+ else if (os == MAC)
+ {
+ m_httpExe = null;
+ m_playerExe = null;
+ }
+ else // probably Unix
+ {
+ // "firefox" is default browser for unix
+ m_httpExe = findUnixProgram(UNIX_DEFAULT_BROWSER);
+
+ // "flashplayer" is standalone flash player on unix
+ m_playerExe = findUnixProgram(UNIX_FLASH_PLAYER);
+ }
+ m_computedExeLocations = true;
+ }
+
+ public String getHttpExeName()
+ {
+ if (getOS() == UNIX)
+ return UNIX_DEFAULT_BROWSER;
+ else
+ return Bootstrap.getLocalizationManager().getLocalizedTextString("webBrowserGenericName"); //$NON-NLS-1$
+ }
+
+ public String getPlayerExeName()
+ {
+ if (getOS() == UNIX)
+ return UNIX_FLASH_PLAYER;
+ else
+ return Bootstrap.getLocalizationManager().getLocalizedTextString("flashPlayerGenericName"); //$NON-NLS-1$
+ }
+
+ /**
+ * Looks for a Unix program. Checks the PATH, and if not found there,
+ * checks the directory specified by the "application.home" Java property.
+ * ("application.home" was set by the "fdb" shell script.)
+ *
+ * @param program program to find, e.g. "firefox"
+ * @return path, or <code>null</code> if not found.
+ */
+ private File findUnixProgram(String program)
+ {
+ String[] cmd = { "/bin/sh", "-c", "which " + program }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ try
+ {
+ Process process = Runtime.getRuntime().exec(cmd);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String line = reader.readLine();
+ if (line != null)
+ {
+ File f = new File(line);
+ if (f.exists())
+ {
+ return f;
+ }
+ }
+
+ // Check in the Flex SDK's "bin" directory. The "application.home"
+ // property is set by the "fdb" shell script.
+ String flexHome = System.getProperty("application.home"); //$NON-NLS-1$
+ if (flexHome != null)
+ {
+ File f = new File(flexHome, "bin/" + program); //$NON-NLS-1$
+ if (f.exists())
+ {
+ return f;
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ // ignore
+ }
+ return null;
+ }
+
+ private File getDefaultWindowsBrowser() {
+ try {
+ String browser = null;
+
+ double osVersion;
+ try {
+ osVersion = Double.parseDouble(System.getProperty("os.version")); //$NON-NLS-1$
+ } catch (NumberFormatException e) {
+ osVersion = 0;
+ }
+
+ if (osVersion >= 6) { // Vista or higher
+ String progid = queryWindowsRegistry(
+ "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice", //$NON-NLS-1$
+ "Progid"); //$NON-NLS-1$
+ if (progid != null) {
+ browser = getClassShellOpenCommand(progid);
+ }
+ }
+
+ if (browser == null) {
+ browser = getClassShellOpenCommand("http"); //$NON-NLS-1$
+ }
+
+ if (browser != null) {
+ browser = extractExenameFromCommandString(browser);
+ return new File(browser);
+ } else {
+ return null;
+ }
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ private String getClassShellOpenCommand(String clazz) throws IOException {
+ return queryWindowsRegistry("HKEY_CLASSES_ROOT\\" + clazz + "\\shell\\open\\command", null); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Note, this function is Windows-specific.
+ */
+ private File determineExeForType(String type)
+ {
+ String it = null;
+ try
+ {
+ String[] cmd = new String[] { "cmd", "/d", "/c", "ftype", type }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Process p = Runtime.getRuntime().exec(cmd);
+ LineNumberReader lnr = new LineNumberReader(new InputStreamReader(p.getInputStream()));
+ String line = null;
+ type += "="; //$NON-NLS-1$
+ while( it == null && (line = lnr.readLine()) != null)
+ {
+ if (line.length() < type.length() ||
+ line.substring(0, type.length()).compareToIgnoreCase(type) == 0)
+ {
+ it = line;
+ break;
+ }
+ }
+ p.destroy();
+
+ // if we have one extract cmd = " "
+ if (it != null)
+ {
+ int equalSign = it.indexOf('=');
+ if (equalSign != -1)
+ it = it.substring(equalSign+1);
+
+ it = extractExenameFromCommandString(it);
+ }
+ }
+ catch (IOException e)
+ {
+ // means it didn't work
+ }
+
+ if (it != null)
+ return new File(it);
+ else
+ return null;
+ }
+
+ /**
+ * Given a command string of the form
+ * "path_to_exe" args
+ * or
+ * path_to_exe args
+ *
+ * return the path_to_exe. Note that path_to_exe may contain spaces.
+ */
+ protected String extractExenameFromCommandString(String cmd)
+ {
+ // now strip trailing junk if any
+ if (cmd.startsWith("\"")) { //$NON-NLS-1$
+ // ftype is enclosed in quotes
+ int closingQuote = cmd.indexOf('"', 1);
+ if (closingQuote == -1)
+ closingQuote = cmd.length();
+ cmd = cmd.substring(1, closingQuote);
+ } else {
+ // Some ftypes don't use enclosing quotes. This is tricky -- we have to
+ // scan through the string, stopping at each space and checking whether
+ // the filename up to that point refers to a valid filename. For example,
+ // if the input string is
+ //
+ // C:\Program Files\Macromedia\Flash 9\Players\SAFlashPlayer.exe %1
+ //
+ // then we need to stop at each space and see if that is an EXE name:
+ //
+ // C:\Program.exe
+ // C:\Program Files\Macromedia\Flash.exe
+ // C:\Program Files\Macromedia\Flash 9\Players\SAFlashPlayer.exe
+
+ int endOfFilename = -1;
+ for (;;) {
+ int nextSpace = cmd.indexOf(' ', endOfFilename+1);
+ if (nextSpace == -1) {
+ endOfFilename = -1;
+ break;
+ }
+ String filename = cmd.substring(0, nextSpace);
+ if (!filename.toLowerCase().endsWith(".exe")) //$NON-NLS-1$
+ filename += ".exe"; //$NON-NLS-1$
+ if (new File(filename).exists()) {
+ endOfFilename = nextSpace;
+ break;
+ }
+ endOfFilename = nextSpace;
+ }
+ if (endOfFilename != -1 && endOfFilename < cmd.length())
+ cmd = cmd.substring(0, endOfFilename);
+ }
+ return cmd;
+ }
+
+ /*
+ * @see flash.tools.debugger.IDebuggerCallbacks#launchDebugTarget(java.lang.String[])
+ */
+ public Process launchDebugTarget(String[] cmd) throws IOException
+ {
+ return Runtime.getRuntime().exec(cmd);
+ }
+
+ @Override
+ public Process launchDebugTarget(String[] cmd, ILauncher launcher) throws IOException {
+ return launcher.launch(cmd);
+ }
+
+ /*
+ * @see flash.tools.debugger.IDebuggerCallbacks#terminateDebugTarget(java.lang.Process)
+ */
+ public void terminateDebugTarget(Process process) throws IOException
+ {
+ terminateDebugTarget(process, null);
+ }
+
+ @Override
+ public void terminateDebugTarget(Process process, ILauncher launcher) throws IOException {
+ if(null == launcher)
+ {
+ process.destroy();
+ }
+ else
+ {
+ launcher.terminate(process);
+ }
+
+ }
+
+ public String queryWindowsRegistry(String key, String value) throws IOException
+ {
+ return queryWindowsRegistry(key, value, 0);
+ }
+
+ /**
+ * This implementation of queryWindowsRegistry() does not make any native
+ * calls. I had to do it this way because it is too hard, at this point,
+ * to add native code to the Flex code tree.
+ */
+ public String queryWindowsRegistry(String key, String value, int registryBitMode) throws IOException
+ {
+ Process p = null;
+ String result = null;
+
+ List<String> arguments = new ArrayList<String>(6);
+ arguments.add("reg.exe"); //$NON-NLS-1$
+ arguments.add("query"); //$NON-NLS-1$
+ arguments.add(key);
+ if (value == null || value.length() == 0)
+ {
+ arguments.add("/ve"); //$NON-NLS-1$
+ }
+ else
+ {
+ arguments.add("/v"); //$NON-NLS-1$
+ arguments.add(value);
+ }
+
+ // This line must not be in try/catch -- if it throws an exception,
+ // we want that to propagate out to our caller.
+ p = Runtime.getRuntime().exec(arguments.toArray(new String[arguments.size()]));
+
+ try
+ {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
+
+ String line;
+ while ((line = reader.readLine()) != null)
+ {
+ if (line.equalsIgnoreCase(key))
+ {
+ line = reader.readLine();
+ if (line != null)
+ {
+ Matcher matcher = registryValuePattern.matcher(line);
+ if (matcher.find()) {
+ result = matcher.group(1);
+ }
+ }
+ break;
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ if (Trace.error)
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (p != null)
+ {
+ p.destroy();
+ p = null;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Default implementation does not know how to get the version
+ * of an application.
+ */
+ public int[] getAppVersion(File application) throws IOException {
+ return null;
+ }
+
+ /**
+ * Default application does not have any extra arguments for the
+ * browser.
+ */
+ public String[] getBrowserParameters(String uri)
+ {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/Frame.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/Frame.java b/debugger/src/main/java/flash/tools/debugger/Frame.java
new file mode 100644
index 0000000..9c757ec
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/Frame.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * The Frame object represents a single frame of the actionscript call stack.
+ * Each Frame contains a Location object, which identifies the line of source
+ * for the frame, and a set of variables that are available within the frame.
+ * The set of variables includes a 'this' pointer, arguments passed into
+ * the function and locals available within the scope of the function.
+ * A given frame is only valid when execution has suspended.
+ * @since Version 2
+ */
+public interface Frame
+{
+ /**
+ * Location object related to this frame.
+ */
+ public Location getLocation();
+
+ /**
+ * 'this' variable for the frame. Will return null
+ * if no 'this' pointer available for the frame.
+ * @throws NoResponseException
+ * @throws NotSuspendedException
+ * @throws NotConnectedException
+ */
+ public Variable getThis(Session s) throws NoResponseException, NotSuspendedException, NotConnectedException;
+
+ /**
+ * Arguments that were passed into the function. An empty
+ * array is used to denote that no arguments were passed into
+ * this function scope.
+ * @throws NoResponseException
+ * @throws NotSuspendedException
+ * @throws NotConnectedException
+ */
+ public Variable[] getArguments(Session s) throws NoResponseException, NotSuspendedException, NotConnectedException;
+
+ /**
+ * Locals used within this function scope. An empty
+ * array is used to denote no locals are available
+ * within this function scope.
+ * @throws NoResponseException
+ * @throws NotSuspendedException
+ * @throws NotConnectedException
+ */
+ public Variable[] getLocals(Session s) throws NoResponseException, NotSuspendedException, NotConnectedException;
+
+ /**
+ * Returns a string which contains the raw signature of
+ * the call. This information can be used for display
+ * purposes in the event the Location object contains
+ * a null SourceFile, which happens when a call is
+ * made into or through a non-debug executable.
+ * The format of the string is one of the following:
+ * <ul>
+ * <li> <code>declaringClass/[[namespace::]function]</code> (for regular functions) </li>
+ * <li> <code>declaringClass$cinit</code> (class constructor for statics) </li>
+ * <li> <code>declaringClass$iinit</code> (class instance ctor)</li>
+ * <li> <code>global$init</code> </li>
+ * </ul>
+ *<p>
+ * where <code>declaringClass</code> is the name of the
+ * class in which the function is declared (even if it
+ * is an anonymous inner function); <code>namespace</code>
+ * is the namespace of the function (the meaning of this
+ * varies depending on whether the function is private,
+ * protected etc.; see <code>Variable.getNamespace()</code>
+ * for more information); and <code>function</code> is
+ * the name of the function, or <code>""</code> if the
+ * function is anonymous.
+ *</p><p>
+ * If the signature is unknown then the value
+ * "" will be returned. Note: this may occur even when
+ * Location contains a non-null SourceFile.
+ * </p><p>
+ * Examples:
+ * <ul>
+ * <li> <code>MyClass/myFunction</code> for a public function </li>
+ * <li> <code>MyClass/MyClass::myFunction</code> for a private function </li>
+ * <li> <code>MyClass/</code> for an anonymous inner function declared
+ * somewhere inside <code>MyClass</code> </li>
+ * <li> <code>""</code> if unknown </li>
+ * </ul>
+ * </p>
+ */
+ public String getCallSignature();
+
+ /**
+ * Returns a list of objects which make up the scope chain of
+ * this frame.
+ * <p>
+ * Some of the entries will be classes; some will be instances
+ * of classes; some will be functions; etc.
+ * <p>
+ * <b>Bug:</b> Currently, this does <em>not</em> include any
+ * scope chain entries which were created via "with var".
+ */
+ public Variable[] getScopeChain(Session s) throws NoResponseException, NotSuspendedException, NotConnectedException;
+
+ /**
+ * Returns the worker ID associated to this frame. This will return
+ * Isolate.DEFAULT_ID, that is, the main worker.
+ */
+ public int getIsolateId();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/IDebuggerCallbacks.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/IDebuggerCallbacks.java b/debugger/src/main/java/flash/tools/debugger/IDebuggerCallbacks.java
new file mode 100644
index 0000000..8c97bca
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/IDebuggerCallbacks.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Miscellaneous callbacks from the DJAPI to the debugger which is using it.
+ *
+ * @author mmorearty
+ */
+public interface IDebuggerCallbacks
+{
+ /**
+ * Tells the debugger to recompute the values which will be returned by
+ * getHttpExe() and getPlayerExe().
+ *
+ * This does NOT need to be called before the first call to either of
+ * those functions. The intent of this function is to allow the debugger
+ * to cache any expensive calculations, but still allow for the possibility
+ * of recalculating the values from time to time (e.g. when a new launch
+ * is going to happen).
+ */
+ public void recomputeExeLocations();
+
+ /**
+ * Returns the executable of the browser to launch for http: URLs, or
+ * <code>null</code> if not known.
+ */
+ public File getHttpExe();
+
+ /**
+ * Returns the parameters to pass to the browser or null if non-existent.
+ * If this is present, URL is assumed to already exist in this array.
+ */
+ public String[] getBrowserParameters(String uri);
+
+ /**
+ * Returns the executable for the standalone Flash player, or <code>null</code>
+ * if not known.
+ */
+ public File getPlayerExe();
+
+ /**
+ * Returns a name such as "firefox" or "Web browser", the name of the
+ * browser, useful for error messages. Never returns <code>null</code>.
+ */
+ public String getHttpExeName();
+
+ /**
+ * Returns a name such as "SAFlashPlayer.exe" or "gflashplayer" or "Flash
+ * player", the name of the standalone player, useful for error messages.
+ * Never returns <code>null</code>.
+ */
+ public String getPlayerExeName();
+
+ /**
+ * Launches a debug target. The arguments are the same as those of
+ * Runtime.exec().
+ */
+ public Process launchDebugTarget(String[] cmd) throws IOException;
+
+ /**
+ * Terminates a debug target process.
+ */
+ public void terminateDebugTarget(Process process) throws IOException;
+
+ /**
+ * Launches a debug target using the launcher instance<code>ILauncher.launch(cmd)</code>.
+ *
+ */
+ public Process launchDebugTarget(String[] cmd, ILauncher launcher) throws IOException;
+
+ /**
+ * Terminates a debug target process by invoking <code>ILauncher.terminate(process)</code>
+ */
+ public void terminateDebugTarget(Process process, ILauncher launcher) throws IOException;
+
+
+ /**
+ * Query the Windows registry.
+ *
+ * @param key
+ * The registry key, in a format suitable for the REG.EXE
+ * program. You must use full key names such as
+ * HKEY_LOCAL_MACHINE rather the shorter abbreviations such as
+ * HKLM.
+ * @param value
+ * The value within that key, or null for the unnamed ("empty")
+ * value
+ * @return the value stored at the location, or null if key or value was not
+ * found
+ * @throws IOException
+ * indicates the registry query failed -- warning, this can
+ * really happen! Some implementations of this function don't
+ * work on Windows 2000. So, this function should not be counted
+ * on too heavily -- you should have a backup plan.
+ */
+ public String queryWindowsRegistry(String key, String value) throws IOException;
+
+ /**
+ * Same as queryWindowsRegistry, but allows specific access to the 32-bit
+ * or 64-bit part of the registry.
+ */
+ public String queryWindowsRegistry(String key, String value, int registryBitMode) throws IOException;
+
+ /**
+ * Returns the version number of an application. For example, Firefox 3.5.4
+ * would return new int[] { 3, 5 }.
+ * <p>
+ * As of this writing, the only thing this is used for is to determine, on
+ * Windows, whether the user is running IE 8; if he is, we need to pass the
+ * "-noframemerging" command-line argument. It is generally okay to just
+ * return <code>null</code> from this function; a robust implementation is
+ * not required.
+ *
+ * @param application
+ * the application whose version number is desired. On Windows,
+ * this will typically be a path to a .exe file. On Mac, it may
+ * point to a .app directory such as "/Applications/Safari.app",
+ * or it may point to the underlying binary, such as
+ * "/Applications/Safari.app/Contents/MacOS/Safari".
+ * @return an array of two integers if the version can be determined, or
+ * null if it cannot be determined. The first integer is the major
+ * version number, and the second integer is the minor version
+ * number. More detailed information cannot be provided, because
+ * this function needs to be cross- platform, and the format of
+ * version information tends to vary widely from one platform to
+ * another.
+ * @throws IOException
+ * e.g. for file not found, etc.
+ */
+ public int[] getAppVersion(File application) throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/ILaunchNotification.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/ILaunchNotification.java b/debugger/src/main/java/flash/tools/debugger/ILaunchNotification.java
new file mode 100644
index 0000000..e01d724
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/ILaunchNotification.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+import java.io.IOException;
+
+/**
+ * Used to notify caller in case of ADL Exit Code 1: Successful invocation of an already running
+ * AIR application. ADL exits immediately.
+ *
+ * @author sakkus
+ */
+public interface ILaunchNotification
+{
+ /**
+ * Notifies the listener that the launch is done, and, if it failed,
+ * an exception with information about why it failed.
+ *
+ * @param e
+ * an exception if the launch failed, or null if the launch
+ * succeeded.
+ */
+ public void notify(IOException e);
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/ILauncher.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/ILauncher.java b/debugger/src/main/java/flash/tools/debugger/ILauncher.java
new file mode 100644
index 0000000..68c87f7
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/ILauncher.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package flash.tools.debugger;
+
+import java.io.IOException;
+
+/**
+ * A ILauncher which handles the launching of the URI or the command.
+ *
+ * ILauncher is to provide more flexibility to handle the Player launch in different platforms.
+ *
+ * @author ugs
+ *
+ */
+public interface ILauncher {
+
+ /**
+ * Launches the debug target.
+ *
+ * @param cmd - Launch URL and other arguments
+ * @return A handle to the process.
+ *
+ * @throws IOException
+ */
+ public Process launch(String[] cmd) throws IOException;
+
+ /**
+ * Terminate the process started by launch method.
+ * @param process - process started by launch.
+ * @throws IOException
+ */
+ public void terminate(Process process) throws IOException;
+
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/IProgress.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/IProgress.java b/debugger/src/main/java/flash/tools/debugger/IProgress.java
new file mode 100644
index 0000000..f63ec68
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/IProgress.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * A simple interface to report progress on some operation.
+ *
+ * @author mmorearty
+ */
+public interface IProgress
+{
+ /**
+ * Reports how much work has been done.
+ *
+ * @param current
+ * how much progress has been made toward the total
+ * @param total
+ * the total amount of work
+ */
+ public void setProgress(int current, int total);
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/InProgressException.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/InProgressException.java b/debugger/src/main/java/flash/tools/debugger/InProgressException.java
new file mode 100644
index 0000000..3bf6f2a
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/InProgressException.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * InProgressException is thrown when a request cannot
+ * be fulfilled because some other activity is currently
+ * taking place that will alter the result of the request.
+ */
+public class InProgressException extends PlayerDebugException
+{
+ private static final long serialVersionUID = -8307030350432666820L;
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/Isolate.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/Isolate.java b/debugger/src/main/java/flash/tools/debugger/Isolate.java
new file mode 100644
index 0000000..982c2dd
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/Isolate.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package flash.tools.debugger;
+
+/**
+ * The Isolate object uniquely identifies a "Worker" in ActionScript.
+ * Workers are conceptually similar to Threads, but their implementation
+ * closely follows more that of a web worker than an actual OS Thread.
+ *
+ * By default there is a default isolate object with id DEFAULT_ID.
+ * @author anirudhs
+ *
+ */
+public interface Isolate {
+
+ public static final int DEFAULT_ID = 1;
+
+ /**
+ * Get the unique integer ID associated with the
+ * worker. This is Isolate.DEFAULT_ID for the
+ * primordial.
+ * @return unique integer ID
+ */
+ public int getId();
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/IsolateController.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/IsolateController.java b/debugger/src/main/java/flash/tools/debugger/IsolateController.java
new file mode 100644
index 0000000..ed09477
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/IsolateController.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package flash.tools.debugger;
+
+import flash.tools.debugger.expression.PlayerFaultException;
+
+/**
+ * Worker specific debug session commands. These are a subset of Session that
+ * can be individually routed to a specific worker (including the main worker if
+ * the player does not support concurrency). This is implemented by
+ * PlayerSession and used by the getWorkerSession() api.
+ *
+ * @see flash.tools.debugger.IsolateSession,
+ * flash.tools.debugger.Session#getWorkerSession(int)
+ * @author anirudhs
+ *
+ */
+public interface IsolateController {
+
+ /**
+ * @see flash.tools.debugger.Session#resume()
+ */
+ public void resumeWorker(int isolateId) throws NotSuspendedException, NotConnectedException, NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#suspend()
+ */
+ public void suspendWorker(int isolateId) throws SuspendedException, NotConnectedException, NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#isSuspended()
+ */
+ public boolean isWorkerSuspended(int isolateId) throws NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#isSuspended()
+ */
+ public int suspendReasonWorker(int isolateId) throws NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getFrames()
+ */
+ public Frame[] getFramesWorker(int isolateId) throws NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepInto()
+ */
+ public void stepIntoWorker(int isolateId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepOut()
+ */
+ public void stepOutWorker(int isolateId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepOver()
+ */
+ public void stepOverWorker(int isolateId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepContinue()
+ */
+ public void stepContinueWorker(int isolateId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getSwfs()
+ */
+ public SwfInfo[] getSwfsWorker(int isolateId) throws NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#setBreakpoint(int, int)
+ */
+ public Location setBreakpointWorker(int fileId, int lineNum, int isolateId) throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getWatchList()
+ */
+ public Watch[] getWatchListWorker(int isolateId) throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getVariableList()
+ */
+ public Variable[] getVariableListWorker(int isolateId) throws NotSuspendedException, NoResponseException, NotConnectedException, VersionException;
+
+ /**
+ * @see flash.tools.debugger.Session#getValue(long)
+ */
+ public Value getValueWorker(long valueId, int isolateId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getGlobal(String)
+ */
+ public Value getGlobalWorker(String name, int isolateId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalIs(Value, Value)
+ */
+ public boolean evalIsWorker(Value value, Value type, int isolateId) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalIs(Value, String)
+ */
+ public boolean evalIsWorker(Value value, String type, int isolateId) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalInstanceof(Value, Value)
+ */
+ public boolean evalInstanceofWorker(Value value, Value type, int isolateId) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalInstanceof(Value, String)
+ */
+ public boolean evalInstanceofWorker(Value value, String type, int isolateId) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalIn(Value, Value)
+ */
+ public boolean evalInWorker(Value property, Value object, int isolateId) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalAs(Value, Value)
+ */
+ public Value evalAsWorker(Value value, Value type, int isolateId) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#callFunction(Value, String, Value[])
+ */
+ public Value callFunctionWorker(Value thisObject, String functionName, Value[] args, int isolateId) throws PlayerDebugException;
+
+ /**
+ * @see flash.tools.debugger.Session#callConstructor(String, Value[])
+ */
+ public Value callConstructorWorker(String classname, Value[] args, int isolateId) throws PlayerDebugException;
+
+ /**
+ * @see flash.tools.debugger.Session#setExceptionBreakpoint(String)
+ */
+ public boolean setExceptionBreakpointWorker(String exceptionClass, int isolateId) throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#clearExceptionBreakpoint(String)
+ */
+ public boolean clearExceptionBreakpointWorker(String exceptionClass, int isolateId) throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#breakOnCaughtExceptions(boolean)
+ */
+ public void breakOnCaughtExceptions(boolean b, int isolateId) throws NotSupportedException, NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#supportsWatchpoints()
+ */
+ public boolean supportsWatchpoints(int isolateId);
+
+ /**
+ * @see flash.tools.debugger.Session#playerCanBreakOnAllExceptions()
+ */
+ public boolean playerCanBreakOnAllExceptions(int isolateId);
+
+ /**
+ * @see flash.tools.debugger.Session#supportsWideLineNumbers()
+ */
+ public boolean supportsWideLineNumbers(int isolateId);
+
+ /**
+ * @see flash.tools.debugger.Session#playerCanCallFunctions(String)
+ */
+ public boolean playerCanCallFunctions(int isolateId);
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/IsolateSession.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/IsolateSession.java b/debugger/src/main/java/flash/tools/debugger/IsolateSession.java
new file mode 100644
index 0000000..6b57d62
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/IsolateSession.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package flash.tools.debugger;
+
+import flash.tools.debugger.expression.PlayerFaultException;
+
+/**
+ * Used to issue commands to a particular worker (isolate).
+ * @see Session
+ * @author anirudhs
+ */
+public interface IsolateSession {
+
+ /**
+ * @see flash.tools.debugger.Session#resume()
+ */
+ public void resume() throws NotSuspendedException, NotConnectedException, NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#suspend()
+ */
+ public void suspend() throws SuspendedException, NotConnectedException, NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#isSuspended()
+ */
+ public boolean isSuspended() throws NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#isSuspended()
+ */
+ public int suspendReason() throws NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getFrames()
+ */
+ public Frame[] getFrames() throws NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepInto()
+ */
+ public void stepInto() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepOut()
+ */
+ public void stepOut() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepOver()
+ */
+ public void stepOver() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#stepContinue()
+ */
+ public void stepContinue() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getSwfs()
+ */
+ public SwfInfo[] getSwfs() throws NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#setBreakpoint(int, int)
+ */
+ public Location setBreakpoint(int fileId, int lineNum) throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getWatchList()
+ */
+ public Watch[] getWatchList() throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getVariableList()
+ */
+ public Variable[] getVariableList() throws NotSuspendedException, NoResponseException, NotConnectedException, VersionException;
+
+ /**
+ * @see flash.tools.debugger.Session#getValue(long)
+ */
+ public Value getValue(long valueId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#getGlobal(String)
+ */
+ public Value getGlobal(String name) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalIs(Value, Value)
+ */
+ public boolean evalIs(Value value, Value type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalIs(Value, String)
+ */
+ public boolean evalIs(Value value, String type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalInstanceof(Value, Value)
+ */
+ public boolean evalInstanceof(Value value, Value type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalInstanceof(Value, String)
+ */
+ public boolean evalInstanceof(Value value, String type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalIn(Value, Value)
+ */
+ public boolean evalIn(Value property, Value object) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#evalAs(Value, Value)
+ */
+ public Value evalAs(Value value, Value type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * @see flash.tools.debugger.Session#resume()
+ */
+ public Value callFunction(Value thisObject, String functionName, Value[] args) throws PlayerDebugException;
+
+ /**
+ * @see flash.tools.debugger.Session#callFunction(Value, String, Value[])
+ */
+ public Value callConstructor(String classname, Value[] args) throws PlayerDebugException;
+
+ /**
+ * @see flash.tools.debugger.Session#setExceptionBreakpoint(String)
+ */
+ public boolean setExceptionBreakpoint(String exceptionClass) throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#clearExceptionBreakpoint(String)
+ */
+ public boolean clearExceptionBreakpoint(String exceptionClass) throws NoResponseException, NotConnectedException;
+
+ /**
+ * @see flash.tools.debugger.Session#breakOnCaughtExceptions(boolean)
+ */
+ public void breakOnCaughtExceptions(boolean b) throws NotSupportedException, NoResponseException;
+
+ /**
+ * @see flash.tools.debugger.Session#supportsWatchpoints()
+ */
+ public boolean supportsWatchpoints();
+
+ /**
+ * @see flash.tools.debugger.Session#playerCanBreakOnAllExceptions()
+ */
+ public boolean playerCanBreakOnAllExceptions();
+
+ /**
+ * @see flash.tools.debugger.Session#supportsWideLineNumbers()
+ */
+ public boolean supportsWideLineNumbers();
+
+ /**
+ * @see flash.tools.debugger.Session#playerCanCallFunctions()
+ */
+ public boolean playerCanCallFunctions();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/Location.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/Location.java b/debugger/src/main/java/flash/tools/debugger/Location.java
new file mode 100644
index 0000000..bf6103c
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/Location.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * The Location object identifies a specific line number with a SourceFile.
+ * It is used for breakpoint manipulation and obtaining stack frame context.
+ */
+public interface Location
+{
+ /**
+ * Source file for this location
+ */
+ public SourceFile getFile();
+
+ /**
+ * Line number within the source for this location
+ */
+ public int getLine();
+
+ /**
+ * Worker to which this location belongs.
+ */
+ public int getIsolateId();
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/NoResponseException.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/NoResponseException.java b/debugger/src/main/java/flash/tools/debugger/NoResponseException.java
new file mode 100644
index 0000000..b6756e6
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/NoResponseException.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * NoResponseException is thrown when the Player does
+ * not respond to the command that was issued.
+ *
+ * The field m_waitedFor contains the number of
+ * milliseconds waited for the response.
+ */
+public class NoResponseException extends PlayerDebugException
+{
+ private static final long serialVersionUID = -3704426811630352537L;
+
+ /**
+ * Number of milliseconds that elapsed causing the timeout
+ * -1 means unknown.
+ */
+ public int m_waitedFor;
+
+ public NoResponseException(int t)
+ {
+ m_waitedFor = t;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ Map<String, String> args = new HashMap<String, String>();
+ String formatString;
+ if (m_waitedFor != -1 && m_waitedFor != 0)
+ {
+ formatString = "timeout"; //$NON-NLS-1$
+ args.put("time", Integer.toString(m_waitedFor)); //$NON-NLS-1$
+ }
+ else
+ {
+ formatString = "timeoutAfterUnknownDelay"; //$NON-NLS-1$
+ }
+ return Bootstrap.getLocalizationManager().getLocalizedTextString(formatString, args);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/NotConnectedException.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/NotConnectedException.java b/debugger/src/main/java/flash/tools/debugger/NotConnectedException.java
new file mode 100644
index 0000000..662a10a
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/NotConnectedException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * NotConnectedException is thrown when the Session
+ * is no longer connnected to the Player
+ */
+public class NotConnectedException extends PlayerDebugException
+{
+ private static final long serialVersionUID = -9087367591357152206L;
+
+ @Override
+ public String getMessage()
+ {
+ return Bootstrap.getLocalizationManager().getLocalizedTextString("notConnected"); //$NON-NLS-1$
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/NotSupportedException.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/NotSupportedException.java b/debugger/src/main/java/flash/tools/debugger/NotSupportedException.java
new file mode 100644
index 0000000..8e6dbd3
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/NotSupportedException.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * Indicates that a debugger feature is not supported by the Flash
+ * player that is being targeted. For example, newer players
+ * support the ability to have the debugger call arbitrary
+ * functions, but older ones do not.
+ *
+ * @author Mike Morearty
+ */
+public class NotSupportedException extends PlayerDebugException {
+ private static final long serialVersionUID = -8873935118857320824L;
+
+ /**
+ * @param s an error message, e.g. "Target player does not support
+ * function calls," or "Target player does not support watchpoints".
+ */
+ public NotSupportedException(String s)
+ {
+ super(s);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/NotSuspendedException.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/NotSuspendedException.java b/debugger/src/main/java/flash/tools/debugger/NotSuspendedException.java
new file mode 100644
index 0000000..c5dad0e
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/NotSuspendedException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * NotSuspendedException is thrown when the Player
+ * is in a state for which the action cannot be performed.
+ */
+public class NotSuspendedException extends PlayerDebugException
+{
+ private static final long serialVersionUID = 1373922470760042675L;
+
+ @Override
+ public String getMessage()
+ {
+ return Bootstrap.getLocalizationManager().getLocalizedTextString("notSuspended"); //$NON-NLS-1$
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/Player.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/Player.java b/debugger/src/main/java/flash/tools/debugger/Player.java
new file mode 100644
index 0000000..8b83250
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/Player.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+import java.io.File;
+
+/**
+ * Describes a Flash player.
+ *
+ * @author mmorearty
+ */
+public interface Player
+{
+ /**
+ * Indicates a standalone Flash player, e.g. FlashPlayer.exe.
+ *
+ * @see #getType()
+ */
+ public static final int STANDALONE = 1;
+
+ /**
+ * Indicates a Netscape-plugin Flash player, e.g. NPSWF32.dll. Used on
+ * Windows by all Netscape-based browsers (e.g. Firefox etc.), and on Mac
+ * and Linux by all browsers.
+ *
+ * @see #getType()
+ */
+ public static final int NETSCAPE_PLUGIN = 2;
+
+ /**
+ * Indicates an ActiveX-control Flash player, e.g. Flash.ocx. Used on Windows
+ * by Internet Explorer.
+ *
+ * @see #getType()
+ */
+ public static final int ACTIVEX = 3;
+
+ /**
+ * Indicates the Flash player inside AIR.
+ */
+ public static final int AIR = 4;
+
+ /**
+ * Returns what type of Player this is: <code>STANDALONE</code>, <code>NETSCAPE_PLUGIN</code>,
+ * <code>ACTIVEX</code>, or <code>AIR</code>.
+ */
+ public int getType();
+
+ /**
+ * Returns the path to the Flash player file -- e.g. the path to
+ * FlashPlayer.exe, NPSWF32.dll, Flash.ocx, or adl.exe -- or
+ * <code>null</code> if not known. (Filenames are obviously
+ * platform-specific.)
+ *
+ * <p>
+ * Note that the file is not guaranteed to exist. You can use File.exists()
+ * to test that.
+ */
+ public File getPath();
+
+ /**
+ * Returns the web browser with which this player is associated,
+ * or <code>null</code> if this is the standalone player or AIR,
+ * or if we're not sure which browser will be run.
+ */
+ public Browser getBrowser();
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/PlayerDebugException.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/PlayerDebugException.java b/debugger/src/main/java/flash/tools/debugger/PlayerDebugException.java
new file mode 100644
index 0000000..a8e9f7c
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/PlayerDebugException.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+/**
+ * PlayerDebugException is the base class for all
+ * exceptions thrown by the playerdebug API
+ */
+public class PlayerDebugException extends Exception
+{
+ private static final long serialVersionUID = 757986761482127248L;
+
+ public PlayerDebugException() { super(); }
+ public PlayerDebugException(String s) { super(s); }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/07f5a7de/debugger/src/main/java/flash/tools/debugger/Session.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flash/tools/debugger/Session.java b/debugger/src/main/java/flash/tools/debugger/Session.java
new file mode 100644
index 0000000..35ebed4
--- /dev/null
+++ b/debugger/src/main/java/flash/tools/debugger/Session.java
@@ -0,0 +1,604 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger;
+
+import flash.tools.debugger.events.DebugEvent;
+import flash.tools.debugger.expression.PlayerFaultException;
+
+/**
+ * The Session object manages all aspects of debugging session with
+ * the Flash Player. A program can be suspended, resumed, single
+ * stepping can be performed and state information can be obtained
+ * through this object.
+ */
+public interface Session
+{
+ /**
+ * Returns the URL that identifies this Session.
+ * Note: this may not be unique across Sessions if
+ * the same launching mechanism and SWF are used.
+ * @return URI received from the connected Player.
+ * It identifies the debugging session
+ */
+ public String getURI();
+
+ /**
+ * Returns the Process object, if any, that triggered this Session.
+ * @return the Process object that was used to create this Session.
+ * If SessionManager.launch() was not used, then null is returned.
+ */
+ public Process getLaunchProcess();
+
+ /**
+ * Adjust the preferences for this session; see SessionManager
+ * for a list of valid preference strings.
+ *
+ * If an invalid preference is passed, it will be silently ignored.
+ * @param pref preference name, one of the strings listed above
+ * @param value value to set for preference
+ */
+ public void setPreference(String pref, int value);
+
+ /**
+ * Return the value of a particular preference item
+ *
+ * @param pref preference name, one of the strings listed in <code>SessionManager</code>
+ * @throws NullPointerException if pref does not exist
+ * @see SessionManager
+ */
+ public int getPreference(String pref) throws NullPointerException;
+
+ /**
+ * Is the Player currently connected for this session. This function
+ * must be thread-safe.
+ *
+ * @return true if connection is alive
+ */
+ public boolean isConnected();
+
+ /**
+ * Allow the session to start communicating with the player. This
+ * call must be made PRIOR to any other Session method call.
+ * @return true if bind was successful.
+ * @throws VersionException connected to Player which does not support all API completely
+ */
+ public boolean bind() throws VersionException;
+
+ /**
+ * Permanently stops the debugging session and breaks the
+ * connection. If this Session is used for any subsequent
+ * calls exceptions will be thrown.
+ * <p>
+ * Note: this method allows the caller to disconnect
+ * from the debugging session (and Player) without
+ * terminating the Player. A subsequent call to terminate()
+ * will destroy the Player process.
+ * <p>
+ * Under normal circumstances this method need not be
+ * called since a call to terminate() performs both
+ * actions of disconnecting from the Player and destroying
+ * the Player process.
+ */
+ public void unbind();
+
+ /**
+ * Permanently stops the debugging session and breaks the connection. If
+ * this session ID is used for any subsequent calls exceptions will be
+ * thrown.
+ * <p>
+ * Note that due to platform and browser differences, it should not be
+ * assumed that this function will necessarily kill the process being
+ * debugged. For example:
+ *
+ * <ul>
+ * <li> On all platforms, Firefox cannot be terminated. This is because when
+ * we launch a new instance of Firefox, Firefox actually checks to see if
+ * there is another already-running instance. If there is, then the new
+ * instance just passes control to that old instance. So, the debugger
+ * doesn't know the process ID of the browser. It would be bad to attempt to
+ * figure out the PID and then kill that process, because the user might
+ * have other browser windows open that they don't want to lose. </li>
+ * <li> On Mac, similar problems apply to the Safari and Camino browsers:
+ * all browsers are launched with /usr/bin/open, so we never know the
+ * process ID, and we can't kill it. However, for Safari and Camino, what we
+ * do attempt to do is communicate with the browser via AppleScript, and
+ * tell it to close the window of the program that is being debugged. </li>
+ * </ul>
+ *
+ * <p>
+ * If SessionManager.launch() was used to initiate the Session then calling
+ * this function also causes getLaunchProcess().destroy() to be called.
+ * <p>
+ * Note: this method first calls unbind() if needed.
+ */
+ public void terminate();
+
+ /**
+ * Continue a halted session. Execution of the ActionScript
+ * will commence until a reason for halting exists. That
+ * is, a breakpoint is reached or the <code>suspend()</code> method is called.
+ * <p>
+ * This method will NOT block. It will return immediately
+ * after the Player resumes execution. Use the isSuspended
+ * method to determine when the Player has halted.
+ *
+ * @throws NoResponseException if times out
+ * @throws NotSuspendedException if Player is already running
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public void resume() throws NotSuspendedException, NotConnectedException, NoResponseException;
+
+ /**
+ * Halt a running session. Execution of the ActionScript
+ * will stop at the next possible breakpoint.
+ * <p>
+ * This method WILL BLOCK until the Player halts for some
+ * reason or an error occurs. During this period, one or
+ * more callbacks may be initiated.
+ *
+ * @throws NoResponseException if times out
+ * @throws SuspendedException if Player is already suspended
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public void suspend() throws SuspendedException, NotConnectedException, NoResponseException;
+
+ /**
+ * Is the Player currently halted awaiting requests, such as continue,
+ * stepOut, stepIn, stepOver. This function is guaranteed to be thread-safe.
+ *
+ * @return true if player halted
+ * @throws NotConnectedException
+ * if Player is disconnected from Session
+ */
+ public boolean isSuspended() throws NotConnectedException;
+
+ /**
+ * Returns a SuspendReason integer which indicates
+ * why the Player has suspended execution.
+ * @return see SuspendReason
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public int suspendReason() throws NotConnectedException;
+
+ /**
+ * Returns an array of frames that identify the location and contain
+ * arguments, locals and 'this' information for each frame on the
+ * function call stack. The 0th frame contains the current location
+ * and context for the actionscript program. Likewise
+ * getFrames[getFrames().length] is the topmost (or outermost) frame
+ * of the call stack.
+ * @return array of call frames with 0th element representing the current frame.
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public Frame[] getFrames() throws NotConnectedException;
+
+ /**
+ * Step to the next executable source line within the
+ * program, will enter into functions.
+ * <p>
+ * This method will NOT block. It will return immediately
+ * after the Player resumes execution. Use the isSuspended
+ * method to determine when the Player has halted.
+ *
+ * @throws NoResponseException if times out
+ * @throws NotSuspendedException if Player is running
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public void stepInto() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * Step out of the current method/function onto the
+ * next executable soruce line.
+ * <p>
+ * This method will NOT block. It will return immediately
+ * after the Player resumes execution. Use the isSuspended
+ * method to determine when the Player has halted.
+ *
+ * @throws NoResponseException if times out
+ * @throws NotSuspendedException if Player is running
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public void stepOut() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * Step to the next executable source line within
+ * the program, will NOT enter into functions.
+ * <p>
+ * This method will NOT block. It will return immediately
+ * after the Player resumes execution. Use the isSuspended
+ * method to determine when the Player has halted.
+ *
+ * @throws NoResponseException if times out
+ * @throws NotSuspendedException if Player is running
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public void stepOver() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * Continue the process of stepping.
+ * This call should only be issued if a previous
+ * stepXXX() call was made and the Player suspended
+ * execution due to a breakpoint being hit.
+ * That is getSuspendReason() == SuspendReason.Break
+ * This operation can be used for assisting with
+ * the processing of conditional breakpoints.
+ * @throws NoResponseException if times out
+ * @throws NotSuspendedException if Player is running
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public void stepContinue() throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * Obtain information about the various SWF(s) that have been
+ * loaded into the Player, for this session.
+ *
+ * Note: As SWFs are loaded by the Player a SwfLoadedEvent is
+ * fired. At this point, a call to getSwfInfo() will provide
+ * updated information.
+ *
+ * @return array of records describing the SWFs
+ * @throws NoResponseException if times out
+ */
+ public SwfInfo[] getSwfs() throws NoResponseException;
+
+ /**
+ * Get a list of the current breakpoints. No specific ordering
+ * of the breakpoints is implied by the array.
+ * @return breakpoints currently set.
+ * @throws NoResponseException if times out
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public Location[] getBreakpointList() throws NoResponseException, NotConnectedException;
+
+ /**
+ * Set a breakpoint on a line within the given file.
+ * <p>
+ * <em>Warning:</em> <code>setBreakpoint()</code> and
+ * <code>clearBreakpoint()</code> do not keep track of how many times they
+ * have been called for a given Location. For example, if you make two calls
+ * to <code>setBreakpoint()</code> for file X.as line 10, and then one
+ * call to <code>clearBreakpoint()</code> for that same file and line,
+ * then the breakpoint is gone. So, the caller is responsible for keeping
+ * track of whether the user has set two breakpoints at the same location.
+ *
+ * @return null if breakpoint not set, otherwise
+ * Location of breakpoint.
+ * @throws NoResponseException if times out
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public Location setBreakpoint(int fileId, int lineNum) throws NoResponseException, NotConnectedException;
+
+ /**
+ * Remove a breakpoint at given location. The Location obtain can be a
+ * clone/copy of a Location object returned from a previous call to
+ * getBreakpointList().
+ * <p>
+ * <em>Warning:</em> <code>setBreakpoint()</code> and
+ * <code>clearBreakpoint()</code> do not keep track of how many times they
+ * have been called for a given Location. For example, if you make two calls
+ * to <code>setBreakpoint()</code> for file X.as line 10, and then one
+ * call to <code>clearBreakpoint()</code> for that same file and line,
+ * then the breakpoint is gone. So, the caller is responsible for keeping
+ * track of whether the user has set two breakpoints at the same location.
+ *
+ * @return null if breakpoint was not removed.
+ * @throws NoResponseException
+ * if times out
+ * @throws NotConnectedException
+ * if Player is disconnected from Session
+ */
+ public Location clearBreakpoint(Location location) throws NoResponseException, NotConnectedException;
+
+ /**
+ * Get a list of the current watchpoint. No specific ordering
+ * of the watchpoints is implied by the array. Also, the
+ * list may contain watchpoints that are no longer relevant due
+ * to the variable going out of scope.
+ * @return watchpoints currently set.
+ * @throws NoResponseException if times out
+ * @throws NotConnectedException if Player is disconnected from Session
+ * @since Version 2
+ */
+ public Watch[] getWatchList() throws NoResponseException, NotConnectedException;
+
+ /**
+ * Set a watchpoint on a given variable. A watchpoint is used
+ * to suspend Player execution upon access of a particular variable.
+ * If the variable upon which the watchpoint is set goes out of scope,
+ * the watchpoint will NOT be automatically removed.
+ * <p>
+ * Specification of the variable item to be watched requires two
+ * pieces of information (similar to setScalarMember())
+ * The Variable and the name of the particular member to be watched
+ * within the variable.
+ * For example if the watchpoint is to be applied to 'a.b.c'. First the
+ * Value for object 'a.b' must be obtained and then the call
+ * setWatch(v, "c", ...) can be issued.
+ * The watchpoint can be triggered (i.e. the Player suspended) when either a read
+ * or write (or either) occurs on the variable. If the Player is suspended
+ * due to a watchpoint being fired, then the suspendReason() call will
+ * return SuspendReason.WATCH.
+ * <p>
+ * Setting a watchpoint multiple times on the same variable will result
+ * in the old watchpoint being removed from the list and a new watchpoint
+ * being added to the end of the list.
+ * <p>
+ * Likewise, if a previously existing watchpoint is modified by
+ * specifiying a different kind variable then the old watchpoint
+ * will be removed from the list and a new watchpoint will be added
+ * to the end of the list.
+ *
+ * @param v the variable, upon whose member, the watch is to be placed.
+ * @param varName is the mmeber name upon which the watch
+ * should be placed. This variable name may NOT contain the dot ('.')
+ * character and MUST be a member of v.
+ * @param kind access type that will trigger the watchpoint to fire --
+ * read, write, or read/write. See <code>WatchKind</code>.
+ * @return null if watchpoint was not created.
+ * @throws NoResponseException if times out
+ * @throws NotConnectedException if Player is disconnected from Session
+ * @throws NotSupportedException if the Player does not support watchpoints,
+ * or does not support watchpoints on this particular member (e.g. because
+ * it is a getter or a dynamic variable).
+ * @since Version 2
+ * @see WatchKind
+ */
+ public Watch setWatch(Value v, String memberName, int kind) throws NoResponseException, NotConnectedException, NotSupportedException;
+
+ /**
+ * Enables or disables a watchpoint.
+ *
+ * @param watch
+ * the watch to enable or disable
+ * @param enabled
+ * whether to enable it or disable it
+ * @throws NotSupportedException
+ * @throws NotConnectedException
+ * @throws NoResponseException
+ */
+ public Watch setWatch(Watch watch) throws NoResponseException, NotConnectedException, NotSupportedException;
+
+ /**
+ * Remove a previously created watchpoint. The watchpoint
+ * that was removed will be returned upon a sucessful call.
+ * @return null if watchpoint was not removed.
+ * @throws NoResponseException if times out
+ * @throws NotConnectedException if Player is disconnected from Session
+ * @since Version 2
+ */
+ public Watch clearWatch(Watch watch) throws NoResponseException, NotConnectedException;
+
+ /**
+ * Obtains a list of variables that are local to the current
+ * halted state.
+ * @deprecated As of version 2.
+ * @see Frame#getLocals
+ */
+ public Variable[] getVariableList() throws NotSuspendedException, NoResponseException, NotConnectedException, VersionException;
+
+ /**
+ * From a given value identifier return a Value. This call
+ * allows tools to access a specific value whenever the Player has
+ * suspended. A Value's id is maintained for the life of the
+ * Value and is guaranteed not to change. Values that
+ * go out of scope are no longer accessible and will result
+ * in a null being returned. Also note, that scalar
+ * variables do not contain an id that can be referenced in
+ * this manner. Therefore the caller must also maintain the
+ * 'context' in which the variable was obtained. For example
+ * if a Number b exists on a, then the reference 'a.b' must be
+ * managed, as the id of 'a' will be needed to obtain the
+ * value of 'b'.
+ * @param valueId identifier from Value class or
+ * from a call to Value.getId()
+ * @return null, if value cannot be found or
+ * value with the specific id.
+ * @throws NoResponseException if times out
+ * @throws NotSuspendedException if Player is running
+ * @throws NotConnectedException if Player is disconnected from Session
+ */
+ public Value getValue(long valueId) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * Looks up a global name, like "MyClass", "String", etc.
+ *
+ * @return its value, or <code>null</code> if the global does not exist.
+ */
+ public Value getGlobal(String name) throws NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * Events provide a mechanism whereby status information is provided from
+ * the Player in a timely fashion.
+ * <p>
+ * The caller has the option of either polling the event queue via
+ * <code>nextEvent()</code> or calling <code>waitForEvent()</code> which
+ * blocks the calling thread until one or more events exist in the queue.
+ *
+ * @throws NotConnectedException
+ * if Session is disconnected from Player
+ * @throws InterruptedException
+ */
+ public void waitForEvent() throws NotConnectedException, InterruptedException;
+
+ /**
+ * Returns the number of events currently in the queue. This function
+ * is guaranteed to be thread-safe.
+ */
+ public int getEventCount();
+
+ /**
+ * Removes and returns the next event from queue
+ */
+ public DebugEvent nextEvent();
+
+ /**
+ * Gets the SourceLocator for this session. If none has been
+ * specified, returns null.
+ */
+ public SourceLocator getSourceLocator();
+
+ /**
+ * Sets the SourceLocator for this session. This can be used in order
+ * to override the default rules used for finding source files.
+ */
+ public void setSourceLocator(SourceLocator sourceLocator);
+
+ /**
+ * Invokes a constructor in the player. Returns the newly created object.
+ * Not supported in Player 9 or AIR 1.0. If you call this function and the
+ * player to which you are connected doesn't support this feature, this will
+ * throw a PlayerDebugException.
+ */
+ public Value callConstructor(String classname, Value[] args) throws PlayerDebugException;
+
+ /**
+ * Invokes a function. For example, calling
+ * <code>callFunction(myobj, "toString", new Value[0])</code> will call
+ * <code>myobj.toString()</code>. Not supported in Player 9 or AIR 1.0.
+ * If you call this function and the player to which you are connected
+ * doesn't support this feature, this will throw a PlayerDebugException.
+ */
+ public Value callFunction(Value thisObject, String functionName, Value[] args) throws PlayerDebugException;
+
+ /**
+ * The player always halts on exceptions that are not going to be caught;
+ * this call allows the debugger to control its behavior when an exception
+ * that *will* be caught is thrown.
+ *
+ * @throws NotSupportedException
+ * thrown by older players that don't support this feature.
+ * @throws NoResponseException
+ */
+ public void breakOnCaughtExceptions(boolean b) throws NotSupportedException, NoResponseException;
+
+ /**
+ * Evaluate the ActionScript expression "value is type"
+ *
+ * @throws PlayerDebugException
+ * @throws PlayerFaultException
+ */
+ public boolean evalIs(Value value, Value type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * Evaluate the ActionScript expression "value is type"
+ *
+ * @throws PlayerDebugException
+ * @throws PlayerFaultException
+ */
+ public boolean evalIs(Value value, String type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * Evaluate the ActionScript expression "value instanceof type"
+ *
+ * @throws PlayerFaultException
+ * @throws PlayerDebugException
+ */
+ public boolean evalInstanceof(Value value, Value type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * Evaluate the ActionScript expression "value instanceof type"
+ *
+ * @throws PlayerFaultException
+ * @throws PlayerDebugException
+ */
+ public boolean evalInstanceof(Value value, String type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * Evaluate the ActionScript expression "property in object"
+ *
+ * @throws PlayerFaultException
+ * @throws PlayerDebugException
+ */
+ public boolean evalIn(Value property, Value object) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * Evaluate the ActionScript expression "value as type"
+ *
+ * @throws PlayerDebugException
+ * @throws PlayerFaultException
+ */
+ public Value evalAs(Value value, Value type) throws PlayerDebugException, PlayerFaultException;
+
+ /**
+ * Returns whether the target player supports watchpoints.
+ * @see #setWatch(Value, String, int)
+ */
+ public boolean supportsWatchpoints();
+
+ /**
+ * Returns the root SocketException that caused the rxMessage()
+ * thread to shut down. This works in conjunction with
+ * PREF_SOCKET_TIMEOUT and helps in detecting broken connections.
+ */
+ public Exception getDisconnectCause();
+
+ /**
+ * Set an exception breakpoint. Returns true if succeeded.
+ * @param exceptionClass
+ * @return
+ * @throws NoResponseException
+ * @throws NotConnectedException
+ */
+ public boolean setExceptionBreakpoint(String exceptionClass) throws NoResponseException, NotConnectedException;
+
+ /**
+ * Clears an exception breakpoint. Returns true if succeeded.
+ * @param exceptionClass
+ * @return
+ * @throws NoResponseException
+ * @throws NotConnectedException
+ */
+ public boolean clearExceptionBreakpoint(String exceptionClass) throws NoResponseException, NotConnectedException;
+
+ // Concurrency begin
+
+ /**
+ * Returns whether the target player supports concurrency.
+ * @see #setActiveIsolate(Value)
+ */
+ public boolean supportsConcurrency();
+
+ /**
+ * Get an array of all workers that the debugger knows of.
+ */
+ public Isolate[] getWorkers();
+
+ /**
+ * Ask the player again for a list of all workers. Use this
+ * method with caution as it will also reset all state about
+ * workers that the debugger is aware of.
+ */
+ public Isolate[] refreshWorkers() throws NotSupportedException, NotSuspendedException, NoResponseException, NotConnectedException;
+
+ /**
+ * Return the worker specific session object that can be used
+ * to communicate with that worker.
+ */
+ public IsolateSession getWorkerSession(int isolateId);
+
+ /**
+ *
+ * Sets the ILauncher instance which is associated with this session.
+ * ILauncher instance is used to terminate the process at the end of the debugging session.
+ *
+ * @param launcher
+ * ILauncher instance used to launch & terminate the process.
+ */
+ public void setLauncher(ILauncher launcher);
+
+}