Wednesday, 2 October 2013

Debugging a core? What tools do you use?

Whenever you have an application crash or become unstable and the worse part is that logs don't give you anything useful, what do you do? What tools could you use.

Well, one thing is strace. Running and tracing a process while it's doing its thing is one way. Crashing the process or generating a core with "gencore", gcore (aka gdb core) or something similar is another.

But what do you do when you want to capture the core and its dependencies on another machine to debug? 

On AIX IBM has snapcore. If you don't know this utility, read about it! It's a great tool but there is no equivalent in Linux. 

What can you do?

Well it turns out that gdb can provide a few things that make this easier. For example, gdb can list the libraries that are loaded in memory on the core. This is helpful so that you can gather those to bring in house.

So once you are in gdb you can do a "info sharedlib" and get this list.

Once you do that, you can collect the libraries that you need and use them to debug the core locally by loading them at the same time as you load the core and binary. You need to set some information when you are doing this.

I'll write another post with my way of doing this... and possibly a "snapcore" equivalent for Linux.

-P
Post a Comment