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.

find_symbol fails on Mach-O

See original GitHub issue

Attempting to run find_symbol(string) on a Mach-O binary results in the error:

File "cle/loader.py", line 473, in find_symbol
    if sym.is_import:
AttributeError: 'list' object has no attribute 'is_import'

This is because the Mach-O implementation of get_symbol always returns a list rather than a single symbol as expected by load_symbol.

Pip version cle 8.19.4.5

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fmagincommented, Sep 18, 2019

Because I am probably the only person around here that feels somewhat responsible for the Mach-O backend, I will be looking into this. The current get_symbol implementation obviously violates assumptions made by other parts of CLE(a strong case for type annotations and checking). The question is of the rest of CLE should be changed to handle binaries with duplicate symbol names (which is allowed in Mach-O) or the backend should be changed so it always returns one symbol, however that is chosen. Namespacing would be one option for the latter, but that might require changes to CLE again to support the concept of namespaces instead of just building them as a string. Other option would be that only an index is valid as an argument for get_symbol and a str requires an additional parameter to specify a namespace or accept a list as a result.

0reactions
github-actions[bot]commented, Sep 16, 2022

This issue has been closed due to inactivity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find symbol address of Mach-o from mach_header in ...
I have a mach-o file loaded in memory (via mmap ) and need to get the address in the binary corresponding to a...
Read more >
[llvm-dev] Kaleidoscope on Windows - bug maybe found?
The root cause of this problem is in libObject - ELF and MachO objects ... this still fails: > > auto ExprSymbol =...
Read more >
lld/MachONormalizedFileFromAtoms.cpp at master · llvm- ...
lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp ... llvm::Error getSymbolTableRegion(const DefinedAtom* atom,. bool &inGlobalsRegion,.
Read more >
MachO — LIEF Documentation
MachO.ParserConfig object at 0x7fdde5b460b0>) -> object. Parse the given binary from a Python IO interface and return a FatBinary object.
Read more >
https://opensource.apple.com/source/libffi/libffi-...
SymbolTable import SymbolTable from macholib.ptypes import * from macholib import mach_o ... 0: raise Exception("nm failed") syms = list() for line in ...
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