+define countlist
[nethome.git] / .gdbinit
1 # See .bashrc: export GDBHISTFILE="$HOME/.gdb_history"
2 # Should also work <jefyi6bzm6.fsf@sykes.suse.de> (untested):
3 # set history filename ~/.gdb_history
4 set history save on
5 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=106814
6 set complaints 0
7 define javadump
8         call _Jv_DeepDebug($arg0)
9 end
10 document javadump
11 call _Jv_DeepDebug($arg0)
12 end
13 define pglist
14         if (*("$arg1")=='@')
15                 set var $arg1=struct $arg1
16         end
17         set var $pglist_list=$arg0
18         while ($pglist_list)
19                 if $argc==2
20                         print *(($arg1 *)$pglist_list->data)
21                 else
22                         print *(($arg1 *)$pglist_list->data)$arg2
23                 end
24                 set var $pglist_list=$pglist_list->next
25         end
26 end
27 document pglist
28 GList or GSList dumper iterating by `->next':
29 pglist <head pointer> {<data type>|@<struct data type>} [<data field to display>]
30 end
31 define plist
32         set var $plist_iter=$arg0
33         while ($plist_iter)
34                 if $argc==1
35                         print *$plist_iter
36                 else
37                         print $plist_iter->$arg1
38                 end
39                 set var $plist_iter=$plist_iter->next
40         end
41 end
42 document plist
43 List dumper iterating by `->next':
44 plist <head pointer> [<data field to display>]
45 end
46 define countlist
47         set var $countlist_iter=$arg0
48         set var $countlist_count=0
49         while ($countlist_iter)
50                 set var $countlist_iter=$countlist_iter->next
51                 set var $countlist_count=$countlist_count+1
52         end
53         p $countlist_count
54 end
55 document countlist
56 List elements counter iterating by `->next':
57 countlist <head pointer>
58 end
59 define debug
60         set debug infrun 1
61         set debug lin-lwp 1
62 end
63 document debug
64 set debug infrun 1
65 set debug lin-lwp 1
66 end
67 define sip
68         stepi
69         x/i $pc
70 end
71 define nip
72         nexti
73         x/i $pc
74 end