one bug fix & reformeatting of the code

This commit is contained in:
2020-01-13 22:13:39 +04:00
parent 2f7dfeca0b
commit fdfce06ee0
2 changed files with 14 additions and 17 deletions
+1 -4
View File
@@ -175,9 +175,6 @@ uint32_t __pst_context::print_expr_block (Dwarf_Op *exprs, int len, char* buff,
} else {
offset += snprintf(buff + offset, buff_size - offset, "0x%hhX(0x%lX, 0x%lx) ", exprs[i].atom, exprs[i].number, exprs[i].number2);
}
// if(exprs[i].atom >= DW_OP_reg0 && exprs[i].atom <= DW_OP_bregx) {
// print_framereg(exprs[i].atom);
// }DW_OP_addr
}
return offset;
@@ -194,7 +191,7 @@ bool __pst_context::calc_expression(Dwarf_Op *exprs, int expr_len, Dwarf_Attribu
}
dwarf_value* v = stack.get();
if(v && v->type == DWARF_TYPE_REGISTER_LOC) {
if(v && (v->type & DWARF_TYPE_REGISTER_LOC)) {
// dereference register location
unw_word_t value = 0;
uint64_t regno = *((uint64_t*)v->value);
+13 -13
View File
@@ -9,19 +9,19 @@
#include "linkedlist.h"
typedef enum {
DWARF_TYPE_INVALID = 0,
DWARF_TYPE_SIGNED = 1,
DWARF_TYPE_UNSIGNED = 2,
DWARF_TYPE_CONST = 4,
DWARF_TYPE_GENERIC = 8,
DWARF_TYPE_CHAR = 16,
DWARF_TYPE_FLOAT = 32,
DWARF_TYPE_REGISTER_LOC = 64,
DWARF_TYPE_MEMORY_LOC = 128,
DWARF_TYPE_PIECE = 256,
DWARF_TYPE_SHORT = 512,
DWARF_TYPE_INT = 1024,
DWARF_TYPE_LONG = 2048
DWARF_TYPE_INVALID = 0, // no type
DWARF_TYPE_SIGNED = 1, // signed type
DWARF_TYPE_UNSIGNED = 2, // unsigned type
DWARF_TYPE_CONST = 4, // constant signed/unsigned type
DWARF_TYPE_GENERIC = 8, // size of machine address type
DWARF_TYPE_CHAR = 16, // 1 byte size
DWARF_TYPE_FLOAT = 32, // machine-dependent floating point size
DWARF_TYPE_REGISTER_LOC = 64, // value located in register specified as 'value'
DWARF_TYPE_MEMORY_LOC = 128, // value located in memory address specified as 'value'
DWARF_TYPE_PIECE = 256, // piece of whole value located in current value
DWARF_TYPE_SHORT = 512, // 2 byte size
DWARF_TYPE_INT = 1024, // 4 byte size
DWARF_TYPE_LONG = 2048 // 8 byte size
} dwarf_value_type;
typedef struct __dwarf_value : public SC_ListNode {