projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2003/09/20 05:03:47
[org.ibex.core.git]
/
src
/
org
/
xwt
/
mips
/
Interpreter.java
diff --git
a/src/org/xwt/mips/Interpreter.java
b/src/org/xwt/mips/Interpreter.java
index
81aa042
..
a957297
100644
(file)
--- a/
src/org/xwt/mips/Interpreter.java
+++ b/
src/org/xwt/mips/Interpreter.java
@@
-26,7
+26,7
@@
public class Interpreter extends VM {
private int nextPC;
// The filename if the binary we're running
private int nextPC;
// The filename if the binary we're running
- private String image;
+ private Object image;
// Register Operations
private final void setFC(boolean b) { fcsr = (fcsr&~0x800000) | (b ? 0x800000 : 0x000000); }
// Register Operations
private final void setFC(boolean b) { fcsr = (fcsr&~0x800000) | (b ? 0x800000 : 0x000000); }
@@
-614,8
+614,10
@@
public class Interpreter extends VM {
}
// Image loading function
}
// Image loading function
- void loadImage(String file) throws IOException {
- ELF elf = new ELF(file);
+ void loadImage(Object file) throws IOException {
+ ELF elf = null;
+ if (file instanceof String) elf = new ELF(new RandomAccessFile((String)file,"r"));
+ else if (file instanceof byte[]) elf = new ELF((byte[])file);
if(elf.header.type != ELF.ELFHeader.ET_EXEC)
throw new IOException("Binary is not an executable");
if(elf.header.machine != ELF.ELFHeader.EM_MIPS)
if(elf.header.type != ELF.ELFHeader.ET_EXEC)
throw new IOException("Binary is not an executable");
if(elf.header.machine != ELF.ELFHeader.EM_MIPS)
@@
-662,6
+664,7
@@
public class Interpreter extends VM {
}
public Interpreter() { }
public Interpreter(String image) throws IOException { loadImage(image); }
}
public Interpreter() { }
public Interpreter(String image) throws IOException { loadImage(image); }
+ public Interpreter(byte[] image) throws IOException { loadImage(image); }
// Debug functions
// NOTE: This probably requires a jdk > 1.1, however, it is only used for debugging
// Debug functions
// NOTE: This probably requires a jdk > 1.1, however, it is only used for debugging
@@
-670,7
+673,7
@@
public class Interpreter extends VM {
String line;
if(image==null) return null;
try {
String line;
if(image==null) return null;
try {
- Process p = Runtime.getRuntime().exec(new String[]{addr2line,"-e",image,toHex(pc)});
+ Process p = Runtime.getRuntime().exec(new String[]{addr2line,"-e",image.toString(),toHex(pc)});
line = new BufferedReader(new InputStreamReader(p.getInputStream())).readLine();
if(line == null) return null;
while(line.startsWith("../")) line = line.substring(3);
line = new BufferedReader(new InputStreamReader(p.getInputStream())).readLine();
if(line == null) return null;
while(line.startsWith("../")) line = line.substring(3);