2
0

.gdbinit 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. handle SIGPIPE pass noprint nostop
  2. handle SIGTTIN pass noprint nostop
  3. # FreeSWITCH Custom GDB commands
  4. define list_sessions
  5. dont-repeat
  6. printf "Listing sessions: \n"
  7. set $i = 0
  8. set $idx = 0
  9. set $len = session_manager.session_table->tablelength
  10. while($idx < $len)
  11. set $x = session_manager.session_table->table[$idx]
  12. while($x != 0x0)
  13. printf "uuid %s is at %p\n", $x->k, $x->v
  14. set $i = $i + 1
  15. set $x = $x->next
  16. end
  17. set $idx = $idx + 1
  18. end
  19. printf "Found %d sessions.\n", $i
  20. end
  21. document list_sessions
  22. Print a list of session uuid and pointers
  23. end
  24. define hash_it_str
  25. dont-repeat
  26. set $i = 0
  27. set $idx = 0
  28. set $len = $arg0->tablelength
  29. printf "len: %d\n", $arg0->tablelength
  30. while($idx < $len)
  31. set $x = $arg0->table[$idx]
  32. while($x != 0x0)
  33. printf "key: %s valueptr: %p\n", $x->k, $x->v
  34. set $x = $x->next
  35. set $i = $i + 1
  36. end
  37. set $idx = $idx + 1
  38. end
  39. end
  40. document hash_it_str
  41. Usage: hash_it_str [hashtable]
  42. Prints the content of a hashtable displaying the key as a string and the value as pointer
  43. end
  44. define hash_it_str_x
  45. dont-repeat
  46. set $i = 0
  47. set $idx = 0
  48. set $len = $arg0->tablelength
  49. while($idx < $len)
  50. set $x=$arg0->table->[$idx]
  51. while($x != 0x0)
  52. printf "key: %s\n", $x->k
  53. print (($arg1*)$x->v)->$arg2
  54. printf "\n\n"
  55. set $x = $x->next
  56. set $i = $i + 1
  57. end
  58. end
  59. end
  60. document hash_it_str_x
  61. Usage: hash_it_str_x [hashtable] [value_type] [member]
  62. 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
  63. end
  64. define event_dump
  65. dont-repeat
  66. set $x = $arg0->headers
  67. while($x != 0x0)
  68. printf "%s = %s\n", $x->name, $x->value
  69. set $x = $x->next
  70. end
  71. end
  72. document event_dump
  73. Usage: event_dump [switch_event_t*]
  74. Print an event's headers and values
  75. end
  76. define print_list
  77. dont-repeat
  78. set $x = $arg0
  79. while ($x != 0x0)
  80. print *$x
  81. set $x = $x->next
  82. end
  83. end
  84. document print_list
  85. Usage print_list [symbol]
  86. Prints all the remaining elements of a linked list
  87. end
  88. define print_tags
  89. dont-repeat
  90. set $x = $arg0
  91. while (*((int*)$x) != 0x0)
  92. info sym $x->t_tag
  93. printf "%p \"%s\"\n", $x->t_value, $x->t_value
  94. set $x = $x + 1
  95. end
  96. end
  97. document print_tags
  98. Usage print_tags [tags]
  99. List sofia tags and their values
  100. end
  101. define setup_session
  102. set $session=(switch_core_session_t*)$arg0
  103. set $channel = $session->channel
  104. printf "UUID: %s\nName: %s\nState: %d\n", $session->uuid_str, $channel->name, $channel->state
  105. end
  106. document setup_session
  107. Usage setup_session [session address]
  108. Sets session and channel from the given address
  109. end
  110. define setup_sofia
  111. set $tech_pvt = (private_object_t*)$session->private_info
  112. set $nh = $tech_pvt->nh
  113. end
  114. document setup_sofia
  115. No arguments. Sets nh and tech_pvt from the current session
  116. end