assume your pc ip is 192.168.0.141
your phone ip is 192.168.0.213
open one terminal
adb shell
cd /data/zxz
./gdbserver 192.168.0.141:1234 ./a.out
open another terminal
path/to/arm-gdb ./a.out
target remote 192.168.0.213:1234
an alternative way is to use local port on phone, then connect the port on phone and the one on pc
# on phone
gdbserver :1234 a.out
adb forward tcp:1234 tcp:1234
# on pc
path/to/arm-gdb ./a.out
target remote localhost:1234