Ubuntu14.04とかもう化石という感じですが、いまさらARM環境を構築しました。
適当にqemuとか入れます。
$ arm-linux-gnueabihf-gcc-4.8 hello.c $ qemu-arm -L /usr/arm-linux-gnueabihf ./a.out
一方のターミナルで
$ qemu-arm -L /usr/arm-linux-gnueabihf -g 1234 ./a.out
として、他方で
$ arm-none-eabi-gdb ./a.out (gdb) set sysroot /usr/arm-linux-gnueabi (gdb) target remote :1234 Remote debugging using :1234 warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration of GDB. Attempting to continue with the default armv5t settings. Cannot access memory at address 0x0 0xf67d6d10 in ?? () (gdb) b main Breakpoint 1 at 0x8440 (gdb) cont Continuing.
という感じです。
Breakpoint 1, 0x00008440 in main () (gdb) disas Dump of assembler code for function main: => 0x00008440 <+0>: push {r11, lr} 0x00008444 <+4>: add r11, sp, #4 0x00008448 <+8>: ldr r0, [pc, #12] ; 0x845c <main+28> 0x0000844c <+12>: bl 0x82dc 0x00008450 <+16>: mov r3, #0 0x00008454 <+20>: mov r0, r3 0x00008458 <+24>: pop {r11, pc} 0x0000845c <+28>: ldrdeq r8, [r0], -r4 End of assembler dump.
ARMアセンブラですね。
ところでgdb-arm-none-eabiを入れる際にこの問題にあたって、 sudo apt-get -o Dpkg::Options::="--force-overwrite" install gdb-arm-none-eabi -y
というワークアラウンドをしました。きびしい。