-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I use pyelftools to get DW_AT_type of DW_TAG_variable, but sometimes the value is incorrect. #381
Comments
I encounter the same issue with a software compiled with armclang V6. I iterating over the CUs and dies and dumped all dies in a DW_AT_type.value -> die dict. Not familiar with the code in detail, where would I have to look for that issue to happen and be fixed most likely. Can you point to a location / code area? Any hints? |
The solution can be found in
where the die.cu.cu_offset is added to attr.value. The following code does not throw any exceptions any longer to me.
Hence:
It would really be nice if that was documented somewhat more obvious or with an example. |
Feel free to send a PR adding an example |
That was a key piece of information for me. maybe it would be a good thing to add to the key error message. |
@silverfoxhu is this still an issue? |
I think it could possibly be closed as long as the information is given enough emphasis in the documentation. Or part of error generated. It was a decent time sink for me. |
I met the same problem. Is there a solution to get the DW_AT_type DIE from the DW_AT_variable DIE? e.g. In the OP's question, how to get the address 0x289 from the DW_AT_variable? |
Have you tried calling |
That works. Thanks very much! |
test.zip
Version 0.27, Oct 27, 2020
I use this version to process dwarf of my elf.
Use pyelftools I got this:
But when I use this command: tricore-objdump --dwarf=info test, I got this:
All of them are ok except DW_AT_type, the first one is 341(0x155), the second is 0x289.
Then, I use get_DIE_from_refaddr to get the DIE of data type.
get_DIE_from_refaddr(0x289) is ok, but get_DIE_from_refaddr(0x155) would lead to an exception(KeyError: 50).
The text was updated successfully, but these errors were encountered: