MCPcopy Create free account
hub / github.com/bloomberg/pystack / generate_all_pystack_combinations

Function generate_all_pystack_combinations

tests/utils.py:216–274  ·  view source on GitHub ↗
(
    corefile=False, native=False
)

Source from the content-addressed store, hash-verified

214
215
216def generate_all_pystack_combinations(
217 corefile=False, native=False
218) -> Iterable[
219 Tuple[str, StackMethod, bool, Tuple[Tuple[int, int], pathlib.Path]]
220]: # pragma: no cover
221 if corefile:
222 stack_methods = (
223 StackMethod.DEBUG_OFFSETS,
224 StackMethod.SYMBOLS,
225 StackMethod.BSS,
226 StackMethod.ELF_DATA,
227 StackMethod.ANONYMOUS_MAPS,
228 )
229 else:
230 stack_methods = (
231 StackMethod.DEBUG_OFFSETS,
232 StackMethod.SYMBOLS,
233 StackMethod.BSS,
234 StackMethod.HEAP,
235 StackMethod.ELF_DATA,
236 )
237
238 blocking_methods: Tuple[bool, ...]
239 if native or corefile:
240 blocking_methods = (True,)
241 else:
242 blocking_methods = (True, False)
243
244 for method, blocking, python in itertools.product(
245 stack_methods,
246 blocking_methods,
247 AVAILABLE_PYTHONS,
248 ):
249 (major_version, minor_version) = python.version
250 if method == StackMethod.DEBUG_OFFSETS and (
251 major_version < 3 or (major_version == 3 and minor_version < 13)
252 ):
253 continue
254 if method == StackMethod.BSS and (
255 major_version > 3 or (major_version == 3 and minor_version >= 10)
256 ):
257 continue
258 if method == StackMethod.ELF_DATA and (
259 major_version < 3 or (major_version == 3 and minor_version < 10)
260 ):
261 continue
262 if method == StackMethod.HEAP and (
263 major_version > 3 or (major_version == 3 and minor_version >= 11)
264 ):
265 continue
266 if method == StackMethod.SYMBOLS and not python.has_symbols:
267 continue
268
269 the_id = (
270 f"method={method.name}, blocking={blocking}, "
271 f"python={major_version}.{minor_version}"
272 )
273

Callers 1

all_pystack_combinationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected