Hi,
The Linux kernel is unfortunately not as well-designed in terms of debugging as the Windows one, so unless you are using JTAG or VMWare that runs on top of the kernel, random hanging could happen. Our best advice would be to try disabling all CPU cores except #0. This should reduce the chance of deadlocks in the kernel.
Also if this is possible, we would advise getting a special machine with a JTAG connection. Although this is slower than debugging over serial port, this will be 100% reliable as the debugging logic will run on top of the kernel without sharing any resources with it.