From e3a0f949e1fbafb98fa3871e4ff05359d4a45c30 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Mon, 30 Jan 2023 15:01:23 +0100 Subject: [PATCH] armbian-next: call-stack-analyze.py: detect missing function_to_file and stop properly (half-finished traces?) --- lib/tools/call-stack-analyze.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/tools/call-stack-analyze.py b/lib/tools/call-stack-analyze.py index f1c261c147..00a7e169f4 100644 --- a/lib/tools/call-stack-analyze.py +++ b/lib/tools/call-stack-analyze.py @@ -158,9 +158,15 @@ for call in bare_calls: # Now go back to the bare_calls, and add the def_file and def_line to each stack member for call in bare_calls: for stack_member in call["stack"]: - stack_member["def_file"] = function_to_file[stack_member["function"]]["def_file"] - stack_member["def_line"] = function_to_file[stack_member["function"]]["def_line"] - stack_member["group"] = function_to_file[stack_member["function"]]["group"] + func = stack_member["function"] + if function_to_file.get(func) is not None: + func2file = function_to_file[func] + stack_member["def_file"] = func2file["def_file"] + stack_member["def_line"] = func2file["def_line"] + stack_member["group"] = func2file["group"] + else: + eprint("Error: function not found in function_to_file: " + func) + raise Exception("Error: function not found in function_to_file: " + func) # Now recompute the calls, dropping from the stack the unwanted groups. calls = []