-git: checkout: +--ignore-other-worktrees
[nethome.git] / .gdbinit
1 add-auto-load-safe-path ~/src/stock
2 add-auto-load-safe-path ~/src/interview/.gdbinit
3 add-auto-load-safe-path ~/src/interview/asan/*-gdb.gdb
4 add-auto-load-safe-path ~/src/toptal.com-codility.com/.gdbinit
5 add-auto-load-safe-path ~/src/toptal.com-codility.com/asan/*-gdb.gdb
6 define bt
7         disable frame-filter all
8         backtrace
9 end
10
11 set break pending on
12 set style enabled off
13 # See .bashrc: export GDBHISTFILE="$HOME/.gdb_history"
14 # Should also work <jefyi6bzm6.fsf@sykes.suse.de> (untested):
15 # set history filename ~/.gdb_history
16 set history save on
17 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=106814
18 set complaints 0
19 set record full insn-number-max 10000000
20 define javadump
21         call _Jv_DeepDebug($arg0)
22 end
23 document javadump
24 call _Jv_DeepDebug($arg0)
25 end
26 define pglist
27         if (*("$arg1")=='@')
28                 set var $arg1=struct $arg1
29         end
30         set var $pglist_list=$arg0
31         while ($pglist_list)
32                 if $argc==2
33                         print *(($arg1 *)$pglist_list->data)
34                 else
35                         print *(($arg1 *)$pglist_list->data)$arg2
36                 end
37                 set var $pglist_list=$pglist_list->next
38         end
39 end
40 document pglist
41 GList or GSList dumper iterating by `->next':
42 pglist <head pointer> {<data type>|@<struct data type>} [<data field to display>]
43 end
44 define plist
45         set var $plist_iter=$arg0
46         while ($plist_iter)
47                 if $argc==1
48                         print *$plist_iter
49                 else
50                         if $argc==2
51                                 print $plist_iter->$arg1
52                         else
53                                 print$arg2 $plist_iter->$arg1
54                         end
55                 end
56                 set var $plist_iter=$plist_iter->next
57         end
58 end
59 document plist
60 List dumper iterating by `->next':
61 plist <head pointer> [<data field to display>] [/<format>]
62 end
63 define countlist
64         set var $countlist_iter=$arg0
65         set var $countlist_count=0
66         while ($countlist_iter)
67                 set var $countlist_iter=$countlist_iter->next
68                 set var $countlist_count=$countlist_count+1
69         end
70         p $countlist_count
71 end
72 document countlist
73 List elements counter iterating by `->next':
74 countlist <head pointer>
75 end
76 define debug
77         set debug infrun 1
78         set debug lin-lwp 1
79 end
80 document debug
81 set debug infrun 1
82 set debug lin-lwp 1
83 end
84 define sip
85         stepi
86         x/i $pc
87 end
88 define nip
89         nexti
90         x/i $pc
91 end
92
93 define mycommand
94   set $i = 0
95   set $foo1=$arg1
96   while $i < $argc
97     eval "print $foo%d", $i
98     set $i = $i + 1
99   end
100 end