Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1425314ybh; Mon, 13 Jul 2020 19:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy2/HKVhOAnDnA6eGd513ADaVTzeKEbFYca75NaaGluYH5hI16iWRLuP6ZEJnbKn72e5iz X-Received: by 2002:a17:907:9484:: with SMTP id dm4mr2629556ejc.56.1594693850828; Mon, 13 Jul 2020 19:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594693850; cv=none; d=google.com; s=arc-20160816; b=U1FVz3IG2RQoM2hF/NXnqX9KiP/TcKk/4wkLiaukNBk35FknYCX+7W8QTTloSTjc5w IN6vAqIQT/MqZcrvO4ilvXRDw3/nKPnD5qYy9UHqKUZyrz3c7e85tBpFr90DVpqv1OSF l0r36O0XTTZU0Xmp6IICRoeD0pzvMyq+7D4Dhz6HqGEqW491VhiDirOTNY1lxNE1FZzf jTIK/oNuPkrsKxzJjT/Thq4SA8CIlsZogOcCFnLiQzg4oO/7unrjiPs/9d5ehXtfebrf uwEy6AygG3yq8HccJDHeTo4I65FyKDH9idaozAQ2XCsN9JZ+mKsqOlq2cCv5sIC2cnEE rPkA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=CMcWgeN70W9yzJtbKSXSLvUJZMguz5JGKLMRefnJ8lw=; b=m8Ddw/lvXYtgCnkGJ80iIgOM80pne2EZivy2R778LuiWjuPShgifT5cUQLIlSw6BJb jrRAnRjPwndrEc5IIbTwoiroQCrclLevG6Rzsi1mV0LK8uF3j43cklOucpHaRe8dI1IY xpclBtlRkALuocgFrizhJVH1q9gw5IB3EI0bLM2eKRo/owRm9LgBTozciQL5OILYGIMe zVkG0sPYEBn1ikKFVnhA0AVKB2ymCOAAZyh6XgNQjvWY15Ztp68rZ4Ic1sFAM20ndoWc d/+7n64oU4krVcL0uIRSpxm8RWVDGmEFS1UgwUHnZozxZLu4r3nQNUSoKMFbu1qKF4Cf J3zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@akamai.com header.s=jan2016.eng header.b=geoh4f3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id uz6si9385785ejb.50.2020.07.13.19.30.26; Mon, 13 Jul 2020 19:30:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@akamai.com header.s=jan2016.eng header.b=geoh4f3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726660AbgGNC35 (ORCPT + 99 others); Mon, 13 Jul 2020 22:29:57 -0400 Received: from mx0a-00190b01.pphosted.com ([67.231.149.131]:38990 "EHLO mx0a-00190b01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbgGNC35 (ORCPT ); Mon, 13 Jul 2020 22:29:57 -0400 Received: from pps.filterd (m0050093.ppops.net [127.0.0.1]) by m0050093.ppops.net-00190b01. (8.16.0.42/8.16.0.42) with SMTP id 06E2Pgf7028288; Tue, 14 Jul 2020 03:26:36 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=jan2016.eng; bh=CMcWgeN70W9yzJtbKSXSLvUJZMguz5JGKLMRefnJ8lw=; b=geoh4f3TugKozfQ9Cfy3aRtr+995DFFBaOKo0APSihxXRXFCe+FPFSSWNX8MyP3I1TcE /npw2P0wBD0pXnTQjLVjdpentHTmJI1tsUEAJnk+H7LaMUte+RfHXjnjDkXsjTX1f8WH BYp0ItB6UiJifUoZA2tWRktRg2jkmAPo2oJrPxmSW8Ct0v2lVs4zlRfSvKfvp1XsNXb8 4Zm7fup2nuFtt+4zC1jfWHCGHNMx/DLoSAAn5q5i0EMCXNhKydpOv45BJWqcrQDFOi3D 0ez6EyK4YAcl3/bpoujT5kawQ1/aYsBBQmDsWkNIY8gzfWczyz6q/8okxN21KxGOe/9o tw== Received: from prod-mail-ppoint2 (prod-mail-ppoint2.akamai.com [184.51.33.19] (may be forged)) by m0050093.ppops.net-00190b01. with ESMTP id 328kc6gxan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Jul 2020 03:26:36 +0100 Received: from pps.filterd (prod-mail-ppoint2.akamai.com [127.0.0.1]) by prod-mail-ppoint2.akamai.com (8.16.0.42/8.16.0.42) with SMTP id 06E2HXAA023075; Mon, 13 Jul 2020 22:26:34 -0400 Received: from prod-mail-relay11.akamai.com ([172.27.118.250]) by prod-mail-ppoint2.akamai.com with ESMTP id 3278rx7aq1-1; Mon, 13 Jul 2020 22:26:34 -0400 Received: from [0.0.0.0] (prod-ssh-gw01.bos01.corp.akamai.com [172.27.119.138]) by prod-mail-relay11.akamai.com (Postfix) with ESMTP id 1996F229E9; Tue, 14 Jul 2020 02:26:34 +0000 (GMT) Subject: Re: [PATCH v4 13/17] dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100' To: Jim Cromie , linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org Cc: linux@rasmusvillemoes.dk, Jonathan Corbet , Andrew Morton , Orson Zhai , Will Deacon , Petr Mladek , linux-doc@vger.kernel.org References: <20200620180643.887546-1-jim.cromie@gmail.com> <20200620180643.887546-14-jim.cromie@gmail.com> From: Jason Baron Message-ID: <30de6359-e56b-0915-5742-a360ef1b2814@akamai.com> Date: Mon, 13 Jul 2020 22:26:34 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200620180643.887546-14-jim.cromie@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-13_17:2020-07-13,2020-07-13 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007140014 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-13_17:2020-07-13,2020-07-13 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007140017 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/20/20 2:06 PM, Jim Cromie wrote: > 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 > > Doc these changes, and sprinkle in a few extra wild-card examples and > trailing # explanation texts. > > 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 1423af580bed..6c04aea8f4cd 100644 > --- a/Documentation/admin-guide/dynamic-debug-howto.rst > +++ b/Documentation/admin-guide/dynamic-debug-howto.rst > @@ -164,6 +164,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 > @@ -172,6 +173,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 > @@ -181,6 +185,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 ae6e523fdecd..7eb963b1bd11 100644 > --- a/lib/dynamic_debug.c > +++ b/lib/dynamic_debug.c > @@ -321,6 +321,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; > } This bit seems like its unrelated to this patch and makes more sense in the previous patch, or as separate patch... Thanks, -Jason > > @@ -357,6 +359,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) { > @@ -372,7 +375,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")) { >