Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1582631pxf; Fri, 19 Mar 2021 10:18:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPOVmMArgmCW5kxM+LaKmRyan5024gZT0lODPfVXvsfqEGZXyHRudKlwe76xWE4ecpZXrX X-Received: by 2002:a17:906:3f87:: with SMTP id b7mr5565598ejj.139.1616174321211; Fri, 19 Mar 2021 10:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616174321; cv=none; d=google.com; s=arc-20160816; b=n/3A4eOAnRdJ1hIqn6RdyxDQnleD2B3qlHwZ9TAS1CsoI5Zf/zc4Y9pOWMdq2uxRHd 4TOlu73in/BjvCkOCpC9zzAwGlTBGoNr4b88NH1Ov3hs1th7Z2xTJA2oAq3RlJ3ziX+W +Re+SySRMAufpflJGozD7Ty2CiyjZzLeIbL9bNcuIRbOcPOcBsuYbV3nXiGRQJCLIWrX /yjGM8Ww0PXj9fCW/71Hw2vaq3EDYmY8S661Kcvd8nNAdxI9gsezEf4kRta2hPj9nFMB YcJXEOvs9CSCENZm4hjWVEbu2lEeZaTD7LhPU7/QV+dUqlXSFDKT9ye+qIL8uf6w/jZ/ ZxCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NmOSs5tEu47Laoh1qxa+rl3JlDXehYKJh6XfrCU+SRM=; b=IHEFeQZwAystVpHwzHY57tTKAGiJGwWIRAfnagrSp+9IrD1Gr/KeZzAnO4GQBubR6j boW1AW9sHLrkb9z0fVwHRPa6uL3wHxmqax+fE/0Mb/JiHUzhZiOsSpc9hpRc6cQ+q7Rg d7MMNpxzFNxVz9HsQTPbzusvXZWgHOqRUHBD/bIjzuzHbpBWHQEroFqfPESmBeP1UUfz kdw4VkIC5Mgul3XpAe+fqQq3t3d78ydXGVifQ/VTXvtafxF8zZcPigKJokCNooTUrjAF v1pd9DuOXlTb0oZ2ztGsMuSLTplRsAWmWm0s+UjRG+Rm+qu2VieOswyVGrTgdfpKBDYS ZJig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OU2XM07/"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si4330856ejj.541.2021.03.19.10.18.15; Fri, 19 Mar 2021 10:18:41 -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=@linaro.org header.s=google header.b="OU2XM07/"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbhCSRRQ (ORCPT + 99 others); Fri, 19 Mar 2021 13:17:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbhCSRRQ (ORCPT ); Fri, 19 Mar 2021 13:17:16 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7B84C06174A for ; Fri, 19 Mar 2021 10:17:15 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id bx7so11637309edb.12 for ; Fri, 19 Mar 2021 10:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=NmOSs5tEu47Laoh1qxa+rl3JlDXehYKJh6XfrCU+SRM=; b=OU2XM07/P0SFEX8dpG4FteiSW0vErpq78CdkpTISEI3TrhMSkCQcs2ABH6+r8ZkqkH NZloQc4xFVaGBSYiMCFUkfobMcc+GMn30T3hfWLv4FEEUqpHWaVZGE2AeuluiUkET39b t6WHSkoXxOlo5HJXOQr6qp1ePUp2KERBezcJio2ikhSdUIWgm8C5MKFx/ra+RI/IC7DF s5yi/XZu5xM02hzzAy+lhL6rcfPl+U9Be+soziyfLPm1VE4HneXtj6foLwOOKTpLQPh7 lR7E1oBw+EKZuyWHKTfP3QW4b+cBxthHGrWJhPGxZIOn53SAltZYkjEk6wfy7KiUprKC 25fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NmOSs5tEu47Laoh1qxa+rl3JlDXehYKJh6XfrCU+SRM=; b=afSvHspKnRTwkaA7A3pMRXmss8Lcwx+pVoFgulT4tkYW3XBO2f39KhQSv0ClIn0dj5 +CF5rC4XoOUt6g/piW1CZ4+S1jzlMoywEyTaSE6YffzTSCIzvJZnB8pOTLPlfPWBrhIZ B41NmViYtiEb60lNpDFYhZcEU8tO08LO31r0YA55RpJDDRX+QiTOAu25bLt5Z0T55j8v FFkI5kWOS5QgygWQNWfUs8Ka6Zt79okbTVag2sgB50mHJ7e2hQ4MIRhrSMoSkGXfhqCj tHR8yPq+zVNL3Pacy8d+MSroj8asBCa419K1rYiupv2AVcePW0puFjwwECEYiWJsaswd k+CA== X-Gm-Message-State: AOAM531gbAzKJrjr+N0aBuN4hc+Bstbxy+dGVmZR8JIf0be2LmGLKeMy LraRkDbGFeSlYIxA9pOiE7fH67/MJpyRvxai X-Received: by 2002:a05:6402:1283:: with SMTP id w3mr10777157edv.340.1616174234323; Fri, 19 Mar 2021 10:17:14 -0700 (PDT) Received: from maple.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id r25sm3914743edv.78.2021.03.19.10.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 10:17:13 -0700 (PDT) Date: Fri, 19 Mar 2021 17:17:12 +0000 From: Daniel Thompson To: Sumit Garg Cc: kgdb-bugreport@lists.sourceforge.net, jason.wessel@windriver.com, dianders@chromium.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kdb: Refactor kdb_defcmd implementation Message-ID: <20210319171712.vlkgnmp7cbnayxdn@maple.lan> References: <20210309121747.859823-1-sumit.garg@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210309121747.859823-1-sumit.garg@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 09, 2021 at 05:47:47PM +0530, Sumit Garg wrote: > Switch to use kdbtab_t instead of separate struct defcmd_set since > now we have kdb_register_table() to register pre-allocated kdb commands. This needs rewriting. I've been struggling for some time to figure out what it actually means means and how it related to the patch. I'm starting to conclude that this might not be my fault! > Also, switch to use a linked list for sub-commands instead of dynamic > array which makes traversing the sub-commands list simpler. We can't call these things sub-commands! These days a sub-commands implies something like `git subcommand` and kdb doesn't have anything like that. > +struct kdb_subcmd { > + char *scmd_name; /* Sub-command name */ > + struct list_head list_node; /* Sub-command node */ > +}; > + > /* The KDB shell command table */ > typedef struct _kdbtab { > char *cmd_name; /* Command name */ > @@ -175,6 +181,7 @@ typedef struct _kdbtab { > kdb_cmdflags_t cmd_flags; /* Command behaviour flags */ > struct list_head list_node; /* Command list */ > bool is_dynamic; /* Command table allocation type */ > + struct list_head kdb_scmds_head; /* Sub-commands list */ > } kdbtab_t; Perhaps this should be more like: struct defcmd_set { kdbtab_t cmd; struct list_head commands; }; This still gets registers using kdb_register_table() but it keeps the macro code all in once place: kdb_register_table(¯o->cmd, 1); I think that is what I *meant* to suggest ;-) . It also avoids having to talk about sub-commands! BTW I'm open to giving defcmd_set a better name (kdb_macro?) but I don't see why we want to give all commands a macro list. Daniel.