Example #1
0
        public MainForm()
        {
            InitializeComponent();

            _client = new xdc.XDebug.Client("localhost", 9000);
            _client.EventCallback += new XDebugEventHandler(XDebugEventCallback);

            // Get the forms up.
            _statusFrm        = new xdc.Forms.StatusForm();
            _callstackFrm     = new xdc.Forms.CallstackForm();
            _localContextFrm  = new xdc.Forms.ContextForm(_client, "Locals");  // todo, name etc
            _globalContextFrm = new xdc.Forms.ContextForm(_client, "Globals"); // todo, name etc

            // Helper objects
            _breakpointMgr = new BreakpointManager();
            _fileMgr       = new FileManager();

            // Handlers
            _callstackFrm.StackSelected += new EventHandler <xdc.Forms.StackEventArgs>(_callstackFrm_StackSelected);

            _CurrentLocation      = new Location();
            _CurrentLocation.line = -1;

            this.KeyPreview = true;

            this.ToggleMenuItems(false);
        }
 private void mnuEditBreakpoint_Click(object sender, EventArgs e)
 {
     if (lstBreakpoints.SelectedItems.Count > 0)
     {
         BreakpointManager.EditBreakpoint(((Breakpoint)lstBreakpoints.SelectedItems[0].Tag));
     }
 }
 public settingsWindow(BreakpointManager bpm)
 {
     InitializeComponent();
     this.bpm          = bpm;
     editSettings      = this.bpm._settings;
     textSaveFile.Text = editSettings.SaveFile;
 }
        public static DebugWorkspace GetWorkspace()
        {
            string romName = EmuApi.GetRomInfo().GetRomName();

            if (_workspace == null || _romName != romName)
            {
                if (_workspace != null)
                {
                    SaveWorkspace();
                }
                _romName   = romName;
                _workspace = DebugWorkspace.GetWorkspace();

                //Load watch entries
                WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries = _workspace.WatchValues;
                WatchManager.GetWatchManager(CpuType.Spc).WatchEntries = _workspace.SpcWatchValues;
                WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries = _workspace.Sa1WatchValues;
                WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries = _workspace.GsuWatchValues;

                LabelManager.ResetLabels();
                LabelManager.SetLabels(_workspace.CpuLabels);
                LabelManager.SetLabels(_workspace.SpcLabels);
                LabelManager.SetDefaultLabels();

                ImportDbgFile();
                LabelManager.RefreshLabels();

                //Load breakpoints
                BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
            }
            return(_workspace);
        }
Example #5
0
 public static void ResetWorkspace()
 {
     if (_workspace != null)
     {
         _workspace.Breakpoints       = new List <Breakpoint>();
         _workspace.WatchValues       = new List <string>();
         _workspace.SpcWatchValues    = new List <string>();
         _workspace.Sa1WatchValues    = new List <string>();
         _workspace.GsuWatchValues    = new List <string>();
         _workspace.NecDspWatchValues = new List <string>();
         _workspace.GbWatchValues     = new List <string>();
         _workspace.CpuLabels         = new List <CodeLabel>();
         _workspace.SpcLabels         = new List <CodeLabel>();
         _workspace.NecDspLabels      = new List <CodeLabel>();
         _workspace.GbLabels          = new List <CodeLabel>();
         WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries     = _workspace.WatchValues;
         WatchManager.GetWatchManager(CpuType.Spc).WatchEntries     = _workspace.SpcWatchValues;
         WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries     = _workspace.Sa1WatchValues;
         WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries     = _workspace.GsuWatchValues;
         WatchManager.GetWatchManager(CpuType.NecDsp).WatchEntries  = _workspace.NecDspWatchValues;
         WatchManager.GetWatchManager(CpuType.Gameboy).WatchEntries = _workspace.GbWatchValues;
         BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
         LabelManager.SetDefaultLabels();
         LabelManager.RefreshLabels();
         _workspace.Save();
         Clear();
     }
 }
Example #6
0
        public void ToggleBreakpoint(bool toggleEnabledFlag)
        {
            int             relativeAddress = Viewer.CodeViewer.CurrentLine;
            AddressTypeInfo info            = Viewer.GetAddressInfo(Viewer.CodeViewer.SelectedLine);

            BreakpointManager.ToggleBreakpoint(relativeAddress, info, toggleEnabledFlag);
        }
 private void mnuRemoveBreakpoint_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in lstBreakpoints.SelectedItems)
     {
         BreakpointManager.RemoveBreakpoint((Breakpoint)item.Tag);
     }
 }
Example #8
0
        /// <summary>
        /// Constructs the Debugger for the specified Target.
        /// </summary>
        /// <param name="target">The target to be debugged.</param>
        public Debugger(ITarget target)
        {
            if (target == null) throw new ArgumentNullException();

            Target = target;
            Breakpoints = new BreakpointManager(this);
            DebugInformation = new DebugInformation();
        }
Example #9
0
        private void mnuRemoveBreakpoint_Click(object sender, EventArgs e)
        {
            Breakpoint bp = GetCurrentLineBreakpoint();

            if (bp != null)
            {
                BreakpointManager.RemoveBreakpoint(bp);
            }
        }
        private void mnuAddBreakpoint_Click(object sender, EventArgs e)
        {
            Breakpoint breakpoint = new Breakpoint();

            if (new frmBreakpoint(breakpoint).ShowDialog() == DialogResult.OK)
            {
                BreakpointManager.AddBreakpoint(breakpoint);
            }
        }
Example #11
0
        public void ToggleBreakpoint()
        {
            AddressTypeInfo info = GetAddressInfo(ctrlCodeViewer.SelectedLine);

            if (info.Address >= 0)
            {
                BreakpointManager.ToggleBreakpoint(-1, info, false);
            }
        }
Example #12
0
 public BreakpointReadActionServerTests()
 {
     _mockBreakpointServer = new Mock <IBreakpointServer>();
     _mockDebuggerClient   = new Mock <IDebuggerClient>();
     _cts = new CancellationTokenSource();
     _breakpointManager = new BreakpointManager();
     _server            = new BreakpointReadActionServer(_mockBreakpointServer.Object,
                                                         _cts, _mockDebuggerClient.Object, _breakpointManager);
 }
Example #13
0
        void DoDispose()
        {
            if (!is_forked)
            {
                if (architecture != null)
                {
                    architecture.Dispose();
                    architecture = null;
                }

                if (mono_language != null)
                {
                    mono_language.Dispose();
                    mono_language = null;
                }

                if (native_language != null)
                {
                    native_language.Dispose();
                    native_language = null;
                }

                if (os != null)
                {
                    os.Dispose();
                    os = null;
                }

                if (symtab_manager != null)
                {
                    symtab_manager.Dispose();
                    symtab_manager = null;
                }
            }

            if (breakpoint_manager != null)
            {
                breakpoint_manager.Dispose();
                breakpoint_manager = null;
            }

            if (thread_db != null)
            {
                thread_db.Dispose();
                thread_db = null;
            }

            if (thread_lock_mutex != null)
            {
                thread_lock_mutex.Dispose();
                thread_lock_mutex = null;
            }

            exception_handlers = null;

            manager.RemoveProcess(this);
        }
Example #14
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            m_pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            mBpRequestInfo = requestInfo[0];
            EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_THREAD, requestInfo));

            mEngine = engine;
            mBPMgr  = bpManager;
        }
Example #15
0
        private Breakpoint GetCurrentLineBreakpoint()
        {
            AddressTypeInfo addressInfo = GetAddressInfo(ctrlCodeViewer.SelectedLine);

            if (addressInfo.Address >= 0)
            {
                int relativeAddress = InteropEmu.DebugGetRelativeAddress((uint)addressInfo.Address, addressInfo.Type);
                return(BreakpointManager.GetMatchingBreakpoint(relativeAddress, addressInfo));
            }
            return(null);
        }
Example #16
0
        private void mnuAddBreakpoint_Click(object sender, EventArgs e)
        {
            Breakpoint breakpoint = new Breakpoint()
            {
                MemoryType = _cpuType == CpuType.Cpu ? SnesMemoryType.CpuMemory : SnesMemoryType.SpcMemory
            };

            if (new frmBreakpoint(breakpoint).ShowDialog() == DialogResult.OK)
            {
                BreakpointManager.AddBreakpoint(breakpoint);
            }
        }
Example #17
0
        private void mnuAddBreakpoint_Click(object sender, EventArgs e)
        {
            SnesMemoryType memType    = _cpuType == CpuType.NecDsp ? SnesMemoryType.DspProgramRom : _cpuType.ToMemoryType();
            Breakpoint     breakpoint = new Breakpoint()
            {
                MemoryType = memType, CpuType = _cpuType
            };

            if (new frmBreakpoint(breakpoint).ShowDialog() == DialogResult.OK)
            {
                BreakpointManager.AddBreakpoint(breakpoint);
            }
        }
        public BreakpointWriteActionServerTests()
        {
            _mockBreakpointServer = new Mock <IBreakpointServer>();
            _mockDebuggerClient   = new Mock <IDebuggerClient>();
            _breakpointManager    = new BreakpointManager();
            _cts    = new CancellationTokenSource();
            _server = new BreakpointWriteActionServer(_mockBreakpointServer.Object,
                                                      _cts, _mockDebuggerClient.Object, _breakpointManager);

            _mockBreakpointServer.Setup(s => s.WriteBreakpointAsync(
                                            It.IsAny <Breakpoint>(), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));
        }
Example #19
0
        public void EnableDisableBreakpoint(int lineIndex)
        {
            int address = this._provider.GetLineAddress(lineIndex);

            if (address >= 0)
            {
                BreakpointManager.EnableDisableBreakpoint(new AddressInfo()
                {
                    Address = address,
                    Type    = SnesMemoryType.SpcMemory
                });
            }
        }
Example #20
0
        private ushort DoFetchForCurrentInstruction()
        {
            ushort effectiveAddress = _currentInstruction.IsIndirect ? _currentIndirectAddress : GetEffectiveAddress(_currentInstruction.Data);

            // If there's a read breakpoint on this address we will halt here.
            if (BreakpointManager.TestBreakpoint(BreakpointType.Read, effectiveAddress))
            {
                _state             = ProcessorState.BreakpointHalt;
                _breakpointAddress = effectiveAddress;
            }

            return(_mem.Fetch(effectiveAddress));
        }
Example #21
0
        private void DoStoreForCurrentInstruction(ushort word)
        {
            ushort effectiveAddress = _currentInstruction.IsIndirect ? _currentIndirectAddress : GetEffectiveAddress(_currentInstruction.Data);

            // If there's a write breakpoint on this address we will halt here.
            if (BreakpointManager.TestBreakpoint(BreakpointType.Write, effectiveAddress))
            {
                _state             = ProcessorState.BreakpointHalt;
                _breakpointAddress = effectiveAddress;
            }

            _mem.Store(effectiveAddress, word);
        }
Example #22
0
        public InprocDebugger(Host host)
        {
            this.Host      = host;
            this.DebugHost = host.Debugger;
            this.Window    = new DebuggerWindow(this);
            this.Tools     = new List <DebuggerTool>();

            this.State       = DebuggerState.Idle;
            this.Breakpoints = new BreakpointManager(this);
            this.CodeCache   = new CodeCache(this);
            this.UserData    = new UserDataStore();

            this.SetupNavigation();

            // Initialize tools...
            // ...
            this.CallstackTool = new CallstackTool(this);
            this.Tools.Add(this.CallstackTool);
            this.CodeTool = new CodeTool(this);
            this.Tools.Add(this.CodeTool);
            this.LogTool = new LogTool(this);
            this.Tools.Add(this.LogTool);
            this.MemoryTool = new MemoryTool(this);
            this.Tools.Add(this.MemoryTool);
            this.StatisticsTool = new StatisticsTool(this);
            this.Tools.Add(this.StatisticsTool);
            this.ThreadsTool = new ThreadsTool(this);
            this.Tools.Add(this.ThreadsTool);
            // ...

            this.Window.Show();

            this.CodeTool.Show(this.Window.DockPanel);
            this.LogTool.Show(this.Window.DockPanel);
            this.ThreadsTool.Show(this.Window.DockPanel);

            WeifenLuo.WinFormsUI.Docking.DockPane dp;
            dp = this.Window.DockPanel.DockPaneFactory.CreateDockPane(this.CodeTool, WeifenLuo.WinFormsUI.Docking.DockState.Document, true);
            this.StatisticsTool.Show(dp, WeifenLuo.WinFormsUI.Docking.DockAlignment.Right, 0.45);
            dp = this.Window.DockPanel.DockPaneFactory.CreateDockPane(this.LogTool, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom, true);
            this.CallstackTool.Show(dp, WeifenLuo.WinFormsUI.Docking.DockAlignment.Right, 0.24);

            this.MemoryTool.Show(this.StatisticsTool.DockHandler.Pane, this.StatisticsTool);

            this.Host.Debugger.Activate(this, Environment.MachineName, Environment.UserName, "InprocDebugger 1.0");

            foreach (DebuggerTool tool in this.Tools)
            {
                tool.OnAttached();
            }
        }
Example #23
0
 public static void ResetWorkspace()
 {
     if (_workspace != null)
     {
         _workspace.Breakpoints    = new List <Breakpoint>();
         _workspace.WatchValues    = new List <string>();
         _workspace.SpcWatchValues = new List <string>();
         WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries = _workspace.WatchValues;
         WatchManager.GetWatchManager(CpuType.Spc).WatchEntries = _workspace.SpcWatchValues;
         BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
         _workspace.Save();
         Clear();
     }
 }
Example #24
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            m_pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            m_bpRequestInfo = requestInfo[0];

            m_engine = engine;
            m_bpManager = bpManager;
            m_boundBreakpoints = new System.Collections.Generic.List<AD7BoundBreakpoint>();

            m_enabled = true;
            m_deleted = false;
        }
Example #25
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            _bpRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(_bpRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));
            _bpRequestInfo = requestInfo[0];

            _engine           = engine;
            _bpManager        = bpManager;
            _boundBreakpoints = new System.Collections.Generic.List <AD7BoundBreakpoint>();

            _enabled = true;
            _deleted = false;
        }
Example #26
0
        public InprocDebugger( Host host )
        {
            this.Host = host;
            this.DebugHost = host.Debugger;
            this.Window = new DebuggerWindow( this );
            this.Tools = new List<DebuggerTool>();

            this.State = DebuggerState.Idle;
            this.Breakpoints = new BreakpointManager( this );
            this.CodeCache = new CodeCache( this );
            this.UserData = new UserDataStore();

            this.SetupNavigation();

            // Initialize tools...
            // ...
            this.CallstackTool = new CallstackTool( this );
            this.Tools.Add( this.CallstackTool );
            this.CodeTool = new CodeTool( this );
            this.Tools.Add( this.CodeTool );
            this.LogTool = new LogTool( this );
            this.Tools.Add( this.LogTool );
            this.MemoryTool = new MemoryTool( this );
            this.Tools.Add( this.MemoryTool );
            this.StatisticsTool = new StatisticsTool( this );
            this.Tools.Add( this.StatisticsTool );
            this.ThreadsTool = new ThreadsTool( this );
            this.Tools.Add( this.ThreadsTool );
            // ...

            this.Window.Show();

            this.CodeTool.Show( this.Window.DockPanel );
            this.LogTool.Show( this.Window.DockPanel );
            this.ThreadsTool.Show( this.Window.DockPanel );

            WeifenLuo.WinFormsUI.Docking.DockPane dp;
            dp = this.Window.DockPanel.DockPaneFactory.CreateDockPane( this.CodeTool, WeifenLuo.WinFormsUI.Docking.DockState.Document, true );
            this.StatisticsTool.Show( dp, WeifenLuo.WinFormsUI.Docking.DockAlignment.Right, 0.45 );
            dp = this.Window.DockPanel.DockPaneFactory.CreateDockPane( this.LogTool, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom, true );
            this.CallstackTool.Show( dp, WeifenLuo.WinFormsUI.Docking.DockAlignment.Right, 0.24 );

            this.MemoryTool.Show( this.StatisticsTool.DockHandler.Pane, this.StatisticsTool );

            this.Host.Debugger.Activate( this, Environment.MachineName, Environment.UserName, "InprocDebugger 1.0" );

            foreach( DebuggerTool tool in this.Tools )
                tool.OnAttached();
        }
Example #27
0
        private void AddBreakpoint(int address)
        {
            PpuAddressTypeInfo addressInfo = InteropEmu.DebugGetPpuAbsoluteAddressAndType((uint)address);

            BreakpointManager.EditBreakpoint(new Breakpoint()
            {
                MemoryType   = addressInfo.Type.ToMemoryType(),
                BreakOnExec  = false,
                BreakOnRead  = true,
                BreakOnWrite = true,
                Address      = (UInt32)addressInfo.Address,
                StartAddress = (UInt32)addressInfo.Address,
                EndAddress   = (UInt32)addressInfo.Address,
                AddressType  = BreakpointAddressType.SingleAddress
            });
        }
Example #28
0
        public void ToggleBreakpoint(bool toggleEnabledFlag)
        {
            AddressTypeInfo info = Viewer.GetAddressInfo(Viewer.CodeViewer.SelectedLine);

            if (info.Address < 0)
            {
                //Current line has no address, try using the next line instead.
                //(Used when trying to set a breakpoint on a row containing only a label)
                info = Viewer.GetAddressInfo(Viewer.CodeViewer.SelectedLine + 1);
            }

            if (info.Address >= 0)
            {
                BreakpointManager.ToggleBreakpoint(info, toggleEnabledFlag);
            }
        }
Example #29
0
        private void EnableDisableBreakpoint(int address)
        {
            if (address >= 0)
            {
                AddressInfo relAddress = new AddressInfo()
                {
                    Address = address,
                    Type    = _manager.RelativeMemoryType
                };

                if (!BreakpointManager.EnableDisableBreakpoint(relAddress, _manager.CpuType))
                {
                    AddressInfo absAddress = DebugApi.GetAbsoluteAddress(relAddress);
                    BreakpointManager.EnableDisableBreakpoint(absAddress, _manager.CpuType);
                }
            }
        }
Example #30
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            _pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_PASSCOUNT, requestInfo));
            _bpRequestInfo = requestInfo[0];

            _engine           = engine;
            _bpManager        = bpManager;
            _boundBreakpoints = new List <AD7BoundBreakpoint>();

            _enabled       = true;
            _deleted       = false;
            _pendingDelete = false;

            _bp      = null; // no underlying breakpoint created yet
            _BPError = null;
        }
Example #31
0
        internal Process(ThreadManager manager, ProcessStart start)
            : this(manager, start.Session)
        {
            this.start = start;

            is_attached = start.PID != 0;

            breakpoint_manager = new BreakpointManager();

            exception_handlers = new Dictionary <int, ExceptionCatchPoint> ();

            symtab_manager = new SymbolTableManager(session);

            os = Inferior.CreateOperatingSystemBackend(this);
            native_language = new NativeLanguage(this, os, target_info);

            session.OnProcessCreated(this);
        }
Example #32
0
 private void mnuAddBreakpoint_Click(object sender, EventArgs e)
 {
     if (lstFunctions.SelectedIndices.Count > 0)
     {
         int absoluteAddress = (int)GetSelectedItem().SubItems[2].Tag;
         BreakpointManager.AddBreakpoint(new Breakpoint()
         {
             MemoryType   = DebugMemoryType.PrgRom,
             BreakOnExec  = true,
             BreakOnRead  = false,
             BreakOnWrite = false,
             Address      = (UInt32)absoluteAddress,
             StartAddress = (UInt32)absoluteAddress,
             EndAddress   = (UInt32)absoluteAddress,
             AddressType  = BreakpointAddressType.SingleAddress
         });
     }
 }
Example #33
0
        private SystemExecutionState ShowBreakpoints()
        {
            bool set = false;

            foreach (BreakpointEntry e in BreakpointManager.EnumerateBreakpoints())
            {
                set = true;
                Console.WriteLine("Address {0}, break on {1}", Helpers.ToOctal(e.Address), e.Type);
            }

            if (!set)
            {
                Console.WriteLine("No breakpoints are currently defined.");
            }

            Console.WriteLine("\nBreakpoints are {0} globally.", BreakpointManager.BreakpointsEnabled ? "enabled" : "disabled");

            return(SystemExecutionState.Debugging);
        }
Example #34
0
 public void AcceptBreakpointManager(BreakpointManager breakpointManager)
 {
     Package.AcceptBreakpointManager(breakpointManager);
 }
Example #35
0
 public AD7Engine()
 {
     breakpointManager = new BreakpointManager(this);
 }