Example #1
0
        private void FormAbortHandler_Load(object sender, System.EventArgs e)
        {
            if (m_mh == null)
            {
                m_settings.ShowDialog();

                m_mh = new MemoryHandler(m_settings.m_ah);
            }

            memoryControl.Link(m_mh, m_symbols_AddressToString, m_symbols_StringToAddress);


            MemorySnapshot mem = m_settings.m_snapshot;

            m_mh.PopulateFromSnapshot(mem);

            for (int i = 0; i <= 12; i++)
            {
                listBoxRegisters.Items.Add(String.Format("R{0,-2}  = 0x{1,8:X8}", i, mem.m_registers[i]));
            }

            listBoxRegisters.Items.Add(String.Format("SP   = 0x{0,8:X8}", mem.m_registers[13]));
            listBoxRegisters.Items.Add(String.Format("LR   = 0x{0,8:X8}", mem.m_registers[14]));
            listBoxRegisters.Items.Add(String.Format("PC   = 0x{0,8:X8}", mem.m_registers[15]));
            listBoxRegisters.Items.Add(String.Format("CPSR = 0x{0,8:X8}", mem.m_cpsr));
            listBoxRegisters.Items.Add(String.Format("BWA  = 0x{0,8:X8}", mem.m_BWA));
            listBoxRegisters.Items.Add(String.Format("BWC  = 0x{0,8:X8}", mem.m_BWC));

            memoryControl.ShowMemory(mem.m_registers[15]);
        }
        public void PopulateFromSnapshot(MemorySnapshot mem)
        {
            m_chunks.Clear();

            if (mem.m_block_RAM != null)
            {
                m_chunks.Add(new Chunk(mem.m_block_RAM));
            }
            if (mem.m_block_FLASH != null)
            {
                m_chunks.Add(new Chunk(mem.m_block_FLASH));
            }
        }
Example #3
0
        private void button_DebugOffline_Click(object sender, System.EventArgs e)
        {
            try
            {
                using(System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog())
                {
                    dlg.Filter = "Snapshot files (*.spodump)|*.spodump|SREC format (*.hex)|*.hex";
                    dlg.Title  = "Load snapshot from a file";

                    if(dlg.ShowDialog() == DialogResult.OK)
                    {
                        if(dlg.FilterIndex == 1)
                        {
                            using(FileStream s = new FileStream( dlg.FileName, FileMode.Open, FileAccess.Read ))
                            {
                                System.Runtime.Serialization.Formatters.Binary.BinaryFormatter fmt = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                                m_snapshot = (MemorySnapshot)fmt.Deserialize( s );

                                if(m_snapshot.m_block_FLASH == null)
                                {
                                    DialogResult res = MessageBox.Show( "No FLASH image in the dump.\nDo you want to connect to a device?", "Snapshot", MessageBoxButtons.YesNoCancel );

                                    if(res == DialogResult.Cancel)
                                    {
                                        m_snapshot = new MemorySnapshot();
                                        return;
                                    }

                                    if(res == DialogResult.Yes)
                                    {
                                        if(Connect() == false)
                                        {
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            ArrayList blocks     = new ArrayList();
                            uint      entrypoint = Microsoft.SPOT.Debugger.SRecordFile.Parse( dlg.FileName, blocks, null );

                            MemorySnapshot.MemoryBlock blk = new MemorySnapshot.MemoryBlock();

                            m_snapshot = new MemorySnapshot();
                            m_snapshot.m_block_FLASH = blk;

                            foreach(_DBG.SRecordFile.Block bl in blocks)
                            {
                                blk.m_address = bl.address;
                                blk.m_data    = bl.data.ToArray();
                            }

                            m_snapshot.m_registers[15] = blk.m_address;
                        }

                        this.Close();
                    }
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show( ex.Message );
            }
        }
Example #4
0
        public void PopulateFromSnapshot( MemorySnapshot mem )
        {
            m_chunks.Clear();

            if(mem.m_block_RAM   != null) m_chunks.Add( new Chunk( mem.m_block_RAM   ) );
            if(mem.m_block_FLASH != null) m_chunks.Add( new Chunk( mem.m_block_FLASH ) );
        }
Example #5
0
            internal Chunk( MemorySnapshot.MemoryBlock mb )
            {
                int len = mb.m_data.Length;

                m_address = mb.m_address;
                m_data    = new short[len];

                for(int i=0; i<len; i++)
                {
                    m_data[i] = mb.m_data[i];
                }
            }
Example #6
0
        private void button_DebugOffline_Click(object sender, System.EventArgs e)
        {
            try
            {
                using (System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog())
                {
                    dlg.Filter = "Snapshot files (*.spodump)|*.spodump|SREC format (*.hex)|*.hex";
                    dlg.Title  = "Load snapshot from a file";

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        if (dlg.FilterIndex == 1)
                        {
                            using (FileStream s = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read))
                            {
                                System.Runtime.Serialization.Formatters.Binary.BinaryFormatter fmt = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                                m_snapshot = (MemorySnapshot)fmt.Deserialize(s);

                                if (m_snapshot.m_block_FLASH == null)
                                {
                                    DialogResult res = MessageBox.Show("No FLASH image in the dump.\nDo you want to connect to a device?", "Snapshot", MessageBoxButtons.YesNoCancel);

                                    if (res == DialogResult.Cancel)
                                    {
                                        m_snapshot = new MemorySnapshot();
                                        return;
                                    }

                                    if (res == DialogResult.Yes)
                                    {
                                        if (Connect() == false)
                                        {
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            ArrayList blocks     = new ArrayList();
                            uint      entrypoint = Microsoft.SPOT.Debugger.SRecordFile.Parse(dlg.FileName, blocks, null);

                            MemorySnapshot.MemoryBlock blk = new MemorySnapshot.MemoryBlock();

                            m_snapshot = new MemorySnapshot();
                            m_snapshot.m_block_FLASH = blk;

                            foreach (_DBG.SRecordFile.Block bl in blocks)
                            {
                                blk.m_address = bl.address;
                                blk.m_data    = bl.data.ToArray();
                            }

                            m_snapshot.m_registers[15] = blk.m_address;
                        }

                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }