[PATCH 2/4] smdb.py: fix param tracking now that we use $ instead of p

Andrew Murray <[email protected]>
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
Since d8084fee2b7c the data source of a parameter is now stored with the
notation: $0 instead of p0 (where the $ or p indicates that the data source
of the parameter is from the callers function parameters, the value next to
it is the parameter number).

Let's update the smdb script to reflect this.

Fixes: d8084fee2b7c ("data_source: change how parameter data source information is recorded")
Signed-off-by: Andrew Murray <[email protected]>
---
 smatch_data/db/smdb.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/smatch_data/db/smdb.py b/smatch_data/db/smdb.py
index 1e089b4804bd..9025a95070b5 100755
--- a/smatch_data/db/smdb.py
+++ b/smatch_data/db/smdb.py
@@ -574,8 +574,8 @@ def trace_param_helper(func, param, indent = 0):
     sources = trace_callers(func, param)
     for path in sources:
 
-        if len(path[1]) and path[1][0] == 'p' and path[1][1] == ' ':
-            p = int(path[1][2:])
+        if len(path[1]) and path[1][0] == '$':
+            p = int(re.findall('\d+', path[1][1:])[0])
             trace_param_helper(path[0], p, indent + 2)
         elif len(path[0]) and path[0][0] == '%':
             print "  %s%s" %(" " * indent, path[1])
-- 
2.21.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.