Exemple #1
0
        public void AddVirtualBreakpoints(Types.ASM.FileInfo ASMFileInfo)
        {
            if (ASMFileInfo == null)
            {
                return;
            }
            foreach (var virtualBP in ASMFileInfo.VirtualBreakpoints.Values)
            {
                virtualBP.IsVirtual = true;
                int globalLineIndex = -1;
                if (!ASMFileInfo.FindGlobalLineIndex(virtualBP.LineIndex, virtualBP.DocumentFilename, out globalLineIndex))
                {
                    Core.AddToOutput("Cannot assign breakpoint for line " + virtualBP.LineIndex + ", no address found" + System.Environment.NewLine);
                    continue;
                }
                int address = ASMFileInfo.FindLineAddress(globalLineIndex);
                if (address != -1)
                {
                    var existingBP = BreakpointAtAddress(address);

                    if (existingBP == null)
                    {
                        C64Studio.Types.Breakpoint bp = new C64Studio.Types.Breakpoint();

                        bp.LineIndex        = virtualBP.LineIndex;
                        bp.Address          = address;
                        bp.TriggerOnExec    = true;
                        bp.IsVirtual        = true;
                        bp.DocumentFilename = virtualBP.DocumentFilename;
                        bp.Virtual.Add(virtualBP);
                        virtualBP.Address = address;
                        // we just need any key (as null is not allowed)
                        if (!BreakPoints.ContainsKey("C64Studio.DebugBreakpoints"))
                        {
                            BreakPoints.Add("C64Studio.DebugBreakpoints", new List <C64Studio.Types.Breakpoint>());
                        }
                        BreakPoints["C64Studio.DebugBreakpoints"].Add(bp);
                        //AddBreakpoint( bp );
                        Debug.Log("Add virtual bp for $" + address.ToString("X4"));
                    }
                    else
                    {
                        // merge with existing
                        existingBP.TriggerOnExec = true;
                        existingBP.Virtual.Add(virtualBP);
                    }
                }
                else
                {
                    Core.AddToOutput("Cannot assign breakpoint for line " + virtualBP.LineIndex + ", no address found" + System.Environment.NewLine);
                }
            }
        }
Exemple #2
0
        public void ReseatBreakpoints(Types.ASM.FileInfo ASMFileInfo)
        {
            foreach (var key in BreakPoints.Keys)
            {
                foreach (Types.Breakpoint breakPoint in BreakPoints[key])
                {
                    breakPoint.RemoteIndex = -1;
                    breakPoint.IsVirtual   = false;
                    breakPoint.Virtual.Clear();
                    breakPoint.Virtual.Add(breakPoint);

                    if (key != "C64Studio.DebugBreakpoints")
                    {
                        breakPoint.Address = -1;
                        int globalLineIndex = 0;
                        if (ASMFileInfo.FindGlobalLineIndex(breakPoint.LineIndex, breakPoint.DocumentFilename, out globalLineIndex))
                        {
                            int address = ASMFileInfo.FindLineAddress(globalLineIndex);
                            if (breakPoint.Address != address)
                            {
                                breakPoint.Address = address;

                                Core.MainForm.Document_DocumentEvent(new BaseDocument.DocEvent(BaseDocument.DocEvent.Type.BREAKPOINT_UPDATED, breakPoint));
                            }
                            if (address != -1)
                            {
                                //Debug.Log( "Found breakpoint at address " + address );
                            }
                        }
                        else if (breakPoint.AddressSource != null)
                        {
                            var address = ASMFileInfo.AddressFromToken(breakPoint.AddressSource);
                            if (address != -1)
                            {
                                breakPoint.Address = address;

                                Core.MainForm.Document_DocumentEvent(new BaseDocument.DocEvent(BaseDocument.DocEvent.Type.BREAKPOINT_UPDATED, breakPoint));
                            }
                        }
                    }
                }
            }
        }