Hi,
- added userland support: read info from virtual memory of process
- replace hardcoded registers by macros
- added address of subroutine to easy lookup in binary file
Commented code will be removed before commit...
Differential D14020
[mips] [ddb] few backtrace changes mizhka on Jan 22 2018, 10:32 PM. Authored by Tags None Referenced Files
Details
Hi,
Commented code will be removed before commit... Tested for a long time under mipsel broadcom hardware. It saves me a lot of time ;) Example of new output: db> bt Tracing pid 215 tid 100061 td 0x80862b40 [kernel] kdb_enter+0x48 (?,?,?,?) ra 8018e6e4 sp c0473b90 sz 24 subr 8018e594 [kernel] kdb_sysctl_enter+0xbc (?,?,?,?) ra 8014f7b0 sp c0473ba8 sz 48 subr 8018e628 [kernel] sysctl_root_handler_locked+0xa4 (?,?,?,?) ra 8014fa78 sp c0473bd8 sz 56 subr 8014f70c [kernel] sysctl_root+0xd8 (?,?,?,?) ra 8014fed4 sp c0473c10 sz 96 subr 8014f9a0 [kernel] userland_sysctl+0x110 (80862b40,?,?,?) ra 80150184 sp c0473c70 sz 112 subr 8014fdc4 [kernel] sys___sysctl+0xac (?,?,?,?) ra 80349874 sp c0473ce0 sz 168 subr 801500d8 [kernel] trap+0x1000 (?,?,?,?) ra 80336304 sp c0473d88 sz 248 subr 80348874 [kernel] MipsUserGenException+0x10c (?,?,?,?) ra 00000000 sp c0473e80 sz 0 subr 803361f8 --- exception, cause 406ef300 badvaddr 0 --- [/tmp/test_tls] (0 400000 4cb000) 0x86e24 0x486e24 (?,?,?,?) ra 004862fc sp 7bffde40 sz 0 subr 486e18 [/tmp/test_tls] (0 400000 4cb000) 0x862fc 0x4862fc (?,?,?,?) ra 00483794 sp 7bffde40 sz 64 subr 48628c [/tmp/test_tls] (0 400000 4cb000) 0x83794 0x483794 (?,?,?,?) ra 00482f38 sp 7bffde80 sz 160 subr 48371c [/tmp/test_tls] (0 400000 4cb000) 0x82f38 0x482f38 (?,?,?,?) ra 0047cc64 sp 7bffdf20 sz 72 subr 482edc [/tmp/test_tls] (0 400000 4cb000) 0x7cc64 0x47cc64 (?,?,?,?) ra 00400598 sp 7bffdf68 sz 40 subr 47cbdc [/tmp/test_tls] (0 400000 4cb000) 0x598 0x400598 (?,?,?,?) ra 00403198 sp 7bffdf90 sz 32 subr 40054c [/tmp/test_tls] (0 400000 4cb000) 0x3198 0x403198 (?,?,?,?) ra 00000000 sp 7bffdfb0 sz 56 subr 402ecc
Diff Detail
Event Timeline
Comment Actions @jhb, many thanks for review! Initial code of userland stacktracing was written to fix TLS on MIPS few months ago. I found it useful.
Comment Actions I get this patch to my forked 12-stable branch. https://github.com/ZRouter/freebsd-src/commit/e905ae1913c4667f6825bb9fa04dca3872620a6f |