book icon indicating copy to clipboard operation
book copied to clipboard

Arch Linux: `target remote :3333` "Connection timed out"; needs IP address

Open michd opened this issue 4 years ago • 1 comments

In 2.2 Hardware, the following gdb command is listend to connect to openocd:

(gdb) target remote :3333

When I ran this on my machine, it consistently timed out:

:3333: Connection timed out.

The command I'm invoking for the gbd console is:

arm-none-eabi-gdb -q target/thumbv7em-none-eabihf/debug/examples/hello

For some more version info, here's the output of arm-non-eabi-gdb --version:

GNU gdb (GDB) 9.2
<snip>

And openocd --version:

Open On-Chip Debugger 0.10.0
<snip>

Openocd is indeed running and listening on the correct port, as per netstat -tulpn | grep LISTEN:

tcp        0      0 0.0.0.0:3333            0.0.0.0:*               LISTEN      13303/openocd

Fix/workaround:

Seeing the 0.0.0.0 in there gave me the idea to try the following:

(gdp) target remote 0.0.0.0:3333

This results in the output described in the book, and allows me to continue.

Perhaps it would help some if this solution was added as a note in the book.

A further note, the same applies to the gdb script openocd.gdb, changing the first line from target extended-remote :3333 to target extended-remote 0.0.0.0:3333 fixes the later part that hit the same issue.

michd avatar Oct 02 '20 19:10 michd

Thank you for finding a fix for this. I would welcome a PR with it for a broader benefit.

eldruin avatar Jul 26 '23 08:07 eldruin