Esempio n. 1
0
        /// <summary>
        /// Creates a Memory breakpoint by optaining the address from
        /// the Debug Information object of the Debugger.
        /// </summary>
        /// <remarks>
        /// If the Debug Symbol is marked as Executable, the breakpoint
        /// will be triggered on Execution by default; otherwise on Write.
        /// </remarks>
        /// <param name="debugger">Debugger used to access Debug Information</param>
        /// <param name="file">Source filename where the symbol is defined. If null or empty,
        /// the filename of the first Debug symbol in the table will be assumed.</param>
        /// <param name="line">Line within the file where the symbol is defined.</param>
        public MemoryBreakpoint(Debugger debugger, string file, int line)
        {
            if (debugger == null) throw new ArgumentNullException("debugger");

            if (string.IsNullOrEmpty(file))
            {
                try { file = debugger.DebugInformation.Symbols[0].Location.File; }
                catch { }
            }

            DebugSymbolLocation location = new DebugSymbolLocation();
            location.File = file;
            location.Line = line;

            DebugSymbol symbol;
            if (!debugger.DebugInformation.ByLocation.TryGetValue(location, out symbol))
            {
                throw new DebugSymbolNotFoundException();
            }

            Address = symbol.Value;

            OnExecute = symbol.IsExecutable;
            OnWrite = !symbol.IsExecutable;
            Enabled = true;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a Memory breakpoint by optaining the address from
        /// the Debug Information object of the Debugger.
        /// </summary>
        /// <remarks>
        /// If the Debug Symbol is marked as Executable, the breakpoint
        /// will be triggered on Execution by default; otherwise on Write.
        /// </remarks>
        /// <param name="debugger">Debugger used to access Debug Information</param>
        /// <param name="file">Source filename where the symbol is defined. If null or empty,
        /// the filename of the first Debug symbol in the table will be assumed.</param>
        /// <param name="line">Line within the file where the symbol is defined.</param>
        public MemoryBreakpoint(Debugger debugger, string file, int line)
        {
            if (debugger == null)
            {
                throw new ArgumentNullException("debugger");
            }

            if (string.IsNullOrEmpty(file))
            {
                try { file = debugger.DebugInformation.Symbols[0].Location.File; }
                catch { }
            }

            DebugSymbolLocation location = new DebugSymbolLocation();

            location.File = file;
            location.Line = line;

            DebugSymbol symbol;

            if (!debugger.DebugInformation.ByLocation.TryGetValue(location, out symbol))
            {
                throw new DebugSymbolNotFoundException();
            }

            Address = symbol.Value;

            OnExecute = symbol.IsExecutable;
            OnWrite   = !symbol.IsExecutable;
            Enabled   = true;
        }