From d4bed025ed6de39e517422b076b5af9d7b31abb7 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 26 May 2017 13:20:20 -0400 Subject: command: Store the command parsing information directly in array Instead of defining an array of pointers, just define the array directly. Signed-off-by: Kevin O'Connor --- scripts/checkstack.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'scripts/checkstack.py') diff --git a/scripts/checkstack.py b/scripts/checkstack.py index 34314218..e4cf45cc 100755 --- a/scripts/checkstack.py +++ b/scripts/checkstack.py @@ -135,8 +135,7 @@ def main(): continue m = re_asm.match(line) if m is None: - if funcaddr not in datalines: - datalines[funcaddr] = line.split() + datalines.setdefault(funcaddr, []).append(line) #print("other", repr(line)) continue insn = m.group('insn') @@ -192,14 +191,24 @@ def main(): funcnameroot = info.funcname.split('.')[0] funcsbyname[funcnameroot] = info cmdfunc = funcsbyname.get('sched_main') + command_index = funcsbyname.get('command_index') + if command_index is not None and cmdfunc is not None: + for line in datalines[command_index.funcaddr]: + parts = line.split() + if len(parts) < 9: + continue + calladdr = int(parts[8]+parts[7], 16) * 2 + numparams = int(parts[2], 16) + stackusage = cmdfunc.basic_stack_usage + 2 + numparams * 4 + cmdfunc.noteCall(0, calladdr, stackusage) + if len(parts) < 17: + continue + calladdr = int(parts[16]+parts[15], 16) * 2 + numparams = int(parts[10], 16) + stackusage = cmdfunc.basic_stack_usage + 2 + numparams * 4 + cmdfunc.noteCall(0, calladdr, stackusage) eventfunc = funcsbyname.get('__vector_13', funcsbyname.get('__vector_17')) for funcnameroot, info in funcsbyname.items(): - if funcnameroot.startswith('parser_'): - f = funcsbyname.get(funcnameroot[7:]) - if f is not None: - numparams = int(datalines[info.funcaddr][2], 16) - stackusage = cmdfunc.basic_stack_usage + 2 + numparams * 4 - cmdfunc.noteCall(0, f.funcaddr, stackusage) if funcnameroot.endswith('_event') and eventfunc is not None: eventfunc.noteCall(0, info.funcaddr, eventfunc.basic_stack_usage + 2) -- cgit v1.2.3-70-g09d2