|
|
@ -1,6 +1,6 @@ |
|
|
|
static u64 |
|
|
|
static u64 |
|
|
|
iterate_call_frame_instructions(struct dwarf_cie *cie, u8 *data, u64 to_read, |
|
|
|
iterate_call_frame_instructions(struct dwarf_cie *cie, u8 *data, u64 to_read, |
|
|
|
struct mi_registers *regs, struct dwarf_regset *regset, u64 location) |
|
|
|
struct dwarf_regset *regset, u64 location) |
|
|
|
{ |
|
|
|
{ |
|
|
|
u64 read = 0; |
|
|
|
u64 read = 0; |
|
|
|
|
|
|
|
|
|
|
@ -274,7 +274,7 @@ read_one_cie(struct dwarf_cie *header, u64 length, u8 *data, u8 *original_data) |
|
|
|
header->instructions = data; |
|
|
|
header->instructions = data; |
|
|
|
header->instructions_length = header->length - (data - original_data - 4); |
|
|
|
header->instructions_length = header->length - (data - original_data - 4); |
|
|
|
|
|
|
|
|
|
|
|
data += iterate_call_frame_instructions(header, data, header->instructions_length, 0, 0, 0); |
|
|
|
data += iterate_call_frame_instructions(header, data, header->instructions_length, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
if (has_R) { |
|
|
|
if (has_R) { |
|
|
|
// NOTE(aolo2): this shit is undocumented. Best sources I could find:
|
|
|
|
// NOTE(aolo2): this shit is undocumented. Best sources I could find:
|
|
|
@ -441,7 +441,7 @@ read_one_fde(struct mi_process proc, struct dwarf_cie *cie, u64 length, u8 *data |
|
|
|
header->instructions = data; |
|
|
|
header->instructions = data; |
|
|
|
header->instructions_length = header->length - (data - original_data - 4); |
|
|
|
header->instructions_length = header->length - (data - original_data - 4); |
|
|
|
|
|
|
|
|
|
|
|
data += iterate_call_frame_instructions(cie, data, header->instructions_length, 0, 0, 0); |
|
|
|
data += iterate_call_frame_instructions(cie, data, header->instructions_length, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
return(data - original_data); |
|
|
|
return(data - original_data); |
|
|
|
} |
|
|
|
} |
|
|
@ -515,7 +515,7 @@ eh_frame_find_fde(struct mi_process proc, u64 pc) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static struct dwarf_regset |
|
|
|
static struct dwarf_regset |
|
|
|
eh_frame_init_registers(struct mi_process proc, struct mi_registers regs, struct dwarf_cie cie) |
|
|
|
eh_frame_init_registers(struct mi_registers regs, struct dwarf_cie cie) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct dwarf_regset regset = { 0 }; |
|
|
|
struct dwarf_regset regset = { 0 }; |
|
|
|
|
|
|
|
|
|
|
@ -536,15 +536,15 @@ eh_frame_init_registers(struct mi_process proc, struct mi_registers regs, struct |
|
|
|
regset.system[14] = regs._sys.r14; |
|
|
|
regset.system[14] = regs._sys.r14; |
|
|
|
regset.system[15] = regs._sys.r15; |
|
|
|
regset.system[15] = regs._sys.r15; |
|
|
|
|
|
|
|
|
|
|
|
iterate_call_frame_instructions(&cie, cie.instructions, cie.instructions_length, ®s, ®set, 0); |
|
|
|
iterate_call_frame_instructions(&cie, cie.instructions, cie.instructions_length, ®set, 0); |
|
|
|
|
|
|
|
|
|
|
|
return(regset); |
|
|
|
return(regset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static struct dwarf_regset |
|
|
|
static struct dwarf_regset |
|
|
|
eh_frame_find_pc(struct mi_process proc, struct dwarf_fde fde, struct mi_registers regs, struct dwarf_regset regset, u64 pc) |
|
|
|
eh_frame_find_pc(struct dwarf_fde fde, struct dwarf_regset regset, u64 pc) |
|
|
|
{ |
|
|
|
{ |
|
|
|
regset.loc = fde.low_pc; |
|
|
|
regset.loc = fde.low_pc; |
|
|
|
iterate_call_frame_instructions(&fde.cie, fde.instructions, fde.instructions_length, ®s, ®set, pc); |
|
|
|
iterate_call_frame_instructions(&fde.cie, fde.instructions, fde.instructions_length, ®set, pc); |
|
|
|
return(regset); |
|
|
|
return(regset); |
|
|
|
} |
|
|
|
} |