Skip to contentSkip to conversation

kgdb debug with ttyUSB0 instead of ttyS0

DISCUSSION Oliver Graute 4 participants 7 messages Apr 25, 2017 – Apr 29, 2017

lore
Share & tools
lore
#0 lore raw

Hello list,

i'am using a null modem cable with two usb to serial converts on both ends between my develop and my target machine. The connection is fine. On both machines the serial interface is /dev/ttyUSB0 for this connection.

On the target machine I try to enable kgdboc

echo ttyUSB0 > /sys/module/kgdboc/parameters/kgdboc

but only got:

echo write error: No such device

if I try:

echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc

is not complaining. Some ideas why ttyUSB0 can't be used with kgdb?

Best regards,

Oliver

#1 lore raw
Quoted 7 lines

echo ttyUSB0 > /sys/module/kgdboc/parameters/kgdboc

but only got:

echo write error: No such device

Is the USB-to-serial device detected on your target? Do you see a ttyUSB0 device node on your target? You can look at the kernel logs on your target when you insert the device. If the kernel has the drivers for it, you should see a device node being created.

-mandeep

Quoted 7 lines

if I try:

echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc

is not complaining. Some ideas why ttyUSB0 can't be used with kgdb?

Quoted 9 lines

Best regards,

Oliver

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170425/b0cebc56/attachment.html

#2 lore raw
In reply to Oliver Graute
Quoted 12 lines · Oliver Graute

Hello list,

i'am using a null modem cable with two usb to serial converts on both ends between my develop and my target machine. The connection is fine. On both machines the serial interface is /dev/ttyUSB0 for this connection.

On the target machine I try to enable kgdboc

echo ttyUSB0 > /sys/module/kgdboc/parameters/kgdboc

but only got:

Quoted 7 lines

echo write error: No such device

if I try:

echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc

is not complaining. Some ideas why ttyUSB0 can't be used with kgdb?

USB needs interrupts in order to run properly, which kgdb doesn't enable when you stop the target, for obvious reasons :)

Stick to a "real" serial connection and you should be fine.

good luck!

greg k-h

#3 lore raw
Quoted 15 lines · Greg KH
Quoted 14 lines · Oliver Graute

Hello list,

i'am using a null modem cable with two usb to serial converts on both ends between my develop and my target machine. The connection is fine. On both machines the serial interface is /dev/ttyUSB0 for this connection.

On the target machine I try to enable kgdboc

echo ttyUSB0 > /sys/module/kgdboc/parameters/kgdboc

but only got:

echo write error: No such device

Quoted 8 lines
Quoted 5 lines

if I try:

echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc

is not complaining. Some ideas why ttyUSB0 can't be used with kgdb?

USB needs interrupts in order to run properly, which kgdb doesn't enable when you stop the target, for obvious reasons :)

ok that make sense

Quoted 1 line

Stick to a "real" serial connection and you should be fine.

thats not so easy. Even the old notebooks today lacks a "real" serial connection. Perhaps I should use a raspberry as target. There I can get a serial over the gpios.

Best Regards,

Oliver

#4 lore raw
Quoted 25 lines · Oliver Graute
Quoted 15 lines · Greg KH
Quoted 14 lines · Oliver Graute

Hello list,

i'am using a null modem cable with two usb to serial converts on both ends between my develop and my target machine. The connection is fine. On both machines the serial interface is /dev/ttyUSB0 for this connection.

On the target machine I try to enable kgdboc

echo ttyUSB0 > /sys/module/kgdboc/parameters/kgdboc

but only got:

echo write error: No such device

Quoted 8 lines
Quoted 5 lines

if I try:

echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc

is not complaining. Some ideas why ttyUSB0 can't be used with kgdb?

USB needs interrupts in order to run properly, which kgdb doesn't enable when you stop the target, for obvious reasons :)

Quoted 7 lines

ok that make sense

Quoted 1 line

Stick to a "real" serial connection and you should be fine.

thats not so easy. Even the old notebooks today lacks a "real" serial connection. Perhaps I should use a raspberry as target. There I can get a serial over the gpios.

Why do you need to use a notebook where Linux works already for kgdb? That's traditionally only used to bring up new hardware platforms.

Also, there is USB serial debugging cables as there is a special mode in the USB 2 and 3 controllers that can be enabled to handle serial messages without interrupts for console/printk early messages that people use. The cables are not cheap to enable this, but worth it if you have to debug this type of target system.

Good luck!

greg k-h

#5 lore raw

The options you suggested are not clear to me. Can you elaborate how I would debug live kernel when all I have on the two systems is usb. Can you list the cable that I can use/order.

Thanks.

Quoted 55 lines · Greg KH
Quoted 6 lines · Oliver Graute
Quoted 5 lines · Greg KH
Quoted 4 lines · Oliver Graute

Hello list,

i'am using a null modem cable with two usb to serial converts on both ends between my develop and my target machine. The connection is

fine.

Quoted 1 line
Quoted 1 line
Quoted 1 line

On both machines the serial interface is /dev/ttyUSB0 for this

connection.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

On the target machine I try to enable kgdboc

echo ttyUSB0 > /sys/module/kgdboc/parameters/kgdboc

but only got:

echo write error: No such device

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

if I try:

echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc

is not complaining. Some ideas why ttyUSB0 can't be used with kgdb?

USB needs interrupts in order to run properly, which kgdb doesn't

enable

Quoted 9 lines
Quoted 1 line

when you stop the target, for obvious reasons :)

ok that make sense

Quoted 1 line

Stick to a "real" serial connection and you should be fine.

thats not so easy. Even the old notebooks today lacks a "real" serial connection. Perhaps I should use a raspberry as target. There I can get a serial over the gpios.

Why do you need to use a notebook where Linux works already for kgdb? That's traditionally only used to bring up new hardware platforms.

Also, there is USB serial debugging cables as there is a special mode in the USB 2 and 3 controllers that can be enabled to handle serial messages without interrupts for console/printk early messages that people use. The cables are not cheap to enable this, but worth it if you have to debug this type of target system.

Good luck!

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Signature · 4 lines
JS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170426/b98a4473/attachment.html 
#6 lore raw
In reply to Greg KH
Quoted 2 lines · Greg KH

Why do you need to use a notebook where Linux works already for kgdb? That's traditionally only used to bring up new hardware platforms.

I just used a old notebook as target to learn how-to debug with kgdb. inspired by the debugging Chapter 4 in the LDD3 Book.

Quoted 5 lines

Also, there is USB serial debugging cables as there is a special mode in the USB 2 and 3 controllers that can be enabled to handle serial messages without interrupts for console/printk early messages that people use. The cables are not cheap to enable this, but worth it if you have to debug this type of target system.

can you point us to such a cable?

Best Regards,

Oliver