Return-Path:
+ * where
+ * If the signature is unknown then the value
+ * "" will be returned. Note: this may occur even when
+ * Location contains a non-null SourceFile.
+ *
+ * Examples:
+ * null
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
+ *
+ *declaringClass/[[namespace::]function]
(for regular functions) declaringClass$cinit
(class constructor for statics) declaringClass$iinit
(class instance ctor)global$init
declaringClass
is the name of the
+ * class in which the function is declared (even if it
+ * is an anonymous inner function); namespace
+ * is the namespace of the function (the meaning of this
+ * varies depending on whether the function is private,
+ * protected etc.; see Variable.getNamespace()
+ * for more information); and function
is
+ * the name of the function, or ""
if the
+ * function is anonymous.
+ *
+ *
+ * MyClass/myFunction
for a public function MyClass/MyClass::myFunction
for a private function MyClass/
for an anonymous inner function declared
+ * somewhere inside MyClass
""
if unknown
+ * Some of the entries will be classes; some will be instances + * of classes; some will be functions; etc. + *
+ * Bug: Currently, this does not 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
+ * null
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 null
+ * 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 null
.
+ */
+ 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 null
.
+ */
+ 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 instanceILauncher.launch(cmd)
.
+ *
+ */
+ public Process launchDebugTarget(String[] cmd, ILauncher launcher) throws IOException;
+
+ /**
+ * Terminates a debug target process by invoking ILauncher.terminate(process)
+ */
+ 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 }.
+ *
+ * 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
+ * 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
+ * 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.
+ *
+ * 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.
+ *
+ * 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:
+ *
+ *
+ * If SessionManager.launch() was used to initiate the Session then calling
+ * this function also causes getLaunchProcess().destroy() to be called.
+ *
+ * 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
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * Warning:
+ * Warning:
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ * The caller has the option of either polling the event queue via
+ * null
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()
+ {
+ MapSTANDALONE
, NETSCAPE_PLUGIN
,
+ * ACTIVEX
, or AIR
.
+ */
+ 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
+ * null
if not known. (Filenames are obviously
+ * platform-specific.)
+ *
+ * null
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 SessionManager
+ * @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.
+ *
+ *
+ *
+ * suspend()
method is called.
+ * setBreakpoint()
and
+ * clearBreakpoint()
do not keep track of how many times they
+ * have been called for a given Location. For example, if you make two calls
+ * to setBreakpoint()
for file X.as line 10, and then one
+ * call to clearBreakpoint()
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().
+ * setBreakpoint()
and
+ * clearBreakpoint()
do not keep track of how many times they
+ * have been called for a given Location. For example, if you make two calls
+ * to setBreakpoint()
for file X.as line 10, and then one
+ * call to clearBreakpoint()
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.
+ * WatchKind
.
+ * @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 null
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.
+ * nextEvent()
or calling waitForEvent()
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
+ * callFunction(myobj, "toString", new Value[0])
will call
+ * myobj.toString()
. 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);
+
+}