I was doing assembler arm64 program (host x64 Linux ubuntu) with AArch64 bare-metal target (aarch64-none-elf) toolchain. I compiled and linked by this toolchain. Next I want to debug it with gdb toolchain. But it doesn't work. When i was on native arm64-8A device, gdb works fine. I want to know what i doing wrong. Meaby i must connect native arm64 device to toolchain gdb. But i don't want do this with qemu or connecting other device, only with x64 device with arm toolchain to debug. Meaby i need to add linked parameters. Or something like that, because target is bare-wire without os. I tried with AArch64 GNU/Linux target (aarch64-none-linux-gnu) toolchain on (host x64 Linux ubuntu) and the same error was.
Need I to connect native arm device with gdbserver to gdb toolchain works fine ? The Arch64 GNU/Linux target (aarch64-none-linux-gnu) toolchain need native device to gdb or only bared wire toolchain. Or only configuration is important.
My terminal:
hubert@hubert-HP-ZBook-15-G3:~/Assembly/assembly toolchain$ aarch64-none-elf-as -o str11.o str11.s
hubert@hubert-HP-ZBook-15-G3:~/Assembly/assembly toolchain$ aarch64-none-elf-ld -o str11 str11.o
hubert@hubert-HP-ZBook-15-G3:~/Assembly/assembly toolchain$ chmod +x str11
hubert@hubert-HP-ZBook-15-G3:~/Assembly/assembly toolchain$ aarch64-none-elf-gdb str11
GNU gdb (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 14.2.90.20240526-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=aarch64-none-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.linaro.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from str11...
(No debugging symbols found in str11)
(gdb) break _start
Breakpoint 1 at 0x400008
(gdb) run
Don't know how to run. Try "help target".
(gdb) target exec str11
(gdb) run
Don't know how to run. Try "help target".
(gdb) quit
hubert@hubert-HP-ZBook-15-G3:~/Assembly/assembly toolchain$ aarch64-none-elf-ld -g -o str11 str11.o
hubert@hubert-HP-ZBook-15-G3:~/Assembly/assembly toolchain$ chmod +x str11
hubert@hubert-HP-ZBook-15-G3:~/Assembly/assembly toolchain$ aarch64-none-elf-gdb str11
GNU gdb (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 14.2.90.20240526-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=aarch64-none-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.linaro.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from str11...
(No debugging symbols found in str11)
(gdb) break _start
Breakpoint 1 at 0x400008
(gdb) run
Don't know how to run. Try "help target".
(gdb)
My code:
.section .data
.section .text
.global _start
_start:
mov w1, #5
mov w2, #6
b mylabel
mylabel:
add w4, w1, w2
b result
result:
mov w0, w4
b _exit
_exit:
mov w7, #0
svc #0
That is because the bare metal gdb is expecting to connect to a remote gdbstub which understands how to implement breakpoints. As you are running the program under linux you should be able to use the normal aarch64 GDB to debug this.