[BACK]Return to kernhist CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / gdbscripts

File: [cvs.NetBSD.org] / src / sys / gdbscripts / kernhist (download)

Revision 1.2, Thu May 12 00:35:10 2016 UTC (4 years, 9 months ago) by mrg
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, thorpej-futex-base, thorpej-futex, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, netbsd-9-base, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, jdolecek-ncq-base, jdolecek-ncq, isaki-audio2-base, isaki-audio2, is-mlppp-base, is-mlppp, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1, ad-namecache-base, ad-namecache, HEAD
Branch point for: tls-maxphys, nick-nhusb
Changes since 1.1: +6 -6 lines

make '$e' in here the whole structure instead of a pointer, to combine
several pointer derefs into one speaking this up significantly.

#	$NetBSD: kernhist,v 1.2 2016/05/12 00:35:10 mrg Exp $

# by mrg and skrll

define kernhist
	dont-repeat

	set $hist = (struct kern_history *)&$arg0
	set $histf = $hist->f
	set $histn = $hist->n
	set $lcv = $histf

	printf "Kernel history %s has %d entries (next free %d)\n", $hist->name, $histn, $histf
	while (1)
		set $e = $hist->e[$lcv]
		set $fmt = $e.fmt

		if ($fmt)
			printf "%06lx.%06d ", $e.tv.tv_sec, $e.tv.tv_usec
			printf "%s#%ld@%d: ", $e.fn, $e.call, $e.cpunum
			printf "%s: %lx %lx %lx %lx\n", $fmt, $e.v[0], $e.v[1], $e.v[2], $e.v[3]
			set $lcv = ($lcv + 1) % $histn
		else
			if ($histf == 0)
				printf "No entries\n"
				loop_break
			end
			# if fmt is NULL and hist->f isn't zero, skip back to
			# the start of the list since it hasn't looped yet.
			set $lcv = 0
		end

		if ($lcv == $histf)
			loop_break
		end
	end
end
document kernhist
dump a kernel hist.  eg, "kernhist usbhist".  note that the format
is not expanded due to there being now way to pass a variable format
string to gdb's printf.
end