Archive for the ‘Programming’ Category
Last day in Novell.
Started out as an intern in the GNOME team about 5 years back. Jumped between Evolution and iFolder a few times for different (voluntary/involuntary) reasons. Met a lot of good engineers. Had both good / bad times. Learned a lot work / non-work.
I loved working on Evolution, Evolution MAPI (may not be perfect, but had a awesome time with it And i’m yet to cash in on the few beers i’ve been offered), Attachment Reminder (Trivial, but looks like you guys liked/hated/loved it), Redesign of Evolution search bar and so on. Best bug that I’ve worked on so far was changing a ‘1’ to ‘-1’ in EText (Oh those early days! Had no clue what GDB can do.. Used hundreds of ‘printf’s, lots of coffee and tested the patience of office night guards and that adrenalin rush!). Thanks to Novell for the opportunity to contribute full-time and getting paid for that.
Special thanks to my mentor Srini. I’m looking forward for more new awesome fun things in GNOME.
I’ll miss the 1-1 coffee breaks talking games/gadgets/music, discussions on research papers that I don’t have a clue about, conversations during ‘tea breaks’ outside office (you would see me very inspired/productive after those sessions), thursday nights ;-) & nice friends that I found beyond ‘work’.
I wrote a small article for a internal magazine and few of my friends wanted me to post it to this blog.
This is for people who are new to GDB and still exploring itz features. So if you’ve used GDB for more than few weeks please ignore and skip :)
GDB – Scripting
A good majority of novice programmers tend to use printf functions to trace function calls and to printout the debug data. This forces you to change the code and compile again and again. To eliminate these superfluous tasks from your day-to-day work, use GDB. The GDB has facilities for scripting and helps in saving plenty of your time.
Tracing Function Calls
If you want to know whether a function is called or not, create a break point and write a simple script.
#Set the breakpoint
(gdb) b mapi_sync
Breakpoint 1 at 0x7fffd75f36e2: file camel-mapi-folder.c, line 741
#Tell GDB what to do when the breakpoint is reached
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just “end”.
continue – Come out of break and continue
end – terminate command list
Run the program now. The GDB prints the function name when the breakpoint is hit and automatically continues running the program.
Breakpoint 1, mapi_sync (folder=0xc9c1a0, expunge=0, ex=0xf3a0c0) at camel-mapi-folder.c:741
741 CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (folder->parent_store);
Using the GDB Scripts for Analyzing the Data
Suppose that you have a singly-linked list that has strings in it. At some point, you might want to know the contents of the list. To do this, use the GDB scripting instead of adding the debug statements in your code.
#Example for gslist traversal.
set $list = ($arg0)
while ((GSList *)$list->next != 0)
p (char *)(GSList *)$list->data
set $list = (GSList *)$list->next
p_gslist_str <list>: Dumps the strings in a GSList
Add the above snippet into a file and load it into the GDB as follows:
(gdb) source /home/jjohnny/scripts/gdb/gslist.gdb
Now, anywhere you want to take a look in the GSList, simply break and
(gdb) p_gslist_str server_uid_list
$17 = 0x7fffd81101b0 “7666BC1E000000015870BD1E00000001”
$18 = 0x7fffd810e330 “7666BC1E000000015970BD1E00000001”
$19 = 0x7fffd810cbe0 “7666BC1E000000015C70BD1E00000001”
Simple scripts thus can save you a lot of time from adding or removing the debugging statements from your code. Now go ahead and create a suite of scripts to aid the library you are writing.
More cool developer tricks later. Have fun !
— End —
Thanks to Radhika for editing the article.
I’ve written (incomplete) simple plugin for Evolution which provides a combo box + menu for switching folders. Now you can hide the sidebar. This really helps in freeing up some space in your screen and can have good vertical view layout. This would help computers with smaller screen size.
To try out this plugin / For more information : http://www.johnnyjacob.org/makespace.html .
One other feature that I would like to have is simple folder bookmarks. Bookmarked folders would appear in the top of the menu (You don’t have to navigate all the way down in the menus)
Let me know what you think and if you would like to have any features put it down in the comments. :)
We have moved away from libmapi 0.7 to libmapi trunk (0.8 development) , so we can take advantage of the new APIs.
We will be constantly updating our code base to libmapi trunk.
Suman is busy in integrating meetings into evolution. (few more tasks left)
I’m currently working on finishing (completing) off the basic features in mailer and will move to optimizing the sync & more.
Sadly, we won’t be able to make it to Evolution 2.24 as we are late (details here). :( Meanwhile we will continue to provide pluggable packages and this will be available as a pluggable provider. 2.26 will have this.
Update 1 : GUADEC Talk available here
Some of the workflows i like (and use) is something like this :
- Interrupted workflow (taken from git-reset man page)
- Suppose you are interrupted by an urgent fix request while you are in the middle of a large change. The files in your working tree are not in any shape to be committed yet, but you need to get to the other branch for a quick bugfix.
$ git checkout feature ;# you were working in "feature" branch and $ work work work ;# got interrupted $ git commit -a -m 'snapshot WIP' (1) $ git checkout master $ fix fix fix $ git commit ;# commit with real log $ git checkout feature $ git reset --soft HEAD^ ;# go back to WIP state (2) $ git reset (3)
Isn’t that wonderful ! I was trying out svn + quilt. But very hard to manage.
Some resources :
- http://git.or.cz/course/svn.html – For SVN users : Understanding GIT.
- Fredrico : http://www.gnome.org/~federico/misc/git-cheat-sheet.txt
- git-svn man page : http://www.kernel.org/pub/software/scm/git/docs/v188.8.131.52/git-svn.html
- Nice starter git-svn tutorial : http://tsunanet.blogspot.com/2007/07/learning-git-svn-in-5min.html
- https://wiki.bnl.gov/dayabay/index.php?title=Synchronizing_Repositories#GIT_and_SVN (good one ! )
- http://youtube.com/watch?v=4XpnKHJAok8 – Linus talk ‘on’ GIT in Google (*not* how to use GIT)
My GIT Ref Card :
# Initialize a repo (like git init):
git-svn init http://svn.foo.org/project/trunk
# Fetch remote revisions:
# Create your own branch to hack on:
git checkout -b my-branch remotes/git-svn
# Merging in master.
git merge --squash foo-branch-name
# Do some work, and then commit your new changes to SVN, as well as
# automatically updating your working HEAD:
# Something is committed to SVN, rebase the latest into your branch:
git-svn fetch && git rebase remotes/git-svn
GIT is fast (super fast) ! and git-svn helps you if you are _stuck_ with svn !
Now GIT has moved out of my ‘staging area’ to everyday use. Yay!! I use it for GNOME/Evolution (and GNOME just moved to SVN a few months back ;-) )