This post is going to be useless to almost everyone, yet hopefully eye opening and fascinating. Mostly, the purpose is so that I don’t have to discover this for the third time and can, at some later date, Google this, find my own article, and simply read about it. This is a tale of linkers and code optimization and perhaps the most elegant ELF loader magic I’ve ever seen.
Picking up right where we left off in our previous exercises. We’ve got a core due to an error. We fix the error by removing line 31 from myprog.c and rebuilding. The program runs now… prints out some text and pauses… to simulate a long-running program that we need to debug without disrupting too much. Let’s get a core! # UMEM_DEBUG=default ./myprog &  74502 read 25144 words. # echo '::gcore' | mdb -p `pgrep myprog` mdb: core.
So what’s this all about then? Debugging. I’ve written a lot of C, I still write a lot of C and I sure as hell end up debugging a lot of C. One thing that pisses me off is when I’ve got a core file, but I’ve no idea about the exact version or build of the ELF binary that produced it. The bottom line is that I still need to find the failure.
I’ve been using these computer things for a while. I’ve written what is now over 100k lines of production C code and many thousands of lines of code in a variety of other languages. I’ve seen my software run and I’ve run other people software. One thing they all have in common is their propensity to break under unforeseen circumstances. Shit happens. On my laptop, I don’t care much. I want nice, I want convenient, I want new and pretty and productive.
- OLDER POSTS
- page 1 of 2