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

Function get_gdb_version

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

Source from the content-addressed store, hash-verified

73
74
75def get_gdb_version():
76 try:
77 stdout, stderr = run_gdb('--version')
78 except OSError as exc:
79 # This is what "no gdb" looks like. There may, however, be other
80 # errors that manifest this way too.
81 raise unittest.SkipTest(f"Couldn't find gdb program on the path: {exc}")
82
83 # Regex to parse:
84 # 'GNU gdb (GDB; SUSE Linux Enterprise 12) 7.7\n' -> 7.7
85 # 'GNU gdb (GDB) Fedora 7.9.1-17.fc22\n' -> 7.9
86 # 'GNU gdb 6.1.1 [FreeBSD]\n' -> 6.1
87 # 'GNU gdb (GDB) Fedora (7.5.1-37.fc18)\n' -> 7.5
88 # 'HP gdb 6.7 for HP Itanium (32 or 64 bit) and target HP-UX 11iv2 and 11iv3.\n' -> 6.7
89 match = re.search(r"^(?:GNU|HP) gdb.*?\b(\d+)\.(\d+)", stdout)
90 if match is None:
91 raise Exception("unable to parse gdb version: %r" % stdout)
92 version_text = stdout
93 major = int(match.group(1))
94 minor = int(match.group(2))
95 version = (major, minor)
96 return (version_text, version)
97
98GDB_VERSION_TEXT, GDB_VERSION = get_gdb_version()
99if GDB_VERSION < (7, 0):

Callers 1

util.pyFile · 0.85

Calls 3

run_gdbFunction · 0.85
searchMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…