Skip to content

Instantly share code, notes, and snippets.

@yudenzel
Created July 16, 2020 01:45
Show Gist options
  • Save yudenzel/3a3069aa9090c530512ab48f5fd681e4 to your computer and use it in GitHub Desktop.
Save yudenzel/3a3069aa9090c530512ab48f5fd681e4 to your computer and use it in GitHub Desktop.
define dump_qhash
set $i = 0
set $qhash = 0
while $i < $argc
eval "set $qhash = $arg%d", $i
set $qhash_data = $qhash.d
set $qhash_endl = $qhash.e
set $buckets = $qhash_data.buckets
set $numBuckets = $qhash_data.numBuckets
set $nodeSize = $qhash_data.nodeSize
set $qhash_size = $qhash_data.size
echo qhash_data =
print *$qhash_data
set $bucket = 0
while $bucket < $numBuckets
set $current_bucket = $buckets[$bucket]
while $current_bucket != $qhash_endl
eval "x/%dx $current_bucket", 3
set $current_bucket = $current_bucket->next
end
set $bucket = $bucket + 1
end
set $i = $i + 1
end
end
define dump_qset
set $i = 0
set $qset = 0
while $i < $argc
eval "set $qset = $arg%d", $i
set $qset_hash = $qset->q_hash
p $qset_hash
dump_qhash $qset_hash
set $i = $i + 1
end
end
define dump_qlist
set $i = 0
set $qlist = 0
while $i < $argc
eval "set $qlist = $arg%d", $i
set $qlist_data = $qlist.d
set $qlist_array = $qlist_data->array
p $qlist_array
set $qlist_begin = $qlist_data->begin
p $qlist_begin
set $qlist_endl = $qlist_data->end
p $qlist_endl
eval "x/%dx $qlist_array", $qlist_endl-$qlist_begin
set $qlist_current = $qlist_begin
while $qlist_current < $qlist_endl
set $current_node_value = $qlist_array[$qlist_current]
p $current_node_value
set $qlist_current = $qlist_current + 1
end
set $i = $i + 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment