Skip to content

Instantly share code, notes, and snippets.

@mizhka
Created May 14, 2019 12:18
Show Gist options
  • Save mizhka/d26481c21ceaab93516ad73842ce70b6 to your computer and use it in GitHub Desktop.
Save mizhka/d26481c21ceaab93516ad73842ce70b6 to your computer and use it in GitHub Desktop.
Poor Man FreeBSD DDB stacktraces
CODE:
int debug = 1;
sysctlbyname("debug.kdb.enter", NULL, NULL, &debug, sizeof(debug));
WHERE:
libc - abort
login - bail
PROC: /sbin/newfs -U /dev/md2
db> bt
Tracing pid 23 tid 100048 td 0x8094cb40
[kernel] kdb_enter+0x4c (?,?,?,?) ra 801e2924 sp c37fdba8 sz 32 subr 801e2820
[kernel] kdb_enter+0x120 (?,?,?,?) ra 801a4b04 sp c37fdbc8 sz 48 subr 801e2884
[kernel] syscall_helper_unregister+0x778 (?,?,?,?) ra 801a74f8 sp c37fdbf8 sz 56 subr 801a4a58
[kernel] sysctl_find_oid+0x534 (?,?,?,?) ra 801a78c8 sp c37fdc30 sz 88 subr 801a73d0
[kernel] userland_sysctl+0xfc (8094cb40,?,?,?) ra 801a7a78 sp c37fdc88 sz 104 subr 801a77cc
[kernel] sys___sysctl+0xa0 (?,?,?,?) ra 8038aae0 sp c37fdcf0 sz 160 subr 801a79d8
[kernel] trap+0xf54 (?,?,?,?) ra 80378784 sp c37fdd90 sz 240 subr 80389b8c
[kernel] MipsUserGenException+0x10c (?,?,?,?) ra 00000000 sp c37fde80 sz 0 subr 80378678
--- exception, cause 7fffc9d8 badvaddr 0 ---
[/lib/libc.so.7] (0 404aa000 40650000) 0x190be4 0x4063abe4 (?,?,?,?) ra 40639ff4 sp 7fffc898 sz 0 subr 4063abd8
[/lib/libc.so.7] (0 404aa000 40650000) 0x18fff4 0x40639ff4 (?,?,?,?) ra 4063759c sp 7fffc898 sz 64 subr 40639f8c
[/lib/libc.so.7] (0 404aa000 40650000) 0x18d59c 0x4063759c (?,?,?,?) ra 40636c3c sp 7fffc8d8 sz 160 subr 4063752c
[/lib/libc.so.7] (0 404aa000 40650000) 0x18cc3c abort (?,?,?,?) ra 40633630 sp 7fffc978 sz 80 subr 40636bdc
[/lib/libc.so.7] (0 404aa000 40650000) 0x189630 getentropy (?,?,?,?) ra 40630318 sp 7fffc9c8 sz 80 subr 4063345c
[/lib/libc.so.7] (0 404aa000 40650000) 0x186318 arc4random_uniform (?,?,?,?) ra 40630680 sp 7fffca18 sz 104 subr 406302e8
[/lib/libc.so.7] (0 404aa000 40650000) 0x186680 arc4random (?,?,?,?) ra 00402efc sp 7fffca80 sz 72 subr 40630624
[/sbin/newfs] (0 400000 40a000) 0x2efc 0x402efc (?,?,?,?) ra 00404f9c sp 7fffcac8 sz 32 subr 402ebc
[/sbin/newfs] (0 400000 40a000) 0x4f9c 0x404f9c (0,7fffef7b,?,?) ra 00402b28 sp 7fffcae8 sz 8696 subr 403b60
[/sbin/newfs] (0 400000 40a000) 0x2b28 0x402b28 (?,7fffee78,?,?) ra 00401340 sp 7fffece0 sz 328 subr 401b20
[/sbin/newfs] (0 400000 40a000) 0x1340 0x401340 (?,?,?,?) ra 00401260 sp 7fffee28 sz 56 subr 40126c
[/sbin/newfs] (0 400000 40a000) 0x1260 0x401260 (?,?,?,?) ra 00000000 sp 7fffee60 sz 40 subr 4011dc
PROC: db> show proc
Process 153 (login) at 0x80932a98:
state: NORMAL
uid: 0 gids: 0
parent: pid 1 at 0x80679000
ABI: FreeBSD ELF32
arguments: login
repear: 0x80679000 reapsubtree: 153
sigparent: 20
vmspace: 0x80684828
(map 0x80684828)
(map.pmap 0x806848ac)
(pmap 0x806848dc)
threads: 1
100047 Run CPU 0 login
db> bt
Tracing pid 153 tid 100047 td 0x80940000
[kernel] kdb_enter+0x4c (?,?,?,?) ra 801e8644 sp c37dfba8 sz 32 subr 801e8540
[kernel] kdb_enter+0x120 (?,?,?,?) ra 801aa7f4 sp c37dfbc8 sz 48 subr 801e85a4
[kernel] syscall_helper_unregister+0x778 (?,?,?,?) ra 801ad1e8 sp c37dfbf8 sz 56 subr 801aa748
[kernel] sysctl_find_oid+0x534 (?,?,?,?) ra 801ad5b8 sp c37dfc30 sz 88 subr 801ad0c0
[kernel] userland_sysctl+0xfc (80940000,?,?,?) ra 801ad768 sp c37dfc88 sz 104 subr 801ad4bc
[kernel] sys___sysctl+0xa0 (?,?,?,?) ra 803908c0 sp c37dfcf0 sz 160 subr 801ad6c8
[kernel] trap+0xf54 (?,?,?,?) ra 8037e564 sp c37dfd90 sz 240 subr 8038f96c
[kernel] MipsUserGenException+0x10c (?,?,?,?) ra 00000000 sp c37dfe80 sz 0 subr 8037e458
--- exception, cause 0 badvaddr 7fffebe0 ---
[/lib/libc.so.7] (0 404aa000 40650000) 0x190be4 0x4063abe4 (?,?,?,?) ra 40639ff4 sp 7fffeb30 sz 0 subr 4063abd8
[/lib/libc.so.7] (0 404aa000 40650000) 0x18fff4 0x40639ff4 (?,?,?,?) ra 4063759c sp 7fffeb30 sz 64 subr 40639f8c
[/lib/libc.so.7] (0 404aa000 40650000) 0x18d59c 0x4063759c (?,?,?,?) ra 00401aec sp 7fffeb70 sz 160 subr 4063752c
[/usr/bin/login] (0 400000 405000) 0x1aec 0x401aec (?,?,?,?) ra 00401bf8 sp 7fffec10 sz 80 subr 401a54
[/usr/bin/login] (0 400000 405000) 0x1bf8 0x401bf8 (?,?,?,?) ra 00402720 sp 7fffec60 sz 32 subr 401bd8
[/usr/bin/login] (0 400000 405000) 0x2720 0x402720 (1,7fffeea4,?,?) ra 004014b0 sp 7fffec80 sz 464 subr 401f20
[/usr/bin/login] (0 400000 405000) 0x14b0 0x4014b0 (?,?,?,?) ra 004013d0 sp 7fffee50 sz 56 subr 4013dc
[/usr/bin/login] (0 400000 405000) 0x13d0 0x4013d0 (?,?,?,?) ra 7fffef9e sp 7fffee88 sz 40 subr 40134c
can't lookup vnode for 0x8067e498
0x7fffef9e (?,?,?,?) ra 00000000 sp 7fffeeb0 sz 0 subr 0
db>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment