Examples of DebugInfo


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

Examples of se.sics.mspsim.util.DebugInfo

  private void updateCurrentSourceCodeFile() {
    currentCodeFile = null;

    try {
      int pc = mspMote.getCPU().getPC();
      DebugInfo debugInfo = debug.getDebugInfo(pc);
      if (pc <= 0) {
        return;
      }
      if (debugInfo == null) {
        logger.warn("No source info at " + String.format("0x%04x", pc));
        return;
      }
      File f = applySubstitutionRules(new File(debugInfo.getPath(), debugInfo.getFile()), rules);
      if (f == null || !f.exists()) {
        logger.warn("Unknown source at " + String.format("0x%04x", pc) + ": " + debugInfo.getPath() + " " + debugInfo.getFile());
        return;
      }

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

Examples of se.sics.mspsim.util.DebugInfo

  private static String getMoteString(Mote mote) {
    if (!(mote instanceof MspMote)) {
      return null;
    }
    try {
      DebugInfo debugInfo =
        ((MspMoteType)mote.getType()).getELF().getDebugInfo(((MspMote)mote).getCPU().reg[MSP430.PC]);
      if (debugInfo == null) {
        return null;
      }
      return debugInfo.getFile() + ":" + debugInfo.getLine();
    } catch (Exception e) {
      return "?";
    }
  }
View Full Code Here

Examples of se.sics.mspsim.util.DebugInfo

      // No debug information is available
      return fileToLineHash;
    }

    for (int address: addresses) {
      DebugInfo info = elf.getDebugInfo(address);
      if (info == null) {
        continue;
      }
      if (info.getPath() == null && info.getFile() == null) {
        continue;
      }
      if (info.getLine() < 0) {
        continue;
      }

      File file;
      if (info.getPath() != null) {
        file = new File(info.getPath(), info.getFile());
      } else {
        file = new File(info.getFile());
      }
      try {
        file = file.getCanonicalFile();
      } catch (IOException e) {
      } catch (java.security.AccessControlException e) {
      }

      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
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.