Skip to content

[Bug] Prerequisite readelf and file should be listed in document explicitly for mac users #974

@pnck

Description

@pnck

GEF+GDB version

gef➤  version
GEF: (Standalone)
Blob Hash(/Users/***/.gdbinit-gef.py): 1a409c397646df9c0b8549d576cd7c7f8ec1ef47
SHA256(/Users/***/.gdbinit-gef.py): f096ff3bf50df08dbbc698a919360014f86f1eea315011cdabebd72a30a5bce8
GDB: 13.2
GDB-Python: 3.11

Operating System

MacOS (Intel)

Describe the issue you encountered

By following the installation manual, mac users may encounter missing file errors:

...
 File "/Users/***/.gdbinit-gef.py", line 1843, in which
    raise FileNotFoundError(f"Missing file `{program}`")
FileNotFoundError: Missing file `readelf` 

Also there is another report #911.

Do you read the docs and look at previously closed issues/PRs for similar cases?

Yes

Architecture impacted

  • X86
  • X64
  • ARM
  • ARM64
  • MIPS
  • MIPS64
  • PPC
  • PPC64
  • RISCV

Describe your issue. Without a proper reproduction step-by-step, your issue will be ignored.

I checked the source and found a special handling adapting to mac:

gef/gef.py

Lines 3315 to 3317 in 0461d6f

elif sys.platform == "darwin":
pbcopy = which("pbcopy")
prog = [pbcopy]

So I suppose this author had made tests on mac and proven its workability.


file and readelf may be installed through homebrew:

$ brew install file binutils

And since binutils is "keg-only", one has to add its bin path into $PATH before starting gdb/gef:

$ export PATH="/usr/local/opt/binutils/bin:$PATH"
$ gdb

After that gef looks working good:

(remote) gef➤  version
GEF: (Standalone)
Blob Hash(/Users/***/.gdbinit-gef.py): 1a409c397646df9c0b8549d576cd7c7f8ec1ef47
SHA256(/Users/***/.gdbinit-gef.py): f096ff3bf50df08dbbc698a919360014f86f1eea315011cdabebd72a30a5bce8
GDB: 13.2
GDB-Python: 3.11
(remote) gef➤  gef-remote
[!] You already are in remote session. Close it first before opening a new one...

The document should add some content about setting up gef on macos.

Minimalist test case

No response

Additional context?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions