Demangle C++ symbols using c++filt. Args: cpp_filt_path (Path): Path to c++filt executable. input_text (str): Text to demangle. Returns: str: Demangled text.
(cpp_filt_path: Path, input_text: str)
| 17 | |
| 18 | |
| 19 | def cpp_filt(cpp_filt_path: Path, input_text: str) -> str: |
| 20 | """ |
| 21 | Demangle C++ symbols using c++filt. |
| 22 | |
| 23 | Args: |
| 24 | cpp_filt_path (Path): Path to c++filt executable. |
| 25 | input_text (str): Text to demangle. |
| 26 | |
| 27 | Returns: |
| 28 | str: Demangled text. |
| 29 | """ |
| 30 | if not cpp_filt_path.exists(): |
| 31 | raise FileNotFoundError(f"cppfilt not found at '{cpp_filt_path}'") |
| 32 | command = [str(cpp_filt_path), "-t", "-n"] |
| 33 | process = subprocess.Popen( |
| 34 | command, |
| 35 | stdin=subprocess.PIPE, |
| 36 | stdout=subprocess.PIPE, |
| 37 | stderr=subprocess.PIPE, |
| 38 | text=True, |
| 39 | ) |
| 40 | stdout, stderr = process.communicate(input=input_text) |
| 41 | if process.returncode != 0: |
| 42 | raise RuntimeError(f"Error running c++filt: {stderr}") |
| 43 | return stdout |
| 44 | |
| 45 | |
| 46 | def demangle_gnu_linkonce_symbols(cpp_filt_path: Path, map_text: str) -> str: |
no test coverage detected