Skip to content

Instantly share code, notes, and snippets.

@yfuruyama
Last active December 16, 2015 22:39
Show Gist options
  • Save yfuruyama/5508977 to your computer and use it in GitHub Desktop.
Save yfuruyama/5508977 to your computer and use it in GitHub Desktop.
gdb utility
# print 'next' field of object(by chain)
#
# usage:
# (gdb)pnext ptr (equals to 'print ptr->next')
# (gdb)ENTER (equals to 'ptr->next->next')
define pnext
init-if-undefined $a = $arg0
init-if-undefined $b = $arg0
# 0 means initialize
if $arg0 == 0
set $a = 0
set $b = 0
else
if $b != $arg0
set $a = $arg0
set $b = $arg0
end
set $a = $a->next
p *$a
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment