How to debug a program via serial port?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to debug a program via serial port?

3,971 Views
alaam
Contributor I

I'm trying to debug an app sitting on my IMX6 board which is connected to PC by serial port, using gdb and gdbserver like described here and here.

I connect to the board by putty and run the following:

gdbserver --multi :2345

And I get:

Listening on port 2345

Then I run the following in Windows cmd (on the PC that the board is connected to via serial port):

arm-linux-gnueabihf-gdb

(gdb) target extended :2345

And after a few seconds, I get:

:2345: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

I also tried COM17:2345 instead of just :2345 and I got:

COM17:2345: No such file or directory.

(COM17 is the serial port I'm connected to as it appears in Device Manager)

Tags (2)
0 Kudos
3 Replies

2,934 Views
alaam
Contributor I

I was doing it wrong.
Now I'm doing the following on the target system:

gdbserver /dev/ttymxc0 ./test/main
Process ./test/main created; pid = 253
Remote debugging using /dev/ttymxc0

and the following on the host system:

gdb path/on/host/main --baud 115200
(gdb) target remote COM15
COM15: No such file or directory.

(COM15 is the serial port name on the host system)

Why am I getting "No such file or directory"?
Could it be that something's wrong in the board?

Thanks

0 Kudos

2,934 Views
alaam
Contributor I

Thanks, I will check the links.

And I have a newer version of gdb (7.7)  the serial is not broken in it.

However, I don't have ttyS0 in dev. Actually, I don't have any ttyS* in dev. I only have tty[num] (for example tty0). Does that say anything?

0 Kudos

2,934 Views
igorpadykov
NXP Employee
NXP Employee

Hi Alaa

seems it could be : gdbserver /dev/ttyS0 as described on
https://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_130.html
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0201a/index.html
however may be recommended to post it on GDB mailing list
https://sourceware.org/gdb/
as on some gdb versions serial was broken as for example reported on
https://sourceware.org/ml/gdb/2007-11/msg00006.html

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos