removed external tool addr2line dependency
This commit is contained in:
parent
79bd0e27ec
commit
6cf7e5eed5
1 changed files with 12 additions and 30 deletions
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: MspCodeWatcher.java,v 1.2 2008/02/11 11:50:44 fros4943 Exp $
|
* $Id: MspCodeWatcher.java,v 1.3 2008/03/19 15:17:22 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote.plugins;
|
package se.sics.cooja.mspmote.plugins;
|
||||||
|
@ -51,7 +51,7 @@ import se.sics.cooja.mspmote.MspMoteType;
|
||||||
import se.sics.mspsim.core.CPUMonitor;
|
import se.sics.mspsim.core.CPUMonitor;
|
||||||
import se.sics.mspsim.core.MSP430;
|
import se.sics.mspsim.core.MSP430;
|
||||||
import se.sics.mspsim.ui.DebugUI;
|
import se.sics.mspsim.ui.DebugUI;
|
||||||
import se.sics.mspsim.util.Utils;
|
import se.sics.mspsim.util.DebugInfo;
|
||||||
|
|
||||||
@ClassDescription("Msp Code Watcher")
|
@ClassDescription("Msp Code Watcher")
|
||||||
@PluginType(PluginType.MOTE_PLUGIN)
|
@PluginType(PluginType.MOTE_PLUGIN)
|
||||||
|
@ -603,40 +603,22 @@ public class MspCodeWatcher extends VisPlugin {
|
||||||
codeFile = null;
|
codeFile = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String[] cmd = new String[]{
|
DebugInfo debugInfo = mspMote.myELFModule.getDebugInfo(mspMote.getCPU().reg[MSP430.PC]);
|
||||||
"addr2line",
|
|
||||||
"-e",
|
|
||||||
moteType.getELFFile().getPath(),
|
|
||||||
Utils.hex16(mspMote.getCPU().reg[MSP430.PC])
|
|
||||||
};
|
|
||||||
|
|
||||||
Process p = Runtime.getRuntime().exec(cmd);
|
/* Nasty Cygwin-Windows fix */
|
||||||
|
String path = debugInfo.getPath();
|
||||||
|
if (path.contains("/cygdrive/")) {
|
||||||
|
int index = path.indexOf("/cygdrive/");
|
||||||
|
char driveCharacter = path.charAt(index+10);
|
||||||
|
|
||||||
BufferedReader input =
|
path = path.replace("/cygdrive/" + driveCharacter + "/", driveCharacter + ":/");
|
||||||
new BufferedReader(
|
|
||||||
new InputStreamReader(
|
|
||||||
p.getInputStream()));
|
|
||||||
|
|
||||||
String output = input.readLine();
|
|
||||||
input.close();
|
|
||||||
|
|
||||||
if (output == null || output.startsWith("?")) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] fileInfo = output.split(":");
|
codeFile = new File(path, debugInfo.getFile());
|
||||||
if (fileInfo.length != 2) {
|
lineNumber = debugInfo.getLine();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Ugly Cygwin-Windows support
|
|
||||||
fileInfo[0] = fileInfo[0].replace("/cygdrive/c/", "c:/");
|
|
||||||
|
|
||||||
codeFile = new File(fileInfo[0]);
|
|
||||||
lineNumber = Integer.parseInt(fileInfo[1]);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.fatal("Error while calling addr2line: " + e);
|
logger.fatal(e);
|
||||||
codeFile = null;
|
codeFile = null;
|
||||||
lineNumber = -1;
|
lineNumber = -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue