Пример #1
0
        /// <summary>
        /// Creates a new object code file object.
        /// </summary>
        /// <param name="StartAddress">The load address of the object file.</param>
        /// <param name="Filename">The name of the object file.</param>
        /// <param name="Architecture">The targeted architecture of the object file.</param>
        /// <param name="Sections">The sections of the object file.</param>
        /// <param name="SymbolTable">The symbol table of the object file.</param>
        /// <param name="Code">The source code of the object file.</param>
        public ObjectCodeFile(long StartAddress, String Filename, String Architecture,
            Section[] Sections, SymbolTable SymbolTable, CodeUnit[] Code)
        {
            this.loadAddress  = StartAddress;
            this.Filepath     = Filename;
            this.Architecture = Architecture;
            this.Sections     = Sections;
            this.SymbolTable  = SymbolTable;
            this.Code         = Code;

            this.RequestedLoadAddress = StartAddress;

            // Sum loaded sections' sizes
            if (this.Sections != null)
            this.Size = this.Sections.Sum(
                sec => sec.Flags.HasFlag(SectionFlags.Load) ? (long)sec.Size : 0);

            // Get unique source file paths
            var tmpFiles = new HashSet<string>();

            foreach (CodeUnit unit in this.Code) {
                tmpFiles.Add(unit.SourceFilepath.Trim());
            }
            this.SourceFiles = tmpFiles.ToArray();
        }
Пример #2
0
        public static int OpenCodeView(CodeUnit unit, bool focus = true)
        {
            int handle = -1;

            // Get the panel if it is already open
            MainPanel panel = GetCodeView(unit) as MainPanel;
            if (panel != null) { handle = codeViews[panel]; }

            App.MainWindow.InvokeMethod((Action)delegate
            {
                // Create a new panel if not already open
                if (handle == -1)
                {
                    // Create panel
                    var newPanel = new MainPanel()
                    {
                        Title   = unit.Name,
                        Content = new UnitCodeView(unit),
                        IsOpen  = true
                    };
                    // De-register view on close
                    newPanel.Closed += (sender) => codeViews.Remove((MainPanel)sender);
                    // Add panel
                    handle = App.MainWindow.AddMainPanel(newPanel, new PanelLocation());
                    codeViews.Add(newPanel, handle);
                }
                if (focus) App.MainWindow.FocusMainPanel(handle);
            });

            return handle;
        }
Пример #3
0
 /// <summary>
 /// Creates a new object code file object.
 /// </summary>
 /// <param name="StartAddress">The starting address of the object file.</param>
 /// <param name="Filename">The name of the object file.</param>
 /// <param name="Architecture">The targeted architecture of the object file.</param>
 /// <param name="Sections">The sections of the object file.</param>
 /// <param name="SymbolTable">The symbol table of the object file.</param>
 /// <param name="Code">The source code of the object file.</param>
 public ObjectCodeFile(uint StartAddress, String Filename, String Architecture,
     Section[] Sections, SymbolTable SymbolTable, CodeUnit[] Code)
 {
     this.StartAddress = StartAddress;
     this.Filename     = Filename;
     this.Architecture = Architecture;
     this.Sections     = Sections;
     this.SymbolTable  = SymbolTable;
     this.Code         = Code;
 }
Пример #4
0
        public static IMainPanel GetCodeView(CodeUnit unit)
        {
            foreach (MainPanel panel in codeViews.Keys)
            {
                UnitCodeView view = panel.Content as UnitCodeView;

                if (view != null && view.CodeUnit == unit)
                {
                    return panel;
                }
            }
            return null;
        }
Пример #5
0
        public SymbolContextItem(CodeUnit unit, SymbolEntry symbol)
        {
            this.InitializeComponent();

            this.unit            = unit;
            this.symbol          = symbol;
            this.symbolText.Text = symbol.Name;

            // Check if breakpoint already set - if so, give option to clear
            this.breakpoint = Application.Debugger.Breakpoints.GetBreakpoint(symbol.Value);

            if (this.breakpoint != null && !this.breakpoint.IsActive)
            {
                this.breakpoint = null;
            }
            this.UpdateBPText();
        }
Пример #6
0
 public UnitCodeView(CodeUnit codeUnit)
     : this()
 {
     this.CodeUnit = codeUnit;
 }
Пример #7
0
 public void OpenAssemblyView(CodeUnit unit)
 {
     CodeViewer.OpenCodeView(unit);
 }