Ejemplo n.º 1
0
        public virtual System.Text.StringBuilder appendContent(System.Text.StringBuilder sb, int max)
        {
            int size = Size;

            byte[] data = Data;
            int    i    = 0;

            // First, output formatted content -- content for which some of the other functions
            // in this class, such as getDWord and getString, did formatting.
            sb.Append(m_debugFormatted);

            // Now, for any left-over bytes which no one bothered to parse, output them as hex.
            for (i = 0; i < max && i + m_debugFormattedThroughIndex < size; i++)
            {
                int v = data[i + m_debugFormattedThroughIndex] & 0xff;
                sb.Append(" 0x");                 //$NON-NLS-1$
                FieldFormat.formatLongToHex(sb, v, 2, true);
            }

            if (i + m_debugFormattedThroughIndex < size)
            {
                sb.Append(" ...");                 //$NON-NLS-1$
            }
            return(sb);
        }
Ejemplo n.º 2
0
        protected internal virtual void  startFormatted(String action)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            bool leadingZeros            = false;
            int  width = -1;

            for (int i = 0; i < format.Length; i++)
            {
                char c = format[i];
                if (c == '%')
                {
                    c = format[++i];
                    if (System.Char.IsDigit(c))
                    {
                        // absorb a leading zero, if any
                        if (c == '0')
                        {
                            leadingZeros = true;
                            c            = format[++i];
                        }

                        System.Text.StringBuilder number = new System.Text.StringBuilder();
                        while (System.Char.IsDigit(c))
                        {
                            number.Append(c);
                            c = format[++i];
                        }
                        try
                        {
                            width = System.Int32.Parse(number.ToString());
                        }
                        catch (System.FormatException)
                        {
                            width = -1;
                        }
                    }

                    if (c == 'O')
                    {
                        FieldFormat.formatLongToHex(sb, offset, width, leadingZeros);
                    }
                    else if (c == 'o')
                    {
                        FieldFormat.formatLong(sb, offset, width, leadingZeros);
                    }
                    else if (c == 'a')
                    {
                        sb.Append(action);
                    }
                }
                else
                {
                    sb.Append(c);
                }
            }
            out_Renamed.Write(sb.ToString());
        }
Ejemplo n.º 3
0
 // Debugging helper function: we've parsed a number out of the stream of input bytes,
 // so record that as a hex number of the appropriate length, e.g. "0x12" or "0x1234"
 // or "0x12345678", depending on numBytes.
 private void  debugAppendNumber(long value_Renamed, int numBytes)
 {
     if (PlayerSession.m_debugMsgOn || PlayerSession.m_debugMsgFileOn)
     {
         System.Text.StringBuilder sb = new System.Text.StringBuilder();
         sb.Append("0x");                 //$NON-NLS-1$
         FieldFormat.formatLongToHex(sb, value_Renamed, numBytes * 2, true);
         debugAppend(sb.ToString());
     }
 }
Ejemplo n.º 4
0
        // Extended low level break information
        public static void  appendBreakInfo(DebugCLI cli, System.Text.StringBuilder sb, bool includeFault)
        {
            Session       session  = cli.Session;
            FileInfoCache fileInfo = cli.FileCache;

            int reason = session.suspendReason();
            int offset = ((PlayerSession)session).SuspendOffset;
            int index  = ((PlayerSession)session).SuspendActionIndex;

            SwfInfo info = null;

            try
            {
                info = fileInfo.Swfs[index];
            }
            catch (IndexOutOfRangeException)
            {
            }
            if (info != null)
            {
                System.Collections.IDictionary args = new System.Collections.Hashtable();
                args["swfName"] = FileInfoCache.nameOfSwf(info);                      //$NON-NLS-1$
                sb.Append(LocalizationManager.getLocalizedTextString("key35", args)); //$NON-NLS-1$
                sb.Append(' ');
            }

            System.Collections.IDictionary args2 = new System.Collections.Hashtable();
            System.Text.StringBuilder      sb2   = new System.Text.StringBuilder();
            args2["address"] = "0x" + FieldFormat.formatLongToHex(sb2, offset, 8) + " (" + offset + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
            sb.Append(LocalizationManager.getLocalizedTextString("atAddress", args2));                   //$NON-NLS-1$

            if (includeFault)
            {
                args2 = new System.Collections.Hashtable();
                System.Text.StringBuilder reasonBuffer = new System.Text.StringBuilder();
                cli.appendReason(reasonBuffer, reason);
                args2["fault"] = reasonBuffer.ToString();                                         //$NON-NLS-1$
                sb.Append(' ');
                sb.Append(LocalizationManager.getLocalizedTextString("haltedDueToFault", args2)); //$NON-NLS-1$
            }
        }