bugfixed parsing of files read from mspsim
This commit is contained in:
parent
0c94b567b9
commit
4222d0adcd
|
@ -36,7 +36,6 @@ import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Observable;
|
import java.util.Observable;
|
||||||
|
|
||||||
|
@ -582,9 +581,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
||||||
/* Match file */
|
/* Match file */
|
||||||
Hashtable<Integer, Integer> lineTable = debuggingInfo.get(file);
|
Hashtable<Integer, Integer> lineTable = debuggingInfo.get(file);
|
||||||
if (lineTable == null) {
|
if (lineTable == null) {
|
||||||
Enumeration<File> fileEnum = debuggingInfo.keys();
|
for (File f: debuggingInfo.keySet()) {
|
||||||
while (fileEnum.hasMoreElements()) {
|
|
||||||
File f = fileEnum.nextElement();
|
|
||||||
if (f != null && f.getName().equals(file.getName())) {
|
if (f != null && f.getName().equals(file.getName())) {
|
||||||
lineTable = debuggingInfo.get(f);
|
lineTable = debuggingInfo.get(f);
|
||||||
break;
|
break;
|
||||||
|
@ -598,9 +595,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
||||||
/* Match line number */
|
/* Match line number */
|
||||||
Integer address = lineTable.get(lineNr);
|
Integer address = lineTable.get(lineNr);
|
||||||
if (address != null) {
|
if (address != null) {
|
||||||
Enumeration<Integer> lineEnum = lineTable.keys();
|
for (Integer l: lineTable.keySet()) {
|
||||||
while (lineEnum.hasMoreElements()) {
|
|
||||||
Integer l = lineEnum.nextElement();
|
|
||||||
if (l != null && l.intValue() == lineNr) {
|
if (l != null && l.intValue() == lineNr) {
|
||||||
/* Found line address */
|
/* Found line address */
|
||||||
return lineTable.get(l);
|
return lineTable.get(l);
|
||||||
|
|
|
@ -317,7 +317,7 @@ public abstract class MspMoteType implements MoteType {
|
||||||
logger.warn("Old simulation config detected: SkySerial was replaced by MspSerial");
|
logger.warn("Old simulation config detected: SkySerial was replaced by MspSerial");
|
||||||
intfClass = MspSerial.class.getName();
|
intfClass = MspSerial.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<? extends MoteInterface> moteInterfaceClass =
|
Class<? extends MoteInterface> moteInterfaceClass =
|
||||||
simulation.getGUI().tryLoadClass(this, MoteInterface.class, intfClass);
|
simulation.getGUI().tryLoadClass(this, MoteInterface.class, intfClass);
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public abstract class MspMoteType implements MoteType {
|
||||||
private static ELF loadELF(String filepath) throws IOException {
|
private static ELF loadELF(String filepath) throws IOException {
|
||||||
return ELF.readELF(filepath);
|
return ELF.readELF(filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ELF elf; /* cached */
|
private ELF elf; /* cached */
|
||||||
public ELF getELF() throws IOException {
|
public ELF getELF() throws IOException {
|
||||||
if (elf == null) {
|
if (elf == null) {
|
||||||
|
@ -379,9 +379,9 @@ public abstract class MspMoteType implements MoteType {
|
||||||
}
|
}
|
||||||
return elf;
|
return elf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable<File, Hashtable<Integer, Integer>> debuggingInfo = null; /* cached */
|
private Hashtable<File, Hashtable<Integer, Integer>> debuggingInfo = null; /* cached */
|
||||||
public Hashtable<File, Hashtable<Integer, Integer>> getFirmwareDebugInfo()
|
public Hashtable<File, Hashtable<Integer, Integer>> getFirmwareDebugInfo()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (debuggingInfo == null) {
|
if (debuggingInfo == null) {
|
||||||
debuggingInfo = getFirmwareDebugInfo(getELF());
|
debuggingInfo = getFirmwareDebugInfo(getELF());
|
||||||
|
@ -407,33 +407,35 @@ public abstract class MspMoteType implements MoteType {
|
||||||
|
|
||||||
for (int address: addresses) {
|
for (int address: addresses) {
|
||||||
DebugInfo info = elf.getDebugInfo(address);
|
DebugInfo info = elf.getDebugInfo(address);
|
||||||
|
if (info == null) {
|
||||||
if (info != null && info.getPath() != null && info.getFile() != null && info.getLine() >= 0) {
|
continue;
|
||||||
|
|
||||||
/* 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());
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
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;
|
return fileToLineHash;
|
||||||
|
|
Loading…
Reference in a new issue