gdbinit 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2010-2012 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011 Centre National de la Recherche Scientifique
  5. #
  6. # StarPU is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # StarPU is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. define starpu-print-job
  17. set language c
  18. set $job = (struct _starpu_job *)$arg0
  19. printf "StarPU Job (%p)\n", $job
  20. printf "\ttask:\t\t\t\t<%p>\n", $job->task
  21. printf "\tsubmitted:\t\t\t<%d>\n", $job->submitted
  22. printf "\tterminated:\t\t\t<%d>\n", $job->terminated
  23. printf "\tjob_id:\t\t\t\t<%d>\n", $job->job_id
  24. if _starpu_use_fxt == 1
  25. if $job->model_name
  26. printf "\tmodel_name:\t\t\t<%s>\n", $job->model_name
  27. end
  28. end
  29. end
  30. document starpu-print-job
  31. Prints a StarPU job
  32. end
  33. define starpu-print-task
  34. set language c
  35. set $task = (struct starpu_task *)$arg0
  36. set $job = (struct _starpu_job *)$task->starpu_private
  37. if $task->status == 0
  38. set $status="STARPU_TASK_INVALID"
  39. end
  40. if $task->status == 1
  41. set $status="STARPU_TASK_BLOCKED"
  42. end
  43. if $task->status == 2
  44. set $status="STARPU_TASK_READY"
  45. end
  46. if $task->status == 3
  47. set $status="STARPU_TASK_RUNNING"
  48. end
  49. if $task->status == 4
  50. set $status="STARPU_TASK_FINISHED"
  51. end
  52. if $task->status == 5
  53. set $status="STARPU_TASK_BLOCKED_ON_TAG"
  54. end
  55. if $task->status == 6
  56. set $status="STARPU_TASK_BLOCKED_ON_TASK"
  57. end
  58. if $task->status == 7
  59. set $status="STARPU_TASK_BLOCKED_ON_DATA"
  60. end
  61. printf "StarPU Task (%p)\n", $task
  62. printf "\tcodelet:\t\t\t<%p>\n", $task->cl
  63. printf "\tcallback:\t\t\t<%p>\n", $task->callback_func
  64. printf "\tsynchronous:\t\t\t<%d>\n", $task->synchronous
  65. printf "\texecute_on_a_specific_worker:\t<%d>\n", $task->execute_on_a_specific_worker
  66. printf "\tworkerid:\t\t\t<%d>\n", $task->workerid
  67. printf "\tdetach:\t\t\t\t<%d>\n", $task->detach
  68. printf "\tdestroy:\t\t\t<%d>\n", $task->destroy
  69. printf "\tregenerate:\t\t\t<%d>\n", $task->regenerate
  70. printf "\tstatus:\t\t\t\t<%s>\n", $status
  71. printf "\tjob:\t\t\t\t<%p>\n", $job
  72. printf "\tndeps:\t\t\t\t<%u>\n", $job->job_successors->ndeps
  73. printf "\tndeps_completed:\t\t<%u>\n", $job->job_successors->ndeps_completed
  74. printf "\tnsuccs:\t\t\t\t<%u>\n", $job->job_successors->nsuccs
  75. if $job
  76. starpu-print-job $job
  77. end
  78. end
  79. document starpu-print-task
  80. Prints a StarPU task
  81. end
  82. define starpu-tasks-on-worker
  83. set language c
  84. set $worker=config->workers[$arg0]
  85. set $task=$worker->local_tasks->head
  86. while $task != 0x0
  87. starpu-print-task $task
  88. set $task=$task->next
  89. end
  90. end
  91. define starpu-tasks-on-workers
  92. set language c
  93. set $num=0
  94. while $num<config->topology->nworkers
  95. printf "Worker %s\n", config->workers[$num].name
  96. starpu-tasks-on-worker $num
  97. set $num = $num + 1
  98. end
  99. end
  100. define starpu-workers
  101. set language c
  102. set $num=0
  103. printf "[Id] Name Arch Mask Devid Bindid Workerid Isrunning Isinitialized\n"
  104. while $num<config->topology->nworkers
  105. set $worker=&config->workers[$num]
  106. printf "[%2d] %-10s %-4d %-4d %-5d %-6d %-8d %-9d %-13d\n", $num, $worker->name, $worker->arch, $worker->worker_mask, \
  107. $worker->devid, $worker->bindid, $worker->workerid, $worker->worker_is_running, $worker->worker_is_initialized
  108. set $num = $num + 1
  109. end
  110. end
  111. document starpu-workers
  112. Prints a list of the StarPU workers
  113. end
  114. define starpu-tags
  115. printf "tags htbl %p\n", tag_htbl
  116. printf "TODO\n"
  117. end
  118. define starpu-tasks
  119. printf "%d submitted tasks\n", nsubmitted
  120. printf "%d ready tasks\n", nready
  121. printf "Tasks being run:\n"
  122. set $n = 0
  123. while $n < config.topology.nworkers
  124. set $task = config.workers[$n].current_task
  125. if ($task)
  126. printf "worker %d:\n", $n
  127. starpu-print-task $task
  128. set $j = (struct _starpu_job *) $task->starpu_private
  129. set $nsuccs = $j->job_successors.nsuccs
  130. set $i = 0
  131. while $i < $nsuccs
  132. set $cg = $j->job_successors.succ[$i]
  133. if ($cg->cg_type == 1)
  134. # STARPU_CG_APPS
  135. printf "waited for by application"
  136. end
  137. if ($cg->cg_type == 2)
  138. # STARPU_CG_TAG
  139. printf "will produce tag %x\n", $cg->succ.tag
  140. end
  141. if ($cg->cg_type == 4)
  142. # STARPU_CG_TASK
  143. printf "dep of task %p\n", $cg->succ.job
  144. starpu-print-task $cg->succ.job->task
  145. end
  146. set $i = $i + 1
  147. end
  148. end
  149. set $n = $n + 1
  150. end
  151. if (tag_htbl)
  152. printf "TODO: tags\n"
  153. end
  154. print "TODO: complete\n"
  155. end
  156. define starpu
  157. printf "Here I am...\n"
  158. end
  159. define starpu-print-mode
  160. if ($arg0 & 1)
  161. printf "R"
  162. end
  163. if ($arg0 & 2)
  164. printf "W"
  165. end
  166. if ($arg0 & 4)
  167. printf " SCRATCH"
  168. end
  169. if ($arg0 & 8)
  170. printf " REDUX"
  171. end
  172. end
  173. define starpu-print-data
  174. set language c
  175. set $data = (starpu_data_handle_t) $arg0
  176. printf "Data handle %p\n", $data
  177. printf "Home node %d\n", $data->home_node
  178. printf "RWlock refs %d\n", $data->refcnt
  179. printf "Busy count %d\n", $data->busy_count
  180. printf "Current mode "
  181. starpu-print-mode $data->current_mode
  182. printf "\n"
  183. if $data->current_mode & (4|8)
  184. set $n = 0
  185. while $n < config.topology.nworkers
  186. set $replicate = $data->per_worker[$n]
  187. printf "Worker %2d %10s:", $n, config->workers[$n]->name
  188. if $replicate->state == 0
  189. printf " OWNER"
  190. end
  191. if $replicate->state == 1
  192. printf " SHARED"
  193. end
  194. if $replicate->state == 2
  195. printf " INVALID"
  196. end
  197. if $replicate->initialized
  198. printf " initialized"
  199. end
  200. printf "\n"
  201. set $n = $n + 1
  202. end
  203. else
  204. set $n = 0
  205. while $n < descr.nnodes
  206. set $replicate = &$data->per_node[$n]
  207. printf "Node %2d (%2d):", $n, $replicate->refcnt
  208. if $replicate->state == 0
  209. printf " OWNER"
  210. end
  211. if $replicate->state == 1
  212. printf " SHARED"
  213. end
  214. if $replicate->state == 2
  215. printf " INVALID"
  216. end
  217. if $replicate->initialized
  218. printf " initialized"
  219. end
  220. printf "\n"
  221. set $n = $n + 1
  222. end
  223. end
  224. printf "Post sync tasks\n"
  225. set $tasklist = $data->post_sync_tasks
  226. while $tasklist != 0x0
  227. starpu-print-task $tasklist->task
  228. set $tasklist = $tasklist->next
  229. end
  230. printf "Requester tasks\n"
  231. set $requesterlist = $data->req_list._head
  232. while $requesterlist != 0x0
  233. printf "mode: "
  234. starpu-print-mode $requesterlist->mode
  235. printf "\n"
  236. starpu-print-job $requesterlist->j
  237. set $requesterlist = $requesterlist->_next
  238. end
  239. if ($data->nchildren)
  240. printf "%d children\n", $data->nchildren
  241. end
  242. end
  243. define starpu-print-datas
  244. set $entry = registered_handles
  245. while $entry
  246. starpu-print-data $entry->handle
  247. printf "\n"
  248. set $entry = (struct handle_entry *) $entry.hh.next
  249. end
  250. end
  251. define starpu-print-request
  252. set $r = (struct _starpu_data_request *)$arg0
  253. printf "Request %p\n", $r
  254. printf "Refcnt %d\n", $r->refcnt
  255. printf "Handle %p\n", $r->handle
  256. printf "src_replicate %p\n", $r->src_replicate
  257. printf "dst_replicate %p\n", $r->dst_replicate
  258. printf "handling_node %d\n", $r->handling_node
  259. if ($r->mode & 1)
  260. printf "R"
  261. end
  262. if ($r->mode & 2)
  263. printf "W"
  264. end
  265. if ($r->mode & 4)
  266. printf "S"
  267. end
  268. if ($r->mode & 8)
  269. printf "X"
  270. end
  271. printf "\n"
  272. printf "completed: %d\n", $r->completed
  273. printf "retval: %d\n", $r->retval
  274. printf "ndeps: %d\n", $r->ndeps
  275. printf "next_req_count: %d\n", $r->next_req_count
  276. end
  277. define starpu-print-requests
  278. set $node = 0
  279. while $node < descr.nnodes
  280. printf "Node %u:\n", $node
  281. set $request = data_requests[$node]._head
  282. while $request != 0
  283. printf " Request %p: handle %p ", $request, $request->handle
  284. starpu-print-mode $request->mode
  285. printf "\n"
  286. set $request = $request->_next
  287. end
  288. set $node = $node + 1
  289. end
  290. end
  291. define starpu-print-prequests
  292. set $node = 0
  293. while $node < descr.nnodes
  294. printf "Node %u:\n", $node
  295. set $request = data_requests_pending[$node]._head
  296. while $request != 0
  297. printf " Request %p: handle %p ", $request, $request->handle
  298. starpu-print-mode $request->mode
  299. printf "\n"
  300. set $request = $request->_next
  301. end
  302. set $node = $node + 1
  303. end
  304. end
  305. define starpu-print-frequests
  306. set $node = 0
  307. while $node < descr.nnodes
  308. printf "Node %u:\n", $node
  309. set $request = prefetch_requests[$node]._head
  310. while $request != 0
  311. printf " Request %p: handle %p ", $request, $request->handle
  312. starpu-print-mode $request->mode
  313. printf "\n"
  314. set $request = $request->_next
  315. end
  316. set $node = $node + 1
  317. end
  318. end
  319. document starpu
  320. List of StarPU-specific gdb functions:
  321. starpu-workers prints a list of the StarPU workers
  322. starpu-tasks-on-workers prints a list of the tasks currently running on workers
  323. starpu-tasks-on-worker prints a list of the tasks running on the given worker
  324. starpu-print-job prints a StarPU job
  325. starpu-print-task prints a StarPU task
  326. starpu-print-data prints a StarPU data handle
  327. starpu-print-datas prints all StarPU data handles
  328. starpu-print-request prints a StarPU data request
  329. starpu-print-requests prints all StarPU data requests
  330. starpu-print-prequests prints all pending StarPU data requests
  331. starpu-print-frequests prints all StarPU prefetch data requests
  332. starpu-tasks prints a list of the tasks flowing in StarPU
  333. starpu-tags prints a list of the tags known to StarPU
  334. end