I'm experiencing strange bug when I close lid of my laptop - system freezes (no reaction on keys, no response form ssh) hard and displays some strange colour effects. The kernel log (after reboot) shows nothing. My question is - how to debug it? Maybe there's a way to track last called kernel function or something similar?
The kernel probably did log some information, but they never made it on time to the disk. If your laptop has got a serial port, set the kernel to use it as console (add
console=ttyS[X] as boot option); you will see the messages there from another machine as it happens. If not, you can use an Ethernet port and try netconsole.