probe-finder.c (6f1b6291cf73cb3223f6fb9ec16862a5fe7ed957) | probe-finder.c (c06547d02094e7eb81389e9485a45d91cc21914c) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * probe-finder.c : C expression to kprobe event converter 4 * 5 * Written by Masami Hiramatsu <mhiramat@redhat.com> 6 */ 7 8#include <inttypes.h> --- 590 unchanged lines hidden (view full) --- 599 } else 600 memcpy(&pf->sp_die, sc_die, sizeof(Dwarf_Die)); 601 602 /* Get the frame base attribute/ops from subprogram */ 603 dwarf_attr(&pf->sp_die, DW_AT_frame_base, &fb_attr); 604 ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1); 605 if (ret <= 0 || nops == 0) { 606 pf->fb_ops = NULL; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * probe-finder.c : C expression to kprobe event converter 4 * 5 * Written by Masami Hiramatsu <mhiramat@redhat.com> 6 */ 7 8#include <inttypes.h> --- 590 unchanged lines hidden (view full) --- 599 } else 600 memcpy(&pf->sp_die, sc_die, sizeof(Dwarf_Die)); 601 602 /* Get the frame base attribute/ops from subprogram */ 603 dwarf_attr(&pf->sp_die, DW_AT_frame_base, &fb_attr); 604 ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1); 605 if (ret <= 0 || nops == 0) { 606 pf->fb_ops = NULL; |
607#if _ELFUTILS_PREREQ(0, 142) | 607#ifdef HAVE_DWARF_CFI_SUPPORT |
608 } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && 609 (pf->cfi_eh != NULL || pf->cfi_dbg != NULL)) { 610 if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 && 611 (dwarf_cfi_addrframe(pf->cfi_dbg, pf->addr, &frame) != 0)) || 612 dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) { 613 pr_warning("Failed to get call frame on 0x%jx\n", 614 (uintmax_t)pf->addr); 615 free(frame); 616 return -ENOENT; 617 } | 608 } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && 609 (pf->cfi_eh != NULL || pf->cfi_dbg != NULL)) { 610 if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 && 611 (dwarf_cfi_addrframe(pf->cfi_dbg, pf->addr, &frame) != 0)) || 612 dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) { 613 pr_warning("Failed to get call frame on 0x%jx\n", 614 (uintmax_t)pf->addr); 615 free(frame); 616 return -ENOENT; 617 } |
618#endif | 618#endif /* HAVE_DWARF_CFI_SUPPORT */ |
619 } 620 621 /* Call finder's callback handler */ 622 ret = pf->callback(sc_die, pf); 623 624 /* Since *pf->fb_ops can be a part of frame. we should free it here. */ 625 free(frame); 626 pf->fb_ops = NULL; --- 508 unchanged lines hidden (view full) --- 1135 if (elf == NULL) 1136 return -EINVAL; 1137 1138 if (gelf_getehdr(elf, &ehdr) == NULL) 1139 return -EINVAL; 1140 1141 pf->machine = ehdr.e_machine; 1142 | 619 } 620 621 /* Call finder's callback handler */ 622 ret = pf->callback(sc_die, pf); 623 624 /* Since *pf->fb_ops can be a part of frame. we should free it here. */ 625 free(frame); 626 pf->fb_ops = NULL; --- 508 unchanged lines hidden (view full) --- 1135 if (elf == NULL) 1136 return -EINVAL; 1137 1138 if (gelf_getehdr(elf, &ehdr) == NULL) 1139 return -EINVAL; 1140 1141 pf->machine = ehdr.e_machine; 1142 |
1143#if _ELFUTILS_PREREQ(0, 142) | 1143#ifdef HAVE_DWARF_CFI_SUPPORT |
1144 do { 1145 GElf_Shdr shdr; 1146 1147 if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) && 1148 shdr.sh_type == SHT_PROGBITS) 1149 pf->cfi_eh = dwarf_getcfi_elf(elf); 1150 1151 pf->cfi_dbg = dwarf_getcfi(dbg->dbg); 1152 } while (0); | 1144 do { 1145 GElf_Shdr shdr; 1146 1147 if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) && 1148 shdr.sh_type == SHT_PROGBITS) 1149 pf->cfi_eh = dwarf_getcfi_elf(elf); 1150 1151 pf->cfi_dbg = dwarf_getcfi(dbg->dbg); 1152 } while (0); |
1153#endif | 1153#endif /* HAVE_DWARF_CFI_SUPPORT */ |
1154 1155 ret = debuginfo__find_probe_location(dbg, pf); 1156 return ret; 1157} 1158 1159struct local_vars_finder { 1160 struct probe_finder *pf; 1161 struct perf_probe_arg *args; --- 757 unchanged lines hidden --- | 1154 1155 ret = debuginfo__find_probe_location(dbg, pf); 1156 return ret; 1157} 1158 1159struct local_vars_finder { 1160 struct probe_finder *pf; 1161 struct perf_probe_arg *args; --- 757 unchanged lines hidden --- |