Example #1
0
        internal DebugInfo Method_GetDebugInfo(long id)
        {
            var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_DEBUG_INFO, new PacketWriter ().WriteId (id));

            DebugInfo info = new DebugInfo ();
            info.max_il_offset = res.ReadInt ();

            SourceInfo[] sources = null;
            if (Version.AtLeast (2, 13)) {
                int n = res.ReadInt ();
                sources = new SourceInfo [n];
                for (int i = 0; i < n; ++i) {
                    sources [i].source_file = res.ReadString ();
                    if (Version.AtLeast (2, 14)) {
                        sources [i].hash = new byte [16];
                        for (int j = 0; j < 16; ++j)
                            sources [i].hash [j] = (byte)res.ReadByte ();
                    }
                }
            } else {
                sources = new SourceInfo [1];
                sources [0].source_file = res.ReadString ();
            }

            int n_il_offsets = res.ReadInt ();
            info.il_offsets = new int [n_il_offsets];
            info.line_numbers = new int [n_il_offsets];
            info.source_files = new SourceInfo [n_il_offsets];
            info.column_numbers = new int [n_il_offsets];
            info.end_line_numbers = new int [n_il_offsets];
            info.end_column_numbers = new int [n_il_offsets];
            for (int i = 0; i < n_il_offsets; ++i) {
                info.il_offsets [i] = res.ReadInt ();
                info.line_numbers [i] = res.ReadInt ();
                if (Version.AtLeast (2, 12)) {
                    int idx = res.ReadInt ();
                    info.source_files [i] = idx >= 0 ? sources [idx] : default (SourceInfo);
                } else {
                    info.source_files [i] = sources [0];
                }
                if (Version.AtLeast (2, 19))
                    info.column_numbers [i] = res.ReadInt ();
                else
                    info.column_numbers [i] = 0;
                if (Version.AtLeast (2, 32)) {
                    info.end_line_numbers [i] = res.ReadInt ();
                    info.end_column_numbers [i] = res.ReadInt ();
                } else {
                    info.end_column_numbers [i] = -1;
                    info.end_column_numbers [i] = -1;
                }
            }

            return info;
        }