char *name;
int ret;
ret = dwarf_diename(dw_die, &name, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_OK) {
ret = strcmp(tname, name);
dwarf_dealloc(__dw_debug, name, DW_DLA_STRING);
/* TODO: check ranges */
ret = dwarf_lowpc(sp_die, &lopc, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_NO_ENTRY)
return 0;
ret = dwarf_highpc(sp_die, &hipc, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
if (lopc <= addr && addr < hipc) {
*offs = addr - lopc;
return 1;
int ret;
ret = dwarf_hasattr(dw_die, DW_AT_inline, &inl, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
return inl;
}
int ret;
ret = dwarf_attr(dw_die, DW_AT_abstract_origin, &attr, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
ret = dwarf_formref(attr, &cu_offs, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
dwarf_dealloc(__dw_debug, attr, DW_DLA_ATTR);
return cu_offs;
}
/* Try to get entry pc */
ret = dwarf_attr(dw_die, DW_AT_entry_pc, &attr, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_OK) {
ret = dwarf_formaddr(attr, &addr, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
dwarf_dealloc(__dw_debug, attr, DW_DLA_ATTR);
return addr;
}
/* Try to get low pc */
ret = dwarf_lowpc(dw_die, &addr, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_OK)
return addr;
/* Try to get ranges */
ret = dwarf_attr(dw_die, DW_AT_ranges, &attr, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
ret = dwarf_formref(attr, &offs, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
ret = dwarf_get_ranges(__dw_debug, offs, &ranges, &cnt, NULL,
&__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
addr = ranges[0].dwr_addr1;
dwarf_ranges_dealloc(__dw_debug, ranges, cnt);
return addr;
while (!(ret = die_cb(cur_link, data))) {
/* Check child die */
ret = dwarf_child(cur_link->die, &new_die, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_OK) {
new_link.parent = cur_link;
new_link.die = new_die;
/* Move to next sibling */
ret = dwarf_siblingof(__dw_debug, cur_link->die, &new_die,
&__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
dwarf_dealloc(__dw_debug, cur_link->die, DW_DLA_DIE);
cur_link->die = new_die;
if (ret == DW_DLV_NO_ENTRY)
new_link.parent = NULL;
ret = dwarf_child(parent_die, &new_link.die, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_OK)
return __search_die_tree(&new_link, die_cb, data);
else
int ret, i;
ret = dwarf_loclist_n(attr, &llbuf, &lcnt, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
ret = DW_DLV_NO_ENTRY;
for (i = 0; i < lcnt; ++i) {
if (llbuf[i]->ld_lopc <= addr &&
memcpy(desc, llbuf[i], sizeof(Dwarf_Locdesc));
desc->ld_s =
malloc(sizeof(Dwarf_Loc) * llbuf[i]->ld_cents);
- ERR_IF(desc->ld_s == NULL);
+ DIE_IF(desc->ld_s == NULL);
memcpy(desc->ld_s, llbuf[i]->ld_s,
sizeof(Dwarf_Loc) * llbuf[i]->ld_cents);
ret = DW_DLV_OK;
" %s=%+lld(%s)", pf->var, offs, regs);
else
ret = snprintf(pf->buf, pf->len, " %s=%s", pf->var, regs);
- ERR_IF(ret < 0);
- ERR_IF(ret >= pf->len);
+ DIE_IF(ret < 0);
+ DIE_IF(ret >= pf->len);
}
/* Show a variables in kprobe event format */
if (ret != DW_DLV_OK)
goto error;
/* TODO? */
- ERR_IF(ld.ld_cents != 1);
+ DIE_IF(ld.ld_cents != 1);
show_location(&ld.ld_s[0], pf);
free(ld.ld_s);
dwarf_dealloc(__dw_debug, attr, DW_DLA_ATTR);
int ret;
ret = dwarf_tag(dlink->die, &tag, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if ((tag == DW_TAG_formal_parameter ||
tag == DW_TAG_variable) &&
(die_compare_name(dlink->die, pf->var) == 0)) {
if (!is_c_varname(pf->var)) {
/* Output raw parameters */
ret = snprintf(pf->buf, pf->len, " %s", pf->var);
- ERR_IF(ret < 0);
- ERR_IF(ret >= pf->len);
+ DIE_IF(ret < 0);
+ DIE_IF(ret >= pf->len);
return ;
}
int ret;
ret = dwarf_attr(sp_die, DW_AT_frame_base, &attr, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
ret = attr_get_locdesc(attr, &pf->fbloc, (pf->addr - pf->cu_base));
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
dwarf_dealloc(__dw_debug, attr, DW_DLA_ATTR);
}
/* Output name of probe point */
ret = dwarf_diename(sp_die, &name, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_OK) {
ret = snprintf(tmp, MAX_PROBE_BUFFER, "%s+%u", name,
(unsigned int)offs);
/* This function has no name. */
ret = snprintf(tmp, MAX_PROBE_BUFFER, "0x%llx", pf->addr);
}
- ERR_IF(ret < 0);
- ERR_IF(ret >= MAX_PROBE_BUFFER);
+ DIE_IF(ret < 0);
+ DIE_IF(ret >= MAX_PROBE_BUFFER);
len = ret;
/* Find each argument */
int ret;
ret = dwarf_tag(dlink->die, &tag, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
/* Check the address is in this subprogram */
if (tag == DW_TAG_subprogram &&
die_within_subprogram(dlink->die, pf->addr, &offs)) {
int ret;
ret = dwarf_srclines(cu_die, &lines, &cnt, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
for (i = 0; i < cnt; i++) {
ret = dwarf_line_srcfileno(lines[i], &fno, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
if (fno != pf->fno)
continue;
ret = dwarf_lineno(lines[i], &lineno, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
if (lineno != (Dwarf_Unsigned)pp->line)
continue;
ret = dwarf_lineaddr(lines[i], &addr, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
eprintf("Probe point found: 0x%llx\n", addr);
pf->addr = addr;
/* Search a real subprogram including this line, */
int ret;
ret = dwarf_tag(dlink->die, &tag, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (tag == DW_TAG_subprogram) {
if (die_compare_name(dlink->die, pp->function) == 0) {
if (die_inlined_subprogram(dlink->die)) {
ret = dwarf_die_CU_offset(dlink->die,
&pf->inl_offs,
&__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
eprintf("inline definition offset %lld\n",
pf->inl_offs);
return 0;
for (lk = dlink->parent; lk != NULL; lk = lk->parent) {
tag = 0;
dwarf_tag(lk->die, &tag, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (tag == DW_TAG_subprogram &&
!die_inlined_subprogram(lk->die))
goto found;
found:
/* Get offset from subprogram */
ret = die_within_subprogram(lk->die, pf->addr, &offs);
- ERR_IF(!ret);
+ DIE_IF(!ret);
show_probepoint(lk->die, offs, pf);
/* Continue to search */
}
/* Search CU (Compilation Unit) */
ret = dwarf_next_cu_header(__dw_debug, NULL, NULL, NULL,
&addr_size, &next_cuh, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_NO_ENTRY)
break;
/* Get the DIE(Debugging Information Entry) of this CU */
ret = dwarf_siblingof(__dw_debug, 0, &cu_die, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
/* Check if target file is included. */
if (pp->file)
if (!pp->file || pf.fno) {
/* Save CU base address (for frame_base) */
ret = dwarf_lowpc(cu_die, &pf.cu_base, &__dw_error);
- ERR_IF(ret == DW_DLV_ERROR);
+ DIE_IF(ret == DW_DLV_ERROR);
if (ret == DW_DLV_NO_ENTRY)
pf.cu_base = 0;
if (pp->line)
dwarf_dealloc(__dw_debug, cu_die, DW_DLA_DIE);
}
ret = dwarf_finish(__dw_debug, &__dw_error);
- ERR_IF(ret != DW_DLV_OK);
+ DIE_IF(ret != DW_DLV_OK);
return pp->found;
}