private void panel1_Paint(object sender, PaintEventArgs e) { if (mJM == null || !mJM.ValidLoadedProgram || mStackWords == null) { return; } Graphics g = e.Graphics; using (Brush myBrush = new SolidBrush(panel1.ForeColor)) { for (int ii = 0; ii < mStackWords.Length; ii++) { //uint word = mStackWords[ii]; int ypos = ii * panel1.Font.Height; Rectangle bounds = new Rectangle(0, ypos, panel1.ClientRectangle.Width, panel1.Font.Height); if ((mLowAddress + ii) == mStackPointer) { using (SolidBrush b = new SolidBrush(_highlightColor)) g.FillRectangle(b, bounds); } else { using (SolidBrush b = new SolidBrush(panel1.BackColor)) g.FillRectangle(b, bounds); } uint address = (uint)((mLowAddress + ii) << 2); string myString = address.ToString("X8") + ":"; if (mJM.InRange(address, ARMPluginInterfaces.MemorySize.Word)) { uint opcode = mJM.GetMemoryNoSideEffect(address, ARMPluginInterfaces.MemorySize.Word); myString += opcode.ToString("X8"); } else { myString += new string('?', 8); } g.DrawString(myString, panel1.Font, myBrush, bounds); }//for ii } }
/// <summary> /// Property to evaluate itself and return a string representation. /// </summary> public override string ToString() { //evaluate based on its type switch (_wt) { //item is a byte case WatchView.WatchType.Byte: { //get byte from memory uint data = _JM.GetMemoryNoSideEffect(this.Address, ARMPluginInterfaces.MemorySize.Byte); //and convert to signed/unsigned, then to string if (_signed) { return(((sbyte)data).ToString()); } else { return(_displayHex ? "0x" + ((byte)data).ToString("x2") : ((byte)data).ToString()); } } //item is a halfword(2 bytes) case WatchView.WatchType.HalfWord: { uint data = _JM.GetMemoryNoSideEffect(this.Address, ARMPluginInterfaces.MemorySize.HalfWord); //and convert to signed/unsigned, then to string if (_signed) { return(((short)data).ToString()); } else { return(_displayHex ? "0x" + ((ushort)data).ToString("x4") : ((ushort)data).ToString()); } } //item is a word(4 bytes) case WatchView.WatchType.Word: { uint data = _JM.GetMemoryNoSideEffect(this.Address, ARMPluginInterfaces.MemorySize.Word); //and convert to signed/unsigned, then to string if (_signed) { return(((int)data).ToString()); } else { return(_displayHex ? "0x" + data.ToString("x8") : data.ToString()); } } //item is a character case WatchView.WatchType.Character: { uint data = _JM.GetMemoryNoSideEffect(this.Address, ARMPluginInterfaces.MemorySize.Byte); //if the character is normal ascii, return it, otherwise indicate a dot(.) char cdata = '.'; if (data >= 32 && data <= 127) { cdata = (char)data; } return("'" + cdata + "'"); } //item is a string case WatchView.WatchType.String: { //load string for simulator memory, no side effects string str = Utils.loadStringFromMemory(_JM.GetMemoryNoSideEffect, this.Address, 64); return("\"" + str + "\""); } default: return(""); } //switch } //ToString
private uint GetMemory(uint address, ARMPluginInterfaces.MemorySize ms) { return(_JM.GetMemoryNoSideEffect(address, ms)); }