Ejemplo n.º 1
0
        // A helper method used to construct a new pending breakpoint.
        public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            AD7PendingBreakpoint pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, _engine, this);

            ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint;
            _pendingBreakpoints.Add(pendingBreakpoint);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handle a modified breakpoint event. Only handles address changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void BreakpointModified(object sender, EventArgs args)
        {
            MICore.Debugger.ResultEventArgs res = args as MICore.Debugger.ResultEventArgs;
            MICore.ResultValue bkpt             = res.Results.Find("bkpt");
            string             bkptId           = null;

            //
            // =breakpoint-modified,
            //    bkpt ={number="2",type="breakpoint",disp="keep",enabled="y",addr="<MULTIPLE>",times="0",original-location="main.cpp:220"},
            //          { number="2.1",enabled="y",addr="0x9c2149a9",func="Foo::bar<int>(int)",file="main.cpp",fullname="C:\\\\...\\\\main.cpp",line="220",thread-groups=["i1"]},
            //          { number="2.2",enabled="y",addr="0x9c2149f2",func="Foo::bar<float>(float)",file="main.cpp",fullname="C:\\\\...\\\\main.cpp",line="220",thread-groups=["i1"]}
            // note: the ".x" part of the breakpoint number never appears in stopping events, that is, when executing at one of these addresses
            //       the stopping event delivered contains bkptno="2"
            if (bkpt is MICore.ValueListValue)
            {
                MICore.ValueListValue list = bkpt as MICore.ValueListValue;
                bkptId = list.Content[0].FindString("number"); // 0 is the "<MULTIPLE>" entry
            }
            else
            {
                bkptId = bkpt.FindString("number");
            }
            AD7PendingBreakpoint pending = _pendingBreakpoints.Find((p) => { return(p.BreakpointId == bkptId); });

            if (pending == null)
            {
                return;
            }
            var bindList = pending.PendingBreakpoint.BindAddresses(bkpt);

            RebindAddresses(pending, bindList);
        }
Ejemplo n.º 3
0
        private AD7PendingBreakpoint BindToAddress(string bkptno, ulong addr, /*OPTIONAL*/ TupleValue frame, out AD7BoundBreakpoint bbp)
        {
            bbp = null;
            AD7PendingBreakpoint pending = CodeBreakpoints.FirstOrDefault((p) => { return(p.BreakpointId == bkptno); });

            if (pending == null)
            {
                return(null);
            }
            // the breakpoint number is known, check to see if it is known to be bound to this address
            bbp = Array.Find(pending.EnumBoundBreakpoints(), (b) => b.Addr == addr);
            if (bbp == null)
            {
                // add this address as a bound breakpoint
                bbp = Array.Find(pending.EnumBoundBreakpoints(), (b) => b.Addr == 0);
                if (bbp != null)    // <MULTIPLE>
                {
                    bbp.UpdateAddr(addr);
                }
                else
                {
                    bbp = pending.AddBoundBreakpoint(new BoundBreakpoint(pending.PendingBreakpoint, addr, frame));
                }
            }
            return(pending);
        }
Ejemplo n.º 4
0
 public AD7BoundBreakpoint(AD7Engine engine, AD7PendingBreakpoint pendingBreakpoint, AD7BreakpointResolution breakpointResolution, BoundBreakpoint bp)
 {
     _engine               = engine;
     _pendingBreakpoint    = pendingBreakpoint;
     _breakpointResolution = breakpointResolution;
     _deleted              = false;
     _bp = bp;
 }
Ejemplo n.º 5
0
 public AD7BoundBreakpoint(AD7Engine engine, AD7PendingBreakpoint pendingBreakpoint, AD7BreakpointResolution breakpointResolution, BoundBreakpoint bp)
 {
     _engine = engine;
     _pendingBreakpoint = pendingBreakpoint;
     _breakpointResolution = breakpointResolution;
     _deleted = false;
     _bp = bp;
 }
Ejemplo n.º 6
0
        internal AD7PendingBreakpoint AddPendingBreakpoint(IDebugBreakpointRequest2 pBPRequest)
        {
            var bp = new AD7PendingBreakpoint(_engine, pBPRequest);

            lock (_pendingBreakpoints)
                _pendingBreakpoints.Add(bp);

            TryBindBreakpoints();
            return(bp);
        }
Ejemplo n.º 7
0
 public AD7BoundBreakpoint(AD7Engine engine, ulong address, AD7PendingBreakpoint pendingBreakpoint, AD7BreakpointResolution breakpointResolution, BoundBreakpoint bp)
 {
     _engine = engine;
     Addr = address;
     _pendingBreakpoint = pendingBreakpoint;
     _breakpointResolution = breakpointResolution;
     _enabled = true;
     _deleted = false;
     _bp = bp;
 }
Ejemplo n.º 8
0
 public AD7BoundBreakpoint(AD7Engine engine, ulong address, AD7PendingBreakpoint pendingBreakpoint, AD7BreakpointResolution breakpointResolution, BoundBreakpoint bp)
 {
     _engine               = engine;
     Addr                  = address;
     _pendingBreakpoint    = pendingBreakpoint;
     _breakpointResolution = breakpointResolution;
     _enabled              = true;
     _deleted              = false;
     _bp = bp;
 }
Ejemplo n.º 9
0
 private void RebindAddresses(AD7PendingBreakpoint pending, List<BoundBreakpoint> boundList)
 {
     if (boundList.Count == 0)
     {
         return;
     }
     var bkpt = Array.Find(pending.EnumBoundBreakpoints(), (b) => b.Addr == 0);
     int i = 0;
     if (bkpt != null)
     {
         bkpt.UpdateAddr(boundList[0].Addr);     // replace <MULTIPLE> placeholder address
         i = 1;
     }
     for (; i < boundList.Count; ++i)
     {
         pending.AddBoundBreakpoint(boundList[i]);
     }
 }
Ejemplo n.º 10
0
        private void RebindAddresses(AD7PendingBreakpoint pending, List <BoundBreakpoint> boundList)
        {
            if (boundList.Count == 0)
            {
                return;
            }
            var bkpt = Array.Find(pending.EnumBoundBreakpoints(), (b) => b.Addr == 0);
            int i    = 0;

            if (bkpt != null)
            {
                bkpt.UpdateAddr(boundList[0].Addr);     // replace <MULTIPLE> placeholder address
                i = 1;
            }
            for (; i < boundList.Count; ++i)
            {
                pending.AddBoundBreakpoint(boundList[i]);
            }
        }
Ejemplo n.º 11
0
        private static BindResult EvalBindWatchResult(Results bindResult, AD7PendingBreakpoint pbreak, string address, uint size)
        {
            string errormsg = "Unknown error";

            if (bindResult.ResultClass == ResultClass.error)
            {
                if (bindResult.Contains("msg"))
                {
                    errormsg = bindResult.FindString("msg");
                }
                if (String.IsNullOrWhiteSpace(errormsg))
                {
                    errormsg = "Unknown error";
                }
                return(new BindResult(errormsg));
            }
            else if (bindResult.ResultClass != ResultClass.done)
            {
                return(new BindResult(errormsg));
            }
            TupleValue bkpt = null;

            if (bindResult.Contains("wpt"))
            {
                ResultValue b = bindResult.Find("wpt");
                if (b is TupleValue)
                {
                    bkpt = b as TupleValue;
                }
            }
            else
            {
                return(new BindResult(errormsg));
            }

            string number = bkpt.FindString("number");

            PendingBreakpoint bp  = new PendingBreakpoint(pbreak, number, MIBreakpointState.Single);
            BoundBreakpoint   bbp = new BoundBreakpoint(bp, MICore.Debugger.ParseAddr(address), size);

            return(new BindResult(bp, bbp));
        }
Ejemplo n.º 12
0
        internal static void GetILOffset(AD7PendingBreakpoint bp, MethodMirror methodMirror, out int ilOffset)
        {
            List<Mono.Debugger.Soft.Location> locations = methodMirror.Locations.ToList();

            foreach (Mono.Debugger.Soft.Location location in locations)
            {
                int line = location.LineNumber;
                int column = location.ColumnNumber;

                if (line != bp.StartLine + 1)
                    continue;
                //if (column != bp.StartColumn)
                //    continue;

                ilOffset = location.ILOffset;

                Console.WriteLine(location.ColumnNumber);
                return;
            }

            throw new Exception("Cant bind breakpoint");
        }
Ejemplo n.º 13
0
 public AD7BoundBreakpoint FindHitBreakpoint(string bkptno, ulong addr, /*OPTIONAL*/ TupleValue frame, out bool fContinue)
 {
     fContinue = false;
     lock (_pendingBreakpoints)
     {
         AD7BoundBreakpoint   bbp;
         AD7PendingBreakpoint pending = BindToAddress(bkptno, addr, frame, out bbp);
         if (pending == null)
         {
             return(null);
         }
         fContinue = true;
         if (!pending.Enabled || pending.Deleted || pending.PendingDelete)
         {
             return(null);
         }
         if (!bbp.Enabled || bbp.Deleted)
         {
             return(null);
         }
         fContinue = false;
         return(bbp);
     }
 }
Ejemplo n.º 14
0
 internal void DeletePendingBreakpoint(AD7PendingBreakpoint breakPoint)
 {
     lock (_pendingBreakpoints)
         _pendingBreakpoints.Remove(breakPoint);
 }
Ejemplo n.º 15
0
        internal static async Task <BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            string  basename   = System.IO.Path.GetFileName(documentName);  // get basename from Windows path
            Results bindResult = await process.MICommandFactory.BreakInsert(process.EscapePath(basename), line, condition, ResultClass.None);

            string errormsg = "Unknown error";

            if (bindResult.ResultClass == ResultClass.error)
            {
                if (bindResult.Contains("msg"))
                {
                    errormsg = bindResult.FindString("msg");
                }
                if (String.IsNullOrWhiteSpace(errormsg))
                {
                    errormsg = "Unknown error";
                }
                return(new BindResult(errormsg));
            }
            else if (bindResult.ResultClass != ResultClass.done)
            {
                return(new BindResult(errormsg));
            }
            TupleValue     bkpt = null;
            ValueListValue list = null;

            if (bindResult.Contains("bkpt"))
            {
                ResultValue b = bindResult.Find("bkpt");
                if (b is TupleValue)
                {
                    bkpt = b as TupleValue;
                }
                else if (b is ValueListValue)
                {
                    // "<MULTIPLE>" sometimes includes a list of bound breakpoints
                    list = b as ValueListValue;
                    bkpt = list.Content[0] as TupleValue;
                }
            }
            else
            {
                // If the source file is not found, "done" is the result without a binding
                // (the error is sent via an "&" string and hence lost)
                return(new BindResult(errormsg));
            }
            Debug.Assert(bkpt.FindString("type") == "breakpoint");

            string number = bkpt.FindString("number");
            string addr   = bkpt.TryFindString("addr");

            PendingBreakpoint bp = new PendingBreakpoint(pbreak, number, StringToBreakpointState(addr));

            if (list == null)   // single breakpoint
            {
                BoundBreakpoint bbp = bp.GetBoundBreakpoint(bkpt);

                if (bbp == null)
                {
                    return(new BindResult(bp, MICoreResources.Status_BreakpointPending));
                }
                return(new BindResult(bp, bbp));
            }
            else   // <MULTIPLE> with list of addresses
            {
                BindResult res = new BindResult(bp);
                for (int i = 1; i < list.Content.Length; ++i)
                {
                    BoundBreakpoint bbp = bp.GetBoundBreakpoint(list.Content[i] as TupleValue);
                    res.BoundBreakpoints.Add(bbp);
                }
                return(res);
            }
        }
Ejemplo n.º 16
0
        internal static async Task <BindResult> Bind(string functionName, DebuggedProcess process, string condition, bool enabled, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            return(EvalBindResult(await process.MICommandFactory.BreakInsert(functionName, condition, enabled, ResultClass.None), pbreak));
        }
Ejemplo n.º 17
0
 internal PendingBreakpoint(AD7PendingBreakpoint pbreak, string number, MIBreakpointState state)
 {
     AD7breakpoint = pbreak;
     Number        = number;
     _breakState   = state;
 }
Ejemplo n.º 18
0
 internal void BoundBreakpoint(AD7PendingBreakpoint breakpoint)
 {
     var iid = new Guid(AD7BreakpointBoundEvent.IID);
     _eventCallback.Event(_engine, _engine.RemoteProcess, _engine, null, new AD7BreakpointBoundEvent(breakpoint), ref iid,
         AD7AsynchronousEvent.Attributes);
 }
Ejemplo n.º 19
0
        internal static async Task <BindResult> Bind(ulong codeAddress, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            return(EvalBindResult(await process.MICommandFactory.BreakInsert(codeAddress, condition, ResultClass.None), pbreak));
        }
Ejemplo n.º 20
0
 public AD7BreakpointBoundEvent(AD7PendingBreakpoint pendingBreakpoint, AD7BoundBreakpoint boundBreakpoint)
 {
     _pendingBreakpoint = pendingBreakpoint;
     _boundBreakpoint   = boundBreakpoint;
 }
Ejemplo n.º 21
0
        private static BindResult EvalBindWatchResult(Results bindResult, AD7PendingBreakpoint pbreak, string address, uint size)
        {
            string errormsg = "Unknown error";
            if (bindResult.ResultClass == ResultClass.error)
            {
                if (bindResult.Contains("msg"))
                {
                    errormsg = bindResult.FindString("msg");
                }
                if (String.IsNullOrWhiteSpace(errormsg))
                {
                    errormsg = "Unknown error";
                }
                return new BindResult(errormsg);
            }
            else if (bindResult.ResultClass != ResultClass.done)
            {
                return new BindResult(errormsg);
            }
            TupleValue bkpt = null;
            if (bindResult.Contains("wpt"))
            {
                ResultValue b = bindResult.Find("wpt");
                if (b is TupleValue)
                {
                    bkpt = b as TupleValue;
                }
            }
            else
            {
                return new BindResult(errormsg);
            }

            string number = bkpt.FindString("number");

            PendingBreakpoint bp = new PendingBreakpoint(pbreak, number, MIBreakpointState.Single);
            BoundBreakpoint bbp = new BoundBreakpoint(bp, MICore.Debugger.ParseAddr(address), size);
            return new BindResult(bp, bbp);
        }
Ejemplo n.º 22
0
        internal static async Task<BindResult> Bind(string address, uint size, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            return EvalBindWatchResult(await process.MICommandFactory.BreakWatch(address, size, ResultClass.None), pbreak, address, size);
        }
Ejemplo n.º 23
0
 public AD7BreakpointEvent(AD7PendingBreakpoint boundBreakpoints)
 {
     _boundBreakpoints = boundBreakpoints;
 }
        internal AD7PendingBreakpoint AddPendingBreakpoint(IDebugBreakpointRequest2 pBPRequest)
        {
            var bp = new AD7PendingBreakpoint(_engine, pBPRequest);
            lock (_pendingBreakpoints)
                _pendingBreakpoints.Add(bp);

            TryBindBreakpoints();
            return bp;
        }
Ejemplo n.º 25
0
        internal static async Task <BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, bool enabled, IEnumerable <Checksum> checksums, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            string compilerSrcName;

            if (!process.MapCurrentSrcToCompileTimeSrc(documentName, out compilerSrcName))
            {
                compilerSrcName = Path.GetFileName(documentName);
            }
            return(await EvalBindResult(await process.MICommandFactory.BreakInsert(compilerSrcName, process.UseUnixSymbolPaths, line, condition, enabled, checksums, ResultClass.None), pbreak));
        }
Ejemplo n.º 26
0
 // A helper method used to construct a new pending breakpoint.
 public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
 {
     AD7PendingBreakpoint pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, _engine, this);
     ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint;
     lock (_pendingBreakpoints)
     {
         _pendingBreakpoints.Add(pendingBreakpoint);
     }
 }
Ejemplo n.º 27
0
 internal PendingBreakpoint(AD7PendingBreakpoint pbreak, string number, MIBreakpointState state)
 {
     AD7breakpoint = pbreak;
     Number = number;
     _breakState = state;
 }
Ejemplo n.º 28
0
        internal static async Task<BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            string basename = System.IO.Path.GetFileName(documentName);     // get basename from Windows path
            Results bindResult = await process.MICommandFactory.BreakInsert(process.EscapePath(basename), line, condition, ResultClass.None);
            string errormsg = "Unknown error";
            if (bindResult.ResultClass == ResultClass.error)
            {
                if (bindResult.Contains("msg"))
                {
                    errormsg = bindResult.FindString("msg");
                }
                if (String.IsNullOrWhiteSpace(errormsg))
                {
                    errormsg = "Unknown error";
                }
                return new BindResult(errormsg);
            }
            else if (bindResult.ResultClass != ResultClass.done)
            {
                return new BindResult(errormsg);
            }
            TupleValue bkpt = null;
            ValueListValue list = null;
            if (bindResult.Contains("bkpt"))
            {
                ResultValue b = bindResult.Find("bkpt");
                if (b is TupleValue)
                {
                    bkpt = b as TupleValue;
                }
                else if (b is ValueListValue)
                {
                    // "<MULTIPLE>" sometimes includes a list of bound breakpoints
                    list = b as ValueListValue;
                    bkpt = list.Content[0] as TupleValue;
                }
            }
            else
            {
                // If the source file is not found, "done" is the result without a binding
                // (the error is sent via an "&" string and hence lost)
                return new BindResult(errormsg);
            }
            Debug.Assert(bkpt.FindString("type") == "breakpoint");

            string number = bkpt.FindString("number");
            string addr = bkpt.TryFindString("addr");

            PendingBreakpoint bp = new PendingBreakpoint(pbreak, number, StringToBreakpointState(addr));
            if (list == null)   // single breakpoint
            {
                BoundBreakpoint bbp = bp.GetBoundBreakpoint(bkpt);

                if (bbp == null)
                {
                    return new BindResult(bp, MICoreResources.Status_BreakpointPending);
                }
                return new BindResult(bp, bbp);
            }
            else   // <MULTIPLE> with list of addresses
            {
                BindResult res = new BindResult(bp);
                for (int i = 1; i < list.Content.Length; ++i)
                {
                    BoundBreakpoint bbp = bp.GetBoundBreakpoint(list.Content[i] as TupleValue);
                    res.BoundBreakpoints.Add(bbp);
                }
                return res;
            }
        }
Ejemplo n.º 29
0
 internal static async Task<BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
 {
     string basename = System.IO.Path.GetFileName(documentName);     // get basename from Windows path
     return EvalBindResult(await process.MICommandFactory.BreakInsert(process.EscapePath(basename), line, condition, ResultClass.None), pbreak);
 }
Ejemplo n.º 30
0
        internal static async Task <BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, bool enabled, IEnumerable <Checksum> checksums, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            string compilerSrcName;

            if (!process.MapCurrentSrcToCompileTimeSrc(documentName, out compilerSrcName))
            {
                compilerSrcName = Path.GetFileName(documentName);
            }
            BindResult bindResults = EvalBindResult(await process.MICommandFactory.BreakInsert(compilerSrcName, process.UseUnixSymbolPaths, line, condition, enabled, checksums, ResultClass.None), pbreak);

            // On GDB, the returned line information is from the pending breakpoint instead of the bound breakpoint.
            // Check the address mapping to make sure the line info is correct.
            if (process.MICommandFactory.Mode == MIMode.Gdb &&
                bindResults.BoundBreakpoints != null)
            {
                foreach (var boundBreakpoint in bindResults.BoundBreakpoints)
                {
                    string matchFile = compilerSrcName;
                    if (!string.IsNullOrEmpty(boundBreakpoint.CompiledFileName))
                    {
                        matchFile = boundBreakpoint.CompiledFileName;   // get the file name as it appears in the symbolic info
                    }
                    boundBreakpoint.Line = await process.LineForStartAddress(matchFile, boundBreakpoint.Addr);
                }
            }

            return(bindResults);
        }
Ejemplo n.º 31
0
 internal void BreakpointHit(AD7PendingBreakpoint breakpoint, AD7Thread thread)
 {
     var iid = new Guid(AD7BreakpointEvent.IID);
     _eventCallback.Event(_engine, _engine.RemoteProcess, _engine, thread, new AD7BreakpointEvent(breakpoint), ref iid,
         AD7StoppingEvent.Attributes);
 }
 internal void DeletePendingBreakpoint(AD7PendingBreakpoint breakPoint)
 {
     lock (_pendingBreakpoints)
         _pendingBreakpoints.Remove(breakPoint);
 }
Ejemplo n.º 33
0
        internal static async Task <BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            string basename = System.IO.Path.GetFileName(documentName);     // get basename from Windows path

            return(EvalBindResult(await process.MICommandFactory.BreakInsert(process.EscapePath(basename), line, condition, ResultClass.None), pbreak));
        }
Ejemplo n.º 34
0
 public AD7ErrorBreakpoint(AD7PendingBreakpoint pending, string errormsg, enum_BP_ERROR_TYPE errorType = enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING)
 {
     _pending   = pending;
     _error     = errormsg;
     _errorType = errorType;
 }
Ejemplo n.º 35
0
 internal static async Task <BindResult> Bind(string functionName, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
 {
     return(EvalBindResult(await process.MICommandFactory.BreakInsert(functionName, condition, ResultClass.None), pbreak));
 }
Ejemplo n.º 36
0
        internal static async Task<BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            string basename = System.IO.Path.GetFileName(documentName);     // get basename from Windows path
            basename = process.EscapePath(basename);
            BindResult bindResults = EvalBindResult(await process.MICommandFactory.BreakInsert(basename, line, condition, ResultClass.None), pbreak);

            // On GDB, the returned line information is from the pending breakpoint instead of the bound breakpoint.
            // Check the address mapping to make sure the line info is correct.
            if (process.MICommandFactory.Mode == MIMode.Gdb &&
                bindResults.BoundBreakpoints != null)
            {
                foreach (var boundBreakpoint in bindResults.BoundBreakpoints)
                {
                    boundBreakpoint.Line = await process.LineForStartAddress(basename, boundBreakpoint.Addr);
                }
            }

            return bindResults;
        }
Ejemplo n.º 37
0
 public AD7BreakpointBoundEvent(AD7PendingBreakpoint pendingBreakpoint, AD7BoundBreakpoint boundBreakpoint)
 {
     _pendingBreakpoint = pendingBreakpoint;
     _boundBreakpoint = boundBreakpoint;
 }
Ejemplo n.º 38
0
        internal static async Task<BindResult> Bind(ulong codeAddress, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            return EvalBindResult(await process.MICommandFactory.BreakInsert(codeAddress, condition, ResultClass.None), pbreak);
        }
Ejemplo n.º 39
0
        internal static async Task <BindResult> Bind(string address, uint size, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            return(EvalBindWatchResult(await process.MICommandFactory.BreakWatch(address, size, ResultClass.None), pbreak, address, size));
        }
Ejemplo n.º 40
0
 public AD7ErrorBreakpoint(AD7PendingBreakpoint pending, string errormsg, enum_BP_ERROR_TYPE errorType = enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING)
 {
     _pending = pending;
     _error = errormsg;
     _errorType = errorType;
 }
Ejemplo n.º 41
0
        internal static async Task <BindResult> Bind(string documentName, uint line, uint column, DebuggedProcess process, string condition, bool enabled, IEnumerable <Checksum> checksums, AD7PendingBreakpoint pbreak)
        {
            process.VerifyNotDebuggingCoreDump();

            string basename = System.IO.Path.GetFileName(documentName);     // get basename from Windows path

            basename = process.EscapePath(basename);

            BindResult bindResults = EvalBindResult(await process.MICommandFactory.BreakInsert(basename, line, condition, enabled, checksums, ResultClass.None), pbreak);

            // On GDB, the returned line information is from the pending breakpoint instead of the bound breakpoint.
            // Check the address mapping to make sure the line info is correct.
            if (process.MICommandFactory.Mode == MIMode.Gdb &&
                bindResults.BoundBreakpoints != null)
            {
                foreach (var boundBreakpoint in bindResults.BoundBreakpoints)
                {
                    boundBreakpoint.Line = await process.LineForStartAddress(basename, boundBreakpoint.Addr);
                }
            }

            return(bindResults);
        }
Ejemplo n.º 42
0
 internal static async Task<BindResult> Bind(string functionName, DebuggedProcess process, string condition, AD7PendingBreakpoint pbreak)
 {
     return EvalBindResult(await process.MICommandFactory.BreakInsert(functionName, condition, ResultClass.None), pbreak);
 }
Ejemplo n.º 43
0
        private static BindResult EvalBindResult(Results bindResult, AD7PendingBreakpoint pbreak)
        {
            string errormsg = "Unknown error";

            if (bindResult.ResultClass == ResultClass.error)
            {
                if (bindResult.Contains("msg"))
                {
                    errormsg = bindResult.FindString("msg");
                }
                if (String.IsNullOrWhiteSpace(errormsg))
                {
                    errormsg = "Unknown error";
                }
                return(new BindResult(errormsg));
            }
            else if (bindResult.ResultClass != ResultClass.done)
            {
                return(new BindResult(errormsg));
            }
            TupleValue     bkpt = null;
            ValueListValue list = null;

            if (bindResult.Contains("bkpt"))
            {
                ResultValue b = bindResult.Find("bkpt");
                if (b is TupleValue)
                {
                    bkpt = b as TupleValue;
                }
                else if (b is ValueListValue)
                {
                    // "<MULTIPLE>" sometimes includes a list of bound breakpoints
                    list = b as ValueListValue;
                    bkpt = list.Content[0] as TupleValue;
                }
            }
            else
            {
                // If the source file is not found, "done" is the result without a binding
                // (the error is sent via an "&" string and hence lost)
                return(new BindResult(errormsg));
            }
            Debug.Assert(bkpt.FindString("type") == "breakpoint");

            string number  = bkpt.FindString("number");
            string warning = bkpt.TryFindString("warning");
            string addr    = bkpt.TryFindString("addr");

            PendingBreakpoint bp;

            if (!string.IsNullOrEmpty(warning))
            {
                Debug.Assert(string.IsNullOrEmpty(addr));
                return(new BindResult(new PendingBreakpoint(pbreak, number, MIBreakpointState.Pending), warning));
            }
            bp = new PendingBreakpoint(pbreak, number, StringToBreakpointState(addr));
            if (list == null)   // single breakpoint
            {
                BoundBreakpoint bbp = bp.GetBoundBreakpoint(bkpt);

                if (bbp == null)
                {
                    return(new BindResult(bp, MICoreResources.Status_BreakpointPending));
                }
                return(new BindResult(bp, bbp));
            }
            else   // <MULTIPLE> with list of addresses
            {
                BindResult res = new BindResult(bp);
                for (int i = 1; i < list.Content.Length; ++i)
                {
                    BoundBreakpoint bbp = bp.GetBoundBreakpoint(list.Content[i] as TupleValue);
                    res.BoundBreakpoints.Add(bbp);
                }
                return(res);
            }
        }
Ejemplo n.º 44
0
        private static BindResult EvalBindResult(Results bindResult, AD7PendingBreakpoint pbreak)
        {
            string errormsg = "Unknown error";
            if (bindResult.ResultClass == ResultClass.error)
            {
                if (bindResult.Contains("msg"))
                {
                    errormsg = bindResult.FindString("msg");
                }
                if (String.IsNullOrWhiteSpace(errormsg))
                {
                    errormsg = "Unknown error";
                }
                return new BindResult(errormsg);
            }
            else if (bindResult.ResultClass != ResultClass.done)
            {
                return new BindResult(errormsg);
            }
            TupleValue bkpt = null;
            ValueListValue list = null;
            if (bindResult.Contains("bkpt"))
            {
                ResultValue b = bindResult.Find("bkpt");
                if (b is TupleValue)
                {
                    bkpt = b as TupleValue;
                }
                else if (b is ValueListValue)
                {
                    // "<MULTIPLE>" sometimes includes a list of bound breakpoints
                    list = b as ValueListValue;
                    bkpt = list.Content[0] as TupleValue;
                }
            }
            else
            {
                // If the source file is not found, "done" is the result without a binding
                // (the error is sent via an "&" string and hence lost)
                return new BindResult(errormsg);
            }
            Debug.Assert(bkpt.FindString("type") == "breakpoint");

            string number = bkpt.FindString("number");
            string addr = bkpt.TryFindString("addr");

            PendingBreakpoint bp = new PendingBreakpoint(pbreak, number, StringToBreakpointState(addr));
            if (list == null)   // single breakpoint
            {
                BoundBreakpoint bbp = bp.GetBoundBreakpoint(bkpt);

                if (bbp == null)
                {
                    return new BindResult(bp, MICoreResources.Status_BreakpointPending);
                }
                return new BindResult(bp, bbp);
            }
            else   // <MULTIPLE> with list of addresses
            {
                BindResult res = new BindResult(bp);
                for (int i = 1; i < list.Content.Length; ++i)
                {
                    BoundBreakpoint bbp = bp.GetBoundBreakpoint(list.Content[i] as TupleValue);
                    res.BoundBreakpoints.Add(bbp);
                }
                return res;
            }
        }
Ejemplo n.º 45
0
 public AD7BreakpointEvent(AD7PendingBreakpoint boundBreakpoints)
 {
     _boundBreakpoints = boundBreakpoints;
 }