On Mon, Jul 17, 2017 at 09:48:53AM -0700, John Baldwin wrote: > On Wednesday, July 12, 2017 04:41:09 PM Mark Johnston wrote: > > On Wed, Jul 12, 2017 at 02:23:52PM -0700, John Baldwin wrote: > > > On Wednesday, July 12, 2017 06:29:25 PM Mark Johnston wrote: > > > > Author: markj > > > > Date: Wed Jul 12 18:29:25 2017 > > > > New Revision: 320918 > > > > URL: https://svnweb.freebsd.org/changeset/base/320918 > > > > > > > > Log: > > > > Add a newline after the version string. > > > > > > > > MFC after: 3 days > > > > > > I think the version string normally has a trailing \n emedded in it? > > > > You're right. The problem in my case is that the version string is > > getting truncated in mkdumpheader(), and so the trailing \n is omitted. > > > > > Also, > > > have you verified that crashinfo is still able to match the Version String > > > from the generated info.X file? I think it might as it stops printing > > > lines > > > once it matches the second line of the version, so I think (just reading > > > the > > > awk) that it will not include the extra newline in the 'ivers' compared > > > against 'version' from gdb. > > > > That's true, but it looks like it doesn't work properly in the truncated > > case. What if we declare a match when the version string in the info.X > > file matches a prefix of the version string reported by gdb? > > Sorry I didn't reply earlier. I think the patch below for crashinfo is fine > (but have not tested it myself):
I did test it with both truncated and non-truncated version strings (with r321035 applied). The bit that gets truncated first is the objdir path, so I think it'd be unlikely that we match the wrong kernel: the build time and build number are also both contained in the version string. > > > diff --git a/usr.sbin/crashinfo/crashinfo.sh > > b/usr.sbin/crashinfo/crashinfo.sh > > index e52c01419b0d..b3029c6eea4a 100755 > > --- a/usr.sbin/crashinfo/crashinfo.sh > > +++ b/usr.sbin/crashinfo/crashinfo.sh > > @@ -85,8 +85,9 @@ find_kernel() > > > > # Look for a matching kernel version. > > for k in `sysctl -n kern.bootfile` $(ls -t /boot/*/kernel); do > > - kvers=$(gdb_command $k 'printf " Version String: %s", version' > > \ > > - 2>/dev/null) > > + kvers=$(gdb_command $k 'printf " Version String: %s", version' > > | \ > > + awk "{line=line\$0\"\n\"} END{print > > substr(line,1,${#ivers})}" \ > > + 2>/dev/null) > > if [ "$ivers" = "$kvers" ]; then > > KERNEL=$k > > break > > > > > -- > John Baldwin _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"