From owner-freebsd-arch@FreeBSD.ORG Mon Feb 11 10:01:37 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 92B7ED99 for ; Mon, 11 Feb 2013 10:01:37 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by mx1.freebsd.org (Postfix) with ESMTP id 1B9BA1813 for ; Mon, 11 Feb 2013 10:01:36 +0000 (UTC) Received: from mailout-de.gmx.net ([10.1.76.10]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0M0NrX-1UucNZ0WLt-00uWGr for ; Mon, 11 Feb 2013 11:01:36 +0100 Received: (qmail invoked by alias); 11 Feb 2013 10:01:35 -0000 Received: from p5B1326F3.dip.t-dialin.net (EHLO rotluchs.lokal) [91.19.38.243] by mail.gmx.net (mp010) with SMTP; 11 Feb 2013 11:01:35 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1+hHp8bqjqhJp57ZRetDSdvNnTRct5B/tN6gZMU3K ymp9NJuEKsVBGb Message-ID: <5118C17F.9020706@gmx.de> Date: Mon, 11 Feb 2013 11:01:35 +0100 From: Christoph Mallon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130129 Thunderbird/17.0.2 MIME-Version: 1.0 To: Andriy Gapon Subject: Re: Proposal: Unify printing the function name in panic messages() References: <51141E33.4080103@gmx.de> <511426B8.2070800@FreeBSD.org> <51160E06.1070404@gmx.de> <5116121E.1010601@FreeBSD.org> <511616AC.8080306@gmx.de> <511622A2.2090601@FreeBSD.org> <51166AD5.4090707@FreeBSD.org> In-Reply-To: <51166AD5.4090707@FreeBSD.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: Chris Rees , freebsd-arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2013 10:01:37 -0000 On 09.02.2013 16:27, Andriy Gapon wrote: > on 09/02/2013 12:46 Chris Rees said the following: >> OK, which tool can one find a panic message split across lines in source code? >> I would find this very useful. > > http://grok.x12.su/source/search?q=%22offset+below+first+LBA%22&project=freebsd > > Generally, I like opengrok very much. Pity that we don't have an official > server. fxr.watson.org is great, but opengrok is superior to glimpse. > E.g. try the same kind of search here: http://fxr.watson.org/fxr/search > > BTW, a local version (slower because no index is used): > $ pcregrep -r -M 'offset\W*below\W*first\W*LBA' sys/ > sys/geom/part/g_part.c: DPRINTF("partition %d has start offset > below first " > "LBA: %jd < %jd\n", e1->gpe_index, > pcregrep comes from devel/pcre. > > P.S. my first instinct was to try git grep first, git grep seems to support perl > regular expressions in general, but it looks like the port doesn't include the > necessary support: > fatal: cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE > > P.P.S. I must say that I use textproc/glimpse (with index weekly updated via > cron) and in 99% of cases glimpse 'something' immediately returns useful > results. It's quite rare that I have to use other tools for searching the code. > I use vim + ctags too :-) Your suggestion is to replace a simple, automatic mechanism by several different tools, which require quite some manual fiddling. When showing the function name, your simple suggestion for using git grep works fine: [0] $EDITOR `git grep -Il "^$NAME("` Christoph [0] I use the following script for the general case "edit all files containing a pattern". I named it git-ed and git-ew, placed it in $PATH, so it can be used conveniently as git ed $PATTERN and git ew $PATTERN. It edits all files containing the given pattern, searches for the pattern und binds \ to find the pattern. #! /bin/sh set -eu PATTERN="$1" shift NAME="${0##*/}" case "$NAME" in git-ed) ;; git-ew) PATTERN="[[:<:]]$PATTERN[[:>:]]";; *) echo "$NAME: who am I?" >&2; exit 1;; esac VIPATTERN=$(echo "$PATTERN" | sed -e 's#\[\[:<:\]\]#\\<#g' -e 's#\[\[:>:\]\]#\\>#g') "$EDITOR" -c "map \\ /$VIPATTERN^M" -c "/$VIPATTERN" $(git grep -Il -e "$PATTERN" "$@")