Exemplo n.º 1
0
        public void LoadBreakPoints()
        {
            if (BreakpointFile == null || !File.Exists(BreakpointFile))
            {
                return;
            }

            bool remap = false;

            foreach (var line in File.ReadAllLines(BreakpointFile))
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                if (line.StartsWith("#HASH: "))
                {
                    if (ImageFile != null && File.Exists(ImageFile))
                    {
                        var hash = line.Substring(7).Trim();

                        remap = VMHash != hash;
                    }
                    continue;
                }

                if (line.StartsWith("#"))
                {
                    continue;
                }

                var parts = line.Split('\t');

                if (parts.Length == 0)
                {
                    continue;
                }

                var address = ParseHexAddress(parts[0]);
                var symbol  = parts.Length >= 2 ? parts[1] : null;

                if (symbol != null && remap)
                {
                    if (symbol.StartsWith("0x") && symbol.Contains('+'))
                    {
                        continue;
                    }

                    address = DebugSource.GetFirstSymbolByName(symbol);

                    if (address == 0)
                    {
                        continue;
                    }
                }

                AddBreakPoint(address, symbol);
            }
        }
Exemplo n.º 2
0
        public void LoadWatches()
        {
            if (Options.WatchFile == null || !File.Exists(Options.WatchFile))
            {
                return;
            }

            bool remap = false;

            foreach (var line in File.ReadAllLines(Options.WatchFile))
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                if (line.StartsWith("#HASH: "))
                {
                    if (Options.ImageFile != null && File.Exists(Options.ImageFile))
                    {
                        var hash = line.Substring(7).Trim();

                        remap = VMHash != hash;
                    }
                    continue;
                }

                if (line.StartsWith("#"))
                {
                    continue;
                }

                var parts = line.Split('\t');

                if (parts.Length < 2)
                {
                    continue;
                }

                var address = ParseHexAddress(parts[0]);
                var size    = parts.Length >= 2 ? Convert.ToUInt32(parts[1]) : 0;
                var symbol  = parts.Length >= 3 ? parts[2] : null;

                if (symbol != null && remap)
                {
                    if (symbol.StartsWith("0x") && symbol.Contains('+'))
                    {
                        continue;
                    }

                    address = DebugSource.GetFirstSymbolByName(symbol);

                    if (address == 0)
                    {
                        continue;
                    }
                }

                AddWatch(symbol, address, size);
            }
        }