MCPcopy Index your code
hub / github.com/python/cpython / check_usable_gdb

Function check_usable_gdb

Lib/test/test_gdb/util.py:106–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104
105
106def check_usable_gdb():
107 # Verify that "gdb" was built with the embedded Python support enabled and
108 # verify that "gdb" can load our custom hooks, as OS security settings may
109 # disallow this without a customized .gdbinit.
110 stdout, stderr = run_gdb(
111 '--eval-command=python import sys; print(sys.version_info)',
112 '--args', sys.executable,
113 check=False)
114
115 if "auto-loading has been declined" in stderr:
116 raise unittest.SkipTest(
117 f"gdb security settings prevent use of custom hooks; "
118 f"stderr: {stderr!r}")
119
120 if not stdout:
121 raise unittest.SkipTest(
122 f"gdb not built with embedded python support; "
123 f"stderr: {stderr!r}")
124
125 if "major=2" in stdout:
126 raise unittest.SkipTest("gdb built with Python 2")
127
128check_usable_gdb()
129

Callers 1

util.pyFile · 0.85

Calls 1

run_gdbFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…