Пример #1
0
        public void GoToDestination(GoToDestination dest)
        {
            if (_memoryType == DebugMemoryType.CpuMemory && dest.CpuAddress >= 0)
            {
                this.ShowAddress(dest.CpuAddress, DebugMemoryType.CpuMemory);
            }
            else if (dest.AddressInfo != null)
            {
                this.ShowAddress(dest.AddressInfo.Address, dest.AddressInfo.Type.ToMemoryType());
            }
            else if (dest.Label != null)
            {
                int relAddress = dest.Label.GetRelativeAddress();
                if (_memoryType == DebugMemoryType.CpuMemory && relAddress >= 0)
                {
                    this.ShowAddress(relAddress, DebugMemoryType.CpuMemory);
                }
                else
                {
                    this.ShowAddress((int)dest.Label.Address, dest.Label.AddressType.ToMemoryType());
                }
            }
            else if (dest.CpuAddress >= 0)
            {
                this.ShowAddress(dest.CpuAddress, DebugMemoryType.CpuMemory);
            }

            this.BringToFront();
        }
        private void txtTraceLog_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                string suffix = "";
                string word   = txtTraceLog.GetWordUnderLocation(e.Location);
                if (word.StartsWith("$"))
                {
                    _destination = new GoToDestination()
                    {
                        CpuAddress = Int32.Parse(word.Substring(1), System.Globalization.NumberStyles.AllowHexSpecifier)
                    };
                    suffix += " (" + word + ")";
                }
                else
                {
                    CodeLabel label = LabelManager.GetLabel(word);
                    if (label != null)
                    {
                        _destination = new GoToDestination()
                        {
                            Label = label
                        };
                        suffix += " (" + label.Label + ")";
                    }
                    else
                    {
                        //Use the current row's address
                        _destination = new GoToDestination()
                        {
                            CpuAddress = txtTraceLog.CurrentLine,
                        };
                        suffix += " ($" + txtTraceLog.CurrentLine.ToString("X4") + ")";
                    }
                }

                mnuViewInDisassembly.Enabled  = DebugWindowManager.GetDebugger() != null;
                mnuEditInMemoryViewer.Enabled = true;

                mnuEditInMemoryViewer.Text = "Edit in Memory Viewer" + suffix;
                mnuViewInDisassembly.Text  = "View in Disassembly" + suffix;
            }
        }
Пример #3
0
 private void SelectAndClose()
 {
     if (_resultCount > 0)
     {
         SearchResultInfo searchResult = _results[_selectedResult].Tag as SearchResultInfo;
         if (!searchResult.Disabled)
         {
             Destination = new GoToDestination()
             {
                 AbsoluteAddress = searchResult.AbsoluteAddress,
                 RelativeAddress = searchResult.RelativeAddress,
                 Label           = searchResult.CodeLabel,
                 File            = searchResult.File,
                 SourceLocation  = searchResult.SourceLocation
             };
             DialogResult = DialogResult.OK;
             Close();
         }
     }
 }
Пример #4
0
        public void GoToDestination(GoToDestination dest)
        {
            if (dest.RelativeAddress?.Type == _memoryType)
            {
                ShowAddress(dest.RelativeAddress.Value);
            }
            else if (dest.AbsoluteAddress?.Type == _memoryType)
            {
                ShowAddress(dest.AbsoluteAddress.Value);
            }
            else if (dest.RelativeAddress != null)
            {
                ShowAddress(dest.RelativeAddress.Value);
            }
            else if (dest.AbsoluteAddress != null)
            {
                ShowAddress(dest.AbsoluteAddress.Value);
            }
            else if (dest.Label != null)
            {
                AddressInfo relAddress = dest.Label.GetRelativeAddress(_memoryType.ToCpuType());
                if (relAddress.Type == _memoryType && relAddress.Address >= 0)
                {
                    ShowAddress(relAddress);
                }
                else
                {
                    AddressInfo absAddress = dest.Label.GetAbsoluteAddress();
                    ShowAddress(absAddress);
                }
            }
            else if (dest.RelativeAddress != null)
            {
                ShowAddress(dest.RelativeAddress.Value);
            }

            BringToFront();
        }
Пример #5
0
 private void SelectAndClose()
 {
     if (_resultCount > 0)
     {
         SearchResultInfo searchResult = _results[_selectedResult].Tag as SearchResultInfo;
         if (!searchResult.Disabled)
         {
             AddressTypeInfo addressInfo = new AddressTypeInfo()
             {
                 Address = searchResult.AbsoluteAddress, Type = searchResult.MemoryType
             };
             Destination = new GoToDestination()
             {
                 AddressInfo = addressInfo,
                 CpuAddress  = addressInfo.Address >= 0 ? InteropEmu.DebugGetRelativeAddress((UInt32)addressInfo.Address, addressInfo.Type) : -1,
                 Label       = searchResult.CodeLabel,
                 File        = searchResult.Filename,
                 Line        = searchResult.FileLineNumber
             };
             DialogResult = DialogResult.OK;
             Close();
         }
     }
 }
Пример #6
0
        public static void OpenMemoryViewer(GoToDestination dest)
        {
            frmMemoryViewer frm = OpenMemoryViewer();

            frm.GoToDestination(dest);
        }
Пример #7
0
 private void GoToDestination(GoToDestination dest)
 {
     ctrlDisassemblyView.GoToDestination(dest);
 }