fixed stupid regression

This commit is contained in:
George Hotz 2014-07-19 12:47:01 -07:00
parent e29ab914db
commit 2b6a65b725
3 changed files with 14 additions and 15 deletions

View File

@ -266,6 +266,7 @@ def start_bindserver(myss, parent_id, start_cl, loop = False):
os.execvp(program.qirabinary, [program.qirabinary, "-D", "/dev/null", "-d", "in_asm",
"-qirachild", "%d %d %d" % (parent_id, start_cl, run_id), "-singlestep",
"/tmp/qira_binary"]+sys.argv[2:])
#"-strace",
def get_next_run_id():

View File

@ -500,16 +500,7 @@ void resize_change_buffer(size_t size) {
void init_QIRA(CPUArchState *env, int id) {
QIRA_DEBUG("init QIRA called\n");
if (GLOBAL_QIRA_did_init == 0) {
GLOBAL_asm_file = fopen("/tmp/qira_asm", "a");
// these three arguments (parent_id, start_clnum, id) must be passed into QIRA
if (GLOBAL_parent_id != -1) {
run_QIRA_log(env, GLOBAL_parent_id, GLOBAL_start_clnum);
}
GLOBAL_QIRA_did_init = 1;
}
GLOBAL_QIRA_did_init = 1;
char fn[PATH_MAX];
GLOBAL_CPUArchState = env;
@ -763,14 +754,15 @@ void run_QIRA_log(CPUArchState *env, int this_id, int to_change) {
bool is_filtered_address(target_ulong pc);
bool is_filtered_address(target_ulong pc) {
// TODO(geohot): FIX THIS!, filter anything that isn't the user binary and not dynamic
return ((pc > 0x40000000 && pc < 0xf6800000) || pc >= 0x100000000);
}
void real_target_disas(FILE *out, CPUArchState *env, target_ulong code, target_ulong size, int flags);
void target_disas(FILE *out, CPUArchState *env, target_ulong code, target_ulong size, int flags);
void target_disas(FILE *out, CPUArchState *env, target_ulong code, target_ulong size, int flags) {
if (unlikely(GLOBAL_QIRA_did_init == 0)) {
init_QIRA(env, GLOBAL_id);
if (unlikely(GLOBAL_asm_file == NULL)) {
GLOBAL_asm_file = fopen("/tmp/qira_asm", "a");
}
if (is_filtered_address(code)) return;
@ -795,6 +787,10 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
TranslationBlock *tb = cpu->current_tb;
if (unlikely(GLOBAL_QIRA_did_init == 0)) {
// these three arguments (parent_id, start_clnum, id) must be passed into QIRA
if (GLOBAL_parent_id != -1) {
run_QIRA_log(env, GLOBAL_parent_id, GLOBAL_start_clnum);
}
init_QIRA(env, GLOBAL_id);
return 0;
}
@ -807,7 +803,7 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
GLOBAL_id = get_next_id();
// this fixes the PID
init_QIRA(env, GLOBAL_id); // wrong
init_QIRA(env, GLOBAL_id);
}
// set this every time, it's not in shmem
@ -820,7 +816,6 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
GLOBAL_last_was_syscall = 0;
}
// TODO(geohot): FIX THIS!, filter anything that isn't the user binary and not dynamic
if (is_filtered_address(tb->pc)) {
GLOBAL_logstate->is_filtered = 1;
} else {

5
scripts/dump_log.py Normal file → Executable file
View File

@ -1,5 +1,8 @@
#!/usr/bin/env python
from middleware import qira_log
logs = qira_log.read_log(qira_log.LOGFILE)
import sys
logs = qira_log.read_log(sys.argv[1])
for l in logs:
print "address: %8x data: %8x clnum: %4d flags: %s" % (l[0], l[1], l[2], qira_log.flag_to_type(l[3]))