|
|
@ -127,15 +127,6 @@ pc_to_sourcepoint(struct mi_process proc, u64 pc, int *comp_unit) |
|
|
|
return(0); |
|
|
|
return(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
|
|
print_word_at_address(int child, u64 address) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
long word = ptrace(PTRACE_PEEKDATA, child, address, NULL); |
|
|
|
|
|
|
|
u8 nb[4]; |
|
|
|
|
|
|
|
memcpy(nb, &word, 4); |
|
|
|
|
|
|
|
printf("word at %#018lx: {%x %x %x %x}\n", address, nb[0], nb[1], nb[2], nb[3]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct mi_buffer |
|
|
|
static struct mi_buffer |
|
|
|
read_file_mmap(char *path) |
|
|
|
read_file_mmap(char *path) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -254,25 +245,6 @@ process_create(char *path) |
|
|
|
return(result); |
|
|
|
return(result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
|
|
print_current_instruction(struct mi_process proc) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
struct mi_registers regs = get_process_registers(proc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long wordb = ptrace(PTRACE_PEEKDATA, proc.pid, regs.rip - 4, NULL); |
|
|
|
|
|
|
|
long word = ptrace(PTRACE_PEEKDATA, proc.pid, regs.rip, NULL); |
|
|
|
|
|
|
|
long worda = ptrace(PTRACE_PEEKDATA, proc.pid, regs.rip + 4, NULL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
u8 nb[12]; |
|
|
|
|
|
|
|
memcpy(nb, &wordb, 4); |
|
|
|
|
|
|
|
memcpy(nb + 4, &word, 4); |
|
|
|
|
|
|
|
memcpy(nb + 8, &worda, 4); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("PC = %#018lx: %x %x %x %x [%x] %x %x %x %x %x %x %x\n", regs.rip, |
|
|
|
|
|
|
|
nb[0], nb[1], nb[2], nb[3], nb[4], nb[5], nb[6], nb[7], |
|
|
|
|
|
|
|
nb[8], nb[9], nb[10], nb[11]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct mi_function * |
|
|
|
static struct mi_function * |
|
|
|
get_function_around_pc(struct mi_process proc, u64 pc) |
|
|
|
get_function_around_pc(struct mi_process proc, u64 pc) |
|
|
|
{ |
|
|
|
{ |
|
|
|