gef: gef fails to provide right context for aarch64 binary

Your issue will be closed unless you confirm the following:

Step 1: Describe your environment

  • Operating System: Debian 10
  • Architecture: x86-64
  • GDB version (including the Python library version): GNU gdb (Debian 8.2.1-2) 8.2.1 Python 3.7.3 (default, Apr 3 2019, 05:39:12)

Step 2: Describe your problem

When I load certain aarch64 binaries with gef, it complains about lack of .gnu_debugdata and then it says most features won’t work. I would be OK with that if it actually displayed context correctly, but it doesn’t. It then believes all code is x86, and proceeds to dereference x86 registers, which of course fails.

Steps to reproduce

  1. Load aarch64 binary without .gnu_debugdata
  2. Attempt to debug stepping as normal

Observed Results

I get the following warning when loading the binary

GEF for linux ready, type `gef' to start, `gef config' to configure
76 commands loaded for GDB 8.2.1 using Python engine 3.7
[*] 4 commands could not be loaded, run `gef missing` to know why.
[+] Configuration from '/home/user/.gef.rc' restored
Reading symbols from binary...Reading symbols from .gnu_debugdata for /home/user/binary...(no debugging symbols found)...done.
[!] '.gnu_debugdata for /home/user/binary' not found/readable
[!] Failed to get file debug information, most of gef features will not work
(no debugging symbols found)...done.
gef➤  

Which probably confuses gef, since it identifies the code as x86:32:

────────────────────────────────────────────────────────────────────────────────────────────────── stack ────
[!] Command 'dereference' failed to execute properly, reason: Unknown register.
────────────────────────────────────────────────────────────────────────────────────────────── registers ────
──────────────────────────────────────────────────────────────────────────────────────────── code:x86:32 ────
   0x6fc195e880 <Object::Init()+168> b      0x6fc195e868 <_ZN10Object4InitEv+144>
   0x6fc195e884 <Object::Start()+0> ldr    x0,  [x0,  #16]
   0x6fc195e888 <Object::Start()+4> cbz    x0,  0x6fc195e898 <_ZN10Object5StartEv+20>
 → 0x6fc195e88c <Object::Start()+8> ldr    x8,  [x0]
   0x6fc195e890 <Object::Start()+12> ldr    x1,  [x8,  #24]
   0x6fc195e894 <Object::Start()+16> br     x1

But gdb detects the architecture correctly:
gef➤  show arch
The target architecture is set automatically (currently aarch64)

Expected results

As per the warning, I’m not expecting most of gef features to work (although to be honest, I haven’t researched why), but I expect the context and registers to be displayed correctly.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (14 by maintainers)

Most upvoted comments

Seems to have fixed it for me too, thanks!