Johnny [Life & Code]

Semper Exploro!

Archive for the ‘Linux Fun’ Category

Push Email for GNOME Evolution’s Exchange MAPI provider (exchange 2007)

with 13 comments

 

After few days of crazy bug hunting (and creating the same) , we have a nice push event notification framework for Evolution-MAPI. When Evolution is running all the changes happening in user’s mailbox in server would immediately be synced. This avoids those long fetches from server.  A short screen cast (watch in HD) :
Currently I’ve got “new mail” event handled and is limited to mailer. Would be working on other events. This feature has some major issues to be solved before it can land in master.
It is FUN !

 

Written by Johnny

November 24, 2009 at 7:28 pm

GDB Scripting : A short article for a internal magazine

with 11 comments

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.

<code>

#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

(gdb) commands

Type commands for when breakpoint 1 is hit, one per line.

End with a line saying just “end”.

> continue

> end

(gdb)

</code>

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.

<code>

#Example for gslist traversal.

define p_gslist_str

set $list = ($arg0)

while ((GSList *)$list->next != 0)

p (char *)(GSList *)$list->data

set $list = (GSList *)$list->next

end

end

document p_gslist_str

p_gslist_str <list>: Dumps the strings in a GSList

end

</code>

Add the above snippet into a file and load it into the GDB as follows:

<code>

(gdb) source /home/jjohnny/scripts/gdb/gslist.gdb

</code>

Now, anywhere you want to take a look in the GSList, simply break and

<code>

(gdb) p_gslist_str server_uid_list

$17 = 0x7fffd81101b0 “7666BC1E000000015870BD1E00000001”

$18 = 0x7fffd810e330 “7666BC1E000000015970BD1E00000001”

$19 = 0x7fffd810cbe0 “7666BC1E000000015C70BD1E00000001”

</code>

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.

Btw when is Archer branch  (Python scripting) getting into GDB ? I’ve been using it a bit .

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 GNU Project Debugger. 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.
<code>
#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
(gdb) commands
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just “end”.
> continue
> end
(gdb)
</code>
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 to print out the data.
</code>
#Example for gslist traversal.
define p_gslist_str
set $list = ($arg0)
while ((GSList *)$list->next != 0)
p (char *)(GSList *)$list->data
set $list = (GSList *)$list->next
end
end
document p_gslist_str
p_gslist_str <list>: Dumps the strings in a GSList
end
</code>
Add the above snippet into a file and load it into the GDB as follows:
<code>
(gdb) source /home/jjohnny/scripts/gdb/gslist.gdb
</code>
Now, anywhere you want to take a look in the GSList, simply break
<code>
(gdb) p_gslist_str server_uid_list
$17 = 0x7fffd81101b0 “7666BC1E000000015870BD1E00000001”
$18 = 0x7fffd810e330 “7666BC1E000000015970BD1E00000001”
$19 = 0x7fffd810cbe0 “7666BC1E000000015C70BD1E00000001”
</code>
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 !

Written by Johnny

July 7, 2009 at 8:56 am

openSUSE 11.1 on PS3

with 9 comments

Woohoo ! After a long delays and issues (in the last few days) I’ve managed to install openSUSE 11.1 in my PS3.  Running a full blown desktop is very sluggish. Reminds me of my first computer (amdk6 500mhz). Some screenies :

6 SPEs

Now onto get the Cell SDK running … Synergetic Processing Elements (SPE) here i come !

Written by Johnny

July 4, 2009 at 10:41 am

Posted in CODE, GNOME, LIFE, Linux Fun, PS3, suse, Tech

Untitled

with one comment

Comments like http://blogs.gnome.org/sragavan/2009/03/18/announcing-anjal-the-new-mail-for-netbooks/#comments makes me do more at times like this 🙂

Proud to be part of Anjal (Pronounce as “An-jal” similar to “Brin-jal”).

Awesome !!!

Written by Johnny

March 19, 2009 at 9:48 am

1 reason to run GDB & 2 reasons to run emacs from source

with one comment

CODE :

GDB : Compiling from Project Archer, you get to have python scripting inside gdb. This opens up numerous possibilities and nice tricks that helps you to debug  faster. http://tromey.com/blog/?cat=17 has few example + demo scripts.  Falling in love  with these ..

EMACS : emacs 23 (in cvs) gives you MultiTTY Support , XFT Font rendering (and more). Looks better with XFT and multitty support rocks !

LIFE :

??

Written by Johnny

February 8, 2009 at 1:08 pm

Posted in CODE, Emacs, Linux Fun, Tech

foss.in 2008

leave a comment »

fossinshow_me_the_code1

Some of the sessions that i’m planning to attend :

Written by Johnny

November 25, 2008 at 1:30 am

Posted in LIFE, Linux Fun

Tagged with

GUADEC 2008 – Day 0 – 3

with 3 comments

Day 0 :

+ Reached Istanbul after 12 hrs through airports / immigration … .

+ Bahrain is very hot !

+ Gulf Air is not fun to fly . 4 + 4 hr flights. So itz alright.

+ Nice Apartment: Istanbul Sweet Home : My Turkisk Bath [Video]

Day 1 :

+ Srini introduced us to other hackers. Confession : I actually had the idea that GNOME hackers are Octopus with lot of (more than 8) tentacles for writing code.They are infact humans 😀

+ First BOF was fedrico’s GIT for GNOME. GIT is all good with cool workflows which is very flexible and you can adapt it to your workflow. But the question are

– Do we want to stick with one DVCS?

– Is there a way to inter-op with different DVCS, if yes ? how messy it is going to be to maintain ?

– And the learning curve for a newbie to learn using something like GIT (index , branches .. blah blah .. )

– I’m all for GIT.It perfectly fits my workflow and very flexible. I didn’t like bzr when i tried out long back. May be i should try it out now ..

+ Thanks to Burkay (one of the awesome volunteers in GUADEC). He helped us to find banks to get our Travellers Cheques cashed.

Day 2 :

+ Out of cash . Yep! Bankrupt. Had to change the our Travelers cheques. Well .. looks like they are not popular here. Well we did go to the corners of the city searching banks that do accept one. Finally we found one. But they need a “Tax Number” wtf ? Took a cab, showing the cabbie the “Tax Office” address (somebody scribbled it for us on paper. Thanks a lot ! ) He goes around & around and drops us just behind our apartment ! lol . Anyhoo .. walked a bit and found one. Few friendly people helped us to get “Tax Number”. Went to the bank cashed the maximum possible limit. What a day ! Totally exhausted walking around …

Day 3 :

+ Core days  : Met Miguel (Awesome) .

+ Interesting sessions. Interesting Talks. Well .. Really motivated. 🙂

+ Met Andre / Guenther / Muelli  (Pics later)

+ HPJ, Scott (from provo) , JP, Micheal ..

Very long post. Lot to write about. Anyhoo as many know, these posts are for helping my buggy MMU.

Written by Johnny

July 10, 2008 at 12:12 pm

Posted in GNOME, Linux Fun, Thoughts