This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix bugs of memory window


Hi,

Can anyone help me to review the attached patch? Thanks. I have tested
at x86_64/FC7.

The patch is mainly to fix the following bugs of memory window:
- fromSpin.setValue would invoke the fromSpin entryEvent again, so the
handleFromSpin is called twice. It happens at toSpin too.
- Prepend row by order from low to high when decrease fromBox.
- removeRow would make iter to set to the next valid row,
iter.getNextIter is not needed after removeRow.

The above-mentioned are happened at disassembly window too. But only
fixing these bugs can not make the window display correctly yet. So
there is no patch for disassembly window this time.

BTW: I'm touching GUI test and the disassembly window and memory window
refactoring. Any suggestions are welcomed.

2007-08-10  Zhao Shujing <pearly.zhao@oracle.com>

    *memory/MemoryWindow.java (fromBox.entryEvent): Use
fromSpin.setValue to invoke fromSpin entryEvent.
    (toBox.entryEvent): Ditto.
    (handleToSpin): Ditto.
    (handleFromSpin): Prepend row by the order from high to low.

Thanks
Pearly
Index: frysk-gui/frysk/gui/memory/MemoryWindow.java
===================================================================
RCS file: /cvs/frysk/frysk-gui/frysk/gui/memory/MemoryWindow.java,v
retrieving revision 1.42
diff -u -r1.42 MemoryWindow.java
--- frysk-gui/frysk/gui/memory/MemoryWindow.java	27 Jul 2007 21:07:22 -0000	1.42
+++ frysk-gui/frysk/gui/memory/MemoryWindow.java	10 Aug 2007 08:07:48 -0000
@@ -484,8 +484,15 @@
             try
             {
               double d = (double) Long.parseLong(str, 16);
-              //fromSpin.setValue(d);
-              handleFromSpin(d);
+              if (d > lastKnownTo)
+              {
+        	  if (lastKnownTo == lastKnownFrom)
+        	      handleFromSpin(lastKnownTo);
+        	  else
+        	      fromSpin.setValue(lastKnownTo);
+              }
+              else
+        	  fromSpin.setValue(d);
             }
             catch (NumberFormatException nfe)
             {
@@ -508,8 +515,15 @@
               try
               {
                 double d = (double) Long.parseLong(str, 16);
-                //toSpin.setValue(d);
-                handleToSpin(d);
+                if (d < lastKnownFrom)
+                {
+                    if (lastKnownFrom == lastKnownTo)
+                	handleToSpin(lastKnownFrom);
+                    else
+                	toSpin.setValue(lastKnownFrom);
+                }
+                else
+                    toSpin.setValue(d);
               }
               catch (NumberFormatException nfe)
               {
@@ -877,12 +891,11 @@
         for (long i = (long) lastKnownFrom; i < (long) val; i++)
           {
             model.removeRow(iter);
-            iter = iter.getNextIter();
           }
       }
     else
       {
-        for (long i = (long) val; i < lastKnownFrom; i++)
+        for (long i = (long) lastKnownFrom - 1; i >= (long) val; i--)
           {
             TreeIter newRow = model.prependRow();
             rowAppend(i, newRow);
@@ -903,7 +916,7 @@
   public void handleToSpin (double val)
   {
     
-    if (this.model.getFirstIter() == null || val == this.lastKnownTo)
+    if (this.model.getFirstIter() == null)
       return;
 
     if (val < this.lastKnownFrom)
@@ -918,8 +931,6 @@
       {
         for (long i = (long) lastKnownTo + 1; i < val + 1; i++)
           rowAppend(i, null);
-        
-        this.lastKnownTo = val;
       }
     else
       {
@@ -931,7 +942,7 @@
       }
 
     this.toBox.setText(Long.toHexString((long) val));
-    this.toSpin.setValue(val);
+    this.lastKnownTo = val;
     refreshList();
   }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]