Skip to main content

debug-binary-for-arm

Date created: 2024-10-01

Description

Normally, we would use gdb to debug binaries on linux, but we need a special setup to debug binaries targetting the ARM architecture while working on a x86 based computer.

Prerequisites

  • gdb-multiarch

Setup

  • Install gdb-multiarch
$ sudo apt install gdb-multiarch
  • Build as shown in [[build-binary-for-arm]].

  • Run the programme in gdb server using [[qemu]]

$ qemu-arm <./binary-name> -g 4242
  • Debug the programme
$ gdb-multiarch 
(gdb) file <./binary-name>
(gdb) target remote localhost:4242