emdbg.analyze.utils
1# Copyright (c) 2023, Auterion AG 2# SPDX-License-Identifier: BSD-3-Clause 3 4from __future__ import annotations 5from pathlib import Path 6 7def read_gdb_log(logfile: Path) -> str: 8 """ 9 Reads a GDB log file and converts a GDB/MI format back into a normal string. 10 """ 11 text = Path(logfile).read_text() 12 if '\n~"' in text: 13 lines = text.splitlines() 14 text = "\n".join(l[2:-1].encode("latin-1").decode('unicode_escape').strip() for l in lines if l.startswith('~"')) 15 return text
def
read_gdb_log(logfile: pathlib.Path) -> str:
8def read_gdb_log(logfile: Path) -> str: 9 """ 10 Reads a GDB log file and converts a GDB/MI format back into a normal string. 11 """ 12 text = Path(logfile).read_text() 13 if '\n~"' in text: 14 lines = text.splitlines() 15 text = "\n".join(l[2:-1].encode("latin-1").decode('unicode_escape').strip() for l in lines if l.startswith('~"')) 16 return text
Reads a GDB log file and converts a GDB/MI format back into a normal string.