forked from signalwire/freeswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gdbinit
executable file
·127 lines (116 loc) · 2.74 KB
/
.gdbinit
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
handle SIGPIPE pass noprint nostop
handle SIGTTIN pass noprint nostop
# FreeSWITCH Custom GDB commands
define list_sessions
dont-repeat
printf "Listing sessions: \n"
set $i = 0
set $idx = 0
set $len = session_manager.session_table->tablelength
while($idx < $len)
set $x = session_manager.session_table->table[$idx]
while($x != 0x0)
printf "uuid %s is at %p\n", $x->k, $x->v
set $i = $i + 1
set $x = $x->next
end
set $idx = $idx + 1
end
printf "Found %d sessions.\n", $i
end
document list_sessions
Print a list of session uuid and pointers
end
define hash_it_str
dont-repeat
set $i = 0
set $idx = 0
set $len = $arg0->tablelength
printf "len: %d\n", $arg0->tablelength
while($idx < $len)
set $x = $arg0->table[$idx]
while($x != 0x0)
printf "key: %s valueptr: %p\n", $x->k, $x->v
set $x = $x->next
set $i = $i + 1
end
set $idx = $idx + 1
end
end
document hash_it_str
Usage: hash_it_str [hashtable]
Prints the content of a hashtable displaying the key as a string and the value as pointer
end
define hash_it_str_x
dont-repeat
set $i = 0
set $idx = 0
set $len = $arg0->tablelength
while($idx < $len)
set $x=$arg0->table->[$idx]
while($x != 0x0)
printf "key: %s\n", $x->k
print (($arg1*)$x->v)->$arg2
printf "\n\n"
set $x = $x->next
set $i = $i + 1
end
end
end
document hash_it_str_x
Usage: hash_it_str_x [hashtable] [value_type] [member]
Prints the content of a hashtable displaying the key as a string and a specific member of the value struct. Args: hashtable value_type member
end
define event_dump
dont-repeat
set $x = $arg0->headers
while($x != 0x0)
printf "%s = %s\n", $x->name, $x->value
set $x = $x->next
end
end
document event_dump
Usage: event_dump [switch_event_t*]
Print an event's headers and values
end
define print_list
dont-repeat
set $x = $arg0
while ($x != 0x0)
print *$x
set $x = $x->next
end
end
document print_list
Usage print_list [symbol]
Prints all the remaining elements of a linked list
end
define print_tags
dont-repeat
set $x = $arg0
while (*((int*)$x) != 0x0)
info sym $x->t_tag
printf "%p \"%s\"\n", $x->t_value, $x->t_value
set $x = $x + 1
end
end
document print_tags
Usage print_tags [tags]
List sofia tags and their values
end
define setup_session
set $session=(switch_core_session_t*)$arg0
set $channel = $session->channel
printf "UUID: %s\nName: %s\nState: %d\n", $session->uuid_str, $channel->name, $channel->state
end
document setup_session
Usage setup_session [session address]
Sets session and channel from the given address
end
define setup_sofia
set $tech_pvt = (private_object_t*)$session->private_info
set $nh = $tech_pvt->nh
end
document setup_sofia
No arguments. Sets nh and tech_pvt from the current session
end