0
votes

Qemu terminated with the log : "QEMU: Terminated via GDBstub" when I tried to connect to QEmu from GDB . I started the QEMU with the following command in one terminal :

qemu-system-arm -serial telnet:localhost:1235,server,nowait,ipv4 -serial telnet:localhost:1236,server,nowait,ipv4 -serial telnet:localhost:1238,server,nowait,ipv4 -gdb tcp:localhost:1234,server,ipv4 -kernel ./build/final.elf -M versatilepb -nographic -m 256 -S

And then in another terminal I started GDB with the command : arm-none-eabi-gdb --command=~/.gdbinit

And the file .gdbinit contains the text:

set history save on set logging on target remote localhost:1234 load ./build/final.elf sym ./build/final.elf b break_virtual

Can you please let me know whats going wrong here?

1

1 Answers

0
votes

GDB automagically loads ~/.gdbinit

so when you load .gdbinit via --command=~/.gdbinit

it runs the script twice,

when it gets to the 2nd invocation of target remote localhost:1234

gdb hangs up its initial connection, qemu quits,

then gdb fails to reconnect to it because it is no longer running.

Either get rid of the --command option or rename the file.