I'm getting some trouble with libdw since changeset:
https://fedorahosted.org/elfutils/changeset/cfdd86ed929c137eaca5dd49cd266bb7...
with function dwarf_getlocation, trying to extract position of a data member.
Given the following code:
///////////// if(dwarf_hasattr(die, DW_AT_data_member_location)) { Dwarf_Attribute attr; Dwarf_Op *expr; unsigned int exprlen;
if(dwarf_attr(die, DW_AT_data_member_location, &attr) && dwarf_getlocation(&attr, &expr, &exprlen)!=-1) { // dwarf_getlocation is returning -1, so // this is not executed } } /////////////
The new function check_constant_offset (attr, llbuf, listlen); is returning -1 in this case. The attribute that is failing is:
(gdb) p *attr $26 = {code = 56, form = 10, valp = 0xb7ad1e8b "\002#", cu = 0x80737cc} DW_AT_data_member_location = 0x38 = 56 DW_FORM_block1 = 0x0a = 10
Am I doing something wrong? Is there another way to extract data member location info? Thanks!
Em Sun, Nov 22, 2009 at 12:59:29AM +0100, Asier Aguirre escreveu:
I'm getting some trouble with libdw since changeset:
https://fedorahosted.org/elfutils/changeset/cfdd86ed929c137eaca5dd49cd266bb7...
with function dwarf_getlocation, trying to extract position of a data member.
May be related to http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00437.html
I need to get that sorted out in pahole too :-\
- Arnaldo
May be related to http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00437.html
It was a bug in the consumer-side support for that format, yes. It's a simple thing to adapt to.
Sorry, that was a stupid bug. It should be fixed in commit 888381b. Apparently we never tested dwarf_getlocation after that change. dwarf_getlocation_addr didn't have the same bug, and that's the only thing systemtap uses, so we managed not to notice that I had completely broken dwarf_getlocation. If you want to work with the broken -ldw before the next elfutils release, you can just use dwarf_getlocation_addr in place of dwarf_getlocation, and the PC value you pass won't actually matter.
Thanks, Roland
Thanks for the fast response and the workaround!
Asier
On Sun, Nov 22, 2009 at 2:08 AM, Roland McGrath roland@redhat.com wrote:
Sorry, that was a stupid bug. It should be fixed in commit 888381b. Apparently we never tested dwarf_getlocation after that change. dwarf_getlocation_addr didn't have the same bug, and that's the only thing systemtap uses, so we managed not to notice that I had completely broken dwarf_getlocation. If you want to work with the broken -ldw before the next elfutils release, you can just use dwarf_getlocation_addr in place of dwarf_getlocation, and the PC value you pass won't actually matter.
Thanks, Roland
elfutils-devel@lists.fedorahosted.org