Skip to content

Instantly share code, notes, and snippets.

@larsks
Last active April 29, 2024 19:17
Show Gist options
  • Save larsks/10bfc29f2a8bc1977a6c3eb0f2fb3de4 to your computer and use it in GitHub Desktop.
Save larsks/10bfc29f2a8bc1977a6c3eb0f2fb3de4 to your computer and use it in GitHub Desktop.
# GDB scripts for working with Linux ax.25 subsystem
define ax-devs
set $x = ax25_dev_list
while ($x != 0)
printf "%s axdev:%d dev_refcnt:%d dev_untracked:%d dev_notrack:%d\n", $x->dev->name, \
$x->refcount->refs->counter, \
$x->dev->dev_refcnt->refs->counter, \
$x->dev->refcnt_tracker->untracked->refs->counter, \
$x->dev->refcnt_tracker->no_tracker->refs->counter
set $x = $x->next
end
end
define ax-sockets
set $x = ax25_list->first
while ($x != 0)
set $cb = (ax25_cb *)($x)
if ($cb->state == 0)
set $state = "LISTEN"
end
if ($cb->state == 1)
set $state = "SABM_SENT"
end
if ($cb->state == 2)
set $state = "DISC_SENT"
end
if ($cb->state == 3)
set $state = "ESTABLISHED"
end
if ($cb->state == 4)
set $state = "RECOVERY"
end
if ($cb->state > 4)
set $state = "UNKNOWN"
end
printf "%s if:%s state:%s paclen:%d window:%d refcnt:%d\n", \
$_as_string($cb), \
$cb->ax25_dev->dev->name, \
$state, \
$cb->paclen, \
$cb->window, \
$cb->refcount->refs->counter
set $x = $x->next
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment