Update: found a workaround - explained at the bottom
I'm trying to remote debug my program via a serial port.
On the target machine (arm, linux) (connected to host machine (Windows) via serial-to-usb) I connected via Putty and looked for ttyS*
in /dev
directory, but I don't have any. I have only tty[num]
(without the S
), and running:
dmesg | grep tty
as suggested here gives the following:
# dmesg | grep tty
Kernel command line: mxc_hdmi.only_cea=0 console=ttymxc1,115200 vmalloc=400M consoleblank=0 rootwait fixrtc root=/dev/mmcblk1p1
2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 58, base_baud = 5000000) is a IMX
21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 59, base_baud = 5000000) is a IMX
console [ttymxc1] enabled
So I tried to use ttymxc0
and ttymxc1
:
gdbserver /dev/ttymxc0 ./test/main
Process ./test/main created; pid = 253
Remote debugging using /dev/ttymxc0
and on host machine (Windows 7): (edited following comments)
gdb path/on/host/main
(gdb) target remote COM15
COM15: No such file or directory.
I see here that serial was broken at gdb 6.6, but I have gdb 7.7.
Why am I getting the No such file or directory error?
edit 2:
Although I had tried renaming the port to COM5 and it didn't help (same result), I renamed the port to COM2 and it worked for once and then it got out and stopped working:
(gdb) target remote COM2
Remote debugging using COM2
Ignoring packet error, continuing...
Malformed response to offset query, qOffsets //got out
(gdb) target remote COM2 //tried again, didn't work
COM2: No such file or directory.
The difference between COM2 and COM15 (besides the digits number) is that in Windows Device Manager COM2 appeared as "used", and COM15 (and COM5) did not. When I picked COM2 as the new name, Windows warned me that it's being used but I accepted the change anyway.
Now I cleared all COM ports and now it's working alternately (haven't succeeded actually debugging yet, but it's not falling on that "no such file or directory" error anymore).
edit 3:
So now target remote COM2
responds with "Remote debugging using COM2 , Malformed response..." when I'm not connected to the target via Putty. When I am connected via Putty, it says "COM2: No such file or directory". It's like the port is taken (by Putty) and gdb can't log into it.
I ended up connecting by TCP instead of serial line:
- Connect target to internet by ethernet cable
- edit
/etc/network/interfaces
to setup dhcp:
auto eth0
iface eth0 inet dhcp
- run
ifconfig
orip addr
on target to get the ip - run on target:
gdbserver [ip:port] ./path/to/executable/on/target
- run on host:
gdb path/to/executable/on/host/compiled/to/target
(gdb) target remote [target's ip:port]
This is a sufficient workaround for me.