Examples of DebugInfo


Examples of se.sics.mspsim.util.DebugInfo

                    /* do not match prologue entries */
                    continue;
                  }
                  if (address >= startEntry &&
                      address <= endEntry) {
                    return new DebugInfo(lineEntry.line, null, data.sourceFiles[lineEntry.file-1], "* not available");
                  }
                }
            }
        }
        return null;
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

      ELF elf = ELF.readELF(args[0]);
      DwarfReader dwarfReader = new DwarfReader(elf);
      dwarfReader.read();
      if (args.length > 1) {
        int address = Integer.parseInt(args[1], 16);
        DebugInfo debugInfo = dwarfReader.getDebugInfo(address);
        if (debugInfo == null) {
          System.out.println(String.format("0x%08x", address) + ": "
              + "??" + ":" + "0");
        } else {
          System.out.println(String.format("0x%08x", address) + ": "
              + new File(debugInfo.getFile()).getName() + ":" + debugInfo.getLine());
        }
      } else {
        for (int address = 0; address <= 0xffff; address++) {
          DebugInfo debugInfo = dwarfReader.getDebugInfo(address);
          if (debugInfo == null) {
            System.out.println(String.format("0x%08x", address) + ": "
                + "??" + ":" + "0");
          } else {
            System.out.println(String.format("0x%08x", address) + ": "
                + new File(debugInfo.getFile()).getName() + ":" + debugInfo.getLine());
          }
        }
      }
    }
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

    dui.updateRegs();
    dui.repaint();
    if (elfData != null && sourceViewer != null
        && sourceViewer.isVisible()) {
      int pc = ControlUI.this.cpu.getPC();
      DebugInfo dbg = elfData.getDebugInfo(pc);
      if (dbg != null) {
        if (ControlUI.this.cpu.getDebug()) {
    System.out.println("looking up $" + Integer.toString(pc, 16) +
           " => " + dbg.getFile() + ':' +
           dbg.getLine());
        }
        sourceViewer.viewFile(dbg.getPath(), dbg.getFile());
        sourceViewer.viewLine(dbg.getLine());
      }
    }
  }
      };
    stepAction.putValue(Action.MNEMONIC_KEY,
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

      //       cpu.step();
//       dui.repaint();
    } else if ("Show Source".equals(cmd)) {
      int pc = cpu.getPC();
      if (elfData != null) {
  DebugInfo dbg = elfData.getDebugInfo(pc);
  if (dbg != null) {
    if (cpu.getDebug()) {
      System.out.println("looking up $" + Integer.toString(pc, 16) +
             " => " + dbg.getFile() + ':' + dbg.getLine());
    }
    if (sourceViewer != null) {
      sourceViewer.viewFile(dbg.getPath(), dbg.getFile());
      sourceViewer.viewLine(dbg.getLine());
    } else {
      System.out.println("File: " + dbg.getFile());
      System.out.println("LineNr: " + dbg.getLine());
    }
  }
      }
    } else if ("Stack Trace".equals(cmd)) {
      cpu.getProfiler().printStackTrace(System.out);
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

      });

      ch.registerCommand("line", new BasicCommand("print line number of address/symbol", "<address or symbol>") {
        public int executeCommand(final CommandContext context) {
          int adr = context.getArgumentAsAddress(0);
          DebugInfo di = getELF().getDebugInfo(adr);
          if (di == null) {
            /* quick hack to test next address too... - since something seems to be off by one sometimes... */
            di = getELF().getDebugInfo(adr + 1);
          }
          if (di != null) {
            di.getLine();
            context.out.println(di);
          } else {
            context.err.println("No line number found for: " + context.getArgument(0));
          }
          return 0;
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

    }
    return '$' + cpu.getAddressAsString(adr);
  }

  private static String getSymOrAddrELF(MSP430 cpu, ELF elf, int adr) {
    DebugInfo me = elf.getDebugInfo(adr);
    if (me != null) {
      return me.toString();
    }
    return '$' + cpu.getAddressAsString(adr);
  }
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

        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) {
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

  private void updateCurrentSourceCodeFile() {
    currentCodeFile = null;

    try {
      DebugInfo debugInfo = mspMote.getELF().getDebugInfo(mspMote.getCPU().reg[MSP430.PC]);

      if (debugInfo == null) {
        return;
      }

      /* Nasty Cygwin-Windows fix */
      String path = debugInfo.getPath();

      if (path == null) {
        return;
      }

      if (path.contains("/cygdrive/")) {
        int index = path.indexOf("/cygdrive/");
        char driveCharacter = path.charAt(index+10);

        path = path.replace("/cygdrive/" + driveCharacter + "/", driveCharacter + ":/");
      }

      currentCodeFile = new File(path, debugInfo.getFile());
      currentLineNumber = debugInfo.getLine();

    } catch (Exception e) {
      logger.fatal("Exception: " + e);
      currentCodeFile = null;
      currentLineNumber = -1;
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

    Hashtable<File, Hashtable<Integer, Integer>> fileToLineHash =
      new Hashtable<File, Hashtable<Integer, Integer>>();

    for (int address: addresses) {
      DebugInfo info = mspMote.getELF().getDebugInfo(address);

      if (info != null && info.getPath() != null && info.getFile() != null && info.getLine() >= 0) {

        /* Nasty Cygwin-Windows fix */
        String path = info.getPath();
        if (path.contains("/cygdrive/")) {
          int index = path.indexOf("/cygdrive/");
          char driveCharacter = path.charAt(index+10);

          path = path.replace("/cygdrive/" + driveCharacter + "/", driveCharacter + ":/");
        }

        File file = new File(path, info.getFile());

        Hashtable<Integer, Integer> lineToAddrHash = fileToLineHash.get(file);
        if (lineToAddrHash == null) {
          lineToAddrHash = new Hashtable<Integer, Integer>();
          fileToLineHash.put(file, lineToAddrHash);
        }

        lineToAddrHash.put(info.getLine(), address);
      }
    }

    return fileToLineHash;
  }
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

  }

  public String getPCString() {
    int pc = myCpu.getPC();
    ELF elf = myCpu.getRegistry().getComponent(ELF.class);
    DebugInfo di = elf.getDebugInfo(pc);

    /* Following code examples from MSPsim, DebugCommands.java */
    if (di == null) {
      di = elf.getDebugInfo(pc + 1);
    }
    if (di == null) {
      /* Return PC value */
      SimpleProfiler sp = (SimpleProfiler)myCpu.getProfiler();
      try {
        MapEntry mapEntry = sp.getCallMapEntry(0);
        if (mapEntry != null) {
          String file = mapEntry.getFile();
          if (file != null) {
            if (file.indexOf('/') >= 0) {
              file = file.substring(file.lastIndexOf('/')+1);
            }
          }
          String name = mapEntry.getName();
          return file + ":?:" + name;
        }
        return String.format("*%02x", pc);
      } catch (Exception e) {
        return null;
      }
    }

    int lineNo = di.getLine();
    String file = di.getFile();
    file = file==null?"?":file;
    if (file.contains("/")) {
      /* strip path */
      file = file.substring(file.lastIndexOf('/')+1, file.length());
    }

    String function = di.getFunction();
    function = function==null?"":function;
    if (function.contains(":")) {
      /* strip arguments */
      function = function.substring(0, function.lastIndexOf(':'));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.