+2018-06-08 Mark Wielaard <mark@klomp.org>
+
+ * dwarf_getlocation_attr.c (addr_valp): Set error and return NULL
+ when there is no .debug_addr section.
+ (dwarf_getlocation_attr): If addr_valp returns NULL, then return -1.
+
2018-06-07 Mark Wielaard <mark@klomp.org>
* libdw_findcu.c (__libdw_intern_next_unit): Report DWARF_E_VERSION,
/* Return DWARF attribute associated with a location expression op.
- Copyright (C) 2013, 2014, 2017 Red Hat, Inc.
+ Copyright (C) 2013, 2014, 2017, 2018 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
addr_valp (Dwarf_CU *cu, Dwarf_Word index)
{
Elf_Data *debug_addr = cu->dbg->sectiondata[IDX_debug_addr];
- Dwarf_Word offset = __libdw_cu_addr_base (cu) + (index * cu->address_size);
if (debug_addr == NULL)
- /* This is really an error, will trigger with dwarf_formaddr. */
- return (unsigned char *) (uintptr_t) offset;
+ {
+ __libdw_seterrno (DWARF_E_NO_DEBUG_ADDR);
+ return NULL;
+ }
+ Dwarf_Word offset = __libdw_cu_addr_base (cu) + (index * cu->address_size);
return (unsigned char *) debug_addr->d_buf + offset;
}
else
result->form = DW_FORM_data8;
result->valp = addr_valp (attr->cu, op->number);
+ if (result->valp == NULL)
+ return -1;
result->cu = attr->cu->dbg->fake_addr_cu;
break;
result->code = DW_AT_low_pc;
result->form = DW_FORM_addr;
result->valp = addr_valp (attr->cu, op->number);
+ if (result->valp == NULL)
+ return -1;
result->cu = attr->cu->dbg->fake_addr_cu;
break;