Lines Matching refs:dloc

478 static enum type_match_result check_variable(struct data_loc_info *dloc,  in check_variable()  argument
489 else if (reg == dloc->fbreg || is_fbreg) in check_variable()
491 else if (arch__is(dloc->arch, "x86") && reg == X86_REG_SP) in check_variable()
618 static struct global_var_entry *global_var__find(struct data_loc_info *dloc, u64 addr) in global_var__find() argument
620 struct dso *dso = map__dso(dloc->ms->map); in global_var__find()
630 static bool global_var__add(struct data_loc_info *dloc, u64 addr, in global_var__add() argument
633 struct dso *dso = map__dso(dloc->ms->map); in global_var__add()
672 bool get_global_var_info(struct data_loc_info *dloc, u64 addr, in get_global_var_info() argument
680 mem_addr = addr + map__reloc(dloc->ms->map); in get_global_var_info()
683 sym = thread__find_symbol_fb(dloc->thread, dloc->cpumode, in get_global_var_info()
699 static void global_var__collect(struct data_loc_info *dloc) in global_var__collect() argument
701 Dwarf *dwarf = dloc->di->dbg; in global_var__collect()
730 if (!get_global_var_info(dloc, pos->addr, &var_name, in global_var__collect()
737 global_var__add(dloc, pos->addr, var_name, &type_die); in global_var__collect()
746 bool get_global_var_type(Dwarf_Die *cu_die, struct data_loc_info *dloc, in get_global_var_type() argument
754 struct dso *dso = map__dso(dloc->ms->map); in get_global_var_type()
758 global_var__collect(dloc); in get_global_var_type()
760 gvar = global_var__find(dloc, var_addr); in get_global_var_type()
762 if (!dwarf_offdie(dloc->di->dbg, gvar->die_offset, type_die)) in get_global_var_type()
771 check_variable(dloc, &var_die, type_die, DWARF_REG_PC, offset, in get_global_var_type()
778 if (!get_global_var_info(dloc, var_addr, &var_name, var_offset)) in get_global_var_type()
781 pc = map__rip_2objdump(dloc->ms->map, ip); in get_global_var_type()
785 check_variable(dloc, &var_die, type_die, DWARF_REG_PC, *var_offset, in get_global_var_type()
793 global_var__add(dloc, var_addr - *var_offset, var_name, type_die); in get_global_var_type()
813 static void update_var_state(struct type_state *state, struct data_loc_info *dloc, in update_var_state() argument
818 int fbreg = dloc->fbreg; in update_var_state()
821 if (dloc->fb_cfa) { in update_var_state()
822 if (die_get_cfa(dloc->di->dbg, addr, &fbreg, &fb_offset) < 0) in update_var_state()
830 if (!dwarf_offdie(dloc->di->dbg, var->die_off, &mem_die)) in update_var_state()
912 static void update_insn_state(struct type_state *state, struct data_loc_info *dloc, in update_insn_state() argument
915 if (dloc->arch->update_insn_state) in update_insn_state()
916 dloc->arch->update_insn_state(state, dloc, cu_die, dl); in update_insn_state()
992 static void setup_stack_canary(struct data_loc_info *dloc) in setup_stack_canary() argument
994 if (arch__is(dloc->arch, "x86")) { in setup_stack_canary()
995 dloc->op->segment = INSN_SEG_X86_GS; in setup_stack_canary()
996 dloc->op->imm = true; in setup_stack_canary()
997 dloc->op->offset = 40; in setup_stack_canary()
1007 struct data_loc_info *dloc, in check_matching_type() argument
1014 int reg = dloc->op->reg1; in check_matching_type()
1015 int offset = dloc->op->offset; in check_matching_type()
1046 if (dloc->op->offset < 0 && reg != state->stack_reg) in check_matching_type()
1056 dloc->type_offset = dloc->op->offset; in check_matching_type()
1065 (unsigned)dloc->type_offset >= size) in check_matching_type()
1080 dloc->type_offset = dloc->op->offset; in check_matching_type()
1084 (unsigned)dloc->type_offset >= size) in check_matching_type()
1098 setup_stack_canary(dloc); in check_matching_type()
1104 u64 var_addr = dloc->op->offset; in check_matching_type()
1109 if (dloc->op->multi_regs) { in check_matching_type()
1110 int reg2 = dloc->op->reg2; in check_matching_type()
1112 if (dloc->op->reg2 == reg) in check_matching_type()
1113 reg2 = dloc->op->reg1; in check_matching_type()
1120 if (get_global_var_type(cu_die, dloc, dloc->ip, var_addr, in check_matching_type()
1122 dloc->type_offset = var_offset; in check_matching_type()
1130 if (reg == dloc->fbreg) { in check_matching_type()
1135 stack = find_stack_state(state, dloc->type_offset); in check_matching_type()
1142 update_insn_state(state, dloc, cu_die, dl); in check_matching_type()
1149 setup_stack_canary(dloc); in check_matching_type()
1158 dloc->type_offset -= stack->offset; in check_matching_type()
1163 if (dloc->fb_cfa) { in check_matching_type()
1165 u64 pc = map__rip_2objdump(dloc->ms->map, dloc->ip); in check_matching_type()
1170 if (die_get_cfa(dloc->di->dbg, pc, &fbreg, &fboff) < 0) in check_matching_type()
1176 stack = find_stack_state(state, dloc->type_offset - fboff); in check_matching_type()
1183 update_insn_state(state, dloc, cu_die, dl); in check_matching_type()
1190 setup_stack_canary(dloc); in check_matching_type()
1199 dloc->type_offset -= fboff + stack->offset; in check_matching_type()
1205 if (dso__kernel(map__dso(dloc->ms->map))) { in check_matching_type()
1209 if (dloc->op->segment == INSN_SEG_X86_GS && dloc->op->imm && in check_matching_type()
1210 arch__is(dloc->arch, "x86")) { in check_matching_type()
1213 addr = dloc->op->offset; in check_matching_type()
1215 if (get_global_var_type(cu_die, dloc, dloc->ip, addr, in check_matching_type()
1217 dloc->type_offset = offset; in check_matching_type()
1224 if (dloc->op->offset < 0 && reg != state->stack_reg) { in check_matching_type()
1225 addr = (s64) dloc->op->offset; in check_matching_type()
1227 if (get_global_var_type(cu_die, dloc, dloc->ip, addr, in check_matching_type()
1231 dloc->type_offset = offset; in check_matching_type()
1242 static enum type_match_result find_data_type_insn(struct data_loc_info *dloc, in find_data_type_insn() argument
1249 struct symbol *sym = dloc->ms->sym; in find_data_type_insn()
1254 init_type_state(&state, dloc->arch); in find_data_type_insn()
1266 u64 addr = map__rip_2objdump(dloc->ms->map, this_ip); in find_data_type_insn()
1273 update_var_state(&state, dloc, addr, dl->al.offset, var_types); in find_data_type_insn()
1275 if (this_ip == dloc->ip) { in find_data_type_insn()
1276 ret = check_matching_type(&state, dloc, in find_data_type_insn()
1283 update_insn_state(&state, dloc, cu_die, dl); in find_data_type_insn()
1294 static int arch_supports_insn_tracking(struct data_loc_info *dloc) in arch_supports_insn_tracking() argument
1296 if ((arch__is(dloc->arch, "x86")) || (arch__is(dloc->arch, "powerpc"))) in arch_supports_insn_tracking()
1305 static enum type_match_result find_data_type_block(struct data_loc_info *dloc, in find_data_type_block() argument
1317 if (!arch_supports_insn_tracking(dloc)) in find_data_type_block()
1320 prev_dst_ip = dst_ip = dloc->ip; in find_data_type_block()
1331 src_ip = map__objdump_2rip(dloc->ms->map, start); in find_data_type_block()
1335 if (annotate_get_basic_blocks(dloc->ms->sym, src_ip, dst_ip, in find_data_type_block()
1344 src_ip - dloc->ms->sym->start, in find_data_type_block()
1345 dst_ip - dloc->ms->sym->start); in find_data_type_block()
1355 ret = find_data_type_insn(dloc, &basic_blocks, var_types, in find_data_type_block()
1359 int offset = dloc->op->offset; in find_data_type_block()
1367 if (dloc->op->multi_regs) in find_data_type_block()
1369 dloc->op->reg1, dloc->op->reg2); in find_data_type_block()
1371 snprintf(buf, sizeof(buf), "reg%d", dloc->op->reg1); in find_data_type_block()
1374 offset_sign, offset, buf, dloc->type_offset); in find_data_type_block()
1392 static int find_data_type_die(struct data_loc_info *dloc, Dwarf_Die *type_die) in find_data_type_die() argument
1394 struct annotated_op_loc *loc = dloc->op; in find_data_type_die()
1409 if (dloc->op->multi_regs) in find_data_type_die()
1410 snprintf(buf, sizeof(buf), "reg%d, reg%d", dloc->op->reg1, dloc->op->reg2); in find_data_type_die()
1411 else if (dloc->op->reg1 == DWARF_REG_PC) in find_data_type_die()
1414 snprintf(buf, sizeof(buf), "reg%d", dloc->op->reg1); in find_data_type_die()
1424 dloc->ms->sym->name, dloc->ip - dloc->ms->sym->start); in find_data_type_die()
1431 pc = map__rip_2objdump(dloc->ms->map, dloc->ip); in find_data_type_die()
1434 if (!find_cu_die(dloc->di, pc, &cu_die)) { in find_data_type_die()
1447 if (get_global_var_type(&cu_die, dloc, dloc->ip, dloc->var_addr, in find_data_type_die()
1449 dloc->type_offset = offset; in find_data_type_die()
1452 dloc->var_addr, offset); in find_data_type_die()
1471 fbreg = dloc->fbreg = *block.data - DW_OP_reg0; in find_data_type_die()
1474 dloc->fb_cfa = true; in find_data_type_die()
1475 if (die_get_cfa(dloc->di->dbg, pc, &fbreg, in find_data_type_die()
1484 dloc->fb_cfa, fbreg); in find_data_type_die()
1499 if (!die_find_variable_by_addr(&scopes[i], dloc->var_addr, in find_data_type_die()
1514 result = check_variable(dloc, &var_die, &mem_die, reg, type_offset, is_fbreg); in find_data_type_die()
1518 dloc->var_addr, type_offset); in find_data_type_die()
1528 dloc->type_offset = type_offset; in find_data_type_die()
1545 result = find_data_type_block(dloc, &cu_die, scopes, in find_data_type_die()
1602 struct annotated_data_type *find_data_type(struct data_loc_info *dloc) in find_data_type() argument
1604 struct dso *dso = map__dso(dloc->ms->map); in find_data_type()
1611 dloc->type_offset = dloc->op->offset; in find_data_type()
1613 dloc->fbreg = -1; in find_data_type()
1615 if (find_data_type_die(dloc, &type_die) < 0) in find_data_type()