@@ -602,9 +602,12 @@ set show_conv_list \
{$_probe_arg10 = <error: No frame selected>} \
{$_probe_arg11 = <error: No frame selected>} \
{$_isvoid = <internal function _isvoid>} \
- {$_gdb_major = 8} \
- {$_gdb_minor = 4} \
}
+
+lassign [get_gdb_version] gdb_version_major gdb_version_minor
+lappend show_conv_list "\$_gdb_major = $gdb_version_major"
+lappend show_conv_list "\$_gdb_minor = $gdb_version_minor"
+
if ![skip_python_tests] {
append show_conv_list \
{
@@ -6353,5 +6353,31 @@ proc cd { dir } {
builtin_cd $dir
}
+# Read the version of GDB from the version.in file in the GDB source directory.
+#
+# Return a two-element list with the major and minor version components.
+#
+# If the third component of the GDB version is greater than 0, we increment
+# minor by 1. For example, for version "8.3.50", we will return {8 4}.
+
+gdb_caching_proc get_gdb_version {
+ global srcdir
+
+ set version_file [open "$srcdir/../version.in" r]
+ set version_string [read $version_file]
+ close $version_file
+
+ # Remove trailing newline so that the last component doesn't include it.
+ set version_string [string trimright $version_string \n]
+
+ lassign [split $version_string .] major minor patch
+
+ if { $patch > 0 } {
+ incr minor
+ }
+
+ return [list $major $minor]
+}
+
# Always load compatibility stuff.
load_lib future.exp