smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Murray <andrew.murray@arm.com>
To: smatch@vger.kernel.org
Subject: [PATCH] db/smdb: add info command with type filtering
Date: Fri, 21 Jun 2019 11:18:42 +0100	[thread overview]
Message-ID: <20190621101842.2332-1-andrew.murray@arm.com> (raw)

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 <andrew.murray@arm.com>
---
 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 "<function> - how a function is called"
+    print "info <type> - how a function is called, filtered by type"
     print "return_states <function> - what a function returns"
     print "call_tree <function> - show the call tree"
     print "where <struct_type> <member> - 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

             reply	other threads:[~2019-06-21 10:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 10:18 Andrew Murray [this message]
2019-06-21 14:53 ` [PATCH] db/smdb: add info command with type filtering Dan Carpenter
2019-06-21 14:59   ` Andrew Murray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190621101842.2332-1-andrew.murray@arm.com \
    --to=andrew.murray@arm.com \
    --cc=smatch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).