From b414980a765e2f8a97802fcf9847d230d7788536 Mon Sep 17 00:00:00 2001 From: Point Not Foe Date: Tue, 12 Nov 2024 10:33:39 -0800 Subject: [PATCH] Fix call graph processing to ensure function names are set before adding calls --- stack-usage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stack-usage.py b/stack-usage.py index a44b265..93d32e3 100644 --- a/stack-usage.py +++ b/stack-usage.py @@ -89,10 +89,11 @@ def addCallee(self, callee): cgraph.getFunction(text[3]).setStackSize(int(cols[1])) with open(args.callgraph, "r") as f: + name = None for line in f: if line.find("@") != -1 and not line.startswith(" Aux: @"): name = line[0:line.find("/")] - if line.startswith(" Calls:") and len(line) > 10: + if line.startswith(" Calls:") and len(line) > 10 and name is not None: for callee in line[9:].split(" "): if callee.find("/") != -1: cgraph.addCall(name, callee[:callee.find("/")])