[gdb/testsuite] Use regexp to match $_gdb_{major,minor}

Every time we update the gdb version number, test-case gdb.base/default.exp
needs updating because it matches the values of convenience variables
$_gdb_{major,minor} using hardcoded expected values:
...
	{$_gdb_major = 17} \
	{$_gdb_minor = 1} \
...

I'm assuming the values were hardcoded because gdb_test_list_exact was used.

Since the previous patch, that's not longer the case, so use regexps instead,
getting rid of this annoyance [1].

Tested on x86_64-linux.

[1] https://sourceware.org/pipermail/gdb-patches/2019-October/160935.html
This commit is contained in:
Tom de Vries
2025-08-17 08:57:09 +02:00
parent f586f9b61d
commit f28a89fd76

View File

@@ -766,8 +766,6 @@ set show_conv_list \
{$_gdb_maint_setting = <internal function _gdb_maint_setting>} \
{$_gdb_setting_str = <internal function _gdb_setting_str>} \
{$_gdb_setting = <internal function _gdb_setting>} \
{$_gdb_major = 17} \
{$_gdb_minor = 1} \
{$_shell_exitsignal = void} \
{$_shell_exitcode = 0} \
{$_active_linker_namespaces = 1} \
@@ -812,6 +810,18 @@ if { [regexp "$re_var = $re_val" $lines] } {
set all_found 0
}
set re_vars \
[list \
[string_to_regexp {$_gdb_major}] \
[string_to_regexp {$_gdb_minor}]]
foreach re_var $re_vars {
if { [regexp "$re_var = $decimal" $lines] } {
incr matches
} else {
set all_found 0
}
}
if { [regexp [string_to_regexp {$_tlb = void}] $lines] } {
incr matches
} else {