MCPcopy Create free account
hub / github.com/adny-code/fastgrind / _parse_function_table

Method _parse_function_table

tools/fastgrind.py:614–628  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

612 raise ValueError("tick data offset does not match header")
613
614 def _parse_function_table(self) -> list[str | None]:
615 section = self.section_by_type[SECTION_FUNCTION_TABLE]
616 pos = section.offset
617 end = pos + section.length
618 names: list[str | None] = [None]
619 for _ in range(int(self.header["function_count"])):
620 self._require_range(pos, U32_STRUCT.size)
621 (name_bytes,) = U32_STRUCT.unpack_from(self._mmap, pos)
622 pos += U32_STRUCT.size
623 self._require_range(pos, name_bytes)
624 names.append(bytes(self._mmap[pos : pos + name_bytes]).decode("utf-8", errors="replace"))
625 pos += name_bytes
626 if pos != end:
627 raise ValueError("function table size does not match the encoded payload")
628 return names
629
630 def _derive_display_names(self, function_names: Sequence[str | None]) -> list[str | None]:
631 short_names = [_simplify_symbol(name) if name else None for name in function_names]

Callers 1

__init__Method · 0.95

Calls 1

_require_rangeMethod · 0.95

Tested by

no test coverage detected