mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
[gdb/testsuite] Simplify gdb.cp/local-static.exp
Simplify test-case gdb.cp/local-static.exp in the following way. First rewrite this uplevel into a more usual form: ... -set print_quoted_re [uplevel 1 "subst_vars \"$print_quoted_re\""] +set print_quoted_re [uplevel 1 [list subst -nocommands $print_quoted_re]] ... This requires us to use "subst -nocommands" instead of subst_vars, to allow backslash substitution, which previously was happening implicitly because of the way uplevel was used. Then, declare globals hex and syntax_re, such that we no longer have to use uplevel: ... -set print_quoted_re [uplevel 1 [list subst -nocommands $print_quoted_re]] +set print_quoted_re [subst -nocommands $print_quoted_re] ... Finally, stop applying backslash substitution, simplifying cxx_scopes_list and c_scopes_list: ... -set print_quoted_re [subst -nocommands $print_quoted_re] +set print_quoted_re [subst_vars $print_quoted_re] ... While we're at it, simplify some regexps using string_to_regexp in a few places. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -47,70 +47,70 @@ proc cannot_resolve {meth} {
|
||||
#SCOPE #PREFIX #PRINT-SCOPE-QUOTED
|
||||
#PRINT-SCOPE-UNQUOTED (opt)
|
||||
set cxx_scopes_list {
|
||||
{"S::method()" "S_M" {= \\{void \\(S \\* const\\)\\} $hex <S::method\\(\\)>}
|
||||
{"S::method()" "S_M" {= \{void \(S \* const\)\} $hex <S::method\(\)>}
|
||||
{[cannot_resolve "S::method"]}}
|
||||
|
||||
{"S::method() const" "S_M_C" {= \\{void \\(const S \\* const\\)\\} $hex <S::method\\(\\) const>}
|
||||
{"S::method() const" "S_M_C" {= \{void \(const S \* const\)\} $hex <S::method\(\) const>}
|
||||
$syntax_re}
|
||||
|
||||
{"S::method() volatile" "S_M_V" {= \\{void \\(volatile S \\* const\\)\\} $hex <S::method\\(\\) volatile>}
|
||||
{"S::method() volatile" "S_M_V" {= \{void \(volatile S \* const\)\} $hex <S::method\(\) volatile>}
|
||||
$syntax_re}
|
||||
|
||||
{"S::method() const volatile" "S_M_CV" {= \\{void \\(const volatile S \\* const\\)\\} $hex <S::method\\(\\) const volatile>}
|
||||
{"S::method() const volatile" "S_M_CV" {= \{void \(const volatile S \* const\)\} $hex <S::method\(\) const volatile>}
|
||||
$syntax_re}
|
||||
|
||||
{"S::method() volatile const" "S_M_CV" {= \\{void \\(const volatile S \\* const\\)\\} $hex <S::method\\(\\) const volatile>}
|
||||
{"S::method() volatile const" "S_M_CV" {= \{void \(const volatile S \* const\)\} $hex <S::method\(\) const volatile>}
|
||||
$syntax_re}
|
||||
|
||||
{"S::method(void)" "S_M" {= \\{void \\(S \\* const\\)\\} $hex <S::method\\(\\)>}}
|
||||
{"S::method(void) const" "S_M_C" {= \\{void \\(const S \\* const\\)\\} $hex <S::method\\(\\) const>}}
|
||||
{"S::method(void) volatile" "S_M_V" {= \\{void \\(volatile S \\* const\\)\\} $hex <S::method\\(\\) volatile>}}
|
||||
{"S::method(void) const volatile" "S_M_CV" {= \\{void \\(const volatile S \\* const\\)\\} $hex <S::method\\(\\) const volatile>}}
|
||||
{"S::method(void) volatile const" "S_M_CV" {= \\{void \\(const volatile S \\* const\\)\\} $hex <S::method\\(\\) const volatile>}}
|
||||
{"S::method(void)" "S_M" {= \{void \(S \* const\)\} $hex <S::method\(\)>}}
|
||||
{"S::method(void) const" "S_M_C" {= \{void \(const S \* const\)\} $hex <S::method\(\) const>}}
|
||||
{"S::method(void) volatile" "S_M_V" {= \{void \(volatile S \* const\)\} $hex <S::method\(\) volatile>}}
|
||||
{"S::method(void) const volatile" "S_M_CV" {= \{void \(const volatile S \* const\)\} $hex <S::method\(\) const volatile>}}
|
||||
{"S::method(void) volatile const" "S_M_CV" {= \{void \(const volatile S \* const\)\} $hex <S::method\(\) const volatile>}}
|
||||
|
||||
{"S::static_method()" "S_SM" {= \\{void \\(void\\)\\} $hex <S::static_method\\(\\)>}
|
||||
{"S::static_method()" "S_SM" {= \{void \(void\)\} $hex <S::static_method\(\)>}
|
||||
"void"}
|
||||
|
||||
{"S::static_method(void)" "S_SM" {= \\{void \\(void\\)\\} $hex <S::static_method\\(\\)>}}
|
||||
{"S::static_method(void)" "S_SM" {= \{void \(void\)\} $hex <S::static_method\(\)>}}
|
||||
|
||||
{"S::inline_method()" "S_IM" {= \\{void \\(S \\* const\\)\\} $hex <S::inline_method\\(\\)>}
|
||||
{"S::inline_method()" "S_IM" {= \{void \(S \* const\)\} $hex <S::inline_method\(\)>}
|
||||
{[cannot_resolve "S::inline_method"]}}
|
||||
|
||||
{"S::inline_method(void)" "S_IM" {= \\{void \\(S \\* const\\)\\} $hex <S::inline_method\\(\\)>}}
|
||||
{"S::inline_method(void)" "S_IM" {= \{void \(S \* const\)\} $hex <S::inline_method\(\)>}}
|
||||
|
||||
{"S::static_inline_method()" "S_SIM" {= \\{void \\(void\\)\\} $hex <S::static_inline_method\\(\\)>}
|
||||
{"S::static_inline_method()" "S_SIM" {= \{void \(void\)\} $hex <S::static_inline_method\(\)>}
|
||||
"void"}
|
||||
|
||||
{"S::static_inline_method(void)" "S_SIM" {= \\{void \\(void\\)\\} $hex <S::static_inline_method\\(\\)>}}
|
||||
{"S::static_inline_method(void)" "S_SIM" {= \{void \(void\)\} $hex <S::static_inline_method\(\)>}}
|
||||
|
||||
{"S2<int>::method()" "S2_M" {= \\{void \\(S2<int> \\* const\\)\\} $hex <S2<int>::method\\(\\)>}
|
||||
{"S2<int>::method()" "S2_M" {= \{void \(S2<int> \* const\)\} $hex <S2<int>::method\(\)>}
|
||||
{[cannot_resolve "S2<int>::method"]}}
|
||||
|
||||
{"S2<int>::static_method()" "S2_SM" {= \\{void \\(void\\)\\} $hex <S2<int>::static_method\\(\\)>}
|
||||
{"S2<int>::static_method()" "S2_SM" {= \{void \(void\)\} $hex <S2<int>::static_method\(\)>}
|
||||
"void"}
|
||||
|
||||
{"S2<int>::inline_method()" "S2_IM" {= \\{void \\(S2<int> \\* const\\)\\} $hex <S2<int>::inline_method\\(\\)>}
|
||||
{"S2<int>::inline_method()" "S2_IM" {= \{void \(S2<int> \* const\)\} $hex <S2<int>::inline_method\(\)>}
|
||||
{[cannot_resolve "S2<int>::inline_method"]}}
|
||||
|
||||
{"S2<int>::static_inline_method()" "S2_SIM" {= \\{void \\(void\\)\\} $hex <S2<int>::static_inline_method\\(\\)>}
|
||||
{"S2<int>::static_inline_method()" "S2_SIM" {= \{void \(void\)\} $hex <S2<int>::static_inline_method\(\)>}
|
||||
"void"}
|
||||
|
||||
{"free_func" "FF" {= \\{void \\(void\\)\\} $hex <free_func\\(\\)>}}
|
||||
{"free_func" "FF" {= \{void \(void\)\} $hex <free_func\(\)>}}
|
||||
|
||||
{"free_func()" "FF" {= \\{void \\(void\\)\\} $hex <free_func\\(\\)>}
|
||||
{"free_func()" "FF" {= \{void \(void\)\} $hex <free_func\(\)>}
|
||||
"void"}
|
||||
|
||||
{"free_func(void)" "FF" {= \\{void \\(void\\)\\} $hex <free_func\\(\\)>}}
|
||||
{"free_func(void)" "FF" {= \{void \(void\)\} $hex <free_func\(\)>}}
|
||||
|
||||
{"free_inline_func()" "FIF" {= \\{void \\(void\\)\\} $hex <free_inline_func\\(\\)>}
|
||||
{"free_inline_func()" "FIF" {= \{void \(void\)\} $hex <free_inline_func\(\)>}
|
||||
"void"}
|
||||
|
||||
{"free_inline_func(void)" "FIF" {= \\{void \\(void\\)\\} $hex <free_inline_func\\(\\)>}}
|
||||
{"free_inline_func(void)" "FIF" {= \{void \(void\)\} $hex <free_inline_func\(\)>}}
|
||||
}
|
||||
|
||||
set c_scopes_list {
|
||||
{"free_func" "FF" {= \\{void \\(void\\)\\} $hex <free_func>}}
|
||||
{"free_inline_func" "FIF" {= \\{void \\(void\\)\\} $hex <free_inline_func>}}
|
||||
{"free_func" "FF" {= \{void \(void\)\} $hex <free_func>}}
|
||||
{"free_inline_func" "FIF" {= \{void \(void\)\} $hex <free_inline_func>}}
|
||||
}
|
||||
|
||||
# A list of all the static varibles defined in each scope. The first
|
||||
@@ -131,6 +131,8 @@ proc do_test {lang} {
|
||||
global vars_list
|
||||
global srcfile testfile
|
||||
global gdb_prompt
|
||||
global hex
|
||||
global syntax_re
|
||||
|
||||
set options {debug}
|
||||
|
||||
@@ -153,7 +155,7 @@ proc do_test {lang} {
|
||||
return
|
||||
}
|
||||
|
||||
gdb_test "show language" " currently [string_to_regexp $lang]\"\\."
|
||||
gdb_test "show language" [string_to_regexp [subst_vars {currently $lang".}]]
|
||||
|
||||
if {$lang == "c"} {
|
||||
set scopes_list $c_scopes_list
|
||||
@@ -170,10 +172,10 @@ proc do_test {lang} {
|
||||
set scope [lindex $scope_line 0]
|
||||
|
||||
set print_quoted_re [lindex $scope_line 2]
|
||||
set print_quoted_re [uplevel 1 "subst_vars \"$print_quoted_re\""]
|
||||
set print_quoted_re [subst_vars $print_quoted_re]
|
||||
|
||||
set print_unquoted_re [lindex $scope_line 3]
|
||||
set print_unquoted_re [uplevel 1 "subst_vars \"$print_unquoted_re\""]
|
||||
set print_unquoted_re [subst_vars $print_unquoted_re]
|
||||
|
||||
gdb_test "print '${scope}'" $print_quoted_re
|
||||
|
||||
@@ -241,7 +243,8 @@ proc do_test {lang} {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gdb_test "print '${sym}'" "No symbol \"$sym\" in current context\\."
|
||||
gdb_test "print '${sym}'" \
|
||||
[string_to_regexp [subst_vars {No symbol "$sym" in current context.}]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user