Monday Dec 07, 2009

Pet peeves on debugger..

On the topic of debuggers, here are some of my top most pet peeve when it comes to debuggers..

DBX

\* Hate pressing n every time to go to next line. For some reason, Sun Studio folks never provided a alias to 'Enter' key like the way we do have on GDB.

GDB

\* There is no nice way to display complex structures . For example, if you want to display a nested structure with some nested union / structure in it, good luck deciphering them. DBX's print does an excellent job on this .

\* Surprisingly for such a vibrant open source community, still there is no simple way to save your break points. If you need to save your breakpoints so that when you quit gdb and want to run again, you still need to do complex steps like

(gdb) info breakpoints

and  manually  copy the last column to some file or .gdbinit .

Come on, we are now living in Web 2.0 era where there is API's for every thing and at the least I would expect some thing like

(gdb) save-breakpoints.

Af course, one can write kludge macros to save your breakpoints etc.But, that is not elegant though... For some unknown reason, got into ranting mode. Ok, time to dump your head into your debugger..


GDB commands

Didn't realize that GDB had an option called 'commands' to execute extra commands after hitting a break point. That is pretty cool. For example, I can now do some thing like



(gdb) b <function name> if ($data)

(gdb) commands <breakpoint-number>
Type commands for when breakpoint 7 is hit, one per line.
End with a line saying just "end".

commands

silent

print $data

cont

end

 Af course, if you are using DBX on Solaris/OpenSolaris,you would do some thing like when { shell statements } .. Hope this helps some one..

About

Sharing what little I know

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today