Commit 4dd42beb authored by George Hotz's avatar George Hotz

add unicorn crash test

parent e0160775
#!/bin/bash #!/bin/bash
git clone https://github.com/geohot/unicorn.git -b dev unicorn2 git clone https://github.com/geohot/unicorn.git -b dev unicorn2
#git clone https://github.com/unicorn-engine/unicorn.git -b dev unicorn2
cd unicorn2 cd unicorn2
#cmake . -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Debug #cmake . -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Debug
cmake . -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Release cmake . -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Release
......
package main
import (
"encoding/binary"
"fmt"
"io/ioutil"
"testing"
)
func TestUnicornCrash(t *testing.T) {
fn := "../mipigo/test/test.bin"
ram := make(map[uint32](uint32))
root := "/tmp/cannon/0_13284469"
mu := GetHookedUnicorn(root, ram, nil)
// program
dat, _ := ioutil.ReadFile(fn)
mu.MemWrite(0, dat)
// inputs
inputs, _ := ioutil.ReadFile(fmt.Sprintf("%s/input", root))
mu.MemWrite(0x30000000, inputs[0:0xc0])
// load into ram
for i := 0; i < len(dat); i += 4 {
value := binary.BigEndian.Uint32(dat[i : i+4])
if value != 0 {
ram[uint32(i)] = value
}
}
mu.Start(0, 0x5ead0004)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment