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

Method _parse_stack_table

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

Source from the content-addressed store, hash-verified

642 return display_names
643
644 def _parse_stack_table(self) -> list[StackNode]:
645 section = self.section_by_type[SECTION_STACK_TABLE]
646 pos = section.offset
647 end = pos + section.length
648 nodes: list[StackNode] = []
649 for expected_node_id in range(int(self.header["stack_node_count"])):
650 self._require_range(pos, STACK_NODE_STRUCT.size)
651 node_id, parent_id, function_id, depth, flags = STACK_NODE_STRUCT.unpack_from(self._mmap, pos)
652 pos += STACK_NODE_STRUCT.size
653 if node_id != expected_node_id:
654 raise ValueError(f"stack node id {node_id} does not match its ordinal {expected_node_id}")
655 nodes.append(StackNode(node_id, parent_id, function_id, depth, flags))
656 if pos != end:
657 raise ValueError("stack table size does not match the encoded payload")
658 return nodes
659
660 def _build_node_paths(self) -> tuple[list[tuple[int, ...]], list[frozenset[int]]]:
661 paths: list[tuple[int, ...]] = [tuple() for _ in self.stack_nodes]

Callers 1

__init__Method · 0.95

Calls 2

_require_rangeMethod · 0.95
StackNodeClass · 0.85

Tested by

no test coverage detected