1

I'm running ARM Ubuntu on a virtual machine inside a mac M1.

I am doing a series of binary reverse engineering exercises where binaries have been supplied in i386.

At first I couldn't run or open a debugger on these files at all. But I found a way. I downloaded qemu and the linux/c shared libraries for the i386 and can run the executable like this:

qemu-i386 -L /usr/i686-linux-gnu $BINARY

I can also open the binary with gdb-multiarch and do disas main which shows some assembly for the function, but if I try to do r and run the binary inside gdb or add breakpoints or anything like that I get this error message:

warning: Selected architecture i386 is not compatible with reported target architecture aarch64
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug share library initializers and
track explicitly loaded dynamic code.
Cannot instert breakpoint -1
Cannot access memory at address ....

Doing set architecture i386 before or after attempting to run doesn't change anything.

What am I missing? Is this possible?

Christopher Reid
  • 4,318
  • 3
  • 35
  • 74
  • You connected gdb to qemu, right? I don't see that on your command line. – Jester Apr 20 '22 at 22:22
  • @Jester I'm not sure how to do this... – Christopher Reid Apr 20 '22 at 23:47
  • 2
    Not sure which qemu version you are using but consult its manual and look for the gdb option. Could be `-s` or `-g`. Then in gdb connect via `target remote`. – Jester Apr 20 '22 at 23:59
  • Basically the opposite question from [How to single step ARM assembly in GDB on QEMU?](https://stackoverflow.com/a/51310791) but the answer should be about the same, just swapping arm for i386 as the target. – Peter Cordes Apr 21 '22 at 00:17

0 Answers0