Exemplo n.º 1
0
        public override bool Equals(System.Object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            if (!(obj is DebugModule))
            {
                return(false);
            }
            DebugModule other = (DebugModule)obj;

            return(this.bitmap == other.bitmap && this.name.Equals(other.name) && this.text.Equals(other.text));
        }
		public override void  doInitAction(DoInitAction tag)
		{
			if (header_field.version > 6 && tag.sprite != null)
			{
				String __Packages = idRef(tag.sprite);
				className = (__Packages != null && __Packages.StartsWith("__Packages"))?__Packages.Substring(11):null; // length("__Packages.") = 11
				
				if (isRegisterClass(tag.actionList))
				{
					DebugModule dm = new DebugModule();
					// C: We actually want the class name here, not the linkage ID.
					dm.name = "<" + __Packages + ".2>";
					// C: We want the class name as the second input argument. Fortunately, we don't
					//    really do anything with the source, so it's okay.
					dm.Text = "Object.registerClass(" + __Packages + ", " + __Packages + ");";
					dm.bitmap = 1;
					
					LineRecord lr = new LineRecord(1, dm);
					
					int startOffset = tag.actionList.getOffset(0);
					dm.addOffset(lr, startOffset);
					
					tag.actionList.insert(startOffset, lr);
					modules.put((int) (SupportClass.Random.NextDouble() * System.Int32.MaxValue), dm);
				}
			}
			
			String[] temp = pool;
			collectActions(tag.actionList);
			pool = temp;
			
			className = null;
		}
		internal virtual void  add(DebugModule m)
		{
            int count = 0;

            if (cache.Contains(m))
            {
                count = (int)cache[m];
            }
 
			cache[m] = ++count;
			
			if (count > topCount)
			{
				topCount = count;
				topModule = m;
			}
		}
Exemplo n.º 4
0
 public override void module(DebugModule dm)
 {
 }
Exemplo n.º 5
0
            public override void module(DebugModule dm)
			{
				Console.Out.WriteLine("DebugScript #" + dm.id + " " + dm.bitmap + " " + dm.name + " (nlines = " + (dm.offsets.Length - 1) + ")");
			}
Exemplo n.º 6
0
		/// <summary> Royale Enhancement Request: 53160...
		/// 
		/// If a debug module represents an AS2 class, the module name should be in the form of classname: fileURL
		/// Matador uses classname: absolutePath (note: absolute, not cannonical)
		/// 
		/// </summary>
		/// <param name="d">
		/// </param>
		protected internal static void  adjustModuleName(DebugModule d)
		{
			d.name = adjustModuleName(d.name);
		}
Exemplo n.º 7
0
		public virtual void  readTags(DebugHandler handler)
		{
			System.Collections.ArrayList lineRecords = new System.Collections.ArrayList();
			
			do 
			{
				int tag = (int) in_Renamed.readUI32();
				switch (tag)
				{
					
					case kDebugScript: 
						DebugModule m = new DebugModule();
						int id = (int) in_Renamed.readUI32();
						m.id = id;
						m.bitmap = (int) in_Renamed.readUI32();
						m.name = in_Renamed.readString();
						m.Text = in_Renamed.readString();
						
						adjustModuleName(m);
						
						if (modules.contains(id))
						{
							DebugModule m2 = (DebugModule) modules.get_Renamed(id);
							if (!m.Equals(m2))
							{
								handler.error("Module '" + m2.name + "' has the same ID as Module '" + m.name + "'");
								handler.error("Let's check for kDebugOffset that came before Module '" + m2.name + "'");
								handler.error("Before: Number of accumulated line records: " + lineRecords.Count);
								lineRecords = purgeLineRecords(lineRecords, id, handler);
								handler.error("After: Number of accumulated line records: " + lineRecords.Count);
							}
						}
						modules.put(id, m);
						handler.module(m);
						break;
					
					case kDebugOffset: 
						id = (int) in_Renamed.readUI32();
						int lineno = (int) in_Renamed.readUI32();
						DebugModule module = (DebugModule) modules.get_Renamed(id);
						LineRecord lr = new LineRecord(lineno, module);
						int offset = (int) in_Renamed.readUI32();
						
						if (module != null)
						{
							// not corrupted before we add the offset and offset add fails
							bool wasCorrupt = module.corrupt;
							if (!module.addOffset(lr, offset) && !wasCorrupt)
								handler.error(module.name + ":" + lineno + " does not exist for offset " + offset + ", module marked for exclusion from debugging");
							handler.offset(offset, lr);
						}
						else
						{
							lineRecords.Add((System.Int32) id);
							lineRecords.Add(lr);
							lineRecords.Add((System.Int32) offset);
						}
						break;
					
					case kDebugBreakpoint: 
						handler.breakpoint((int) in_Renamed.readUI32());
						break;
					
					case kDebugRegisters: 
					{
						offset = (int) in_Renamed.readUI32();
						int size = in_Renamed.readUI8();
						RegisterRecord r = new RegisterRecord(offset, size);
						for (int i = 0; i < size; i++)
						{
							int nbr = in_Renamed.readUI8();
							String name = in_Renamed.readString();
							r.addRegister(nbr, name);
						}
						handler.registers(offset, r);
						break;
					}
					
					
					case kDebugID: 
						FlashUUID uuid = new FlashUUID();
						in_Renamed.readFully(uuid.bytes);
						handler.uuid(uuid);
						break;
					
					case - 1: 
						break;
					
					default: 
						throw new SwfFormatException("Unexpected tag id " + tag);
					
				}
				
				if (tag == - 1)
				{
					break;
				}
			}
			while (true);
			
			int i2 = 0, size2 = lineRecords.Count;
			while (i2 < size2)
			{
				int id = ((System.Int32) lineRecords[i2]);
				LineRecord lr = (LineRecord) lineRecords[i2 + 1];
				int offset = ((System.Int32) lineRecords[i2 + 2]);
				lr.module = (DebugModule) modules.get_Renamed(id);
				
				if (lr.module != null)
				{
					//System.out.println("updated module "+id+" out of order");
					// not corrupted before we add the offset and offset add fails
					bool wasCorrupt = lr.module.corrupt;
					if (!lr.module.addOffset(lr, offset) && !wasCorrupt)
						handler.error(lr.module.name + ":" + lr.lineno + " does not exist for offset " + offset + ", module marked for exclusion from debugging");
					
					handler.offset(offset, lr);
				}
				else
				{
					handler.error("Could not find debug module (id = " + id + ") for offset = " + offset);
				}
				
				i2 += 3;
			}
		}
Exemplo n.º 8
0
 public abstract void module(DebugModule dm);
Exemplo n.º 9
0
		public LineRecord(int lineno, DebugModule module):base(ActionList.sactionLineRecord)
		{
			this.lineno = lineno;
			this.module = module;
		}
Exemplo n.º 10
0
        public override void module(DebugModule dm)
		{
		}
Exemplo n.º 11
0
 public LineRecord(int lineno, DebugModule module) : base(ActionList.sactionLineRecord)
 {
     this.lineno = lineno;
     this.module = module;
 }