question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Key Error: 160 when loading ELF binary compiled with gcc 12.1

See original GitHub issue

I am using cle for a bunch of ELF programs produced with gcc 12.1 and I keep hitting this exception: https://github.com/angr/cle/blob/2a2ffa93a151a6f6aacd0e9e839b5bd3dccbabbf/cle/backends/elf/elf.py#L753-L760

Traceback (most recent call last):
  File "/home/vanessa/Desktop/Code/cle/test.py", line 62, in <module>
    ld = cle.Loader(filename, load_debug_info=True, auto_load_libs=False)
  File "/home/vanessa/Desktop/Code/cle/cle/loader.py", line 133, in __init__
    self.initial_load_objects = self._internal_load(main_binary, *preload_libs, *force_load_libs, preloading=(main_binary, *preload_libs))
  File "/home/vanessa/Desktop/Code/cle/cle/loader.py", line 694, in _internal_load
    obj = self._load_object_isolated(main_spec)
  File "/home/vanessa/Desktop/Code/cle/cle/loader.py", line 876, in _load_object_isolated
    result = backend_cls(binary, binary_stream, is_main_bin=self.main_object is None, loader=self, **options)
  File "/home/vanessa/Desktop/Code/cle/cle/backends/elf/elf.py", line 195, in __init__
    self._load_dies(dwarf)
  File "/home/vanessa/Desktop/Code/cle/cle/backends/elf/elf.py", line 785, in _load_dies
    var = self._load_die_variable(sub_die, expr_parser, type_list)
  File "/home/vanessa/Desktop/Code/cle/cle/backends/elf/elf.py", line 826, in _load_die_variable
    parsed_exprs = expr_parser.parse_expr(die.attributes['DW_AT_location'].value)
  File "/home/vanessa/Desktop/Code/cle/env/lib/python3.9/site-packages/elftools/dwarf/dwarf_expr.py", line 151, in parse_expr
    arg_parser = self._dispatch_table[op]
KeyError: 160

I’m going to try / except and skip it for now, but wanted to bring it to y’all’s attention! I’m not familiar with this dispatch table thing, but I’m thinking maybe there is a new value that pyelftools hasn’t added yet?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vsochcommented, Aug 15, 2022

Yep seems to work! Thanks y’all, closing issue.

1reaction
rhelmotcommented, Jun 15, 2022

Some things to try: try installing pyelftools from git. There are some unreleased changes which I think are relevant. You can also try installing some pending pull requests on pyelftools, https://github.com/eliben/pyelftools/pull/418 in particular seems relevant?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Building on linux arm · Issue #12 - GitHub
The error suggests the gcc binary is somehow being executed as a shell script... That happens when the OS doesn't know how to...
Read more >
Using the GNU Compiler Collection
Using the GNU Compiler Collection. For gcc version 12.1.0. (GCC) ... language syntax recognized by GCC 4.0, and to produce an error if...
Read more >
Cannot load custom ELF executable in GDB - Stack Overflow
I compiled a minimal ELF executable with GCC/NASM to try and reproduce the problem, but the GCC-produced executable loads without a hitch, ...
Read more >
Bug listing with status RESOLVED with resolution TEST ...
Bug:233 - "Emacs segfaults when merged through the sandbox." status:RESOLVED resolution:TEST-REQUEST severity:critical · Bug:3888 - "yenta_socket module not ...
Read more >
wolfSSL Documentation
4.3.1 Cipher Suite Strength and Choosing Proper Key Sizes . ... A.7 wolfSSL Error Handling and Reporting . ... B.12 Algorithms - 3DES...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found