? memory/MemoryWindow.java0921
Index: disassembler/DisassemblyWindow.java
===================================================================
RCS file: /cvs/frysk/frysk-gui/frysk/gui/disassembler/DisassemblyWindow.java,v
retrieving revision 1.32
diff -u -r1.32 DisassemblyWindow.java
--- disassembler/DisassemblyWindow.java 21 Sep 2007 07:00:43 -0000 1.32
+++ disassembler/DisassemblyWindow.java 29 Sep 2007 08:34:42 -0000
@@ -58,7 +58,6 @@
import org.gnu.gtk.DataColumnObject;
import org.gnu.gtk.DataColumnString;
import org.gnu.gtk.Entry;
-import org.gnu.gtk.Label;
import org.gnu.gtk.ListStore;
import org.gnu.gtk.SpinButton;
import org.gnu.gtk.TreeIter;
@@ -68,6 +67,8 @@
import org.gnu.gtk.Window;
import org.gnu.gtk.event.ButtonEvent;
import org.gnu.gtk.event.ButtonListener;
+import org.gnu.gtk.event.ComboBoxEvent;
+import org.gnu.gtk.event.ComboBoxListener;
import org.gnu.gtk.event.EntryEvent;
import org.gnu.gtk.event.EntryListener;
import org.gnu.gtk.event.LifeCycleEvent;
@@ -76,8 +77,12 @@
import org.gnu.gtk.event.SpinListener;
import frysk.gui.common.IconManager;
+import frysk.gui.dialogs.WarnDialog;
import frysk.gui.prefs.PreferenceManager;
+import frysk.gui.monitor.GuiObject;
+import frysk.gui.monitor.ObservableLinkedList;
import frysk.gui.monitor.Saveable;
+import frysk.gui.monitor.SimpleComboBox;
import frysk.proc.Proc;
import frysk.proc.Task;
import frysk.stepping.TaskStepEngine;
@@ -129,10 +134,6 @@
private SpinButton toSpin;
- private Label pcLabelDec;
-
- private Label pcLabelHex;
-
private Entry fromBox;
private Entry toBox;
@@ -143,7 +144,7 @@
private double lastKnownTo;
- private int numInstructions;
+ private int numInstructions = 50;
private long pcOffset = 0;
@@ -163,6 +164,14 @@
private MemoryMap[] mmaps;
+ private SimpleComboBox segmentCombo;
+
+ private ObservableLinkedList segmentList;
+
+ private int segmentIndex = 0;
+
+ private int row = numInstructions*3;
+
/**
* The DisassmblyWindow, given a Task, will disassemble the instructions
* and parameters for that task in memory and display them, as well as their
@@ -180,9 +189,10 @@
this.toSpin = (SpinButton) this.glade.getWidget("toSpin");
this.fromBox = (Entry) this.glade.getWidget("fromBox");
this.toBox = (Entry) this.glade.getWidget ("toBox");
- this.pcLabelDec = (Label) this.glade.getWidget("PCLabelDec");
- this.pcLabelHex = (Label) this.glade.getWidget("PCLabelHex");
+ this.segmentCombo = new SimpleComboBox(
+ (this.glade.getWidget("segmentCombo")).getHandle());
this.model = new ListStore(cols);
+ this.segmentList = new ObservableLinkedList();
this.lock = new LockObserver();
this.DW_active = true;
@@ -273,7 +283,23 @@
this.disassemblerView = (TreeView) this.glade.getWidget("disassemblerView");
this.mmaps = this.myTask.getProc().getMaps();
+
+ for (int i = 0; i < this.mmaps.length; i++)
+ {
+ GuiObject segment = new GuiObject(Long.toHexString(mmaps[i].addressLow)
+ + " - " + Long.toHexString(mmaps[i].addressHigh), "");
+ segmentList.add(i, segment);
+ if (mmaps[i].addressLow <= pc_inc && pc_inc < mmaps[i].addressHigh)
+ this.segmentIndex = i;
+ }
+
+ this.segmentCombo.watchLinkedList(segmentList);
+
+ this.segmentCombo.setSelectedObject((GuiObject) segmentList.get(segmentIndex));
+ this.segmentCombo.setActive(segmentIndex + 1);
+ this.segmentCombo.showAll();
+
this.diss = new Disassembler(myTask.getMemory());
this.fromSpin.setRange(0.0, highestAddress);
this.fromSpin.setValue((double) pc_inc);
@@ -281,9 +307,7 @@
this.lastKnownFrom = pc_inc;
this.toSpin.setRange(0.0, highestAddress);
//this.toSpin.setValue((double) end);
- this.pcLabelDec.setText("" + pc_inc);
- this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
-
+
setUpColumns();
disassemblerView.setAlternateRowColor(true);
@@ -326,6 +350,26 @@
((Button) this.glade.getWidget("formatButton")).hideAll();
+ segmentCombo.addListener(new ComboBoxListener()
+ {
+ public void comboBoxEvent (ComboBoxEvent arg0)
+ {
+ if(arg0.isOfType(ComboBoxEvent.Type.CHANGED))
+ {
+ if (segmentList.indexOf(segmentCombo.getSelectedObject()) == -1)
+ return;
+ int temp = segmentList.indexOf(segmentCombo.getSelectedObject());
+ long startAddress = mmaps[temp].addressLow;
+ long endAddress = mmaps[temp].addressHigh;
+ if (endAddress - startAddress > row)
+ handleSegment (startAddress, startAddress+20*8);
+ else
+ handleSegment (startAddress, endAddress);
+ segmentIndex = temp;
+ }
+ }
+ });
+
this.fromSpin.addListener(new SpinListener()
{
public void spinEvent (SpinEvent arg0)
@@ -343,7 +387,13 @@
if (addressAccessible((long)value))
handleFromSpin(value);
else
+ {
fromSpin.setValue(lastKnownFrom);
+ WarnDialog dialog = new WarnDialog(
+ " No function contains specified address");
+ dialog.showAll();
+ dialog.run();
+ }
}
}
}
@@ -366,7 +416,13 @@
if (addressAccessible((long)value))
handleToSpin(value);
else
- toSpin.setValue(lastKnownTo);
+ {
+ toSpin.setValue(lastKnownTo);
+ WarnDialog dialog = new WarnDialog(
+ " No function contains specified address");
+ dialog.showAll();
+ dialog.run();
+ }
}
}
}
@@ -390,7 +446,13 @@
{
double d = (double) Long.parseLong(str, 16);
if (!addressAccessible((long)d))
- fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ {
+ fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ WarnDialog dialog = new WarnDialog(
+ " No function contains specified address");
+ dialog.showAll();
+ dialog.run();
+ }
else
{
if (d > lastKnownTo)
@@ -401,8 +463,14 @@
fromSpin.setValue(lastKnownTo);
}
else
- fromSpin.setValue(d);
+ {
+ if ( (d < lastKnownFrom) && (lastKnownFrom - d > row*8))
+ handleSegment((long)d, (long)(d + row));
+ else
+ fromSpin.setValue(d);
+ }
}
+
}
catch (NumberFormatException nfe)
{
@@ -416,7 +484,11 @@
handleSymbol(str);
}
catch (RuntimeException e){
- fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ WarnDialog dialog = new WarnDialog(
+ " No Symbol \"" + str + "\" in current context");
+ dialog.showAll();
+ dialog.run();
}
}
}
@@ -440,7 +512,13 @@
{
double d = (double) Long.parseLong(str, 16);
if (!(addressAccessible((long)d)))
- toBox.setText("0x" + Long.toHexString((long) lastKnownTo));
+ {
+ toBox.setText("0x" + Long.toHexString((long) lastKnownTo));
+ WarnDialog dialog = new WarnDialog(
+ " No function contains specified address");
+ dialog.showAll();
+ dialog.run();
+ }
else
{
if (d < lastKnownFrom)
@@ -451,7 +529,12 @@
toSpin.setValue(lastKnownFrom);
}
else
- toSpin.setValue(d);
+ {
+ if ((d > lastKnownTo) && (d - lastKnownTo > row))
+ handleSegment((long)(d - row), (long)d);
+ else
+ toSpin.setValue(d);
+ }
}
}
catch (NumberFormatException nfe)
@@ -466,7 +549,11 @@
handleSymbol(str);
}
catch (RuntimeException e){
- toBox.setText("0x" + Long.toHexString((long) lastKnownTo));
+ toBox.setText("0x" + Long.toHexString((long) lastKnownTo));
+ WarnDialog dialog = new WarnDialog(
+ " No Symbol \"" + str + "\" in current context");
+ dialog.showAll();
+ dialog.run();
}
}
}
@@ -495,8 +582,6 @@
this.lastKnownFrom = pc_inc;
this.toSpin.setRange(0.0, highestAddress);
// this.toSpin.setValue((double) end);
- this.pcLabelDec.setText("" + pc_inc);
- this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
this.model.clear();
this.model.appendRow();
@@ -580,7 +665,7 @@
{
for (int i=0; i< this.mmaps.length; i++)
if (mmaps[i].addressLow <= address && address < mmaps[i].addressHigh)
- return true;
+ return true;
return false;
}
@@ -589,8 +674,6 @@
this.refreshLock = true;
long pc_inc = 0;
pc_inc = myTask.getIsa().pc(myTask);
- this.pcLabelDec.setText("" + pc_inc);
- this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
this.lastKnownFrom = pc_inc;
this.fromSpin.setValue((double) pc_inc);
@@ -788,6 +871,7 @@
private void desensitize ()
{
this.disassemblerView.setSensitive(false);
+ this.segmentCombo.setSensitive(false);
this.fromSpin.setSensitive(false);
this.toSpin.setSensitive(false);
this.fromBox.setSensitive(false);
@@ -797,6 +881,7 @@
private void resensitize ()
{
this.disassemblerView.setSensitive(true);
+ this.segmentCombo.setSensitive(true);
this.fromSpin.setSensitive(true);
this.toSpin.setSensitive(true);
this.fromBox.setSensitive(true);
@@ -942,38 +1027,48 @@
long startAddress = ((Long)addressList.getFirst()).longValue();
Symbol symbol = SymbolFactory.getSymbol(this.myTask, startAddress);
long endAddress = symbol.getAddress() + symbol.getSize();
-
- List instructionsList
- = diss.disassembleInstructionsStartEnd((long)startAddress, (long)endAddress);
- Iterator li = instructionsList.listIterator(0);
- int insnum = 1;
- Instruction ins = (Instruction)li.next();
- this.lastKnownFrom = (double)ins.address;
- while (li.hasNext()){
- ins = (Instruction)li.next();
- insnum++;
- }
- this.lastKnownTo = (double)ins.address;
-
- TreeIter iter = this.model.getFirstIter();
- while (insnum < numInstructions)
- {
- this.model.removeRow(iter);
- this.lastPath.previous();
- numInstructions--;
- }
- while(insnum > numInstructions)
- {
- this.model.appendRow();
- this.lastPath.next();
- numInstructions++;
- }
-
- refreshList();
- fromBox.setText("0x" + Long.toHexString((long)lastKnownFrom));
- fromSpin.setValue(lastKnownFrom);
+ handleSegment(startAddress, endAddress);
+ }
+
+ /**
+ * Display the whole segment
+ * @param startAddress
+ * @param endAddress
+ */
+ private synchronized void handleSegment(long startAddress, long endAddress)
+ {
+ List instructionsList
+ = diss.disassembleInstructionsStartEnd((long)startAddress, (long)endAddress);
+ Iterator li = instructionsList.listIterator(0);
+ int insnum = 1;
+ Instruction ins = (Instruction)li.next();
+ this.lastKnownFrom = (double)ins.address;
+ while (li.hasNext()){
+ ins = (Instruction)li.next();
+ insnum++;
+ }
+ this.lastKnownTo = (double)ins.address;
+
+ TreeIter iter = this.model.getFirstIter();
+ while (insnum < numInstructions)
+ {
+ this.model.removeRow(iter);
+ this.lastPath.previous();
+ numInstructions--;
+ }
+ while(insnum > numInstructions)
+ {
+ this.model.appendRow();
+ this.lastPath.next();
+ numInstructions++;
+ }
+
+ refreshList();
+ fromBox.setText("0x" + Long.toHexString((long)lastKnownFrom));
+ fromSpin.setValue(lastKnownFrom);
}
+
/****************************************************************************
* Save and Load
***************************************************************************/
Index: gladedir/disassemblywindow.glade
===================================================================
RCS file: /cvs/frysk/frysk-gui/frysk/gui/gladedir/disassemblywindow.glade,v
retrieving revision 1.3
diff -u -r1.3 disassemblywindow.glade
--- gladedir/disassemblywindow.glade 15 Jun 2007 12:28:11 -0000 1.3
+++ gladedir/disassemblywindow.glade 29 Sep 2007 08:34:42 -0000
@@ -179,7 +179,7 @@
True
- Current program counter -
+ Segment:
False
False
GTK_JUSTIFY_LEFT
@@ -202,109 +202,38 @@
-
+
True
- False
- 0
-
-
-
- True
- Hexadecimal:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 12
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
-
-
-
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
-
+
True
- Decimal:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 12
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
+ 0
+ 1
+ 0.10000000149
+ 0
+ 0
+ 0
+ 0
+ 0
-
-
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
+
+
+ 1
+ True
+ False
+ True
+
+
-
- 0
- False
- False
-
@@ -777,4 +706,101 @@
+
+ True
+ Warning!
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_NONE
+ False
+ True
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_NORMAL
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ 0.5
+ 0.5
+ 0.5
+ 0.5
+ 0
+ 0
+ 0
+ 0
+
+
+
+ True
+ No function contains specifed address.
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+
+
+ 0
+ True
+ False
+
+
+
+
+
+ True
+ 0.5
+ 0.5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 69
+ 38
+ True
+ True
+ True
+ Close
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
Index: gladedir/memorywindow.glade
===================================================================
RCS file: /cvs/frysk/frysk-gui/frysk/gui/gladedir/memorywindow.glade,v
retrieving revision 1.4
diff -u -r1.4 memorywindow.glade
--- gladedir/memorywindow.glade 26 Sep 2007 06:29:42 -0000 1.4
+++ gladedir/memorywindow.glade 29 Sep 2007 08:34:42 -0000
@@ -177,9 +177,9 @@
0
-
+
True
- Current program counter -
+ Segment:
False
False
GTK_JUSTIFY_LEFT
@@ -208,31 +208,6 @@
0
-
- True
- Hexadecimal:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 12
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
-
-
True
@@ -258,27 +233,43 @@
-
+
True
- Decimal:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 12
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
+ False
+ 0
+
+
+
+ True
+ 0
+ 1
+ 0.10000000149
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 1
+ True
+ False
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
0
- False
- False
+ True
+ True
Index: memory/MemoryWindow.java
===================================================================
RCS file: /cvs/frysk/frysk-gui/frysk/gui/memory/MemoryWindow.java,v
retrieving revision 1.48
diff -u -r1.48 MemoryWindow.java
--- memory/MemoryWindow.java 26 Sep 2007 06:29:42 -0000 1.48
+++ memory/MemoryWindow.java 29 Sep 2007 08:34:43 -0000
@@ -60,7 +60,6 @@
import org.gnu.gtk.DataColumnObject;
import org.gnu.gtk.DataColumnString;
import org.gnu.gtk.Entry;
-import org.gnu.gtk.Label;
import org.gnu.gtk.ListStore;
import org.gnu.gtk.SpinButton;
import org.gnu.gtk.TreeIter;
@@ -80,6 +79,7 @@
import org.gnu.gtk.event.SpinListener;
import frysk.gui.common.IconManager;
+import frysk.gui.dialogs.WarnDialog;
import frysk.gui.prefs.PreferenceManager;
import frysk.gui.monitor.GuiObject;
import frysk.gui.monitor.ObservableLinkedList;
@@ -159,9 +159,9 @@
private SpinButton toSpin;
- private Label pcLabelDec;
+ //private Label pcLabelDec;
- private Label pcLabelHex;
+ //private Label pcLabelHex;
private Entry fromBox;
@@ -169,6 +169,8 @@
private SimpleComboBox bitsCombo;
+ private SimpleComboBox segmentCombo;
+
private GuiObject eight;
private GuiObject sixteen;
@@ -178,6 +180,8 @@
private GuiObject sixtyfour;
private ObservableLinkedList bitsList;
+
+ private ObservableLinkedList segmentList;
private ListStore model;
@@ -200,6 +204,10 @@
private boolean closed = false;
private MemoryMap[] mmaps;
+
+ private int segmentIndex = 0;
+
+ private int row = 20;
/**
* The MemoryWindow displays the information stored at various locations in
@@ -221,12 +229,15 @@
this.toSpin = (SpinButton) this.glade.getWidget("toSpin");
this.fromBox = (Entry) this.glade.getWidget("fromBox");
this.toBox = (Entry) this.glade.getWidget("toBox");
- this.pcLabelDec = (Label) this.glade.getWidget("PCLabelDec");
- this.pcLabelHex = (Label) this.glade.getWidget("PCLabelHex");
+ //this.pcLabelDec = (Label) this.glade.getWidget("PCLabelDec");
+ //this.pcLabelHex = (Label) this.glade.getWidget("PCLabelHex");
this.bitsCombo = new SimpleComboBox(
(this.glade.getWidget("bitsCombo")).getHandle());
+ this.segmentCombo = new SimpleComboBox(
+ (this.glade.getWidget("segmentCombo")).getHandle());
this.model = new ListStore(cols);
this.bitsList = new ObservableLinkedList();
+ this.segmentList = new ObservableLinkedList();
this.setIcon(IconManager.windowIcon);
this.lock = new LockObserver();
@@ -314,7 +325,7 @@
this.diss = new Disassembler(myTask.getMemory());
pc_inc = myTask.getIsa().pc(myTask);
- long end = pc_inc + 20*8;
+ long end = pc_inc + row*8;
this.setTitle(this.getTitle() + " - " + this.myTask.getProc().getCommand()
+ " " + this.myTask.getName());
@@ -332,12 +343,29 @@
this.bitsCombo.setSelectedObject((GuiObject) bitsList.get(currentFormat));
this.bitsCombo.setActive(currentFormat + 1);
+
+ for (int i = 0; i < this.mmaps.length; i++)
+ {
+ GuiObject segment = new GuiObject(Long.toHexString(mmaps[i].addressLow)
+ + " - " + Long.toHexString(mmaps[i].addressHigh), "");
+ segmentList.add(i, segment);
+ if (mmaps[i].addressLow <= pc_inc && pc_inc < mmaps[i].addressHigh)
+ this.segmentIndex = i;
+ }
+
+ this.segmentCombo.watchLinkedList(segmentList);
+
+ this.segmentCombo.setSelectedObject((GuiObject) segmentList.get(segmentIndex));
+
+ this.segmentCombo.setActive(segmentIndex + 1);
+
this.memoryView = (TreeView) this.glade.getWidget("memoryView");
FontDescription fontDesc = new FontDescription("monospace 10");
memoryView.setFont(fontDesc);
this.bitsCombo.showAll();
+ this.segmentCombo.showAll();
this.diss = new Disassembler(myTask.getMemory());
this.fromSpin.setRange(0.0, highestAddress);
this.fromSpin.setValue((double) pc_inc);
@@ -345,8 +373,8 @@
this.toSpin.setValue((double) end);
this.fromBox.setText("0x" + Long.toHexString(pc_inc));
this.toBox.setText("0x" + Long.toHexString(end));
- this.pcLabelDec.setText("" + pc_inc);
- this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
+ //this.pcLabelDec.setText("" + pc_inc);
+ //this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
TreeViewColumn col = new TreeViewColumn();
col.setTitle("Location");
@@ -435,6 +463,27 @@
}
}
});
+
+ segmentCombo.addListener(new ComboBoxListener()
+ {
+ public void comboBoxEvent (ComboBoxEvent arg0)
+ {
+ if(arg0.isOfType(ComboBoxEvent.Type.CHANGED))
+ {
+ if (segmentList.indexOf(segmentCombo.getSelectedObject()) == -1)
+ return;
+ int temp = segmentList.indexOf(segmentCombo.getSelectedObject());
+ long startAddress = mmaps[temp].addressLow;
+ long endAddress = mmaps[temp].addressHigh;
+ if (endAddress - startAddress > row*8)
+ handleSegment (startAddress, startAddress+20*8);
+ else
+ handleSegment (startAddress, endAddress);
+ segmentIndex = temp;
+ recalculate();
+ }
+ }
+ });
((Button) this.glade.getWidget("closeButton")).addListener(new ButtonListener()
{
@@ -475,7 +524,14 @@
if (addressAccessible((long)value))
handleFromSpin(value);
else
+ {
fromSpin.setValue(lastKnownFrom);
+ WarnDialog dialog = new WarnDialog(
+ "Cannot access memory at address 0x" + Long.toHexString((long)value));
+ dialog.showAll();
+ dialog.run();
+ }
+
}
}
}
@@ -498,7 +554,13 @@
if (addressAccessible((long)value))
handleToSpin(value);
else
- toSpin.setValue(lastKnownTo);
+ {
+ toSpin.setValue(lastKnownTo);
+ WarnDialog dialog = new WarnDialog(
+ "Cannot access memory at address 0x" + Long.toHexString((long)value));
+ dialog.showAll();
+ dialog.run();
+ }
}
}
}
@@ -521,7 +583,13 @@
{
double d = (double) Long.parseLong(str, 16);
if (!addressAccessible((long)d))
- fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ {
+ fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ WarnDialog dialog = new WarnDialog(
+ "Cannot access memory at address 0x" + Long.toHexString((long)d));
+ dialog.showAll();
+ dialog.run();
+ }
else
{
if (d > lastKnownTo)
@@ -532,7 +600,12 @@
fromSpin.setValue(lastKnownTo);
}
else
- fromSpin.setValue(d);
+ {
+ if ( (d < lastKnownFrom) && (lastKnownFrom - d > row*8))
+ handleSegment((long)d, (long)(d + row*8));
+ else
+ fromSpin.setValue(d);
+ }
}
}
catch (NumberFormatException nfe)
@@ -547,7 +620,11 @@
handleSymbol(str);
}
catch (RuntimeException e){
- fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ fromBox.setText("0x" + Long.toHexString((long) lastKnownFrom));
+ WarnDialog dialog = new WarnDialog(
+ " No Symbol \"" + str + "\" in current context");
+ dialog.showAll();
+ dialog.run();
}
}
}
@@ -571,7 +648,13 @@
{
double d = (double) Long.parseLong(str, 16);
if (!(addressAccessible((long)d)))
+ {
toBox.setText("0x" + Long.toHexString((long) lastKnownTo));
+ WarnDialog dialog = new WarnDialog(
+ "Cannot access memory at address 0x" + Long.toHexString((long)d));
+ dialog.showAll();
+ dialog.run();
+ }
else
{
if (d < lastKnownFrom)
@@ -582,7 +665,12 @@
toSpin.setValue(lastKnownFrom);
}
else
- toSpin.setValue(d);
+ {
+ if ((d > lastKnownTo) && (d - lastKnownTo > row*8))
+ handleSegment((long)(d - row*8), (long)d);
+ else
+ toSpin.setValue(d);
+ }
}
}
catch (NumberFormatException nfe)
@@ -597,7 +685,11 @@
handleSymbol(str);
}
catch (RuntimeException e){
- toBox.setText("0x" + Long.toHexString((long) lastKnownTo));
+ toBox.setText("0x" + Long.toHexString((long) lastKnownTo));
+ WarnDialog dialog = new WarnDialog(
+ " No Symbol \"" + str + "\" in current context");
+ dialog.showAll();
+ dialog.run();
}
}
}
@@ -632,7 +724,7 @@
this.diss = new Disassembler(myTask.getMemory());
pc_inc = myTask.getIsa().pc(myTask);
- long end = pc_inc + 20;
+ long end = pc_inc + row*8;
this.setTitle(this.getTitle() + " - " + this.myTask.getProc().getCommand()
+ " " + this.myTask.getName());
this.model.clear();
@@ -640,8 +732,8 @@
this.fromSpin.setValue((double) pc_inc);
this.toSpin.setRange(0.0, highestAddress);
this.toSpin.setValue((double) end);
- this.pcLabelDec.setText("" + pc_inc);
- this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
+ //this.pcLabelDec.setText("" + pc_inc);
+ //this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
recalculate();
this.refreshLock = false;
@@ -677,8 +769,8 @@
this.refreshLock = true;
long pc_inc = 0;
pc_inc = myTask.getIsa().pc(myTask);
- this.pcLabelDec.setText("" + pc_inc);
- this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
+ //this.pcLabelDec.setText("" + pc_inc);
+ //this.pcLabelHex.setText("0x" + Long.toHexString(pc_inc));
long diff = (long) this.toSpin.getValue() - (long) this.fromSpin.getValue();
@@ -961,6 +1053,7 @@
{
this.memoryView.setSensitive(false);
this.bitsCombo.setSensitive(false);
+ this.segmentCombo.setSensitive(false);
this.fromSpin.setSensitive(false);
this.toSpin.setSensitive(false);
this.fromBox.setSensitive(false);
@@ -971,6 +1064,7 @@
{
this.memoryView.setSensitive(true);
this.bitsCombo.setSensitive(true);
+ this.segmentCombo.setSensitive(true);
this.fromSpin.setSensitive(true);
this.toSpin.setSensitive(true);
this.fromBox.setSensitive(true);
@@ -1124,36 +1218,46 @@
long startAddress = ((Long)addressList.getFirst()).longValue();
Symbol symbol = SymbolFactory.getSymbol(this.myTask, startAddress);
long endAddress = symbol.getAddress() + symbol.getSize();
- long size = (endAddress - startAddress)/8 + 1;
- long modelSize = ((long)lastKnownTo - (long)lastKnownFrom)/8 + 1;
- TreeIter iter = this.model.getFirstIter();
- while (size < modelSize)
- {
+ handleSegment(startAddress, endAddress);
+ }
+
+ /**
+ * Display the whole segment
+ * @param startAddress
+ * @param endAddress
+ */
+ private synchronized void handleSegment(long startAddress, long endAddress)
+ {
+ long size = (endAddress - startAddress)/8 + 1;
+ long modelSize = ((long)lastKnownTo - (long)lastKnownFrom)/8 + 1;
+ TreeIter iter = this.model.getFirstIter();
+ while (size < modelSize)
+ {
this.model.removeRow(iter);
this.lastPath.previous();
modelSize--;
- }
- while(size > modelSize)
- {
+ }
+ while(size > modelSize)
+ {
this.model.appendRow();
this.lastPath.next();
modelSize++;
- }
- this.lastKnownFrom = (double)startAddress;
- this.lastKnownTo = (double)(double)(startAddress+(long)(endAddress-startAddress)/8*8);
- iter = this.model.getFirstIter();
- this.lastPath = iter.getPath();
- for(int i = 0; i <= lastKnownTo-lastKnownFrom; i=i+8)
- {
+ }
+ this.lastKnownFrom = (double)startAddress;
+ this.lastKnownTo = (double)(double)(startAddress+(long)(endAddress-startAddress)/8*8);
+ iter = this.model.getFirstIter();
+ this.lastPath = iter.getPath();
+ for(int i = 0; i <= lastKnownTo-lastKnownFrom; i=i+8)
+ {
rowAppend((long)(i+startAddress), iter);
iter = iter.getNextIter();
- }
- refreshList();
- fromBox.setText("0x" + Long.toHexString((long)lastKnownFrom));
- fromSpin.setValue(lastKnownFrom);
- toBox.setText("0x" + Long.toHexString((long)lastKnownTo));
- toSpin.setValue(lastKnownTo);
- }
+ }
+ refreshList();
+ fromBox.setText("0x" + Long.toHexString((long)lastKnownFrom));
+ fromSpin.setValue(lastKnownFrom);
+ toBox.setText("0x" + Long.toHexString((long)lastKnownTo));
+ toSpin.setValue(lastKnownTo);
+ }
/****************************************************************************
* Save and Load