Skip to content
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

KeyError: 'r_addend' on Ubuntu 14.04 Python3.4.3 #11

Closed
sheinz opened this issue Jun 29, 2016 · 7 comments
Closed

KeyError: 'r_addend' on Ubuntu 14.04 Python3.4.3 #11

sheinz opened this issue Jun 29, 2016 · 7 comments

Comments

@sheinz
Copy link

sheinz commented Jun 29, 2016

Hi,

I'm having trouble running ScratchABit on my machine:

$ python scratchabit.py example-elf
Traceback (most recent call last):
  File "scratchabit.py", line 721, in <module>
    load_target_file(loader, sys.argv[1])
  File "scratchabit.py", line 623, in load_target_file
    entry = loader.load(engine.ADDRESS_SPACE, fname)
  File "/home/user/esp/virtenv/ScratchABit/plugins/loader/elf.py", line 407, in load
    return load_sections(aspace, elffile)
  File "/home/user/esp/virtenv/ScratchABit/plugins/loader/elf.py", line 280, in load_sections
    if reloc["r_addend"] != 0:
  File "/home/user/esp/virtenv/ScratchABit/plugins/loader/pyelftools/elftools/elf/relocation.py", line 35, in __getitem__
    return self.entry[name]
  File "/home/user/esp/virtenv/ScratchABit/plugins/loader/pyelftools/elftools/construct/lib/container.py", line 35, in __getitem__
    return self.__dict__[name]
KeyError: 'r_addend'

Am I missing something?
I use Ubuntu 14.04 with Python 3.4.3
Thanks

@BlueShrub
Copy link

Same issue here

$ uname -a
Linux novi-ThinkPad-X120e 4.2.0-34-generic #39-Ubuntu SMP Thu Mar 10 22:13:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ python3 -V
Python 3.4.3+

$ python3 scratchabit.py example-elf
Traceback (most recent call last):
  File "scratchabit.py", line 721, in <module>
    load_target_file(loader, sys.argv[1])
  File "scratchabit.py", line 623, in load_target_file
    entry = loader.load(engine.ADDRESS_SPACE, fname)
  File "/opt/ScratchABit/plugins/loader/elf.py", line 407, in load
    return load_sections(aspace, elffile)
  File "/opt/ScratchABit/plugins/loader/elf.py", line 280, in load_sections
    if reloc["r_addend"] != 0:
  File "/opt/ScratchABit/plugins/loader/pyelftools/elftools/elf/relocation.py", line 35, in __getitem__
    return self.entry[name]
  File "/opt/ScratchABit/plugins/loader/pyelftools/elftools/construct/lib/container.py", line 35, in __getitem__
    return self.__dict__[name]
KeyError: 'r_addend'

@pfalcon
Copy link
Owner

pfalcon commented Jul 2, 2016

Thanks for the reports, confirmed.

@pfalcon
Copy link
Owner

pfalcon commented Jul 2, 2016

Partial fix was pushed, though it still crashes later. The issue is that recently "advanced" loading of Xtensa ELF files was added, which was implemented in an adhoc way and now clashes with x86. I'm on it.

@BlueShrub
Copy link

That's a pretty solid response time :).

In the event it's helpful, this is the new error on my machine (although I imagine it's what you were referring to):

# python3 scratchabit.py example-elf
Traceback (most recent call last):
  File "scratchabit.py", line 721, in <module>
    load_target_file(loader, sys.argv[1])
  File "scratchabit.py", line 623, in load_target_file
    entry = loader.load(engine.ADDRESS_SPACE, fname)
  File "/opt/ScratchABit/plugins/loader/elf.py", line 409, in load
    return load_sections(aspace, elffile)
  File "/opt/ScratchABit/plugins/loader/elf.py", line 296, in load_sections
    rel_type = RELOC_TYPES[reloc["r_info_type"]]
KeyError: 7

@pfalcon
Copy link
Owner

pfalcon commented Jul 3, 2016

Yes, that was the other error, and it's now fixed too. python scratchabit.py example-elf now works as expected.

@pfalcon pfalcon closed this as completed Jul 3, 2016
@BlueShrub
Copy link

Works for me now. My first time using this tool -- pretty handy! Very impressed.

Thanks again!

@pfalcon
Copy link
Owner

pfalcon commented Jul 3, 2016

You're welcome. And I know it could be made better, and that's on todo ;-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants