From 8b136c0b35b4b382243cbe6b1a67fb2c48a9296a Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 27 Oct 2009 08:52:49 +0000 Subject: [PATCH] removed obsolete until method --- .../cooja/mspmote/plugins/MspCodeWatcher.java | 59 +------------------ 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java index d8b5ee186..06f5c3432 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MspCodeWatcher.java,v 1.20 2009/09/23 08:22:36 fros4943 Exp $ + * $Id: MspCodeWatcher.java,v 1.21 2009/10/27 08:52:49 fros4943 Exp $ */ package se.sics.cooja.mspmote.plugins; @@ -176,9 +176,6 @@ public class MspCodeWatcher extends VisPlugin { JButton button = new JButton(stepAction); stepAction.putValue(Action.NAME, "Step instruction"); controlPanel.add(button); - button = new JButton(untilAction); - untilAction.putValue(Action.NAME, "Until function return"); - /*controlPanel.add(button);*/ /* Main components: assembler and C code + breakpoints (center) */ @@ -210,11 +207,9 @@ public class MspCodeWatcher extends VisPlugin { public void update(Observable obs, Object obj) { if (!simulation.isRunning()) { stepAction.setEnabled(true); - untilAction.setEnabled(true); updateInfo(); } else { stepAction.setEnabled(false); - untilAction.setEnabled(false); } } }); @@ -605,7 +600,7 @@ public class MspCodeWatcher extends VisPlugin { private AbstractAction stepAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { try { - mspMote.getCPU().step(mspMote.getCPU().cycles+1); + mspMote.getCPU().stepInstructions(1); } catch (EmulationException ex) { logger.fatal("Error: ", ex); } @@ -613,54 +608,4 @@ public class MspCodeWatcher extends VisPlugin { } }; - private AbstractAction untilAction = new AbstractAction() { - public void actionPerformed(ActionEvent e) { - /* XXX TODO Implement me */ - final int max = 10000; - int count=0; - int pc, instruction; - MSP430 cpu = mspMote.getCPU(); - int depth = 0; - - /* Extract function name */ - DebugInfo debugInfo = mspMote.getELF().getDebugInfo(mspMote.getCPU().reg[MSP430.PC]); - if (debugInfo == null || debugInfo.getFunction() == null) { - logger.fatal("Unknown function"); - return; - } - String functionName = debugInfo.getFunction().split(":")[0]; - logger.info("Function: '" + functionName + "'"); - - pc = cpu.readRegister(MSP430Core.PC); - instruction = cpu.memory[pc] + (cpu.memory[pc + 1] << 8); - if (instruction == MSP430.RETURN) { - logger.fatal("Already at return instruction"); - return; - } - - try { - while (count++ < max) { - cpu.step(mspMote.getCPU().cycles+1); - pc = cpu.readRegister(MSP430Core.PC); - instruction = cpu.memory[pc] + (cpu.memory[pc + 1] << 8); - if ((instruction & 0xff80) == MSP430.CALL) { - depth++; - } else if (instruction == MSP430.RETURN) { - depth--; - if (depth < 0) { - updateInfo(); - return; - } - - } - } - } catch (EmulationException e1) { - logger.fatal("Error: ", e1); - } - - logger.fatal("Function '" + functionName + "' did not return within " + max + " instructions"); - updateInfo(); - } - }; - }