From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2672 invoked by alias); 30 Aug 2007 03:51:34 -0000 Received: (qmail 2655 invoked by uid 22791); 30 Aug 2007 03:51:33 -0000 X-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME X-Spam-Check-By: sourceware.org Received: from agminet01.oracle.com (HELO agminet01.oracle.com) (141.146.126.228) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 30 Aug 2007 03:51:27 +0000 Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.186.112]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l7U3pC4H010204; Wed, 29 Aug 2007 22:51:12 -0500 Received: from dhcp-beijing-cdc-10-182-121-20.cn.oracle.com (dhcp-beijing-cdc-10-182-121-20.cn.oracle.com [10.182.121.20]) by rgmgw3.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id l7U3p9gi019173; Wed, 29 Aug 2007 21:51:09 -0600 Subject: [patch] Fix bugs of memory window From: Zhao Shujing Reply-To: pearly.zhao@oracle.com To: Frysk Mailing List Cc: Kris Van Hees , Andrew Cagney Content-Type: multipart/mixed; boundary="=-5hQo6nqEfdDVe72u7j5q" Organization: Oracle Date: Thu, 30 Aug 2007 03:51:00 -0000 Message-Id: <1188446167.7327.22.camel@linux-pzhao.site> Mime-Version: 1.0 X-Mailer: Evolution 2.6.0 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAA== X-Whitelist: TRUE X-Whitelist: TRUE X-Virus-Checked: Checked by ClamAV on sourceware.org X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00370.txt.bz2 --=-5hQo6nqEfdDVe72u7j5q Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 380 Hi, This patch is to fix bug #4617 and other bugs of memory window. - Fixed bug converting to bin and hex when memory value is negative number. - Fixed bug to get octal number by convert from hex. - Setting the font to fixed-width font "monospace 10" - Adding leading zero for all of bin, oct and hex. - Adding prefix zero to octal number. Any suggestions are welcomed Pearly --=-5hQo6nqEfdDVe72u7j5q Content-Description: Content-Disposition: inline; filename=memwin0830.patch Content-Type: text/x-patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 3322 Index: MemoryWindow.java =================================================================== RCS file: /cvs/frysk/frysk-gui/frysk/gui/memory/MemoryWindow.java,v retrieving revision 1.44 diff -u -r1.44 MemoryWindow.java --- MemoryWindow.java 28 Aug 2007 06:05:19 -0000 1.44 +++ MemoryWindow.java 30 Aug 2007 03:35:59 -0000 @@ -53,6 +53,7 @@ import org.gnu.gtk.Button; import org.gnu.gtk.CellRenderer; import org.gnu.gtk.CellRendererText; +import org.gnu.pango.FontDescription; import org.gnu.gtk.DataColumn; import org.gnu.gtk.DataColumnDouble; import org.gnu.gtk.DataColumnObject; @@ -325,6 +326,8 @@ this.bitsCombo.setActive(currentFormat + 1); this.memoryView = (TreeView) this.glade.getWidget("memoryView"); + FontDescription fontDesc = new FontDescription("monospace 10"); + memoryView.setFont(fontDesc); this.bitsCombo.showAll(); this.diss = new Disassembler(myTask.getMemory()); @@ -652,10 +655,16 @@ { for (int i = 0; i < b.length; i++) { - bin = bin + Integer.toBinaryString(b[i] & 0xff); - oct = oct + Integer.toOctalString(b[i] & 0xff); + String str = Integer.toBinaryString(b[i] & 0xff); + while (str.length() < 8) + str = "0"+str; + bin = bin + str; hex = hex + Integer.toHexString(b[i] & 0xff); + if ((b[i] & 0xff)==0) + hex = hex + "0"; } + BigInteger bihex = new BigInteger(hex, 16); + oct = bihex.toString(8); } else { @@ -668,10 +677,24 @@ int diff = bin.length() % BYTE_BITS; if (diff != 0) bin = padBytes(bin, false, diff); + int length = (int)Math.pow(2, currentFormat + 3); + + while (bin.length() < length) + { + bin = "0" + bin; + } + while (oct.length() < (length/3 + 1)) + { + oct = "0" + oct; + } + while (hex.length() < length/4 ) + { + hex = "0" + hex; + } /* Little endian first */ this.model.setValue(iter, (DataColumnString) cols[1], bin); - this.model.setValue(iter, (DataColumnString) cols[3], oct); + this.model.setValue(iter, (DataColumnString) cols[3], "0"+oct); this.model.setValue(iter, (DataColumnString) cols[5], dec); this.model.setValue(iter, (DataColumnString) cols[7], "0x" + hex); @@ -687,9 +710,21 @@ dec = bi.toString(10); else dec = bii.toString(10); - + + while (bin2.length() < length) + { + bin2 = "0" + bin2; + } + while (oct.length() < (length/3 + 1)) + { + oct = "0" + oct; + } + while (hex.length() < length/4 ) + { + hex = "0" + hex; + } this.model.setValue(iter, (DataColumnString) cols[2], bin2); - this.model.setValue(iter, (DataColumnString) cols[4], oct); + this.model.setValue(iter, (DataColumnString) cols[4], "0"+oct); this.model.setValue(iter, (DataColumnString) cols[6], dec); this.model.setValue(iter, (DataColumnString) cols[8], "0x" + hex); --=-5hQo6nqEfdDVe72u7j5q--