Permalink
Browse files

Add some thread-related subroutines

It would be really nice if we could also add something to print the
stack of an arbitrary thread there...
  • Loading branch information...
1 parent cf28a03 commit d23d1e439ce40a9e5a2729f4e68436b343e3bee8 @anttikantee anttikantee committed Jun 17, 2015
Showing with 27 additions and 0 deletions.
  1. +27 −0 gdbscripts/bmk_thr.subr
@@ -0,0 +1,27 @@
+define bmk_thr_pr
+ set $thr = (struct bmk_thread *)$arg0
+ printf "n: %-10s\tsp: 0x%016x\tf: 0x%08x\tw: %ld\n", $thr->bt_name, \
+ $thr->bt_tcb.btcb_sp, $thr->bt_flags, $thr->bt_wakeup_time
+end
+
+define bmk_thr_apply_name
+ set $thr = threadq->tqh_first
+ while ($thr)
+ if (strncmp($thr->bt_name, $arg0, strlen($arg0)) == 0)
+ $arg1 $thr
+ end
+ set $thr = $thr->bt_threadq.tqe_next
+ end
+end
+
+define bmk_thr_apply
+ set $thr = threadq->tqh_first
+ while ($thr)
+ $arg0 $thr
+ set $thr = $thr->bt_threadq.tqe_next
+ end
+end
+
+define bmk_thr_pr_all
+ bmk_thr_apply bmk_thr_pr
+end

0 comments on commit d23d1e4

Please sign in to comment.