Exemplo n.º 1
0
        public void DisplayCurrentCode()
        {
            RefreshSourceMaps();

            //
            // Select active files in the source file list
            //
            SourceFiles.ClearSelected();

            foreach (SourceMap s in _sourceMaps)
            {
                foreach (string fileName in s.GetSourceFiles())
                {
                    for (int i = 0; i < SourceFiles.Items.Count; i++)
                    {
                        if (fileName == (string)SourceFiles.Items[i])
                        {
                            SourceFiles.SetSelected(i, true);
                        }
                    }
                }
            }

            //
            // Find the source line that matches the current TPC, if any.
            //
            int tpc = _system.CP.TPC[(int)_system.CP.CurrentTask];

            foreach (SourceMap s in _sourceMaps)
            {
                SourceEntry entry = s.GetExactSourceForAddress((ushort)tpc);

                if (entry != null)
                {
                    // WE GOT ONE!!!
                    SourceDisplay.AttachMap(s);
                    SourceDisplay.SelectSourceEntry(entry, false, false /* cp */);

                    // Select the source file in the source list
                    for (int i = 0; i < SourceFiles.Items.Count; i++)
                    {
                        if (entry.SourcePath == (string)SourceFiles.Items[i])
                        {
                            SourceFiles.SetSelected(i, true);
                        }
                    }

                    break;
                }
            }

            //
            // Highlight the line in the disassembly as well.
            //
            Disassembly.SelectAddress(tpc);
        }
Exemplo n.º 2
0
        public IOPDebugger(DSystem system)
        {
            InitializeComponent();

            _system = system;

            _sourceMap = new SourceMap("8085 ROM", "IOP\\Source\\SourceMap.txt", "IOP\\Source");

            SourceDisplay.SetSourceRoot(Path.Combine("IOP", "Source"));
            SourceDisplay.AttachMap(_sourceMap);

            PopulateSourceList();

            DisplayCurrentCode();
        }
Exemplo n.º 3
0
        public CPDebugger(DSystem system)
        {
            InitializeComponent();

            _system = system;

            SourceDisplay.SetSourceRoot(Path.Combine("CP", "Source"));

            _loadMap = new MicrocodeLoadMap();
            _loadMap.Load(Path.Combine("CP", "Source", "load_map.txt"));

            _sourceMaps = new List <SourceMap>();

            Disassembly.AttachCP(system.CP);

            PopulateSourceList();
        }
Exemplo n.º 4
0
        private void OnDisassemblySelectionChanged(object sender, EventArgs e)
        {
            //
            // Sync the source display with the selected disassembly address, if possible.
            //
            int address = Disassembly.SelectedAddress;

            //
            // TODO: we should search through all source maps, not just the current one.
            //
            if (SourceDisplay.SourceMap != null && address != -1 && SourceDisplay.SelectedAddress != address)
            {
                SourceEntry entry = SourceDisplay.SourceMap.GetSourceForAddress((ushort)address);

                if (entry != null && !string.IsNullOrWhiteSpace(entry.SourcePath))
                {
                    SourceDisplay.SelectSourceEntry(entry, false, false /* cp */);
                }
            }
        }
Exemplo n.º 5
0
        private void OnSourceDisplayMouseClick(object sender, MouseEventArgs e)
        {
            //
            // On right click when unmapped file is displayed, we will bring up the map dialog.
            //
            if (e.Button == MouseButtons.Right)
            {
                if (SourceDisplay.ReadOnly)
                {
                    LoadMapDialog mapDialog = new LoadMapDialog(SourceDisplay.CurrentSourceFile, _loadMap, _sourceMaps, _system.CP.MicrocodeRam);
                    DialogResult  res       = mapDialog.ShowDialog(this);

                    if (res == DialogResult.OK)
                    {
                        RefreshSourceMaps();
                        SourceDisplay.ReadOnly = false;
                        SourceDisplay.AttachMap(mapDialog.SelectedMap);
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void OnSourceFilesDoubleClicked(object sender, EventArgs e)
        {
            string selectedFile = (string)SourceFiles.SelectedItem;

            //
            // If none of the source maps contain this file, we will display the source in read-only mode
            // (no annotations allowed).
            //
            RefreshSourceMaps();

            bool mapped = false;

            foreach (SourceMap m in _sourceMaps)
            {
                if (m.GetSourceFiles().Contains(selectedFile))
                {
                    SourceDisplay.AttachMap(m);
                    mapped = true;
                    break;
                }
            }

            SourceDisplay.SelectSourceEntry(new SourceEntry((string)SourceFiles.SelectedItem, new string[] { }, 0, 1), !mapped, false /* cp */);
        }
Exemplo n.º 7
0
        public void DisplayCurrentCode()
        {
            SourceEntry entry = _sourceMap.GetSourceForAddress(_system.IOP.CPU.PC);

            if (entry != null && !string.IsNullOrWhiteSpace(entry.SourcePath))
            {
                SourceDisplay.SelectSourceEntry(entry, false, true /* iop */);


                // Find the source entry in the file list and select it.
                for (int i = 0; i < SourceFiles.Items.Count; i++)
                {
                    if ((string)SourceFiles.Items[i] == entry.SourcePath)
                    {
                        SourceFiles.SelectedIndex = i;
                        break;
                    }
                }
            }
            else
            {
                // Should show disassembly instead
            }
        }
Exemplo n.º 8
0
 private void SourceFiles_DoubleClick(object sender, EventArgs e)
 {
     SourceDisplay.SelectSourceEntry(new SourceEntry((string)SourceFiles.SelectedItem, new string[] { }, 0, 1), false, true /* iop */);
 }