flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [44/50] [abbrv] git commit: [flex-falcon] [refs/heads/develop] - re-apply dd66ead15573068a557722c714dd17c8ac2e5877 from Flex SDK
Date Tue, 02 Jun 2015 17:05:47 GMT
re-apply dd66ead15573068a557722c714dd17c8ac2e5877 from Flex SDK


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/0051eda9
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/0051eda9
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/0051eda9

Branch: refs/heads/develop
Commit: 0051eda99e2bea75d604de053515f8b380a58b62
Parents: 4dafb6f
Author: Alex Harui <aharui@apache.org>
Authored: Mon Jun 1 23:09:54 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Mon Jun 1 23:09:54 2015 -0700

----------------------------------------------------------------------
 .../flex/tools/debugger/cli/BreakAction.java    |  14 +-
 .../src/flex/tools/debugger/cli/DebugCLI.java   | 996 ++++++++++++-------
 .../src/flex/tools/debugger/cli/Extensions.java |  29 +-
 .../tools/debugger/cli/LocationCollection.java  |   3 +
 4 files changed, 656 insertions(+), 386 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0051eda9/debugger/src/flex/tools/debugger/cli/BreakAction.java
----------------------------------------------------------------------
diff --git a/debugger/src/flex/tools/debugger/cli/BreakAction.java b/debugger/src/flex/tools/debugger/cli/BreakAction.java
index aa2a78b..3899a70 100644
--- a/debugger/src/flex/tools/debugger/cli/BreakAction.java
+++ b/debugger/src/flex/tools/debugger/cli/BreakAction.java
@@ -64,7 +64,8 @@ public class BreakAction
 	private ValueExp			m_condition;
 	private String				m_conditionString;
 	private int					m_status;
-
+    private boolean             m_propagable;
+    
 	public BreakAction(LocationCollection c) throws NullPointerException
 	{
 		m_where = c;
@@ -84,6 +85,7 @@ public class BreakAction
 	{
 		m_id = BreakIdentifier.next();
 		m_commands = new Vector<String>();
+		m_propagable = true;
 	}
 
 	/* getters */
@@ -102,7 +104,8 @@ public class BreakAction
 	public String				getConditionString()			{ return m_conditionString; }
 	public String				getBreakpointExpression()		{ return m_breakpointExpression; }
 	public int					getStatus()						{ return m_status; }
-
+    public boolean              isPropagable()                  { return m_propagable; }
+    
 	/* setters */
 	public void addCommand(String cmd)					{ m_commands.add(cmd); }
 	public void clearCommands()							{ m_commands.clear(); }
@@ -118,7 +121,8 @@ public class BreakAction
 	public void setSingleSwf(boolean singleSwf)			{ m_singleSwf = singleSwf; }
 	public void setBreakpointExpression(String expr)	{ m_breakpointExpression = expr; }
 	public void setStatus(int status)					{ m_status = status; }
-
+    public void setPropagable(boolean propagable)       { m_propagable = propagable; }
+    
 	public void setLocations(LocationCollection loc)
 	{
 		m_where = loc;
@@ -141,8 +145,8 @@ public class BreakAction
 			while(!match && itr.hasNext())
 			{
 				Location l = (Location)itr.next();
-                if (l != null && l.getFile().getId() == fileId && l.getLine() == line && l.getIsolateId() == isolateId)
-					match = true;
+                if (l != null && l.getFile().getId() == fileId && l.getLine() == line && (isolateId == -1 || l.getIsolateId() == isolateId))
+                	match = true;
 			}
 		}
 		return match;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0051eda9/debugger/src/flex/tools/debugger/cli/DebugCLI.java
----------------------------------------------------------------------
diff --git a/debugger/src/flex/tools/debugger/cli/DebugCLI.java b/debugger/src/flex/tools/debugger/cli/DebugCLI.java
index 4fa4867..46219f7 100644
--- a/debugger/src/flex/tools/debugger/cli/DebugCLI.java
+++ b/debugger/src/flex/tools/debugger/cli/DebugCLI.java
@@ -200,6 +200,13 @@ public class DebugCLI implements Runnable, SourceLocator
     // default metadata retry count 8 attempts per waitForMetadata() call * 5 calls
     public static final int METADATA_RETRIES    = 8*5;
     
+    /**
+     * Whether the break command will show it changed workers.
+     * true at the moment because the break function itself does not display in
+     * which worker the breakpoint has been set.
+     */
+    public static final boolean WORKER_DISPLAY_INTERNAL_SWAP_INFO = true;
+
     /* Enum for the state of the initial prompt shown when a swf is loaded */
     public static enum InitialPromptState { NEVER_SHOWN, SHOWN_ONCE, DONE }  
 
@@ -212,7 +219,8 @@ public class DebugCLI implements Runnable, SourceLocator
 	String		m_cdPath;
 	String		m_mruURI;
 	String m_connectPort;
-	public final static String m_newline = System.getProperty("line.separator"); //$NON-NLS-1$
+    private boolean m_quietMode; // Don't dump out the state of the execution when WORKER_DISPLAY_INTERNAL_SWAP_INFO is set to false.
+    public final static String m_newline = System.getProperty("line.separator"); //$NON-NLS-1$
 
 	private final static LocalizationManager m_localizationManager = new LocalizationManager();
 	private final static FaultActionsBuilder faultActionsBuilder = new FaultActionsBuilder(m_localizationManager);
@@ -1879,8 +1887,8 @@ public class DebugCLI implements Runnable, SourceLocator
 			if (hasMoreTokens())
 			{
 				arg = nextToken();
-                int id = arg.equals(".") ? propertyGet(LIST_MODULE) : parseFileArg(-1, arg); //$NON-NLS-1$
-
+                int id = arg.equals(".") ? propertyGet(LIST_MODULE) : parseFileArg(m_activeIsolate, -1, arg); //$NON-NLS-1$
+                
 				SourceFile m = m_fileInfo.getFile(id, m_activeIsolate);
 				listFunctionsFor(sb, m);
 			}
@@ -1985,7 +1993,8 @@ public class DebugCLI implements Runnable, SourceLocator
 			int status = b.getStatus();
 			boolean isResolved = (status == BreakAction.RESOLVED);
 			Location l = b.getLocation();
-			SourceFile file = (l != null) ? l.getFile() : null;
+            final LocationCollection locations = b.getLocations();
+            SourceFile file = (l != null) ? l.getFile() : null;
 			String funcName = (file == null) ? null : file.getFunctionNameForLine(m_session, l.getLine()) ;
 			boolean singleSwf = b.isSingleSwf();
 			int cmdCount = b.getCommandCount();
@@ -2039,10 +2048,20 @@ public class DebugCLI implements Runnable, SourceLocator
 					sb.append(expr);
 			}
 			
+            final StringBuilder workerList = new StringBuilder();
+            if (locations != null) {
+                for (Iterator<Location> iterator = locations.iterator(); iterator.hasNext(); ) {
+                    Location location = iterator.next();
+                    workerList.append(location.getIsolateId() - 1);
+                    if (iterator.hasNext())
+                        workerList.append(" / ");
+                }
+            }
+			
 			if (l != null) {
 	            Map<String, Object> workerArgs = new HashMap<String, Object>();
-	            workerArgs.put("worker", l.getIsolateId() -1); //$NON-NLS-1$
-	            sb.append(" (");
+                workerArgs.put("worker", workerList.toString()); //$NON-NLS-1$
+                sb.append(" (");
 	            sb.append(getLocalizationManager().getLocalizedTextString("inWorker", workerArgs)); //$NON-NLS-1$
 	            sb.append(") ");
 			}
@@ -2168,73 +2187,64 @@ public class DebugCLI implements Runnable, SourceLocator
 		out(sb.toString());
 	}
 
-	/**
-	 * Dump out the state of the execution, either the fact we are running
-	 * or the breakpoint we hit.
-	 */
-	void dumpHaltState(boolean postStep) throws NotConnectedException
-	{
-		// spit out any event output, if we are to resume after a fault and we're not stepping then we're done.
-		processEvents();
+    /**
+     * Dump out the state of the execution, either the fact we are running
+     * or the breakpoint we hit.
+     */
+    void dumpHaltState(boolean postStep) throws NotConnectedException, SuspendedException, NoResponseException, NotSupportedException, NotSuspendedException, IOException {
+        // spit out any event output, if we are to resume after a fault and we're not stepping then we're done.
+        processEvents();
 //		System.out.println("processEvents = "+m_requestResume);
 
-		//if (m_requestResume && !postStep)
-		if (hasAnyPendingResumes() != -1 && !postStep)
-			return;
-
-		if (!m_session.isConnected())
-		{
-			// session is kaput
-			out(getLocalizationManager().getLocalizedTextString("sessionTerminated")); //$NON-NLS-1$
-			exitSession();
-		}
-		else
-		{
-			if (hasAnythingSuspended())
-			{
-				// capture our break location / information
-				StringBuilder sbLine = new StringBuilder();
-				dumpBreakLine(postStep, sbLine);
-
-				// Process our breakpoints.
-				// Since we can have conditional breakpoints, which the
-				// player always breaks for, but we may not want to, the variable
-				// m_requestResume may be set after this call.  Additionally,
-				// silent may be set for one of two reasons; 1) m_requestResume
-				// was set to true in the call or one or more breakpoints that
-				// hit contained the keyword silent in their command list.
-				//
-				StringBuilder sbBreak = new StringBuilder();
-				boolean silent = processBreak(postStep, sbBreak, m_activeIsolate);
+        //if (m_requestResume && !postStep)
+        if (hasAnyPendingResumes() != -1 && !postStep)
+            return;
+
+        if (!m_session.isConnected()) {
+            // session is kaput
+            out(getLocalizationManager().getLocalizedTextString("sessionTerminated")); //$NON-NLS-1$
+            exitSession();
+        } else {
+            if (!m_quietMode && hasAnythingSuspended()) {
+                // capture our break location / information
+                StringBuilder sbLine = new StringBuilder();
+                dumpBreakLine(postStep, sbLine);
+
+                // Process our breakpoints.
+                // Since we can have conditional breakpoints, which the
+                // player always breaks for, but we may not want to, the variable
+                // m_requestResume may be set after this call.  Additionally,
+                // silent may be set for one of two reasons; 1) m_requestResume
+                // was set to true in the call or one or more breakpoints that
+                // hit contained the keyword silent in their command list.
+                //
+                StringBuilder sbBreak = new StringBuilder();
+                boolean silent = processBreak(postStep, sbBreak, m_activeIsolate);
 
-				StringBuilder sb = new StringBuilder();
-				if (silent)
-				{
-					// silent means we only spit out our current location
-					dumpBreakLine(postStep, sb);
-				}
-				else
-				{
-					// not silent means we append things like normal
-					sb.append(sbLine);
-					if (sbLine.length() > 0 && sbLine.charAt(sbLine.length()-1) != '\n')
-						sb.append(m_newline);
-					sb.append(sbBreak);
-				}
+                StringBuilder sb = new StringBuilder();
+                if (silent) {
+                    // silent means we only spit out our current location
+                    dumpBreakLine(postStep, sb);
+                } else {
+                    // not silent means we append things like normal
+                    sb.append(sbLine);
+                    if (sbLine.length() > 0 && sbLine.charAt(sbLine.length() - 1) != '\n')
+                        sb.append(m_newline);
+                    sb.append(sbBreak);
+                }
 
-				// output whatever was generated 
-				if (sb.length() > 0)
-					out( sb.toString() );
+                // output whatever was generated
+                if (sb.length() > 0)
+                    out(sb.toString());
 
 //				System.out.println("processbreak = "+m_requestResume+",silent="+silent+",reason="+m_session.suspendReason());
-			}
-			else
-			{
-				// very bad, set stepping so that we don't trigger a continue on a breakpoint or fault
-				out(getLocalizationManager().getLocalizedTextString("playerDidNotStop")); //$NON-NLS-1$
-			}
-		}
-	}
+            } else if (!m_quietMode) {
+                // very bad, set stepping so that we don't trigger a continue on a breakpoint or fault
+                out(getLocalizationManager().getLocalizedTextString("playerDidNotStop")); //$NON-NLS-1$
+            }
+            m_quietMode = false;
+        }
+    }
 
 	Location getCurrentLocation()
 	{
@@ -2318,8 +2328,15 @@ public class DebugCLI implements Runnable, SourceLocator
 			appendBreakInfo(sb, m_activeIsolate);
 			//sb.append("unknown location");
 		}
-		else
-		{
+	    /* else if (reason == SuspendReason.Breakpoint && enabledBreakpointIndexOf(l) == -1) {
+	    // Dont output anything
+	
+	    // That's a edge case when a function breaks often, let's say a timer,
+	    // if the break action is disabled, the break event are still dispatched,
+	    // sent to the debugger and outputed, the debugger can't then halt the player anymore,
+	    // even removing the output, that's the same, I will try to fix this better later,
+	    // in between, I comment my changes.
+		}*/ else {
 			if ( activeIsolateChanged ) {
 				sb.append(m_newline + getLocalizationManager().getLocalizedTextString("workerChanged")+ " " + (targetIsolate - 1) + m_newline); 
 			}
@@ -2502,8 +2519,8 @@ public class DebugCLI implements Runnable, SourceLocator
     {
 		// get the newly added swf, which lands at the end list
 		SwfInfo[] swfs = m_fileInfo.getSwfsIsolate(isolateId);
-		SwfInfo swf = (swfs.length > 1) ? swfs[swfs.length-1] : null;
-
+        SwfInfo swf = (swfs.length > 0) ? swfs[swfs.length - 1] : null;
+        
 		// now walk through all breakpoints propagating the 
 		// the break for each source and line number we
 		// find in the new swf
@@ -2516,6 +2533,8 @@ public class DebugCLI implements Runnable, SourceLocator
 				continue;
 			if (bp.getStatus() != BreakAction.RESOLVED)
 				continue;
+            if (!bp.isPropagable())
+                continue;
 
 			try
 			{
@@ -2525,6 +2544,9 @@ public class DebugCLI implements Runnable, SourceLocator
 				Location newLoc = findAndEnableBreak(swf, f, line);
 				if (newLoc != null)
 					bp.addLocation(newLoc);
+                else newLoc.getFile();
+
+                dumpAddedBreakpoint(bp);
 			}
 			catch(InProgressException ipe)
 			{
@@ -2538,6 +2560,26 @@ public class DebugCLI implements Runnable, SourceLocator
 		}
     }
 
+    private void dumpAddedBreakpoint(BreakAction bp) {
+        Location l = bp.getLocations().last();
+        int which = bp.getId();
+        String name = l.getFile().getName();
+        int offset = adjustOffsetForUnitTests(l.getFile().getOffsetForLine(l.getLine()));
+
+        Map<String, Object> args = new HashMap<String, Object>();
+        args.put("breakpointNumber", Integer.toString(which)); //$NON-NLS-1$
+        args.put("file", name); //$NON-NLS-1$
+        args.put("line", Integer.toString(l.getLine())); //$NON-NLS-1$
+        String formatString;
+        if (offset != 0) {
+            args.put("offset", "0x" + Integer.toHexString(offset)); //$NON-NLS-1$ //$NON-NLS-2$
+            formatString = "createdBreakpointWithOffset"; //$NON-NLS-1$
+        } else {
+            formatString = "createdBreakpoint"; //$NON-NLS-1$
+        }
+        out(getLocalizationManager().getLocalizedTextString(formatString, args));
+    }
+
 	/**
 	 * Perform the tasks need for when a swf is unloaded
 	 * the player
@@ -2618,7 +2660,7 @@ public class DebugCLI implements Runnable, SourceLocator
 	/**
 	 * Our main loop when the player is off running
 	 */
-	public void runningLoop() throws NoResponseException, NotConnectedException
+    public void runningLoop() throws NoResponseException, NotConnectedException, SuspendedException, NotSupportedException, NotSuspendedException, IOException
 	{
 		int update = propertyGet(UPDATE_DELAY);
 		boolean nowait = (propertyGet(NO_WAITING) == 1) ? true : false;  // DEBUG ONLY; do not document
@@ -2868,7 +2910,7 @@ public class DebugCLI implements Runnable, SourceLocator
 	}
 
 	// Dump a source line of text to the display
-	void dumpStep() throws NotConnectedException
+    void dumpStep() throws NotConnectedException, SuspendedException, IOException, NotSupportedException, NotSuspendedException, NoResponseException
 	{
 		dumpHaltState(true);
 	}
@@ -2922,7 +2964,7 @@ public class DebugCLI implements Runnable, SourceLocator
 	/**
 	 * Perform step into, optional COUNT parameter
 	 */
-	void doStep() throws PlayerDebugException
+    void doStep() throws PlayerDebugException, IOException
 	{
 		waitTilHalted(m_activeIsolate);
 
@@ -2969,7 +3011,7 @@ public class DebugCLI implements Runnable, SourceLocator
 	/**
 	 * Perform step over, optional COUNT parameter
 	 */
-	void doNext() throws PlayerDebugException
+    void doNext() throws PlayerDebugException, IOException
 	{
 		waitTilHalted(m_activeIsolate);
 
@@ -3028,8 +3070,7 @@ public class DebugCLI implements Runnable, SourceLocator
 	/**
 	 * Perform step out
 	 */
-	void doFinish() throws PlayerDebugException
-	{
+    void doFinish() throws PlayerDebugException, IOException {
 		waitTilHalted(m_activeIsolate);
 
 		if (!allowedToStep(m_activeIsolate))
@@ -3082,7 +3123,7 @@ public class DebugCLI implements Runnable, SourceLocator
 	/**
 	 * Delete a breakpoint, very similar logic to disable.
 	 */
-	void doDelete() throws IOException, AmbiguousException, NotConnectedException
+    void doDelete() throws IOException, AmbiguousException, NotConnectedException, SuspendedException, NotSupportedException, NotSuspendedException, NoResponseException
 	{
 		waitTilHalted(m_activeIsolate);
 
@@ -3173,228 +3214,307 @@ public class DebugCLI implements Runnable, SourceLocator
 	/**
 	 * Set a breakpoint
 	 */
-	void doBreak() throws NotConnectedException
+    void doBreak() throws NotConnectedException, NoResponseException, NotSupportedException, NotSuspendedException, IOException, SuspendedException
 	{
-		int isolateId = propertyGet(LIST_WORKER);
+        int isolateId = propertyGet(LIST_WORKER);
+        int savedIsolateId = isolateId;
+
 		/* wait a bit if we are not halted */
-		waitTilHalted(isolateId);
+        waitTilHalted(isolateId);
 
         int module = propertyGet(LIST_MODULE);
-		int line = propertyGet(LIST_LINE);
-		
+        int line = propertyGet(LIST_LINE);
+
+        FileLocation[] fileLocations = new FileLocation[0];
+        boolean wasAlreadySuspended = false;
+        boolean switching = false;
+
         String arg = null;
+        boolean propagate = true;
 
 		/* currentXXX may NOT be invalid! */
-		try
-		{
-			if (hasMoreTokens())
-			{
+        try {
+            if (hasMoreTokens()) {
                 arg = nextToken();
-                int[] result = parseLocationArg(module, line, arg, isolateId);
-                module = result[0];
-                line = result[1];
-			}
-			else
-			{
-				// no parameter mean use current location;  null pointer if nothing works
-				Location l = getCurrentLocationIsolate(isolateId);
-				SourceFile file = l.getFile();
-				module = file.getId();
-				line = l.getLine();
-			}
-
-//			// check to see if there are any existing breakpoints at this file/line
-//			LinkedList existingBreakpoints = new LinkedList();
-//			int start = 0;
-//			for (;;)
-//			{
-//				int bp = breakpointIndexOf(module, line, start, true);
-//				if (bp == -1)
-//					break; // no more matches
-//				boolean isEnabled = breakpointAt(bp).isEnabled();
-//				existingBreakpoints.add("" + bp + (isEnabled ? "" : " (disabled)"));
-//			}
-//			if (existingBreakpoints.size() > 0)
-//			{
-//				String
-//			}
-
-			// go off; create it and set it
-            BreakAction b = addBreakpoint(module, line, isolateId);  // throws npe if not able to set
-            Location l = b.getLocation();
-
-			int which = b.getId();
-			String name = l.getFile().getName();
-			int offset  = adjustOffsetForUnitTests(l.getFile().getOffsetForLine(line));
+                propagate = !arg.contains("@");
+                fileLocations = parseLocationArg(module, line, arg);
+            } else {
+                // no parameter mean use current location;  null pointer if nothing works
+                Location l = getCurrentLocationIsolate(isolateId);
+                SourceFile file = l.getFile();
+
+                final FileLocation fileLocation = new FileLocation(isolateId, file.getId(), l.getLine());
+                fileLocations[0] = fileLocation;
+            }
 
-			Map<String, Object> args = new HashMap<String, Object>();
-			args.put("breakpointNumber", Integer.toString(which)); //$NON-NLS-1$
-			args.put("file", name); //$NON-NLS-1$
-			args.put("line", Integer.toString(line)); //$NON-NLS-1$
-			String formatString;
-			if (offset != 0)
-			{
-				args.put("offset", "0x" + Integer.toHexString(offset)); //$NON-NLS-1$ //$NON-NLS-2$
-				formatString = "createdBreakpointWithOffset"; //$NON-NLS-1$
-			}
-			else
-			{
-				formatString = "createdBreakpoint"; //$NON-NLS-1$
-			}
-			out(getLocalizationManager().getLocalizedTextString(formatString, args));
+            for (FileLocation fileLocation : fileLocations) {
+                isolateId = fileLocation.getIsolateId();
+                module = fileLocation.getModule();
+                line = fileLocation.getLine();
 
-			// worked so add it to our tracking state
-			propertyPut(BPNUM, which);
-		}
-		catch(ParseException pe)
-		{
-			err(pe.getMessage());
-		}
-		catch(AmbiguousException ae)
-		{
-			err(ae.getMessage());
-		}
-		catch(NoMatchException nme)
-		{
-			// We couldn't find a function name or filename which matched what
-			// the user entered.  Do *not* fail; instead, just save this breakpoint
-			// away, and later, as more ABCs get loaded from the SWF, we may be
-			// able to resolve this breakpoint.
-			BreakAction b = addUnresolvedBreakpoint(arg, m_activeIsolate);
+                if (isolateId != savedIsolateId) {
+                    switching = true;
+                    wasAlreadySuspended = swapActiveWorkerAndStop(isolateId);
+                }
 
-			Map<String, Object> args = new HashMap<String, Object>();
-			args.put("breakpointNumber", Integer.toString(b.getId())); //$NON-NLS-1$
-			out(getLocalizationManager().getLocalizedTextString("breakpointCreatedButNotYetResolved", args)); //$NON-NLS-1$
+                // go off; create it and set it
+                BreakAction b = addBreakpoint(module, line, isolateId, propagate);  // throws npe if not able to set
+                dumpAddedBreakpoint(b);
 
-			// add it to our tracking state
-			propertyPut(BPNUM, b.getId());
-		}
-		catch(NullPointerException npe)
-		{
-			String filename;
-			try
-			{
-				filename = m_fileInfo.getFile(module, isolateId).getName() + "#" + module; //$NON-NLS-1$
-			}
-			catch (Exception e)
-			{
-				Map<String, Object> args = new HashMap<String, Object>();
-				args.put("fileNumber", Integer.toString(module)); //$NON-NLS-1$
-				filename = getLocalizationManager().getLocalizedTextString("fileNumber", args); //$NON-NLS-1$
-			}
+                // worked so add it to our tracking state
+                propertyPut(BPNUM, b.getId());
 
-			Map<String, Object> args = new HashMap<String, Object>();
-			args.put("filename", filename); //$NON-NLS-1$
-			args.put("line", Integer.toString(line)); //$NON-NLS-1$
-			err(getLocalizationManager().getLocalizedTextString("breakpointNotSetNoCode", args)); //$NON-NLS-1$
-		}
-	}
+                if (switching) {
+                    continueAndSwapActiveWorkerBack(savedIsolateId, wasAlreadySuspended);
+                    switching = false;
+                }
+            }
+        } catch (ParseException pe) {
+            err(pe.getMessage());
+        } catch (AmbiguousException ae) {
+            err(ae.getMessage());
+        } catch (NoMatchException nme) {
+            // We couldn't find a function name or filename which matched what
+            // the user entered.  Do *not* fail; instead, just save this breakpoint
+            // away, and later, as more ABCs get loaded from the SWF, we may be
+            // able to resolve this breakpoint.
+            BreakAction b = addUnresolvedBreakpoint(arg, m_activeIsolate);
 
-	/**
+            Map<String, Object> args = new HashMap<String, Object>();
+            args.put("breakpointNumber", Integer.toString(b.getId())); //$NON-NLS-1$
+            out(getLocalizationManager().getLocalizedTextString("breakpointCreatedButNotYetResolved", args)); //$NON-NLS-1$
+
+            // add it to our tracking state
+            propertyPut(BPNUM, b.getId());
+        } catch (NullPointerException npe) {
+            String filename;
+            try {
+                filename = m_fileInfo.getFile(module, isolateId).getName() + "#" + module; //$NON-NLS-1$
+            } catch (Exception e) {
+                Map<String, Object> args = new HashMap<String, Object>();
+                args.put("fileNumber", Integer.toString(module)); //$NON-NLS-1$
+                filename = getLocalizationManager().getLocalizedTextString("fileNumber", args); //$NON-NLS-1$
+            }
+
+            Map<String, Object> args = new HashMap<String, Object>();
+            args.put("filename", filename); //$NON-NLS-1$
+            args.put("line", Integer.toString(line)); //$NON-NLS-1$
+            err(getLocalizationManager().getLocalizedTextString("breakpointNotSetNoCode", args)); //$NON-NLS-1$
+        } catch (InProgressException e) {
+            e.printStackTrace();
+        } finally {
+            if (switching) {
+                continueAndSwapActiveWorkerBack(savedIsolateId, wasAlreadySuspended);
+            }
+        }
+    }
+
+    private boolean swapActiveWorkerAndStop(int isolateId) throws IOException, NotSupportedException, NotSuspendedException, NoResponseException, NotConnectedException, SuspendedException {
+        return swapActiveWorkerAndStop(isolateId, WORKER_DISPLAY_INTERNAL_SWAP_INFO);
+    }
+
+    private boolean swapActiveWorkerAndStop(int isolateId, boolean displayInfo) throws IOException, NotSupportedException, NotSuspendedException, NoResponseException, NotConnectedException, SuspendedException {
+        doWorker(isolateId, displayInfo);
+
+        IsolateSession session = m_session.getWorkerSession(m_activeIsolate);
+        final boolean suspended = session.isSuspended();
+
+        if (!suspended) {
+            session.suspend();
+            waitTilHalted(m_activeIsolate);
+        }
+
+        return suspended;
+    }
+
+    private void continueAndSwapActiveWorkerBack(int savedIsolateId, boolean wasAlreadySuspended) throws NotConnectedException, IOException, NotSupportedException, NotSuspendedException, NoResponseException {
+        continueAndSwapActiveWorkerBack(savedIsolateId, wasAlreadySuspended, WORKER_DISPLAY_INTERNAL_SWAP_INFO);
+    }
+
+    private void continueAndSwapActiveWorkerBack(int savedIsolateId, boolean wasAlreadySuspended, boolean displayInfo) throws NotConnectedException, IOException, NotSupportedException, NotSuspendedException, NoResponseException {
+        if (!wasAlreadySuspended) {
+            m_quietMode = !displayInfo;
+            doContinue();
+        }
+
+        if (m_activeIsolate != savedIsolateId)
+            doWorker(savedIsolateId, displayInfo);
+    }
+
+    /**
 	 * Clear a breakpoint
 	 */
-	void doClear() throws NotConnectedException
+    void doClear() throws NotConnectedException, SuspendedException, NoResponseException, NotSupportedException, NotSuspendedException, IOException
 	{
         int module = propertyGet(LIST_MODULE);
-		int line = propertyGet(LIST_LINE);
-		int isolateId = propertyGet(LIST_WORKER);
+        int line = propertyGet(LIST_LINE);
+        int isolateId = propertyGet(LIST_WORKER);
         String arg = null;
 
 		/* wait a bit if we are not halted */
-		waitTilHalted(m_activeIsolate);
+        waitTilHalted(m_activeIsolate);
 
 		/* currentXXX may NOT be invalid! */
-		try
-		{
-			if (hasMoreTokens())
-			{
+        try {
+            if (hasMoreTokens()) {
                 arg = nextToken();
-                int[] result = parseLocationArg(module, line, arg, isolateId);
-                module = result[0];
-                line = result[1];
-			}
+                FileLocation[] fileLocations = parseLocationArg(module, line, arg);
 
-			// map the breakpoint to location and then delete it
-			removeBreakpoint(module, line);
-		}
-		catch(ParseException pe)
-		{
-			err(pe.getMessage());
-		}
-		catch(NoMatchException nme)
-		{
-			if (removeUnresolvedBreakpoint(arg) == null)
-				err(getLocalizationManager().getLocalizedTextString("breakpointLocationUnknown")); //$NON-NLS-1$
-		}
-		catch(AmbiguousException ae)
-		{
-			err(ae.getMessage());
-		}
-		catch(ArrayIndexOutOfBoundsException aio)
-		{
-			// means no breakpoint at this location
-			err(getLocalizationManager().getLocalizedTextString("breakpointLocationUnknown")); //$NON-NLS-1$
-		}
-		catch(NullPointerException npe)
-		{
-			err(getLocalizationManager().getLocalizedTextString("breakpointNotCleared")); //$NON-NLS-1$
-		}
-	}
+                for (FileLocation fileLocation : fileLocations) {
+                    isolateId = fileLocation.getIsolateId();
+                    module = fileLocation.getModule();
+                    line = fileLocation.getLine();
 
-	/**
-	 * Remove the breakpoint from our table and then determine
-	 */
-	BreakAction removeBreakpoint(int fileId, int line) throws ArrayIndexOutOfBoundsException, NotConnectedException
-	{
-		int at = breakpointIndexOf(fileId, line);
-		return removeBreakpointAt(at);
-	}
+                    try {
+                        removeBreakpoint(module, line, isolateId);
+                    } catch (ArrayIndexOutOfBoundsException aio) {
+                        // means no breakpoint at this location
+                        err(getLocalizationManager().getLocalizedTextString("breakpointLocationUnknown")); //$NON-NLS-1$
+                    } catch (NullPointerException npe) {
+                        err(getLocalizationManager().getLocalizedTextString("breakpointNotCleared")); //$NON-NLS-1$
+                    }
+                }
+            }
 
-	BreakAction removeUnresolvedBreakpoint(String unresolvedLocation) throws NotConnectedException
-	{
-		int size = breakpointCount();
-		for(int i=0; i<size; i++)
-		{
-			BreakAction b = breakpointAt(i);
-			String s = b.getBreakpointExpression();
-			if (s != null && s.equals(unresolvedLocation))
-				return removeBreakpointAt(i);
-		}
-		return null;
-	}
+        } catch (ParseException pe) {
+            err(pe.getMessage());
+        } catch (AmbiguousException ae) {
+            err(ae.getMessage());
+        } catch (NoMatchException e) {
+            if (removeUnresolvedBreakpoint(arg) == null)
+                err(e.getMessage());
+        }
+    }
 
-	BreakAction removeBreakpointAt(int at) throws ArrayIndexOutOfBoundsException, NotConnectedException
-	{
-		BreakAction a = breakpointAt(at);
-//		if (isolateId == Isolate.DEFAULT_ID)
-//		else
-//			getIsolateState(isolateId).m_breakpoints.removeElementAt(at);
-		
-		if (a.getStatus() == BreakAction.RESOLVED) {
-			breakDisableRequest(a.getLocations());
-			m_breakpoints.removeElementAt(at);
-		}
-		return a;
-	}
+    BreakAction removeBreakpoint(int fileId, int line, int isolateId) throws ArrayIndexOutOfBoundsException, NotConnectedException, SuspendedException, IOException, NotSupportedException, NotSuspendedException, NoResponseException {
+        int at = breakpointIndexOf(fileId, line, isolateId);
+        return removeBreakpointAt(at, isolateId);
+    }
+
+    BreakAction removeUnresolvedBreakpoint(String unresolvedLocation) throws NotConnectedException, SuspendedException, IOException, NotSupportedException, NotSuspendedException, NoResponseException {
+        int size = breakpointCount();
+        for (int i = 0; i < size; i++) {
+            BreakAction b = breakpointAt(i);
+            String s = b.getBreakpointExpression();
+            if (s != null && s.equals(unresolvedLocation)) {
+                m_breakpoints.removeElementAt(i);
+                return b;
+            }
+        }
+        return null;
+    }
+
+    private BreakAction removeBreakpointAt(int at, int isolateId) throws ArrayIndexOutOfBoundsException, NotConnectedException, NoResponseException, NotSupportedException, SuspendedException, NotSuspendedException, IOException {
+
+        BreakAction a = breakpointAt(at);
+
+        if (a.getStatus() == BreakAction.RESOLVED) {
+            int savedIsolateId = m_activeIsolate;
+            boolean wasAlreadySuspended = false;
+
+            Location location = null;
+            for (Iterator<Location> iterator = a.getLocations().iterator(); iterator.hasNext(); ) {
+                location = iterator.next();
+                if (location.getIsolateId() == isolateId) {
+
+                    boolean switching = false;
+                    if (location.getIsolateId() != savedIsolateId) {
+                        switching = true;
+                        wasAlreadySuspended = swapActiveWorkerAndStop(location.getIsolateId());
+                    }
+
+                    final LocationCollection locationCollection = new LocationCollection();
+                    locationCollection.add(location);
+
+                    breakDisableRequest(locationCollection);
+                    a.getLocations().remove(location);
+                    if (a.getLocations().isEmpty())
+                        m_breakpoints.removeElementAt(at);
+
+                    if (switching)
+                        continueAndSwapActiveWorkerBack(savedIsolateId, wasAlreadySuspended);
+
+                }
+            }
+        } else if (a.getStatus() == BreakAction.UNRESOLVED) {
+            m_breakpoints.removeElementAt(at);
+        }
+
+        return a;
+    }
+
+    BreakAction removeBreakpointAt(int at) throws ArrayIndexOutOfBoundsException, NotConnectedException, NoResponseException, NotSupportedException, SuspendedException, NotSuspendedException, IOException {
+        BreakAction a = breakpointAt(at);
+
+        if (a.getStatus() == BreakAction.RESOLVED) {
+            int savedIsolateId = m_activeIsolate;
+            boolean wasAlreadySuspended;
+
+            for (Iterator<Location> iterator = a.getLocations().iterator(); iterator.hasNext(); ) {
+                Location location = iterator.next();
+
+                if (location.getIsolateId() != savedIsolateId) {
+                    wasAlreadySuspended = swapActiveWorkerAndStop(a.getLocation().getIsolateId());
+
+                    final LocationCollection locationCollection = new LocationCollection();
+                    locationCollection.add(location);
+                    breakDisableRequest(locationCollection);
+
+                    continueAndSwapActiveWorkerBack(savedIsolateId, wasAlreadySuspended);
+                } else
+                    breakDisableRequest(a.getLocations());
+            }
+
+            m_breakpoints.removeElementAt(at);
+
+
+        } else if (a.getStatus() == BreakAction.UNRESOLVED) {
+            m_breakpoints.removeElementAt(at);
+        }
+
+        return a;
+    }
 
     /**
      * Attempt to create new breakpoint at the given file and line. It will be set
      * @param fileId source file identifier
      * @param line line number
+     * @param propagate
      * @return object associated with breakpoint
      */
-    BreakAction addBreakpoint(int fileId, int line, int isolateId) throws NotConnectedException, NullPointerException
-    {
-		// use fileId SourceFile to denote the name of file in which we wish to set a breakpoint    	
-    	SourceFile f = m_fileInfo.getFile(fileId, isolateId);
-      
-        
-		LocationCollection col = enableBreak(f, line, isolateId);
+    BreakAction addBreakpoint(int fileId, int line, int isolateId, boolean propagate) throws NotConnectedException, NullPointerException, InProgressException {
+        // use fileId SourceFile to denote the name of file in which we wish to set a breakpoint
+        final SourceFile f = m_fileInfo.getFile(fileId, isolateId);
+        int bp = breakpointIndexOf(fileId, line, 0, true, -1);
+        int at = breakpointIndexOf(fileId, line, 0, true, isolateId);
+
+        final boolean bpDoesNotExistAtAll = at == -1 && bp == -1;
+        final boolean bpExistsButNotForThisIsolate = at == -1 && bp > -1;
+
+        BreakAction b = null;
+
+        if (bpDoesNotExistAtAll) {
+            LocationCollection col = enableBreak(f, line, isolateId);
+
+            b = new BreakAction(col);  //  throws NullPointerException if collection is null
+            b.setEnabled(true);
+            b.setSingleSwf(m_fileInfo.isSwfFilterOn());
+            b.setPropagable(propagate);
+            breakpointAdd(b);
+        } else {
+            if (bpExistsButNotForThisIsolate){
+                b = breakpointAt(bp);
+                if (b != null) {
+                    SwfInfo[] swfs = m_fileInfo.getSwfsIsolate(isolateId);
+                    SwfInfo swf = (swfs.length > 0) ? swfs[swfs.length - 1] : null;
+                    Location newLoc = findAndEnableBreak(swf, f, line);
+                    if (newLoc != null)
+                        b.addLocation(newLoc);
+                    else newLoc.getFile(); // force NullPointerException if newLoc == null
+                }
+            } else return breakpointAt(at); // already set before
+        }
 
-        BreakAction b = new BreakAction(col);  //  throws NullPointerException if collection is null
-        b.setEnabled(true);
-		b.setSingleSwf(m_fileInfo.isSwfFilterOn());
-        breakpointAdd(b);
         return b;
     }
 	
@@ -3422,6 +3542,8 @@ public class DebugCLI implements Runnable, SourceLocator
 	 * If a previously-unresolved breakpoint is now ambiguous, then that is
 	 * an error, and the return value is 'false' (indicating that the
 	 * debugger should halt).
+     *
+     * Resolve as well resolved BP set in other workers.
 	 */
 	private boolean resolveBreakpoints(StringBuilder sb)
 	{
@@ -3463,43 +3585,33 @@ public class DebugCLI implements Runnable, SourceLocator
 	{
 		int status = b.getStatus();
 		boolean resolved = (status == BreakAction.RESOLVED);
-		if (status == BreakAction.UNRESOLVED) // we don't do anything for RESOLVED or AMBIGUOUS
+        if (status == BreakAction.UNRESOLVED || resolved) // we don't do anything for AMBIGUOUS
 		{
 			/* wait a bit if we are not halted */
 			try
 			{
 				waitTilHalted(m_activeIsolate);
 
-				// First we check for the case where this breakpoint already has a
-				// filename and line number, because those were determined during a
-				// previous session, but then the user did a "kill".
-				//
-				// If this fails, then the "else" clause deals with the case where
-				// the user typed in an expression for which we have not yet found
-				// a filename and line number.
-		    	if (enableBreakpoint(b, b.isAutoDisable(), b.isAutoDelete()))
-		    	{
-		    		resolved = true;
-		    	}
-		    	else
-		    	{
-			        int module = propertyGet(LIST_MODULE);
-					int line = propertyGet(LIST_LINE);
-					int isolateId = propertyGet(LIST_WORKER);
+		        int module = propertyGet(LIST_MODULE);
+				int line = propertyGet(LIST_LINE);
+				int isolateId = propertyGet(LIST_WORKER);
 
-			        String arg = b.getBreakpointExpression();
+		        String arg = b.getBreakpointExpression();
 
-			        if (arg != null)
-			        {
-			            int[] result = parseLocationArg(module, line, arg, isolateId);
-		
-						// whoo-hoo, it resolved!
-		                module = result[0];
-		                line = result[1];
+		        if (arg != null)
+		        {
+                    FileLocation[] fileLocations = parseLocationArg(module, line, arg, false);
+                    
+                    if (fileLocations.length == 1) {
+                    	// whoo-hoo, it resolved!
+	                    
+                        isolateId = fileLocations[0].getIsolateId();
+                        module = fileLocations[0].getModule();
+                        line = fileLocations[0].getLine();
 		
 						// use module SourceFile to denote the name of file in which we wish to set a breakpoint
 				        SourceFile f = m_fileInfo.getFile(module, isolateId);
-//		                SourceFile f = m_fileInfo.getFakeFile(module);
+	//		                SourceFile f = m_fileInfo.getFakeFile(module);
 						LocationCollection col = enableBreak(f, line, isolateId);
 						if (col.isEmpty())
 							throw new NullPointerException(getLocalizationManager().getLocalizedTextString("noExecutableCode")); //$NON-NLS-1$
@@ -3508,7 +3620,7 @@ public class DebugCLI implements Runnable, SourceLocator
 						Location l = col.first();
 						SourceFile file = (l != null) ? l.getFile() : null;
 						String funcName = (file == null) ? null : file.getFunctionNameForLine(m_session, l.getLine()) ;
-
+	
 						Map<String, Object> args = new HashMap<String, Object>();
 						String formatString;
 						args.put("breakpointNumber", Integer.toString(b.getId())); //$NON-NLS-1$
@@ -3519,7 +3631,7 @@ public class DebugCLI implements Runnable, SourceLocator
 						}
 						args.put("file", filename); //$NON-NLS-1$
 						args.put("line", new Integer(l.getLine())); //$NON-NLS-1$
-
+	
 						if (funcName != null)
 						{
 							args.put("functionName", funcName); //$NON-NLS-1$
@@ -3529,13 +3641,13 @@ public class DebugCLI implements Runnable, SourceLocator
 						{
 							formatString = "resolvedBreakpointToFile"; //$NON-NLS-1$
 						}
-
+	
 						sb.append(getLocalizationManager().getLocalizedTextString(formatString, args));
 						sb.append(m_newline);
 						sb.append(m_newline);
 		
-						resolved = true;
-			        }
+						resolved |= true;
+                    }
 		    	}
 			}
 			catch (NotConnectedException e)
@@ -3734,6 +3846,10 @@ public class DebugCLI implements Runnable, SourceLocator
 		return breakpointIndexOf(fileId, line, 0, true);
 	}
 
+	int breakpointIndexOf(int fileId, int line, int isolateId) {
+        return breakpointIndexOf(fileId, line, 0, true, isolateId);
+    }
+	
 	int breakpointIndexOf(Location l, int start) {
 		return breakpointIndexOf(l.getFile().getId(), l.getLine(), start, true);
 	}
@@ -3742,14 +3858,18 @@ public class DebugCLI implements Runnable, SourceLocator
 		return breakpointIndexOf(l.getFile().getId(), l.getLine(), 0, false);
 	}
 
-	int breakpointIndexOf(int fileId, int line, int start, boolean includeDisabled)
+	int breakpointIndexOf(int fileId, int line, int start, boolean includeDisabled) {
+        return breakpointIndexOf(fileId, line, start, includeDisabled, m_activeIsolate);
+    }
+
+    int breakpointIndexOf(int fileId, int line, int start, boolean includeDisabled, int isolateId)
 	{
 		int size = breakpointCount();
 		int hit = -1;
 		for(int i=start; (hit<0) && (i<size) ; i++)
 		{
 			BreakAction b = breakpointAt(i);
-            if (b.locationMatches(fileId, line, m_activeIsolate) && (includeDisabled || b.isEnabled()))
+            if (b.locationMatches(fileId, line, isolateId) && (includeDisabled || b.isEnabled()))
             	hit = i;
 		}
 		return hit;
@@ -3764,7 +3884,7 @@ public class DebugCLI implements Runnable, SourceLocator
 		for(int i=0; (hit<0) && (i<size) ; i++)
 		{
 			BreakAction b = breakpointAt(i);
-            if (b.getId() == id && b.getLocation().getIsolateId() == m_activeIsolate)
+            if (b.getId() == id)
             	hit = i;
 		}
 		return hit;
@@ -4392,8 +4512,17 @@ public class DebugCLI implements Runnable, SourceLocator
         }
     }
 
-    private int parseFileName(String partialFileName) throws NoMatchException, AmbiguousException
-    {
+    private int parseWorkerId(String workerId) throws ParseException {
+        try {
+            return Integer.parseInt(workerId);
+        } catch (NumberFormatException nfe) {
+            Map<String, Object> args = new HashMap<String, Object>();
+            args.put("token", workerId); //$NON-NLS-1$
+            throw new ParseException(getLocalizationManager().getLocalizedTextString("expectedIsolateNumber", args), 0); //$NON-NLS-1$
+        }
+    }
+
+    private int parseFileName(int isolateId, String partialFileName) throws NoMatchException, AmbiguousException {
         SourceFile[] sourceFiles = m_fileInfo.getFiles(partialFileName, m_activeIsolate);
         int nSourceFiles = sourceFiles.length;
 
@@ -4542,7 +4671,7 @@ public class DebugCLI implements Runnable, SourceLocator
       * Allowed formats: #29, MyApp.mxml, MyA
       * A variety of exceptions are thrown for other formats.
       */
-    public int parseFileArg(int module, String arg) throws ParseException, AmbiguousException, NoMatchException
+    public int parseFileArg(int isolateId, int module, String arg) throws ParseException, AmbiguousException, NoMatchException
     {
         /* Special case: a location arg like :15 produces a file arg
            which is an empty string. */
@@ -4561,12 +4690,18 @@ public class DebugCLI implements Runnable, SourceLocator
         /* If the first character is '#', the rest must be a file number. */
         else if (firstChar == '#')
         {
-            return parseFileNumber(arg.substring(1));
+            if (isolateId == m_activeIsolate)
+                return parseFileNumber(arg.substring(1));
+            else {
+                Map<String, Object> args = new HashMap<String, Object>();
+                args.put("token", arg); //$NON-NLS-1$
+                throw new NoMatchException(getLocalizationManager().getLocalizedTextString("noSuchFileOrFunction", args)); //$NON-NLS-1$
+            }
         }
         /* Otherwise, assume beforeColon is a full or partial file name. */
         else
         {
-            return parseFileName(arg);
+            return parseFileName(isolateId, arg);
         }
     }
 
@@ -4604,6 +4739,10 @@ public class DebugCLI implements Runnable, SourceLocator
         }
     }
 
+    public FileLocation[] parseLocationArg(int module, int line, String arg) throws ParseException, AmbiguousException, NoMatchException {
+        return parseLocationArg(module, line, arg, true);
+    }
+
     /**
      * Parse arg to figure out what module and line it specifies.
      *
@@ -4628,18 +4767,27 @@ public class DebugCLI implements Runnable, SourceLocator
      *  Bu:MyF                  29          17
      *
      * A variety of exceptions are thrown for other formats.
+     * Added the possibility to indicate the worker id with this format:
+     *
+     * @2:#29:17
+     * @2:Button.as:17
+     * @2:Bu:17
+     * ...
+     * and all other previous combinations.
      */
-    public int[] parseLocationArg(int module, int line, String arg, int isolateId) throws ParseException, AmbiguousException, NoMatchException
-    {
+    public FileLocation[] parseLocationArg(int module, int line, String arg, boolean all) throws ParseException, AmbiguousException, NoMatchException {
+        int workerId = -1;
         int colonAt = arg.indexOf(':');
-		int wasFunc = 0;  // set to 1 if a function was named
+        int wasFunc = 0;  // set to 1 if a function was named
+        char firstChar = arg.charAt(0);
+        final ArrayList<FileLocation> fileLocations = new ArrayList<FileLocation>();
+        int currentIsolate;
 
         /* First deal with the case where arg doesn't contain a ':'
            and therefore might be specifying either a file or a line. */
+        final Iterator<Integer> iterator = m_isolateState.keySet().iterator();
         if (colonAt < 0)
         {
-            char firstChar = arg.charAt(0);
-
             /* If the first character is 0-9 or '-', arg is assumed to be a line number. */
             if (Character.isDigit(firstChar) || firstChar == '-')
             {
@@ -4649,8 +4797,12 @@ public class DebugCLI implements Runnable, SourceLocator
                is assumed to be a file number. */
             else if (firstChar == '#')
             {
+                workerId = m_activeIsolate;
                 module = parseFileNumber(arg.substring(1));
                 line = 1;
+
+                final FileLocation fileLocation = new FileLocation(workerId + 1, module, line, wasFunc);
+                fileLocations.add(fileLocation);
             }
             /* Otherwise, assume arg is a full or partial function name or file name. */
             else
@@ -4662,36 +4814,66 @@ public class DebugCLI implements Runnable, SourceLocator
 					module = moduleAndLine[0];
 					line = moduleAndLine[1];
 					wasFunc = 1;
-                }
-                /* If it isn't, assume arg is a full or partial file name. */
-                catch(NoMatchException pe)
-                {
-					try
-					{
-						module = parseFileName(arg);
-						line = 1;
-					}
-					catch(NoMatchException pee)
-					{
-						// catch the 'file name' string
-						Map<String, Object> args = new HashMap<String, Object>();
-						args.put("token", arg); //$NON-NLS-1$
-						throw new NoMatchException(getLocalizationManager().getLocalizedTextString("noSuchFileOrFunction", args)); //$NON-NLS-1$
-					}
-                }
-            }
-        }
+					
+	                final FileLocation fileLocation = new FileLocation(workerId + 1, module, line, wasFunc);
+	                fileLocations.add(fileLocation);
+	            } catch (NoMatchException pe) {
+	            /* If it isn't, assume arg is a full or partial file name. */
+	                if (all) {
+	                    while (iterator.hasNext()) {
+	                        currentIsolate = iterator.next();
+	                        try {
+	                            module = parseFileName(currentIsolate, arg);
+	                            line = 1;
+	
+	                            final FileLocation fileLocation = new FileLocation(currentIsolate, module, line, wasFunc);
+	                            fileLocations.add(fileLocation);
+	                        } catch (NoMatchException ignored) {
+	                        }
+	                    }
+	                } else {
+	                    module = parseFileName(m_activeIsolate, arg);
+	                    line = 1;
+	
+	                    final FileLocation fileLocation = new FileLocation(m_activeIsolate, module, line, wasFunc);
+	                    fileLocations.add(fileLocation);
+	                }
+	            }
+	        }
+	    }
+
+	    /* Now deal with the case where arg contains a '@' and / or ':',
+	       and is therefore specifying both a file and a line plus eventually the workerId. */
+	    else {
+	        workerId = m_activeIsolate;
+	        if (firstChar == '@') {
+	            workerId = parseWorkerId(arg.substring(1, colonAt));
+	            arg = arg.substring(colonAt + 1);
+	            colonAt = arg.indexOf(':');
+	            if (colonAt < 0) {
+	            }
+	        }
+	
+	        /* Now deal with the case where arg contains a ':',
+	           and is therefore specifying both a file and a line. */
+	        else
+	        {
+	        	module = parseFileName(m_activeIsolate, arg.substring(0, colonAt));
+	            line = parseLineArg(module, arg.substring(colonAt + 1));
+				wasFunc = (arg.substring(colonAt+1).length() > 1 && Character.isDigit(arg.substring(colonAt+1).charAt(0)) ) ? 0 : 1;
 
-        /* Now deal with the case where arg contains a ':',
-           and is therefore specifying both a file and a line. */
-        else
-        {
-            module = parseFileArg(module, arg.substring(0, colonAt));
-            line = parseLineArg(module, arg.substring(colonAt + 1));
-			wasFunc = (arg.substring(colonAt+1).length() > 1 && Character.isDigit(arg.substring(colonAt+1).charAt(0)) ) ? 0 : 1;
-        }
+				final FileLocation fileLocation = new FileLocation(m_activeIsolate, module, line, wasFunc);
+                fileLocations.add(fileLocation);
+	        }
+	    }
 
-        return new int[] { module, line, wasFunc };
+        if (fileLocations.size() == 0) {
+            Map<String, Object> args = new HashMap<String, Object>();
+            args.put("token", arg); //$NON-NLS-1$
+            throw new NoMatchException(getLocalizationManager().getLocalizedTextString("noSuchFileOrFunction", args)); //$NON-NLS-1$
+        }
+        final Object[] original = fileLocations.toArray();
+        return Arrays.copyOf(original, original.length, FileLocation[].class);
     }
 
 	/**
@@ -4788,12 +4970,14 @@ public class DebugCLI implements Runnable, SourceLocator
                 }
                 else
                 {
-                    int[] result = parseLocationArg(currentModule, currentLine, arg1, workerid);
-                    module1 = result[0];
-                    line2 = line1 = result[1];
+                    FileLocation[] fileLocations = parseLocationArg(currentModule, currentLine, arg1, false);
 
-                    if (hasMoreTokens())
-                    {
+                    if (fileLocations.length == 1) {
+                        module1 = fileLocations[0].getModule();
+                        line2 = line1 = fileLocations[0].getLine();
+                    }
+
+                    if (hasMoreTokens()) {
                         arg2 = nextToken();
                         line2 = parseLineArg(module1, arg2);
                     }
@@ -5851,21 +6035,25 @@ public class DebugCLI implements Runnable, SourceLocator
 	boolean enableBreakpoint(BreakAction a, boolean autoDisable, boolean autoDelete) throws NotConnectedException
 	{
 		boolean retval = false;
-		Location l = a.getLocation();   // use the first location as a source file / line number template 
-		if (l != null)
-		{
-			LocationCollection col = enableBreak(l.getFile(), l.getLine(), l.getIsolateId());
-			if (!col.isEmpty())
+        final LocationCollection locations = a.getLocations();
+
+        for (Iterator<Location> iterator = locations.iterator(); iterator.hasNext(); ) {
+            Location l = iterator.next();
+
+			if (l != null)
 			{
-				a.setEnabled(true);
-				a.setLocations(col);
-				a.setAutoDisable(autoDisable);
-				a.setAutoDelete(autoDelete);
-				a.setSingleSwf(false);
-				a.setStatus(BreakAction.RESOLVED);
-				retval = true;
+				LocationCollection col = enableBreak(l.getFile(), l.getLine(), l.getIsolateId());
+				if (!col.isEmpty())
+				{
+					a.setEnabled(true);
+					a.setAutoDisable(autoDisable);
+					a.setAutoDelete(autoDelete);
+					a.setSingleSwf(false);
+					a.setStatus(BreakAction.RESOLVED);
+					retval |= true;
+				}
 			}
-		}
+        }
 		return retval;
 	}
 
@@ -5889,7 +6077,7 @@ public class DebugCLI implements Runnable, SourceLocator
             if (hasMoreTokens())
             {
                 String arg = nextToken();
-                module = parseFileArg(module, arg);
+                module = parseFileArg(module, module, arg);
 				currentLine = 1;
                 setListingPosition(module, currentLine, worker);
              }
@@ -6414,7 +6602,7 @@ public class DebugCLI implements Runnable, SourceLocator
 	 *
 	 * @return some hit breakpoint requested silence, shhhh!
 	 */
-	boolean processBreak(boolean postStep, StringBuilder sb, int isolateId) throws NotConnectedException
+    boolean processBreak(boolean postStep, StringBuilder sb, int isolateId) throws NotConnectedException, SuspendedException, IOException, NotSupportedException, NotSuspendedException, NoResponseException
 	{
 		Location l = getCurrentLocationIsolate(isolateId);
 		if (l == null || l.getFile() == null)
@@ -7086,14 +7274,22 @@ public class DebugCLI implements Runnable, SourceLocator
 		return quit;
 	}
 
-	void doWorker() throws IOException, NotSupportedException, NotSuspendedException, NoResponseException, NotConnectedException
+    void doWorker() throws IOException, NotSupportedException, NotSuspendedException, NoResponseException, NotConnectedException {
+        if (hasMoreTokens()) {
+            String workerId = nextToken();
+            if (workerId != null && workerId.length() > 0) {
+                int id = Integer.parseInt(workerId);
+                doWorker(++id, true);
+            }
+        }
+    }
+
+    void doWorker(int id, boolean doOutput) throws IOException, NotSupportedException, NotSuspendedException, NoResponseException, NotConnectedException
 	{
 		if (hasMoreTokens()) {
 			String isolateid = nextToken();
 			if (isolateid != null && isolateid.length() > 0) {
 				try {
-					int id = Integer.parseInt(isolateid);
-					id++;
 					boolean found = false;
 					for (Isolate isolate : m_session.getWorkers()) {
 						if (isolate.getId() == id)
@@ -7109,19 +7305,25 @@ public class DebugCLI implements Runnable, SourceLocator
 						propertyPut(LAST_FRAME_DEPTH, 0);
 						propertyPut(CURRENT_FRAME_DEPTH, 0);
 						propertyPut(DISPLAY_FRAME_NUMBER, 0);
-						sb.append(getLocalizationManager().getLocalizedTextString("workerChanged") + " "); //$NON-NLS-1$ //$NON-NLS-2$
-						if (id == Isolate.DEFAULT_ID) {
-							sb.append(getLocalizationManager().getLocalizedTextString("mainThread")); //$NON-NLS-1$
+						if (doOutput) {
+							sb.append(getLocalizationManager().getLocalizedTextString("workerChanged") + " "); //$NON-NLS-1$ //$NON-NLS-2$
+							if (id == Isolate.DEFAULT_ID) {
+								sb.append(getLocalizationManager().getLocalizedTextString("mainThread")); //$NON-NLS-1$
+							}
+							else
+								sb.append((id - 1));
+							sb.append(m_newline);
 						}
-						else
-							sb.append((id - 1));
-						sb.append(m_newline);
 					}
 					else {
-						sb.append(getLocalizationManager().getLocalizedTextString("workerNotFound") + " " + (id - 1)); //$NON-NLS-1$ //$NON-NLS-2$
-						sb.append(m_newline);
+						if (doOutput) {
+							sb.append(getLocalizationManager().getLocalizedTextString("workerNotFound") + " " + (id - 1)); //$NON-NLS-1$ //$NON-NLS-2$
+							sb.append(m_newline);
+						}
+					}
+					if (doOutput) {
+						out(sb.toString());
 					}
-					out(sb.toString());
 				}
 				catch(NumberFormatException e) {
 					err(e.getLocalizedMessage());
@@ -7473,3 +7675,61 @@ public class DebugCLI implements Runnable, SourceLocator
 	void doShowBreak() throws NotConnectedException						{ Extensions.doShowBreak(this);					}
  	void doDisassemble() throws PlayerDebugException					{ Extensions.doDisassemble(this);				}
 }
+
+    class FileLocation {
+
+        public FileLocation () {};
+
+        public FileLocation(int isolateId, int module, int line, int wasFunc) {
+            setIsolateId(isolateId);
+            setModule(module);
+            setLine(line);
+            setWasFunc(wasFunc);
+        };
+
+        public FileLocation(int isolateId, int module, int line) {
+            setIsolateId(isolateId);
+            setModule(module);
+            setLine(line);
+            setWasFunc(0);
+        };
+
+
+        public int getIsolateId() {
+            return isolateId;
+        }
+
+        public void setIsolateId(int isolateId) {
+            this.isolateId = isolateId;
+        }
+
+        public int getModule() {
+            return module;
+        }
+
+        public void setModule(int module) {
+            this.module = module;
+        }
+
+        public int getLine() {
+            return line;
+        }
+
+        public void setLine(int line) {
+            this.line = line;
+        }
+
+        int isolateId;
+        int module;
+        int line;
+
+        public int getWasFunc() {
+            return wasFunc;
+        }
+
+        public void setWasFunc(int wasFunc) {
+            this.wasFunc = wasFunc;
+        }
+
+        int wasFunc;
+    }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0051eda9/debugger/src/flex/tools/debugger/cli/Extensions.java
----------------------------------------------------------------------
diff --git a/debugger/src/flex/tools/debugger/cli/Extensions.java b/debugger/src/flex/tools/debugger/cli/Extensions.java
index 179d8f1..0222290 100644
--- a/debugger/src/flex/tools/debugger/cli/Extensions.java
+++ b/debugger/src/flex/tools/debugger/cli/Extensions.java
@@ -27,7 +27,6 @@ import flash.swf.tools.Disassembler;
 import flash.swf.types.ActionList;
 import flash.tools.ActionLocation;
 import flash.tools.debugger.Bootstrap;
-import flash.tools.debugger.InProgressException;
 import flash.tools.debugger.NotConnectedException;
 import flash.tools.debugger.PlayerDebugException;
 import flash.tools.debugger.Session;
@@ -117,7 +116,7 @@ public class Extensions
 			if (cli.hasMoreTokens())
 			{
 				arg = cli.nextToken();
-				int id = arg.equals(".") ? cli.propertyGet(DebugCLI.LIST_MODULE) : cli.parseFileArg(-1, arg); //$NON-NLS-1$
+                int id = arg.equals(".") ? cli.propertyGet(DebugCLI.LIST_MODULE) : cli.parseFileArg(cli.getActiveIsolateId(), -1, arg); //$NON
 
 				DModule m = (DModule)fileInfo.getFile(id, cli.getActiveIsolateId());
                 m.lineMapping(sb);
@@ -315,6 +314,7 @@ public class Extensions
  		{
 			FileInfoCache fileInfo = cli.getFileCache();
 			Session session = cli.getSession();
+            int isolateId = cli.getActiveIsolateId();
 			if (cli.hasMoreTokens())
  			{
 				arg1 = cli.nextToken();
@@ -325,16 +325,20 @@ public class Extensions
 				}
 				else
 				{
-					int[] result = cli.parseLocationArg(currentModule, currentLine, arg1, currentIsolate);
-					module1 = result[0];
-					line2 = line1 = result[1];
- 					functionNamed = (result[2] == 0) ? false : true;
- 
-					if (cli.hasMoreTokens())
-					{
-						arg2 = cli.nextToken();
-						line2 = cli.parseLineArg(module1, arg2);
-					}
+                    int wasFunc = 0;
+
+                    FileLocation[] fileLocations = cli.parseLocationArg(currentModule, currentLine, arg1, false);
+
+                    if (fileLocations.length == 1) {
+                        module1 = fileLocations[0].getModule();
+                        line2 = line1 = fileLocations[0].getLine();
+                        functionNamed = (fileLocations[0].getWasFunc() != 0);
+                    }
+
+                    if (cli.hasMoreTokens()) {
+                        arg2 = cli.nextToken();
+                        line2 = cli.parseLineArg(module1, arg2);
+                    }
 				}
  			}
  			else
@@ -342,7 +346,6 @@ public class Extensions
  				// since no parms test for valid location if none use players concept of where we stopped
  				if( fileInfo.getFile(currentModule, currentIsolate) == null)
  				{
- 					int isolateId = cli.getActiveIsolateId();
  					//here we simply use the players concept of suspsend
  					DSuspendInfo info = ((PlayerSession)session).getSuspendInfoIsolate(isolateId);
  					int at = info.getOffset();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0051eda9/debugger/src/flex/tools/debugger/cli/LocationCollection.java
----------------------------------------------------------------------
diff --git a/debugger/src/flex/tools/debugger/cli/LocationCollection.java b/debugger/src/flex/tools/debugger/cli/LocationCollection.java
index 0ccc14f..37dbeab 100644
--- a/debugger/src/flex/tools/debugger/cli/LocationCollection.java
+++ b/debugger/src/flex/tools/debugger/cli/LocationCollection.java
@@ -47,6 +47,9 @@ public class LocationCollection
     // Return the first Location object or null
 	public Location     first()					{ return ( (m_locations.size() > 0) ? m_locations.get(0) : null ); }
 
+    // Return the last Location object or null
+    public Location     last()                  { return ( (m_locations.size() > 0) ? m_locations.get(m_locations.size() - 1) : null ); }
+
 	/**
 	 * Removes Locations from the Collection which contain
 	 * SourceFiles with Ids in the range [startingId, endingId].


Mime
View raw message