Recently while working on a project I was trying to debug data corruption on an STL vector using gdb. If you have used gdb for debugging C++ code you probably are aware that trying to print a vector using the standard gdb print command returns a rather cryptic output that is hard to decipher and make sense of. But as the deadline approached and as I continued smashing my head on my desk in desperate need of a fix I figured out that a vector was losing all its between two points in the flow of the program. That’s when I wondered that there must be an easier way to watch vectors. A few searches later I came across this wonderful piece of work by Dr. Eng. Dan C. Marinescu that adds STL container support to gdb. The detailed information page and related links can be found on this wiki. But to make it simple, if you’re looking only for STL support in your gdb version 7 or higher, just download the configuration file from here and add the line source <full_path>/stl-views-1.0.3.gdb to your gdbinit file. On Ubuntu 10.04 this file is in the /etc/gdb/ directory. Of course you can locate the file using the locate gdbinit command and then modify it.
A list of commands that may be used to manipulate STL components using gdb can be found here. I hope this helps.
Latest Entries »
I often think it is harder to figure out one’s own reactions to certain events than it is to solve a complex mathematical problem. I envy those enlightened ones who claim to “know themselves” as that’s one knowledge I would certainly like to gain. This reflection stems from the events of the past week. I had been highly motivated to work in the lab last week. So much so that I spent days and nights in the lab for all days of last week. Sunday was another story though. I went on a hike to Avatar Grove, an ancient forest which stares extinction due to the callous attitude of the provincial government of British Columbia towards old=growth forests. They communicate in usual government speak which involves distorted and often ignorant numbers that are protruded in ways to justify their course of actions. This hike was organized by this fantastic volunteer organization, Ancient Forest Alliance which I am very excited to be a part of. Avatar Grove is one special forest that houses trees that have lasted hundreds (even up to a thousand) of years and form an intricate ecosystem that is teeming with life. There are very few of these old growth forests that still stand on this beautiful planet as gifts of nature. Ridding the land of these giants will add yet another crime to the endless of lists of horrid crimes that we humans have committed against mother nature.
As always, I ended up digressing on to an entirely different issue from the issue at hand. So this visit to this ancient forest with a group of concerned and active individuals was very refreshing. But the forest as always intrigued me and left an impact that I am still reeling with. I feel this strong urge to quit what I am doing and go back to the jungle. Here I was, happy to be motivated about working hard again, working hard to make machines more important in our lives and finding more ways to arrest the remaining fragments of humanity into the virtual worlds of zombie machines created by streams 0s and 1s and then there was one single encounter with mother nature that completely blew me away. I feel like a sinner with no regret, an encroaching parasite who wants the comfort of sleeping in mother nature’s lap but shies away from protecting her. What am I to do?
It has been a really long time since I have been updating my blog and I believe my schedule now permits me to write a little more frequently. If not anything else, I will update this place with my daily thoughts. One excuse I have afforded myself for not updating is that no one really reads my blog since I don’t publicize it. But I noticed that this website has been getting daily hits and now I feel embarrassed about the incomplete sections and lack of updates. So in the coming days, I will update the incomplete sections and also post more frequently. If you have visited this website before, you may also notice that I have been considering and playing around with prospective themes that I would like to change to. For now I am sticking to this theme from mono-lab and once I have made up my mind about the theme, I shall customize it. Thanks to the people (or even bots) who have been dropping by on this website and thanks for your patience!
I wouldn’t remember the last time I wrote a blog post had it not been for the date field in the post below. I just had my 26th birthday and I have reached an important conclusion this year. My secret dreams of becoming a person of significance may never really come true. Although time has reminded me over and over that I am no genius by putting me in the company of smarter men, I somehow saw them as shallow and kept clinging on to this romantic dream of making significant and noteworthy contributions to the human race and to this world.
This year I have realized that I am already 26 and the world now boasts of great people who are much younger than me from different walks of life. Resetting my secret dreams to align with reality has led me to just keep the desire of being able to make some contributions to the human race and to this world. I do not know if I will be able redeem myself from the disappointment of this realization or maybe I should just live with the romance!
