Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5817353ybc; Wed, 27 Nov 2019 09:53:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwHVE18s32fpQbAFJ7glNwNyaPaFDS+MMMqL4gFGFndnflf3JFb5d+07Pw0LcSndNbMye1w X-Received: by 2002:a17:906:82d0:: with SMTP id a16mr22590005ejy.206.1574877200217; Wed, 27 Nov 2019 09:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574877200; cv=none; d=google.com; s=arc-20160816; b=s1jjd10xyUPuVzwI6kg070q3ff8D68bhEO3Lq82eEkJjihT7RCOL5SThED3SlEZ13B JTs18WSvFRyB9BTmb5t5k6l3EEYh7GfimVv6nSNewYl6thm6YujQzlksNBH2rT2y1U43 17C1IfVXExYjmnWnHTg2GXEa9+B+Fq7ccRR6YLWfgbCzFy+mEAEy4RzbW64y/Zy8T4Ne LMhl5UuqcAgJage1CZtap5zCdsqlfmCcBoJ+ET2u4mh6RJx4LSPql+FcFIEahYmRSnaC vU7WGygC95IyZF0S7Zw3N/rSZhPfFqQHxFWaJjfxEPLoDLIfH7qwIs2DfebT4HAXOAB8 NZEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=4wns2J9TrYSMO0FP1gWVXKw38D0t4uNE7MgIhv6xWoQ=; b=EfFiKo8e19Xhe9B/SDh7jrLwJvwgojZIRHw6Lv7Vma0ofis+cdf4jOWlX6Rpc+T052 qtNX9qjHQH5LbezlB2uk5xUcIftWsX/eZZdsDyidVioj/Oh30fZ5EGJgb7mG2lAnrmXF IidKNVP5THyex1IcFhwwF3bVkzPK/4b+3gvCX1uSAVH4XUJLKpstMYt4xcBXcyd+d8Z0 BXDz0wLPgBkKco5S/Se06KZjnO9bFOlqRS4m1oB0wn6gA18St68as2cBsn/mQ6XNYd7N LRWN0zfczrqqCw83zRdsyNUaGemuM2lcvgme3t5MNCBUGdk5R0vF3dhb4dgIXDSLEy9M jEqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EuBmVjM1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mj10si9873422ejb.7.2019.11.27.09.52.56; Wed, 27 Nov 2019 09:53:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EuBmVjM1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbfK0RvO (ORCPT + 99 others); Wed, 27 Nov 2019 12:51:14 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:37969 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbfK0RvO (ORCPT ); Wed, 27 Nov 2019 12:51:14 -0500 Received: by mail-io1-f65.google.com with SMTP id u24so24107368iob.5; Wed, 27 Nov 2019 09:51:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4wns2J9TrYSMO0FP1gWVXKw38D0t4uNE7MgIhv6xWoQ=; b=EuBmVjM1zv9CjNzTeR0hXvCPhtvo+0r2DzV/ks2q6Ug2YbXh+Yhr96JxAKXU4u6t8y 0GrE5DkN1vNSdMMgo9GZ2Yus+RHnwjztsaO4aFnEdl8tf3KxMYoMoAuHfn79peOKmc5w rf4p9ek6iWIhc7WSFnKyRW+hafv6vzlyVrMJUyve6oJxq1m2Z+PEoS450m7jRTHWAU7U +fJ2YVBwLDprArwBpWk9pptVz8j2PiL24zU6PmuJfOD2Hu2I5naMwDMlZU53mFgU+MUw /qDqcg30EX5kvkXFpZ3lYzkb/eheyo6jtSGP9ubXOF4S85CSXOFddJrejcvUo2BGyfen QjlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4wns2J9TrYSMO0FP1gWVXKw38D0t4uNE7MgIhv6xWoQ=; b=M5L1/+4Af4vWELSzEr+qkgPRSGZO/+ZGD9kTNkRw906BEd5wMbCpzsEB8DEpyzsTz3 Vy5Z4fCivsyo72jpXvPtANwsHKBSLfqRan6ruZKKJ6kzB7ia+HhV/37mgD9KOh6TIeiF A4VmfiknbiQ5jrVs2cpxb9HbgrDPcyWfLHe3/koB/V8/9SlODl7ylBsw4WXzn6JjvY7h PpBKlz5PFlEnmdkPde+98IKcudd9MS7oBGxVk2bMtOhdJJaZvxVVYTa3nZumtiwLqrbQ Me0TFzUFVF0PS5HNfkjJTc/IT5+5p6b//mepYssVlw7us67y2g4B5A01SwIEKAG7tkLP dPpw== X-Gm-Message-State: APjAAAX9WopvM7cnmYgUsxUO/cX4hSnlgcaWsk8loC26kkG0HOB0xciM PoQTLgDQZY9n05dTkbPHOtI= X-Received: by 2002:a5e:8c0a:: with SMTP id n10mr39914558ioj.78.1574877073044; Wed, 27 Nov 2019 09:51:13 -0800 (PST) Received: from localhost.localdomain (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id i22sm4526744ill.40.2019.11.27.09.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 09:51:12 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org Cc: linux@rasmusvillemoes.dk, greg@kroah.com, Jim Cromie , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH 08/16] dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100' Date: Wed, 27 Nov 2019 10:51:05 -0700 Message-Id: <20191127175106.1351574-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Accept these additional query forms: echo "file $filestr +_" > control path/to/file.c:100 # as from control, column 1 path/to/file.c:1-100 # or any legal line-range path/to/file.c:func_A # as from an editor/browser path/to/file.c:drm_\* # wildcards still work path/to/file.c:*_foo # lead wildcard too 1st 2 examples are treated as line-ranges, 3,4 are treated as func's Signed-off-by: Jim Cromie --- .../admin-guide/dynamic-debug-howto.rst | 5 +++++ lib/dynamic_debug.c | 20 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index e011f8907116..689a30316589 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -156,6 +156,7 @@ func of each callsite. Example:: func svc_tcp_accept + func *recv* # in rfcomm, bluetooth, ping, tcp file The given string is compared against either the src-root relative @@ -164,6 +165,9 @@ file file svcsock.c file kernel/freezer.c # ie column 1 of control file + file drivers/usb/* # all callsites under it + file inode.c:start_* # parse :tail as a func (above) + file inode.c:1-100 # parse :tail as a line-range (above) module The given string is compared against the module name @@ -173,6 +177,7 @@ module module sunrpc module nfsd + module drm* # both drm, drm_kms_helper format The given string is searched for in the dynamic debug format diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 496c3da48e2b..9a6768e9334a 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -322,6 +322,8 @@ static int parse_linerange(struct ddebug_query *query, const char *first) } else { query->last_lineno = query->first_lineno; } + vpr_info("parsed line %d-%d\n", query->first_lineno, + query->last_lineno); return 0; } @@ -358,6 +360,7 @@ static int ddebug_parse_query(char *words[], int nwords, { unsigned int i; int rc = 0; + char *fline; /* check we have an even number of words */ if (nwords % 2 != 0) { @@ -374,7 +377,22 @@ static int ddebug_parse_query(char *words[], int nwords, if (!strcmp(words[i], "func")) { rc = check_set(&query->function, words[i+1], "func"); } else if (!strcmp(words[i], "file")) { - rc = check_set(&query->filename, words[i+1], "file"); + if (check_set(&query->filename, words[i+1], "file")) + return -EINVAL; + + /* tail :$info is function or line-range */ + fline = strchr(query->filename, ':'); + if (!fline) + break; + *fline++ = '\0'; + if (isalpha(*fline) || *fline == '*' || *fline == '?') { + /* take as function name */ + if (check_set(&query->function, fline, "func")) + return -EINVAL; + } else + if (parse_linerange(query, fline)) + return -EINVAL; + } else if (!strcmp(words[i], "module")) { rc = check_set(&query->module, words[i+1], "module"); } else if (!strcmp(words[i], "format")) { -- 2.23.0