Wednesday, October 7, 2009

Threads in GDB

I was recently facing some issue with a multi threaded program. The program was getting terminated because one thread was dying and it was causing a broken pipe in other threads. Now, there were multiple threads that are opening a pipe. The program had quite a few number of threads. Hence I could not find out which thread was misbehaving and causing the entire application to fail. However, this made me to look into threads support in GDB.

I found the following interesting articles on the net on debugging threads using gdb.

Here is a summary of commands

1. info threads
Shows information on threads

2. thread
Allows you to switch to that thread. Then you can do a bt or something similar

3. break file.c:lineno thread if condition
Allows to set a break point conditionally for a specific thread

4. set print thread-events on
Turns on printing entry and exit of a thread

5. thread apply args
Applies a command to a thread/all threads

I still don't know how to tackle my issue of dying thread. However, I expect a combo of 3,4 might shed some light. I will post the details tomorrow after trying.

Sunday, October 4, 2009

Picasa name tags

Well, I noticed this only recently. Today while adding a few photos to Picasa, I experienced the power of this feature myself. It could,

1. Detect almost all faces present in the images
2. Relate a number of detected photos and recognize they are photos of same person
3. Suggest close matches for most of the photos from already tagged photos.

The below image is a screenshot of google detecting almost all occurrences of my face from an album and suggesting that it is me! It has made a single mistake but that is the picture of one of my paternal uncle.

There was one more amazing factor. For every picture it was making some suggestions. The suggestions were mainly either a correct match or a person who is of close blood relation!

Well, I am not an expert in this field. But, I can see Google coming up with real image search in near future. Well done Google.