Danny
Danny

Reputation: 2673

gdb crashes my machine. How to debug?

We're writing a fairly large system built with a collection of C++ programs. (which heavily use shared libraries)

When trying to debug any of the programs with gdb the entire machine will instantly crash and reboot if you set a break point and (I guess) the program hits the breakpoint.

I don't know where to start. There is nothing in /var/log/messages. dmesg shows only the machine is booting again.

A monitor connected will quickly flash (I guess) a kernel panic message, and then its gone. Can't even read what it is. Centos 6 32 bit Distribution with:

# uname -a
Linux 3.16.6 #1 SMP Fri Oct 31 18:56:38 SGT 2014 i686 i686 i386 GNU/Linux
# gdb --version
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)

There doesn't seem to be any log files I can find.

What to do? Debugging the huge system with print statements is taking forever. Rebuild the kernel? Any procedures or recommendations appreciated.

Upvotes: 1

Views: 696

Answers (1)

Greg Law
Greg Law

Reputation: 79

If you're getting a kernel panic, obviously you need to capture the output before the machine reboots. A couple of ways to do this are:

  1. connect a serial line to the server, and have the console echo on serial. To do this you need to pass, say, console=ttyS0 on the kernel command line when you boot. Or alternatively,

  2. use netconsole to send packets on the network and monitor these from another machine.

There are other options that might help too -- see here for more: https://wiki.ubuntu.com/Kernel/KernelDebuggingTricks

That said, you'll still need to fix whatever is wrong, of course. Sounds as though you're running a custom kernel -- can you take a different kernel revision (where hopefully the bug is fixed)?

Greg

Upvotes: 3

Related Questions