All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] db/smdb: add info command with type filtering
@ 2019-06-21 10:18 Andrew Murray
  2019-06-21 14:53 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Murray @ 2019-06-21 10:18 UTC (permalink / raw)
  To: smatch

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] db/smdb: add info command with type filtering
  2019-06-21 10:18 [PATCH] db/smdb: add info command with type filtering Andrew Murray
@ 2019-06-21 14:53 ` Dan Carpenter
  2019-06-21 14:59   ` Andrew Murray
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2019-06-21 14:53 UTC (permalink / raw)
  To: Andrew Murray; +Cc: smatch

On Fri, Jun 21, 2019 at 11:18:42AM +0100, Andrew Murray wrote:
> @@ -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)

Somehow this chunk didn't apply at all but I did it manually.

Applied.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] db/smdb: add info command with type filtering
  2019-06-21 14:53 ` Dan Carpenter
@ 2019-06-21 14:59   ` Andrew Murray
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Murray @ 2019-06-21 14:59 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: smatch

On Fri, Jun 21, 2019 at 05:53:02PM +0300, Dan Carpenter wrote:
> On Fri, Jun 21, 2019 at 11:18:42AM +0100, Andrew Murray wrote:
> > @@ -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]

The patch didn't apply because my local tree had this line ^^ in.

> > -    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)
> 
> Somehow this chunk didn't apply at all but I did it manually.

I messed up when making the patch.

Thanks,

Andrew Murray

> 
> Applied.
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-21 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-21 10:18 [PATCH] db/smdb: add info command with type filtering Andrew Murray
2019-06-21 14:53 ` Dan Carpenter
2019-06-21 14:59   ` Andrew Murray

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.