code-coverage: Modify regex for assembly line capture
Due to a change of toolchain, the assembly lines cannot be
captured in blocks. This change is backward compatible with
the other toolchains.
Signed-off-by: Saul Romero <saul.romero@arm.com>
diff --git a/coverage-tool/coverage-reporting/intermediate_layer.py b/coverage-tool/coverage-reporting/intermediate_layer.py
index 2cb1a81..b565236 100644
--- a/coverage-tool/coverage-reporting/intermediate_layer.py
+++ b/coverage-tool/coverage-reporting/intermediate_layer.py
@@ -436,7 +436,7 @@
:param asm_code: Lines of assembly code within the dump
:return: AssemblyLine object.
"""
- lines = re.findall(r"^\s+([a-fA-F0-9]+):\t(.+?)\n", asm_code,
+ lines = re.findall(r"^(?:\s+)?([a-fA-F0-9]+):\t(.+?)\n", asm_code,
re.DOTALL | re.MULTILINE)
for line in lines:
if len(line) != 2:
@@ -648,8 +648,8 @@
command = "%s -Sl %s | tee %s" % (OBJDUMP, elf_filename,
elf_filename.replace(".elf", ".dump"))
dump = os_command(command, show_command=True)
- # with open(elf_filename.replace(".elf", ".dump"), "r") as f:
- # dump = f.read()
+ with open(elf_filename.replace(".elf", ".dump"), "r") as f:
+ dump = f.read()
dump += "\n\n" # For pattern matching the last function
logger.info(f"Parsing assembly file {elf_filename}")
elf_name = os.path.splitext(os.path.basename(elf_filename))[0]