Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1421186pxj; Sat, 29 May 2021 13:03:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxL4A8um9np/EJSLuUVdXodZudLERhkjulJOIm86FK8+WcGdmgSCwfIAg44VysqO4g54fn/ X-Received: by 2002:a05:6e02:130f:: with SMTP id g15mr12095492ilr.73.1622318629518; Sat, 29 May 2021 13:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622318629; cv=none; d=google.com; s=arc-20160816; b=LL6ujb2xuAUeBsDWJ/XXmDcTv4DeyeSQ3sku9DHbgTsPJKG13kCmM4+PR9A8+vpcDb 5PSluHHSpiCAxJ2tVuDY/w4mZTbULtzg6bu4HI3RmZ2js//znjDfNdLT2mo+oWW5fmF8 3qq3YDq3Bn3mlRE1yRTMFY+9chOFMqLXL0IOl3xnNB8BBVBVv4bjsLBhVLFIDxC36mQh VDAtjjL00CPYSleFnyAsTY6sbwg/uY3CZbjBOzsatbmSuKj5+zOtkCScP1Ys2t/8axBw EwN2LNBVnNOjXj5Qo097Wxo9BjVfOeoT7mYNe5vY9/RBNl4pdfqUxja/JHUPWb6jwH9e SP5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5BWTKJqrrf/kNw/3F6fFg2m/DKJ7sDuPUp8KcuaUwDI=; b=cTStVccSQ+htZ2dDpdNun16pDRA30gbeTqhgvWqFdRmwJ96+XOxGiCaFKy1HVuxwUI G33pSkFztBGGj0q7Il3ZgGZTRhhpa3hhKHnpZOWSFLoMu79FUSUUcTK0FwRVTiovoCsH S7+hPkIneiwBht4axPKC+/oO6Clx6ImK+QXvwty0UlPpIUWnp1STRw1jqsxnqZUVooxe NjjrRKRT69bfUUv9THJq2M0lrcE4rvUX3QY3dChXiwLa7DQeZsIvNtybpLHTLSe4yav1 mH2RdXuyBju8zuO1r69aTPA4MLHXaNBs31K9PUZWtdWPkSbjdsum6uk1uat+9gSR7BHA P0pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sQZWCrwV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si9747398jak.57.2021.05.29.13.03.28; Sat, 29 May 2021 13:03:49 -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=@gmail.com header.s=20161025 header.b=sQZWCrwV; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbhE2UEO (ORCPT + 99 others); Sat, 29 May 2021 16:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbhE2UEA (ORCPT ); Sat, 29 May 2021 16:04:00 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55376C06174A for ; Sat, 29 May 2021 13:02:22 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id c31-20020a056830349fb02903a5bfa6138bso49230otu.7 for ; Sat, 29 May 2021 13:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5BWTKJqrrf/kNw/3F6fFg2m/DKJ7sDuPUp8KcuaUwDI=; b=sQZWCrwVmZmovix4zivtx3AdYm57/J+aeEvBMkwqnyp+865ReCVbVcVNjKsJqPCjoR 4eh9tZkStPmxuZ82UrOfnFXx0X4fbnOdCrge8urNaeFdg52Zxd8TtgNeMXtli8NIIlYM yQXAIu1oOP/mtzZxwhlymGRtRQoQ1EzfDCR9rtAnJcylClPs4QIMv22Abb+WMt4s8G9E dKzfGzv28L2CuxI2z2vL+u8uC2o4MZgO/MLD40que/C5XR2Dfb9SZ9go/T6GCsEDy7O3 y8Ao27GzhjAFmYg1ILSLqKAml3PQfClcf8tIuDTgOTjrBYYtbH0UI18gOR06ua92kciW oObA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5BWTKJqrrf/kNw/3F6fFg2m/DKJ7sDuPUp8KcuaUwDI=; b=VVjZcp6ASFbncNGlkVN94RGnKTgMxoVDInIWQUVW3nv9CN1hZb37HZy4Pkk48th8sN UdOrG+NS6TFOPHZlS0lWgA4L4pBtVIHesGnq2YfjxmTYvGLeRXf+jN+Y7UZre554/8Wg Q1V0qLqkhJWbMhiUNc4MNkpXZyKX36vtrCxAgIF4Ky1i62rfxc9eeelQXM6aEtSOcpKK OVjGzR9ZuSiLisdBfAjvuljad6m70O5JZtEC4xKbzdbG0vmcuixOX8hRgWQOcMDd8JTZ KYmkVy579MEEKJLiqve7OjHqDwWXI0+Nk1oqnwh7pstCZJ74pZr/IFHOqZG3nga7Y1x4 DXyg== X-Gm-Message-State: AOAM533ip9DJP6QD5408iSsKFdPfj60v99C4J/kP7foeeesVJpjwpzUb XcTT2XBrJSIirQuXd4FIeQk= X-Received: by 2002:a05:6830:2707:: with SMTP id j7mr1155137otu.171.1622318541716; Sat, 29 May 2021 13:02:21 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t39sm1868064ooi.42.2021.05.29.13.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 13:02:21 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [RFC PATCH v6 08/34] dyndbg: accept null site in ddebug_match_site Date: Sat, 29 May 2021 14:00:03 -0600 Message-Id: <20210529200029.205306-9-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210529200029.205306-1-jim.cromie@gmail.com> References: <20210529200029.205306-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since all query terms must be satisfied, we can reorder for clarity, moving !!site dependent checks after those on _ddebug itself. 1- move format and line-number check code to the top of the function, since they don't use/check site info. 2- test site pointer: If its null, we return early, skipping 3: If the query tests against missing site info, fail the match. otherwize site matches. 3- rest of function (checking site vs query) is unchanged. ddebug_match_site ignores module, because it's tested already by the caller, where it is known from debug_tables. no functional changes Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 839dd128ba20..d62dc471bc1f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -146,21 +146,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) static int ddebug_match_site(const struct ddebug_query *query, const struct _ddebug *dp) { - struct _ddebug_site *dc = dp->site; - - /* match against the source filename */ - if (query->filename && - !match_wildcard(query->filename, dc->filename) && - !match_wildcard(query->filename, - kbasename(dc->filename)) && - !match_wildcard(query->filename, - trim_prefix(dc->filename))) - return false; - - /* match against the function */ - if (query->function && - !match_wildcard(query->function, dc->function)) - return false; + struct _ddebug_site *dc; /* match against the format */ if (query->format) { @@ -182,6 +168,29 @@ static int ddebug_match_site(const struct ddebug_query *query, dp->lineno > query->last_lineno) return false; + dc = dp->site; + if (!dc) { + /* site info has been dropped, so query cannot test these fields */ + if (query->filename || query->function) + return false; + else + return true; + } + + /* match against the source filename */ + if (query->filename && + !match_wildcard(query->filename, dc->filename) && + !match_wildcard(query->filename, + kbasename(dc->filename)) && + !match_wildcard(query->filename, + trim_prefix(dc->filename))) + return false; + + /* match against the function */ + if (query->function && + !match_wildcard(query->function, dc->function)) + return false; + return true; } @@ -211,7 +220,7 @@ static int ddebug_change(const struct ddebug_query *query, for (i = 0; i < dt->num_ddebugs; i++) { struct _ddebug *dp = &dt->ddebugs[i]; - struct _ddebug_site *dc = dp->site; + struct _ddebug_site *dc; if (!ddebug_match_site(query, dp)) continue; -- 2.31.1