public void AddLine(CrashDumpLine line)
        {
            string content = $"{line.Number}\t{line.Address}\t{line.Path}";

            if (!string.IsNullOrEmpty(line.Desc))
            {
                content += $"\t{line.Desc}";
            }
            _lines.Add(content);
        }
        // ... #00 pc 00018c10  /system/lib/libc.so (strlen+71)
        bool TryAddLine(string line)
        {
            string number  = null;
            string address = null;
            string path    = null;
            string desc    = null;

            for (int i = 0; i < line.Length; i++)
            {
                var c = line[i];
                if (number == null)
                {
                    if (c == '#')
                    {
                        number = TakeToWhiteSpace(line, i, out i);
                        TakeToWhiteSpace(line, i, out i);                         // ps
                    }
                    else
                    {
                        continue;
                    }
                }
                if (!char.IsWhiteSpace(c))
                {
                    if (address == null)
                    {
                        address = TakeToWhiteSpace(line, i, out i);
                    }
                    else if (path == null)
                    {
                        path = TakeToWhiteSpace(line, i, out i);
                    }
                    else if (desc == null)
                    {
                        desc = TakeToEnd(line, i);
                        break;
                    }
                }
            }
            if (!string.IsNullOrEmpty(number) && !string.IsNullOrEmpty(address) && !string.IsNullOrEmpty(path))
            {
                var crashLine = new CrashDumpLine(number, address, path, desc);
                Lines.Add(crashLine);
                Console.WriteLine($"'{crashLine.Number}', '{crashLine.Address}', '{crashLine.Path}', '{crashLine.Desc}'");
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        public bool Analyze(CrashDumpLine line, Output output)
        {
            Console.WriteLine($"Start analyze line '{line.Number}'");
            var normalizedAddress = NormalizeAddress(line.Address);

            Console.WriteLine($"Address: '{line.Address}' => '{normalizedAddress}'");
            var libLineIndex = FindLineWithAddress(normalizedAddress);

            if (libLineIndex >= 0)
            {
                var libLine         = _contents[libLineIndex];
                var funcHeaderIndex = FindFuncHeaderIndex(libLineIndex);
                if (funcHeaderIndex >= 0)
                {
                    var funcHeader = _contents[funcHeaderIndex];
                    Console.WriteLine($"Line analyzed: '{line.Number}'");
                    var libEntry = new LibEntry(line, libLine, funcHeader);
                    output.AddEntry(libEntry);
                    return(true);
                }
            }
            Console.WriteLine($"Line didn't analyzed: '{line.Number}'");
            return(false);
        }
Exemplo n.º 4
0
 public LibEntry(CrashDumpLine crashLine, string libLine, string funcHeader)
 {
     CrashLine  = crashLine;
     LibLine    = libLine;
     FuncHeader = funcHeader;
 }