示例#1
0
		/// <summary> Determines if the given BreakAction requests a halt given the file
		/// line and optionally a conditional to evaluate.'
		/// </summary>
		internal virtual bool shouldBreak(BreakAction a, int fileId, int line)
		{
			bool should = a.Enabled;
			ValueExp exp = a.getCondition();
			if (should && exp != null && !m_requestHalt)
			// halt request fires true
			{
				// evaluate it then update our boolean
				try
				{
					System.Object result = evalExpression(exp, false);
					should = BooleanExp.toBoolean(result);
				}
				catch (System.NullReferenceException)
				{
				}
				catch (System.FormatException)
				{
				}
			}
			return should;
		}
示例#2
0
		internal virtual bool enableBreakpoint(BreakAction a, bool autoDisable, bool autoDelete)
		{
			bool retval = false;
			Location l = a.Location; // use the first location as a source file / line number template 
			if (l != null)
			{
				LocationCollection col = enableBreak(l.File, l.Line);
				if (!col.Empty)
				{
					a.Enabled = true;
					a.Locations = col;
					a.AutoDisable = autoDisable;
					a.AutoDelete = autoDelete;
					a.SingleSwf = false;
					a.Status = BreakAction.RESOLVED;
					retval = true;
				}
			}
			return retval;
		}
示例#3
0
		internal virtual bool breakpointAdd(BreakAction a)
		{
			return m_breakpoints.Add(a) >= 0;
		}
示例#4
0
		/// <summary> Try to resolve one breakpoint.  We do this every time a new ABC or
		/// SWF is loaded.
		/// </summary>
		/// <param name="b">the breakpoint to resolve (it's okay if it's already resolved)
		/// </param>
		/// <param name="sb">a StringBuffer to which any messages for are appended;
		/// to the user.
		/// </param>
		/// <returns> true if the breakpoint is resolved
		/// </returns>
		/// <throws>  AmbiguousException </throws>
		/// <throws>  NullPointerException  </throws>
		private bool tryResolveBreakpoint(BreakAction b, System.Text.StringBuilder sb)
		{
			int status = b.Status;
			bool resolved = (status == BreakAction.RESOLVED);
			if (status == BreakAction.UNRESOLVED)
			// we don't do anything for RESOLVED or AMBIGUOUS
			{
				/* wait a bit if we are not halted */
				try
				{
					waitTilHalted();
					
					// 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.AutoDisable, b.AutoDelete))
					{
						resolved = true;
					}
					else
					{
						int module = propertyGet(LIST_MODULE);
						int line = propertyGet(LIST_LINE);
						
						String arg = b.BreakpointExpression;
						
						if (arg != null)
						{
							int[] result = parseLocationArg(module, line, arg);
							
							// whoo-hoo, it resolved!
							module = result[0];
							line = result[1];
							
							// use module SourceFile to denote the name of file in which we wish to set a breakpoint
							SourceFile f = m_fileInfo.getFile(module);
							LocationCollection col = enableBreak(f, line);
							if (col.Empty)
								throw new NullReferenceException(LocalizationManager.getLocalizedTextString("noExecutableCode")); //$NON-NLS-1$
							b.Locations = col;
							
							Location l = col.first();
							SourceFile file = (l != null)?l.File:null;
							String funcName = (file == null)?null:file.getFunctionNameForLine(m_session, l.Line);
							
							System.Collections.IDictionary args = new System.Collections.Hashtable();
							String formatString;
							args["breakpointNumber"] = System.Convert.ToString(b.Id); //$NON-NLS-1$
							String filename = file.Name;
							if (b.SingleSwf && file != null)
							{
								filename = filename + "#" + file.Id; //$NON-NLS-1$
							}
							args["file"] = filename; //$NON-NLS-1$
							args["line"] = (System.Int32) l.Line; //$NON-NLS-1$
							
							if (funcName != null)
							{
								args["functionName"] = funcName; //$NON-NLS-1$
								formatString = "resolvedBreakpointToFunction"; //$NON-NLS-1$
							}
							else
							{
								formatString = "resolvedBreakpointToFile"; //$NON-NLS-1$
							}
							
							sb.Append(LocalizationManager.getLocalizedTextString(formatString, args));
							sb.Append(m_newline);
							sb.Append(m_newline);
							
							resolved = true;
						}
					}
				}
				catch (NotConnectedException)
				{
					// Ignore
				}
				catch (NoMatchException)
				{
					// Okay, it's still not resolved; do nothing
				}
				catch (System.FormatException e)
				{
					// this shouldn't happen
					if (Trace.error)
					{
						Trace.trace(e.ToString());
					}
				}
				catch (AmbiguousException e)
				{
					b.Status = BreakAction.AMBIGUOUS;
					throw e; // rethrow
				}
				catch (System.NullReferenceException e)
				{
					b.Status = BreakAction.NOCODE;
					throw e; // rethrow
				}
			}
			return resolved;
		}
示例#5
0
		/// <summary> Create a new, *unresolved* breakpoint.  Unresolved means we weren't able to
		/// parse the location string, presumably because the filename to which it refers
		/// has not yet been loaded.
		/// </summary>
		/// <param name="unresolvedLocation">the breakpoint location, exactly as typed by the user
		/// </param>
		/// <returns> object associated with breakpoint
		/// </returns>
		private BreakAction addUnresolvedBreakpoint(String unresolvedLocation)
		{
			BreakAction b = new BreakAction(unresolvedLocation);
			b.Enabled = true;
			b.SingleSwf = m_fileInfo.SwfFilterOn;
			breakpointAdd(b);
			return b;
		}
示例#6
0
		/// <summary> Attempt to create new breakpoint at the given file and line. It will be set</summary>
		/// <param name="fileId">source file identifier
		/// </param>
		/// <param name="line">line number
		/// </param>
		/// <returns> object associated with breakpoint
		/// </returns>
		internal virtual BreakAction addBreakpoint(int fileId, int line)
		{
			// use fileId SourceFile to denote the name of file in which we wish to set a breakpoint
			SourceFile f = m_fileInfo.getFile(fileId);
			LocationCollection col = enableBreak(f, line);
			
			BreakAction b = new BreakAction(col); //  throws NullPointerException if collection is null
			b.Enabled = true;
			b.SingleSwf = m_fileInfo.SwfFilterOn;
			breakpointAdd(b);
			return b;
		}