fix SF in print_expr_block() due to wrong dereference of stack pointer

to memory location
This commit is contained in:
2020-01-16 12:31:55 +04:00
parent 06385ba36e
commit 80285dd94e
+1 -3
View File
@@ -154,11 +154,9 @@ uint32_t __pst_context::print_expr_block (Dwarf_Op *exprs, int len, char* buff,
} else if(map->op_num == DW_OP_bregx) { } else if(map->op_num == DW_OP_bregx) {
uint32_t regno = decode_uleb128((unsigned char*)&exprs[i].number); uint32_t regno = decode_uleb128((unsigned char*)&exprs[i].number);
int32_t off = decode_sleb128((unsigned char*)&exprs[i].number2); int32_t off = decode_sleb128((unsigned char*)&exprs[i].number2);
unw_word_t ptr = 0; unw_word_t ptr = 0;
unw_get_reg(&cursor, regno, &ptr); unw_get_reg(&cursor, regno, &ptr);
//ptr += off; //ptr += off;
offset += snprintf(buff + offset, buff_size - offset, "%s(%s%s%d) reg_value = 0x%lX", map->op_name, unw_regname(regno), off >= 0 ? "+" : "", off, ptr); offset += snprintf(buff + offset, buff_size - offset, "%s(%s%s%d) reg_value = 0x%lX", map->op_name, unw_regname(regno), off >= 0 ? "+" : "", off, ptr);
} else if(map->op_num == DW_OP_regx) { } else if(map->op_num == DW_OP_regx) {
int32_t reg = decode_sleb128((unsigned char*)&exprs[i].number); int32_t reg = decode_sleb128((unsigned char*)&exprs[i].number);
@@ -168,7 +166,7 @@ uint32_t __pst_context::print_expr_block (Dwarf_Op *exprs, int len, char* buff,
offset += snprintf(buff + offset, buff_size - offset, "%s(%s) value = 0x%lX", map->op_name, unw_regname(reg), value); offset += snprintf(buff + offset, buff_size - offset, "%s(%s) value = 0x%lX", map->op_name, unw_regname(reg), value);
} else if(map->op_num == DW_OP_addr) { } else if(map->op_num == DW_OP_addr) {
offset += snprintf(buff + offset, buff_size - offset, "%s value = 0x%X", map->op_name, *((uint32_t*)exprs[i].number)); offset += snprintf(buff + offset, buff_size - offset, "%s value = %p", map->op_name, (void*)exprs[i].number);
} else { } else {
offset += snprintf(buff + offset, buff_size - offset, "%s(0x%lX, 0x%lx) ", map->op_name, exprs[i].number, exprs[i].number2); offset += snprintf(buff + offset, buff_size - offset, "%s(0x%lX, 0x%lx) ", map->op_name, exprs[i].number, exprs[i].number2);
} }