Return-Path: Received: from foss.arm.com ([217.140.110.172]:57418 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbfFUKSv (ORCPT ); Fri, 21 Jun 2019 06:18:51 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A1091142F for ; Fri, 21 Jun 2019 03:18:50 -0700 (PDT) Received: from e119886-lin.cambridge.arm.com (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2D82F3F718 for ; Fri, 21 Jun 2019 03:18:50 -0700 (PDT) From: Andrew Murray Subject: [PATCH] db/smdb: add info command with type filtering Date: Fri, 21 Jun 2019 11:18:42 +0100 Message-Id: <20190621101842.2332-1-andrew.murray@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: smatch-owner@vger.kernel.org List-ID: To: smatch@vger.kernel.org Add a new command to smdb that shows caller info filtered by a user specified type. This allows us to remove the abandoned, broken and undocumented user_data and param_value commands. It's also possible to remove the unamed command (i.e. calling smdb with just a function), as this new 'info' command provides the same functionality when a user does not specify a type. However let's keep it for now to avoid confusing users. Signed-off-by: Andrew Murray --- smatch_data/db/smdb.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/smatch_data/db/smdb.py b/smatch_data/db/smdb.py index 29a5be8488ac..c0b310b13b1d 100755 --- a/smatch_data/db/smdb.py +++ b/smatch_data/db/smdb.py @@ -17,6 +17,7 @@ except sqlite3.Error, e: def usage(): print "%s" %(sys.argv[0]) print " - how a function is called" + print "info - how a function is called, filtered by type" print "return_states - what a function returns" print "call_tree - show the call tree" print "where - where a struct member is set" @@ -605,6 +606,12 @@ if len(sys.argv) < 2: if len(sys.argv) == 2: func = sys.argv[1] print_caller_info("", func) +elif sys.argv[1] == "info": + my_type = "" + if len(sys.argv) == 4: + my_type = sys.argv[3] + func = sys.argv[2] + print_caller_info("", func, my_type) elif sys.argv[1] == "call_info": if len(sys.argv) != 4: usage() @@ -612,13 +619,6 @@ elif sys.argv[1] == "call_info": func = sys.argv[3] caller_info_values(filename, func) print_caller_info(filename, func) -elif sys.argv[1] == "user_data": - func = sys.argv[2] - filename = sys.argv[3] - print_caller_info(filename, func, "USER_DATA") -elif sys.argv[1] == "param_value": - func = sys.argv[2] - print_caller_info(filename, func, "PARAM_VALUE") elif sys.argv[1] == "function_ptr" or sys.argv[1] == "fn_ptr": func = sys.argv[2] print_fn_ptrs(func) -- 2.21.0