Use valnum_re more often. Do this by replacing "\\\$\[0-9\]+" and similar.
I ran these commands handling 6 variants of $decimal:
...
$ find gdb/testsuite/ -type f -name *.exp* \
| xargs sed -i 's/\\\\\\$\\\[0-9\\\]+/${::valnum_re}/g
$ find gdb/testsuite/ -type f -name *.exp* \
| xargs sed -i 's/\\\\\\$\\\[0-9\]+/${::valnum_re}/g'
$ find gdb/testsuite/ -type f -name *.exp* \
| xargs sed -i 's/\\\\\\$$decimal/${::valnum_re}/g'
$ find gdb/testsuite/ -type f -name *.exp* \
| xargs sed -i 's/\\\\\\$$::decimal/${::valnum_re}/g'
$ find gdb/testsuite/ -type f -name *.exp* \
| xargs sed -i 's/\\\\\\$${decimal}/${::valnum_re}/g'
$ find gdb/testsuite/ -type f -name *.exp* \
| xargs sed -i 's/\\\\\\$${::decimal}/${::valnum_re}/g'
...
and then once more matching '\\$' instead of '\\\$'.
Approved-by: Kevin Buettner <kevinb@redhat.com>
"continuing to Create_Small"
gdb_test "finish" \
- "Value returned is \\\$\[0-9\]+ = \\(1, 1\\)" \
+ "Value returned is ${::valnum_re} = \\(1, 1\\)" \
"value printed by finish of Create_Small"
# Now continue until reaching the second breakpoint inside Create_Large,
}
gdb_test "finish" \
- "Value returned is \\\$\[0-9\]+ = \\(2, 2, 2, 2\\)" \
+ "Value returned is ${::valnum_re} = \\(2, 2, 2, 2\\)" \
"value printed by finish of Create_Large"
# Now continue until reaching the third breakpoint, and then do another
"continuing to Create_Small_Float_Vector"
gdb_test "finish" \
- "Value returned is \\\$\[0-9\]+ = \\(4.25, 4.25\\)" \
+ "Value returned is ${::valnum_re} = \\(4.25, 4.25\\)" \
"value printed by finish of Create_Small_Float_Vector"
global gdb_prompt
gdb_test_multiple "print $var'access" "address of $var" {
- -re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
+ -re "${::valnum_re} = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
return $expect_out(1,string)
}
}
set test "print/x $var"
gdb_test_multiple "$test" $test {
- -re "\\$\[0-9\]+ = [string_to_regexp $val].*$gdb_prompt $" {
+ -re "${::valnum_re} = [string_to_regexp $val].*$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
+ -re "${::valnum_re} = $addr.*$gdb_prompt $" {
fail "$test (prints just address)"
}
- -re "\\$\[0-9\]+ = 0x\[a-f0-9\]+.*$gdb_prompt $" {
+ -re "${::valnum_re} = 0x\[a-f0-9\]+.*$gdb_prompt $" {
fail "$test (prints unexpected address)"
}
}
foreach space {"" " "} {
set test "print/x $var'$space$attr"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
+ -re "${::valnum_re} = $addr.*$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
+ -re "${::valnum_re} = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
fail "$test (prints unexpected address)"
}
}
proc test_p_op1_equals_op2 {op1 op2} {
set test "print $op1 = $op2"
- gdb_test $test "\\$\[0-9\]+ = true"
+ gdb_test $test "${::valnum_re} = true"
}
clean_restart ${testfile}
# The number we just sent, ignore.
exp_continue
}
- -re "\\\$\[0-9\]+ = (\[^\r\n\]+)\r\n" {
+ -re "${::valnum_re} = (\[^\r\n\]+)\r\n" {
if {[regexp $result $expect_out(1,string)]} {
pass $command
} else {
}
# Check the value of GCSPR in the core file.
- gdb_test "print/x \$gcspr" "\\$\[0-9\]+ = $saved_gcspr" \
+ gdb_test "print/x \$gcspr" "${::valnum_re} = $saved_gcspr" \
"gcspr contents from core file"
}
gdb_test "p/x ${tagged_ptr_symbol}" \
[multi_line \
"Logical tag \\(${ltag}\\) does not match the allocation tag \\(0x${atag_hexnz}\\)\." \
- "\\\$\[0-9\]+ = ${untagged_ptr}"] \
+ "${::valnum_re} = ${untagged_ptr}"] \
"show tag mismatch"
}
}
# Check the value of ssp in the core file.
- gdb_test "print/x \$pl3_ssp" "\\$\[0-9\]+ = $saved_pl3_ssp" \
+ gdb_test "print/x \$pl3_ssp" "${::valnum_re} = $saved_pl3_ssp" \
"pl3_ssp contents from core file"
}
gdb_test "next" ".*write_regs.*" "next over read_regs"
for {set i 0} {$i < 16} {incr i 1} {
- gdb_test "p \$wR$i.u64 == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test reg wR$i"
+ gdb_test "p \$wR$i.u64 == ((${i}LL << 32) | ${i})" "${::valnum_re} = 1" "test reg wR$i"
}
# Don't test wCSSF.
-gdb_test "p \$wCASF" "\\\$$decimal = 200" "test reg wCASF"
+gdb_test "p \$wCASF" "${::valnum_re} = 200" "test reg wCASF"
for {set i 0} {$i < 4} {incr i 1} {
- gdb_test "p \$wCGR$i == 100 + $i" "\\\$$decimal = 1" "test reg wCGR$i"
+ gdb_test "p \$wCGR$i == 100 + $i" "${::valnum_re} = 1" "test reg wCGR$i"
}
# Also verify the copies read by the target.
for {set i 0} {$i < 16} {incr i 1} {
- gdb_test "p regs\[$i\] == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test stored wR$i"
+ gdb_test "p regs\[$i\] == ((${i}LL << 32) | ${i})" "${::valnum_re} = 1" "test stored wR$i"
}
# Don't test wcssf.
-gdb_test "p control_regs\[1\]" "\\\$$decimal = 200" "test stored wCASF"
+gdb_test "p control_regs\[1\]" "${::valnum_re} = 200" "test stored wCASF"
for {set i 0} {$i < 4} {incr i 1} {
- gdb_test "p control_regs\[$i + 2\] == 100 + $i" "\\\$$decimal = 1" "test stored wCGR$i"
+ gdb_test "p control_regs\[$i + 2\] == 100 + $i" "${::valnum_re} = 1" "test stored wCGR$i"
}
# Now check that FCRs are accessible and 32-bit wide.
gdb_test "info registers \$fcsr" "fcsr: $hex"
-gdb_test "print sizeof \$fcsr" "\\\$$decimal = 4"
+gdb_test "print sizeof \$fcsr" "${::valnum_re} = 4"
gdb_test "info registers \$fir" "fir: $hex"
-gdb_test "print sizeof \$fir" "\\\$$decimal = 4"
+gdb_test "print sizeof \$fir" "${::valnum_re} = 4"
-re "Breakpoint 1.*inmain .*$gdb_prompt $" {
gdb_test_multiple "finish" \
"check for MIPS16 support in the processor" {
- -re "Value returned is \\\$\[0-9\]+ = 0\[^0-9\].*$gdb_prompt $" {
+ -re "Value returned is ${::valnum_re} = 0\[^0-9\].*$gdb_prompt $" {
verbose "MIPS16 support check successful."
}
-re "$gdb_prompt $" {
for {set i 0} {$i < 16} {incr i 1} {
gdb_test "set \$dl$i=d128" "" "set dl$i register"
-gdb_test "print \$dl$i" "\\\$$decimal = 1\.2345678910" "print dl$i register as DFP"
+gdb_test "print \$dl$i" "${::valnum_re} = 1\.2345678910" "print dl$i register as DFP"
gdb_test "info reg dl$i" \
"dl$i\[ \]*1\.2345678910\[ \t\]*\\(raw 0x2205800000000000000000049c5de09c\\)" \
set crashline [gdb_get_line_number "FAULT"]
-gdb_test "print \$tdb0" "\\\$\[0-9\]+ = <unavailable>" "tdb0 unavailable"
-gdb_test "print \$tr0" "\\\$\[0-9\]+ = <unavailable>" "tr0 unavailable"
+gdb_test "print \$tdb0" "${::valnum_re} = <unavailable>" "tdb0 unavailable"
+gdb_test "print \$tr0" "${::valnum_re} = <unavailable>" "tr0 unavailable"
gdb_test "next" \
"Program received signal SIGSEGV, .*" \
"crash in transaction"
-gdb_test "print/x \$tdb0" "\\\$\[0-9\]+ = 0x1.*" "tdb0 available"
+gdb_test "print/x \$tdb0" "${::valnum_re} = 0x1.*" "tdb0 available"
gdb_test "set print symbol-filename" "" "set print symbol-filename"
gdb_test "print/a \$atia" \
"<crash_in_transaction.*:$crashline>" \
set expected_len [expr {1 + [llength $re_list]}]
gdb_test "print argc" \
- "\\\$$::decimal = $expected_len" "argc for $name"
+ "${::valnum_re} = $expected_len" "argc for $name"
set i 1
foreach arg $re_list {
}
gdb_test "print argv\[$i\]" \
- "\\\$$::decimal = $::hex \"$arg\"" \
+ "${::valnum_re} = $::hex \"$arg\"" \
"argv\[$i\] for $name"
set i [expr {$i + 1}]
}
}
} else {
gdb_test_multiple $cmd "" {
- -re -wrap "^\\$$::decimal$result_re" {
+ -re -wrap "^${::valnum_re}$result_re" {
pass $gdb_test_name
}
}
}
gdb_test_multiple $cmd "" {
- -re -wrap "^$warning_re\\$$::decimal$result_re" {
+ -re -wrap "^$warning_re${::valnum_re}$result_re" {
pass $gdb_test_name
}
}
gdb_run_cmd
gdb_test_multiple "" "commands executed twice" {
- -re "\\$${decimal} = 100123\r\n\\$${decimal} = 100123\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 100123\r\n${::valnum_re} = 100123\r\n$gdb_prompt $" {
pass $gdb_test_name
}
}
# gdb_test that requires us to use gdb_expect here.
send_gdb "print $L'\\0'\n"
gdb_expect {
- -re "\\\$${decimal} = 0 $L'\\\\000'\[\r\n\]+$gdb_prompt $" {
+ -re "${::valnum_re} = 0 $L'\\\\000'\[\r\n\]+$gdb_prompt $" {
pass "print the null character in ${target_charset}"
}
-re "$gdb_prompt $" {
-re "No symbol \"${var}\" in current context\\.\[\r\n\]+${gdb_prompt} $" {
pass "test eliminated var ${var}"
}
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" {
+ -re "${::valnum_re} = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" {
fail "test eliminated var ${var}"
}
}
# Access the memory the addresses point to.
if { $dump_excluded == 0 } {
- gdb_test "print/x *(char *) $coredump_var_addr($var)" "\(\\\$$decimal = <error: \)?Cannot access memory at address $hex\(>\)?" \
+ gdb_test "print/x *(char *) $coredump_var_addr($var)" "\(${::valnum_re} = <error: \)?Cannot access memory at address $hex\(>\)?" \
"printing $var when core is loaded (should not work)"
gdb_test "print/x *(char *) $coredump_var_addr($working_var)" " = $working_value.*" \
"print/x *$working_var ( = $working_value)"
# Test correct mapping of corefile sections by printing some variables.
-gdb_test "print coremaker_data" "\\\$$decimal = 202"
-gdb_test "print coremaker_bss" "\\\$$decimal = 10"
-gdb_test "print coremaker_ro" "\\\$$decimal = 201"
+gdb_test "print coremaker_data" "${::valnum_re} = 202"
+gdb_test "print coremaker_bss" "${::valnum_re} = 10"
+gdb_test "print coremaker_ro" "${::valnum_re} = 201"
-gdb_test "print func2::coremaker_local" "\\\$$decimal = \\{0, 1, 2, 3, 4\\}"
+gdb_test "print func2::coremaker_local" "${::valnum_re} = \\{0, 1, 2, 3, 4\\}"
# Test the presence and the correct values of $_exitsignal and
# $_exitcode variables. The corefile is generated with a SIGABRT,
# This caused gdb to output garbage and possibly segfault
gdb_test_debug_expr "print \"hello\"" \
- ".*OP_STRING\[^\r\n\]*.*: ordinary string.*\[\r\n\]\\$$decimal = \"hello\"" \
+ ".*OP_STRING\[^\r\n\]*.*: ordinary string.*\[\r\n\]${::valnum_re} = \"hello\"" \
"string evaluation with debug expr"
# An expression using a function call.
gdb_test_debug_expr "print call_me ( &val )" \
- ".*OP_FUNCALL\[^\r\n\]*.*UNOP_ADDR.*\[\r\n\]\\$$decimal = 0.*" \
+ ".*OP_FUNCALL\[^\r\n\]*.*UNOP_ADDR.*\[\r\n\]${::valnum_re} = 0.*" \
"function call expression"
set test "capture $expression"
}
gdb_test_multiple "print ${expression}" "$test" {
- -re "\\$\[0-9\]+ = (\[^\r\n\]+).*$gdb_prompt $" {
+ -re "${::valnum_re} = (\[^\r\n\]+).*$gdb_prompt $" {
set output_string "$expect_out(1,string)"
pass "$test"
}
set test "capture type of pointer $pointer"
set output_string ""
gdb_test_multiple "p ${pointer}" $test {
- -re "\\$\[0-9\]+ = .*$gdb_prompt $" {
+ -re "${::valnum_re} = .*$gdb_prompt $" {
# Expected output of "p ${pointer}" is like "$7 = (int (*)[32]) 0x804a0e0",
# and we want to extract "(int (*)[32]) 0x804a0e0" from it via
# following regexp.
}
gdb_test_no_output "set print finish off"
gdb_test "finish" \
- "Value returned is \\\$$decimal = <not displayed>"
+ "Value returned is ${::valnum_re} = <not displayed>"
gdb_test "print \$" " = 1" \
"Ensure return value was properly saved"
}
gdb_test $cmd \
[multi_line \
"#0${ws}setup_done ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#1${ws}${any} f1 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#2${ws}${any} f2 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#3${ws}${any} f3 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#4${ws}${any} f4 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#5${ws}${any} main ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
] \
"run a simple command on all frames"
}
gdb_test $cmd \
[multi_line \
"#0${ws}setup_done ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#1${ws}${any} f1 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#2${ws}${any} f2 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
] \
"run a simple command on the 3 innermost frames"
}
gdb_test $cmd \
[multi_line \
"#3${ws}${any} f3 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#4${ws}${any} f4 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#5${ws}${any} main ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
] \
"run a simple command on the 3 outermost frames"
}
"#2${ws}${any} f2 ${any}" \
"No symbol \\\"f3arg\\\" in current context." \
"#3${ws}${any} f3 ${any}" \
- "\\\$\[0-9]+ = 3${any}" \
+ "${::valnum_re} = 3${any}" \
"#4${ws}${any} f4 ${any}" \
"No symbol \\\"f3arg\\\" in current context." \
"#5${ws}${any} main ${any}" \
gdb_test $cmd \
[multi_line \
"#3${ws}${any} f3 ${any}" \
- "\\\$\[0-9]+ = 3${any}" \
+ "${::valnum_re} = 3${any}" \
] \
"run a command failing in all frames except #3, -s to silently continue"
}
gdb_test $cmd \
[multi_line \
"#0${ws}setup_done ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
"#1${ws}${any} f1 ${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
] \
"run a command, printing location"
}
set cmd "frame apply $frame_apply_args p /x 20"
gdb_test $cmd \
[multi_line \
- "\\\$\[0-9]+ = 0x14${any}" \
- "\\\$\[0-9]+ = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
+ "${::valnum_re} = 0x14${any}" \
] \
"run a command with -q quiet flag, printing only command results"
}
"level 0-5 -q -s -q"} {
set cmd "frame apply $frame_apply_args p f3arg"
gdb_test $cmd \
- "\\\$\[0-9]+ = 3${any}" \
+ "${::valnum_re} = 3${any}" \
"run a command failing in all frames except #3, -s to silently continue, quiet"
}
}
# Go back up, make sure the return value is 0.
gdb_test "finish" \
- "Run till exit from #0 +incr \\(i=-1\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+($hex in )?main \\(\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+.*Value returned is \\$$decimal = 0" \
+ "Run till exit from #0 +incr \\(i=-1\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+($hex in )?main \\(\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+.*Value returned is ${::valnum_re} = 0" \
"go back to main from incr, first time"
gdb_test_no_output "up-silently" "move up to decr"
gdb_test "finish" \
- "Run till exit from #1 +($hex in )?decr \\(i=0\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+($hex in )?main \\(\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+.*Value returned is \\$$decimal = -1" \
+ "Run till exit from #1 +($hex in )?decr \\(i=0\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+($hex in )?main \\(\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+.*Value returned is ${::valnum_re} = -1" \
"go back to main from decr"
# Go back up again, make sure the return value is 0.
gdb_test "finish" \
- "Run till exit from #0 +incr \\(i=-1\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+($hex in )?main \\(\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+.*Value returned is \\$$decimal = 0" \
+ "Run till exit from #0 +incr \\(i=-1\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+($hex in )?main \\(\\)\[ \r\n\]+at .*${srcfile}:$decimal\[\r\n\]+.*Value returned is ${::valnum_re} = 0" \
"go back to main from incr, second time"
set endian [get_endianness]
# Test printing of character vector types
-gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
-gdb_test "print c4\[2\]" "\\\$$decimal = 3"
+gdb_test "print c4" "${::valnum_re} = \\{1, 2, 3, 4\\}"
+gdb_test "print c4\[2\]" "${::valnum_re} = 3"
# Test operators on integer vector types
-gdb_test "print i4a" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print i4b" "\\\$$decimal = \\{1, 2, 8, 4\\}"
+gdb_test "print i4a" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print i4b" "${::valnum_re} = \\{1, 2, 8, 4\\}"
# Arithmetic operators
-gdb_test "print i4a + i4b" "\\\$$decimal = \\{3, 6, 16, 20\\}"
-gdb_test "print i4a - i4b" "\\\$$decimal = \\{1, 2, 0, 12\\}"
-gdb_test "print i4a * i4b" "\\\$$decimal = \\{2, 8, 64, 64\\}"
-gdb_test "print i4a / i4b" "\\\$$decimal = \\{2, 2, 1, 4\\}"
-gdb_test "print i4a % i4b" "\\\$$decimal = \\{0, 0, 0, 0\\}"
-gdb_test "print i4a++" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print ++i4a" "\\\$$decimal = \\{4, 6, 10, 18\\}"
-gdb_test "print i4a--" "\\\$$decimal = \\{4, 6, 10, 18\\}"
-gdb_test "print --i4a" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print +i4a" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print -i4a" "\\\$$decimal = \\{-2, -4, -8, -16\\}"
+gdb_test "print i4a + i4b" "${::valnum_re} = \\{3, 6, 16, 20\\}"
+gdb_test "print i4a - i4b" "${::valnum_re} = \\{1, 2, 0, 12\\}"
+gdb_test "print i4a * i4b" "${::valnum_re} = \\{2, 8, 64, 64\\}"
+gdb_test "print i4a / i4b" "${::valnum_re} = \\{2, 2, 1, 4\\}"
+gdb_test "print i4a % i4b" "${::valnum_re} = \\{0, 0, 0, 0\\}"
+gdb_test "print i4a++" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print ++i4a" "${::valnum_re} = \\{4, 6, 10, 18\\}"
+gdb_test "print i4a--" "${::valnum_re} = \\{4, 6, 10, 18\\}"
+gdb_test "print --i4a" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print +i4a" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print -i4a" "${::valnum_re} = \\{-2, -4, -8, -16\\}"
# Bitwise operators
-gdb_test "print i4a & i4b" "\\\$$decimal = \\{0, 0, 8, 0\\}"
-gdb_test "print i4a | i4b" "\\\$$decimal = \\{3, 6, 8, 20\\}"
-gdb_test "print i4a ^ i4b" "\\\$$decimal = \\{3, 6, 0, 20\\}"
-gdb_test "print ~i4a" "\\\$$decimal = \\{-3, -5, -9, -17\\}"
+gdb_test "print i4a & i4b" "${::valnum_re} = \\{0, 0, 8, 0\\}"
+gdb_test "print i4a | i4b" "${::valnum_re} = \\{3, 6, 8, 20\\}"
+gdb_test "print i4a ^ i4b" "${::valnum_re} = \\{3, 6, 0, 20\\}"
+gdb_test "print ~i4a" "${::valnum_re} = \\{-3, -5, -9, -17\\}"
# Shift operators
-gdb_test "print i4a << i4b" "\\\$$decimal = \\{4, 16, 2048, 256\\}"
-gdb_test "print i4a >> i4b" "\\\$$decimal = \\{1, 1, 0, 1\\}"
+gdb_test "print i4a << i4b" "${::valnum_re} = \\{4, 16, 2048, 256\\}"
+gdb_test "print i4a >> i4b" "${::valnum_re} = \\{1, 1, 0, 1\\}"
# Test operators on floating point vector types
-gdb_test "print f4a" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print f4b" "\\\$$decimal = \\{1, 2, 8, 4\\}"
+gdb_test "print f4a" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print f4b" "${::valnum_re} = \\{1, 2, 8, 4\\}"
# Arithmetic operators
-gdb_test "print f4a + f4b" "\\\$$decimal = \\{3, 6, 16, 20\\}"
-gdb_test "print f4a - f4b" "\\\$$decimal = \\{1, 2, 0, 12\\}"
-gdb_test "print f4a * f4b" "\\\$$decimal = \\{2, 8, 64, 64\\}"
-gdb_test "print f4a / f4b" "\\\$$decimal = \\{2, 2, 1, 4\\}"
-gdb_test "print +f4a" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print -f4a" "\\\$$decimal = \\{-2, -4, -8, -16\\}"
+gdb_test "print f4a + f4b" "${::valnum_re} = \\{3, 6, 16, 20\\}"
+gdb_test "print f4a - f4b" "${::valnum_re} = \\{1, 2, 0, 12\\}"
+gdb_test "print f4a * f4b" "${::valnum_re} = \\{2, 8, 64, 64\\}"
+gdb_test "print f4a / f4b" "${::valnum_re} = \\{2, 2, 1, 4\\}"
+gdb_test "print +f4a" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print -f4a" "${::valnum_re} = \\{-2, -4, -8, -16\\}"
# When casting to vector the input type must have the same length as
# the total length of the vector.
-gdb_test "print (char4) 0x01010101" "\\\$$decimal = \\{1, 1, 1, 1\\}"
-gdb_test "print (int2) lla" "\\\$$decimal = \\{1, 1\\}"
+gdb_test "print (char4) 0x01010101" "${::valnum_re} = \\{1, 1, 1, 1\\}"
+gdb_test "print (int2) lla" "${::valnum_re} = \\{1, 1\\}"
# Check that "whatis" doesn't peel off the destination type's typedef
# by mistake, in expressions that involve a cast to typedef type.
"type = int __attribute__ \\(\\(vector_size\\(2\\)\\)\\)"
if {![string compare $endian big]} {
- gdb_test "print (char4) ia" "\\\$$decimal = \\{0, 0, 0, 2\\}"
+ gdb_test "print (char4) ia" "${::valnum_re} = \\{0, 0, 0, 2\\}"
} else {
- gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}"
+ gdb_test "print (char4) ia" "${::valnum_re} = \\{2, 0, 0, 0\\}"
}
gdb_test "print (int2) 1" "can only cast scalar to vector of same size"
gdb_test "print lla + c4" "conversion of scalar to vector involves truncation"
gdb_test "print lla + i4a" "conversion of scalar to vector involves truncation"
-gdb_test "print c4 + ib" "\\\$$decimal = \\{2, 3, 4, 5\\}"
-gdb_test "print i4a + ib" "\\\$$decimal = \\{3, 5, 9, 17\\}"
-gdb_test "print i4a + 1" "\\\$$decimal = \\{3, 5, 9, 17\\}"
-gdb_test "print 1 + i4a" "\\\$$decimal = \\{3, 5, 9, 17\\}"
-gdb_test "print fa - f4b" "\\\$$decimal = \\{1, 0, -6, -2\\}"
-gdb_test "print 2 - f4b" "\\\$$decimal = \\{1, 0, -6, -2\\}"
-gdb_test "print f4a * fb" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print f4a * 1" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print ia / i4b" "\\\$$decimal = \\{2, 1, 0, 0\\}"
-gdb_test "print 2 / i4b" "\\\$$decimal = \\{2, 1, 0, 0\\}"
-gdb_test "print i4a % ib" "\\\$$decimal = \\{0, 0, 0, 0\\}"
-gdb_test "print i4a % 1" "\\\$$decimal = \\{0, 0, 0, 0\\}"
-gdb_test "print ia & i4b" "\\\$$decimal = \\{0, 2, 0, 0\\}"
-gdb_test "print 2 & i4b" "\\\$$decimal = \\{0, 2, 0, 0\\}"
-gdb_test "print i4a | ib" "\\\$$decimal = \\{3, 5, 9, 17\\}"
-gdb_test "print i4a | 1" "\\\$$decimal = \\{3, 5, 9, 17\\}"
-gdb_test "print ia ^ i4b" "\\\$$decimal = \\{3, 0, 10, 6\\}"
-gdb_test "print 2 ^ i4b" "\\\$$decimal = \\{3, 0, 10, 6\\}"
-gdb_test "print i4a << ib" "\\\$$decimal = \\{4, 8, 16, 32\\}"
-gdb_test "print i4a << 1" "\\\$$decimal = \\{4, 8, 16, 32\\}"
-gdb_test "print i4a >> ib" "\\\$$decimal = \\{1, 2, 4, 8\\}"
-gdb_test "print i4a >> 1" "\\\$$decimal = \\{1, 2, 4, 8\\}"
-
-gdb_test "print i4a = \{2, 4, 8, 16\}" "\\\$$decimal = \\{2, 4, 8, 16\\}"
-gdb_test "print i4a <<= ib" "\\\$$decimal = \\{4, 8, 16, 32\\}"
+gdb_test "print c4 + ib" "${::valnum_re} = \\{2, 3, 4, 5\\}"
+gdb_test "print i4a + ib" "${::valnum_re} = \\{3, 5, 9, 17\\}"
+gdb_test "print i4a + 1" "${::valnum_re} = \\{3, 5, 9, 17\\}"
+gdb_test "print 1 + i4a" "${::valnum_re} = \\{3, 5, 9, 17\\}"
+gdb_test "print fa - f4b" "${::valnum_re} = \\{1, 0, -6, -2\\}"
+gdb_test "print 2 - f4b" "${::valnum_re} = \\{1, 0, -6, -2\\}"
+gdb_test "print f4a * fb" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print f4a * 1" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print ia / i4b" "${::valnum_re} = \\{2, 1, 0, 0\\}"
+gdb_test "print 2 / i4b" "${::valnum_re} = \\{2, 1, 0, 0\\}"
+gdb_test "print i4a % ib" "${::valnum_re} = \\{0, 0, 0, 0\\}"
+gdb_test "print i4a % 1" "${::valnum_re} = \\{0, 0, 0, 0\\}"
+gdb_test "print ia & i4b" "${::valnum_re} = \\{0, 2, 0, 0\\}"
+gdb_test "print 2 & i4b" "${::valnum_re} = \\{0, 2, 0, 0\\}"
+gdb_test "print i4a | ib" "${::valnum_re} = \\{3, 5, 9, 17\\}"
+gdb_test "print i4a | 1" "${::valnum_re} = \\{3, 5, 9, 17\\}"
+gdb_test "print ia ^ i4b" "${::valnum_re} = \\{3, 0, 10, 6\\}"
+gdb_test "print 2 ^ i4b" "${::valnum_re} = \\{3, 0, 10, 6\\}"
+gdb_test "print i4a << ib" "${::valnum_re} = \\{4, 8, 16, 32\\}"
+gdb_test "print i4a << 1" "${::valnum_re} = \\{4, 8, 16, 32\\}"
+gdb_test "print i4a >> ib" "${::valnum_re} = \\{1, 2, 4, 8\\}"
+gdb_test "print i4a >> 1" "${::valnum_re} = \\{1, 2, 4, 8\\}"
+
+gdb_test "print i4a = \{2, 4, 8, 16\}" "${::valnum_re} = \\{2, 4, 8, 16\\}"
+gdb_test "print i4a <<= ib" "${::valnum_re} = \\{4, 8, 16, 32\\}"
# Test some error scenarios
gdb_test "print i4a + d2" "Cannot perform operation on vectors with different types"
runto_main
-gdb_test "print a" "\\\$$decimal = inf"
-gdb_test "print b" "\\\$$decimal = nan\\(0x.*\\)"
+gdb_test "print a" "${::valnum_re} = inf"
+gdb_test "print b" "${::valnum_re} = nan\\(0x.*\\)"
close $fd
# The expected output from the script...
-set script_output "\\$\[0-9\]+ = 1\[\r\n\]+\\$\[0-9\]+ = 2.*"
+set script_output "${::valnum_re} = 1\[\r\n\]+${::valnum_re} = 2.*"
# Start a fresh GDB. We don't need an executable for this test, so
# nothing else to do in terms of testcase setup.
}
# Check that we restore input in GDB correctly.
-gdb_test "print 1" "^\\\$$decimal = 1" "gdb input still works"
+gdb_test "print 1" "^${::valnum_re} = 1" "gdb input still works"
# Run a command and use an anchor to make sure no output appears
# before the command's expected output.
- gdb_test "print 999" "^\\\$$decimal = 999" $message
+ gdb_test "print 999" "^${::valnum_re} = 999" $message
}
# Run a few execution-related commands on CON1, and ensure the proper
-re "^\[^\$\]\[^\r\n\]+\r\n" {
exp_continue
}
- -re "^\\\$${decimal} = 2\r\n$gdb_prompt " {
+ -re "^${::valnum_re} = 2\r\n$gdb_prompt " {
if { $saw_memory_access } {
if { $saw_auxv_parse } {
# The expression parser may look up global symbols, which
set func_addr 0
send_gdb "print $func\n"
gdb_expect {
- -re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" {
+ -re "${::valnum_re} = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" {
set func_addr $expect_out(1,string)
pass "get $msg"
}
set pc 0
set msg "reading \$pc: $sym"
gdb_test_multiple "print/x \$pc" $msg {
- -re "\\\$$decimal = ($hex)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = ($hex)\r\n$gdb_prompt $" {
set pc $expect_out(1,string)
pass $msg
}
set pc2 [find_breakpoint_pc "other"]
-gdb_test "print /d $pc1 == $pc2" "\\\$$decimal = 1" "same pc from minimal symbol"
+gdb_test "print /d $pc1 == $pc2" "${::valnum_re} = 1" "same pc from minimal symbol"
untested "couldn't run to marker1"
}
-gdb_test "print foo_ptr" "\\\$$decimal = \\\(struct foo \\\*\\\) $hex"
-gdb_test "print foz_ptr" "\\\$$decimal = \\\(foz\\\) $hex"
+gdb_test "print foo_ptr" "${::valnum_re} = \\\(struct foo \\\*\\\) $hex"
+gdb_test "print foz_ptr" "${::valnum_re} = \\\(foz\\\) $hex"
gdb_continue_to_breakpoint "$testname - address set"
gdb_test_multiple "print/x p" $testname {
- -re "\\$\[0-9\]+ = (0x\[0-9a-f\]*)\r?\n$gdb_prompt $" {
+ -re "${::valnum_re} = (0x\[0-9a-f\]*)\r?\n$gdb_prompt $" {
pass $testname
return $expect_out(1,string)
}
set pc_before_stepping ""
set test "pc before stepping"
gdb_test_multiple "print/x \$pc" $test {
- -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = (\[^\r\n\]*)\r\n$gdb_prompt $" {
set pc_before_stepping $expect_out(1,string)
pass $test
}
set pc_after_stepping ""
set msg "pc after stepping"
gdb_test_multiple "print/x \$pc" $msg {
- -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = (\[^\r\n\]*)\r\n$gdb_prompt $" {
set pc_after_stepping $expect_out(1,string)
pass $msg
}
gdb_file_cmd ${binfile}
# Check the values of the variables.
-gdb_test "print static_foo" "\\\$$decimal = 1"
-gdb_test "print static_bar" "\\\$$decimal = 2"
-gdb_test "print global_foo" "\\\$$decimal = 3"
-gdb_test "print global_bar" "\\\$$decimal = 4"
+gdb_test "print static_foo" "${::valnum_re} = 1"
+gdb_test "print static_bar" "${::valnum_re} = 2"
+gdb_test "print global_foo" "${::valnum_re} = 3"
+gdb_test "print global_bar" "${::valnum_re} = 4"
gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main"
# Print scope0.c::filelocal, which is 1
- gdb_test "print filelocal" "\\\$$decimal = 1"
- gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at main"
+ gdb_test "print filelocal" "${::valnum_re} = 1"
+ gdb_test "print 'scope0.c'::filelocal" "${::valnum_re} = 1" "print 'scope0.c'::filelocal at main"
# Print scope0.c::filelocal_bss, which is 101
- gdb_test "print filelocal_bss" "\\\$$decimal = 101"
- gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_main"
+ gdb_test "print filelocal_bss" "${::valnum_re} = 101"
+ gdb_test "print 'scope0.c'::filelocal_bss" "${::valnum_re} = 101" "print 'scope0.c'::filelocal_bss in test_at_main"
# Print scope0.c::filelocal_ro, which is 201
# No clue why the rs6000 fails this test.
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main"
+ gdb_test "print filelocal_ro" "${::valnum_re} = 201" "print filelocal_ro in test_at_main"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro"
+ gdb_test "print 'scope0.c'::filelocal_ro" "${::valnum_re} = 201" "print 'scope0.c'::filelocal_ro"
# Print scope1.c::filelocal, which is 2
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal"
+ gdb_test "print 'scope1.c'::filelocal" "${::valnum_re} = 2" "print 'scope1.c'::filelocal"
# Print scope1.c::filelocal_bss, which is 102
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss"
+ gdb_test "print 'scope1.c'::filelocal_bss" "${::valnum_re} = 102" "print 'scope1.c'::filelocal_bss"
# Print scope1.c::filelocal_ro, which is 202
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro"
+ gdb_test "print 'scope1.c'::filelocal_ro" "${::valnum_re} = 202" "print 'scope1.c'::filelocal_ro"
# Print scope1.c::foo::funclocal, which is 3
- gdb_test "print foo::funclocal" "\\\$$decimal = 3"
+ gdb_test "print foo::funclocal" "${::valnum_re} = 3"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal"
+ gdb_test "print 'scope1.c'::foo::funclocal" "${::valnum_re} = 3" "print 'scope1.c'::foo::funclocal"
# Print scope1.c::foo::funclocal_ro, which is 203
- gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203"
+ gdb_test "print foo::funclocal_ro" "${::valnum_re} = 203"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro"
+ gdb_test "print 'scope1.c'::foo::funclocal_ro" "${::valnum_re} = 203" "print 'scope1.c'::foo::funclocal_ro"
# Print scope1.c::bar::funclocal, which is 4
- gdb_test "print bar::funclocal" "\\\$$decimal = 4"
+ gdb_test "print bar::funclocal" "${::valnum_re} = 4"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal"
+ gdb_test "print 'scope1.c'::bar::funclocal" "${::valnum_re} = 4" "print 'scope1.c'::bar::funclocal"
}
proc_with_prefix test_at_foo {} {
gdb_test "next" ".*bar \\(\\);"
# Print scope0.c::filelocal, which is 1
- gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at foo"
+ gdb_test "print 'scope0.c'::filelocal" "${::valnum_re} = 1" "print 'scope0.c'::filelocal at foo"
# Print scope0.c::filelocal_bss, which is 101
- gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_foo"
+ gdb_test "print 'scope0.c'::filelocal_bss" "${::valnum_re} = 101" "print 'scope0.c'::filelocal_bss in test_at_foo"
# Print scope0.c::filelocal_ro, which is 201
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro"
+ gdb_test "print 'scope0.c'::filelocal_ro" "${::valnum_re} = 201" "print 'scope0.c'::filelocal_ro"
# Print scope1.c::filelocal, which is 2
- gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo"
+ gdb_test "print filelocal" "${::valnum_re} = 2" "print filelocal at foo"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at foo"
+ gdb_test "print 'scope1.c'::filelocal" "${::valnum_re} = 2" "print 'scope1.c'::filelocal at foo"
- gdb_test "print filelocal_bss" "\\\$$decimal = 102" \
+ gdb_test "print filelocal_bss" "${::valnum_re} = 102" \
"print filelocal_bss at foo"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at foo"
+ gdb_test "print 'scope1.c'::filelocal_bss" "${::valnum_re} = 102" "print 'scope1.c'::filelocal_bss at foo"
- gdb_test "print filelocal_ro" "\\\$$decimal = 202" \
+ gdb_test "print filelocal_ro" "${::valnum_re} = 202" \
"print filelocal_ro at foo"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at foo"
+ gdb_test "print 'scope1.c'::filelocal_ro" "${::valnum_re} = 202" "print 'scope1.c'::filelocal_ro at foo"
# Print scope1.c::foo::funclocal, which is 3
- gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo"
+ gdb_test "print funclocal" "${::valnum_re} = 3" "print funclocal at foo"
- gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
+ gdb_test "print foo::funclocal" "${::valnum_re} = 3" \
"print foo::funclocal at foo"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo"
+ gdb_test "print 'scope1.c'::foo::funclocal" "${::valnum_re} = 3" "print 'scope1.c'::foo::funclocal at foo"
# Print scope1.c::foo::funclocal_bss, which is 103
- gdb_test "print funclocal_bss" "\\\$$decimal = 103" \
+ gdb_test "print funclocal_bss" "${::valnum_re} = 103" \
"print funclocal_bss at foo"
- gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
+ gdb_test "print foo::funclocal_bss" "${::valnum_re} = 103" \
"print foo::funclocal_bss at foo"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo"
+ gdb_test "print 'scope1.c'::foo::funclocal_bss" "${::valnum_re} = 103" "print 'scope1.c'::foo::funclocal_bss at foo"
# Print scope1.c::foo::funclocal_ro, which is 203
- gdb_test "print funclocal_ro" "\\\$$decimal = 203" \
+ gdb_test "print funclocal_ro" "${::valnum_re} = 203" \
"print funclocal_ro at foo"
- gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
+ gdb_test "print foo::funclocal_ro" "${::valnum_re} = 203" \
"print foo::funclocal_ro at foo"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo"
+ gdb_test "print 'scope1.c'::foo::funclocal_ro" "${::valnum_re} = 203" "print 'scope1.c'::foo::funclocal_ro at foo"
# Print scope1.c::bar::funclocal, which is 4
- gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
+ gdb_test "print bar::funclocal" "${::valnum_re} = 4" \
"print bar::funclocal at foo"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo"
+ gdb_test "print 'scope1.c'::bar::funclocal" "${::valnum_re} = 4" "print 'scope1.c'::bar::funclocal at foo"
}
gdb_test "next"
# Print scope0.c::filelocal, which is 1
- gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at bar"
+ gdb_test "print 'scope0.c'::filelocal" "${::valnum_re} = 1" "print 'scope0.c'::filelocal at bar"
# Print scope0.c::filelocal_bss, which is 101
- gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_bar"
+ gdb_test "print 'scope0.c'::filelocal_bss" "${::valnum_re} = 101" "print 'scope0.c'::filelocal_bss in test_at_bar"
# Print scope0.c::filelocal_ro, which is 201
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro at bar"
+ gdb_test "print 'scope0.c'::filelocal_ro" "${::valnum_re} = 201" "print 'scope0.c'::filelocal_ro at bar"
# Print scope1.c::filelocal, which is 2
- gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar"
+ gdb_test "print filelocal" "${::valnum_re} = 2" "print filelocal at bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at bar"
+ gdb_test "print 'scope1.c'::filelocal" "${::valnum_re} = 2" "print 'scope1.c'::filelocal at bar"
# Print scope1.c::filelocal_bss, which is 102
- gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar"
+ gdb_test "print filelocal_bss" "${::valnum_re} = 102" "print filelocal_bss at bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at bar"
+ gdb_test "print 'scope1.c'::filelocal_bss" "${::valnum_re} = 102" "print 'scope1.c'::filelocal_bss at bar"
# Print scope1.c::filelocal_ro, which is 202
- gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar"
+ gdb_test "print filelocal_ro" "${::valnum_re} = 202" "print filelocal_ro in test_at_bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at bar"
+ gdb_test "print 'scope1.c'::filelocal_ro" "${::valnum_re} = 202" "print 'scope1.c'::filelocal_ro at bar"
# Print scope1.c::foo::funclocal, which is 3
- gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar"
+ gdb_test "print foo::funclocal" "${::valnum_re} = 3" "print foo::funclocal at bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at bar"
+ gdb_test "print 'scope1.c'::foo::funclocal" "${::valnum_re} = 3" "print 'scope1.c'::foo::funclocal at bar"
# Print scope1.c::foo::funclocal_bss, which is 103
- gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar"
+ gdb_test "print foo::funclocal_bss" "${::valnum_re} = 103" "print foo::funclocal_bss at bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at bar"
+ gdb_test "print 'scope1.c'::foo::funclocal_bss" "${::valnum_re} = 103" "print 'scope1.c'::foo::funclocal_bss at bar"
# Print scope1.c::foo::funclocal_ro, which is 203
- gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar"
+ gdb_test "print foo::funclocal_ro" "${::valnum_re} = 203" "print foo::funclocal_ro at bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at bar"
+ gdb_test "print 'scope1.c'::foo::funclocal_ro" "${::valnum_re} = 203" "print 'scope1.c'::foo::funclocal_ro at bar"
# Print scope1.c::bar::funclocal, which is 4
- gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar"
- gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar"
+ gdb_test "print funclocal" "${::valnum_re} = 4" "print funclocal at bar"
+ gdb_test "print bar::funclocal" "${::valnum_re} = 4" "print bar::funclocal at bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at bar"
+ gdb_test "print 'scope1.c'::bar::funclocal" "${::valnum_re} = 4" "print 'scope1.c'::bar::funclocal at bar"
# Print scope1.c::bar::funclocal_bss, which is 104
- gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar"
- gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar"
+ gdb_test "print funclocal_bss" "${::valnum_re} = 104" "print funclocal_bss at bar"
+ gdb_test "print bar::funclocal_bss" "${::valnum_re} = 104" "print bar::funclocal_bss at bar"
if {[test_compiler_info gcc-*-*]} { setup_xfail "rs6000-*-*" }
- gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "print 'scope1.c'::bar::funclocal_bss at bar"
+ gdb_test "print 'scope1.c'::bar::funclocal_bss" "${::valnum_re} = 104" "print 'scope1.c'::bar::funclocal_bss at bar"
}
# This test has little to do with local scopes, but it is in scope.exp anyway.
set home ""
set test "print home var"
gdb_test_multiple "print home" $test {
- -re "\\\$$decimal = $hex \"\(.+\)\"\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = $hex \"\(.+\)\"\r\n$gdb_prompt $" {
set home $expect_out(1,string)
pass $test
}
set curdir ""
set test "print dir var"
gdb_test_multiple "print dir" $test {
- -re "\\\$$decimal = \"\(.+\)\"\(, .*repeats.*\)?\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \"\(.+\)\"\(, .*repeats.*\)?\r\n$gdb_prompt $" {
set curdir $expect_out(1,string)
pass $test
}
gdb_breakpoint [gdb_get_line_number "break-here"]
gdb_continue_to_breakpoint "break-here" ".* break-here .*"
- gdb_test "print dir" "\\\$$decimal = \"$tmpdir\", .*" \
+ gdb_test "print dir" "${::valnum_re} = \"$tmpdir\", .*" \
"inferior cwd is correctly set"
set gdb_cwd_after_run ""
gdb_breakpoint [gdb_get_line_number "break-here"]
gdb_continue_to_breakpoint "break-here" ".* break-here .*"
- gdb_test "print dir" "\\\$$decimal = \"$tmpdir\", .*" \
+ gdb_test "print dir" "${::valnum_re} = \"$tmpdir\", .*" \
"inferior cwd is correctly set"
# Reset the inferior's cwd.
gdb_breakpoint [gdb_get_line_number "break-here"]
gdb_continue_to_breakpoint "break-here" ".* break-here .*"
- gdb_test "print dir" "\\\$$decimal = \"$gdb_cwd\", .*" \
+ gdb_test "print dir" "${::valnum_re} = \"$gdb_cwd\", .*" \
"inferior cwd got reset correctly"
}
}
set var_value_match "$hex \"$var_value\""
}
- gdb_test "print my_getenv (\"$var_name\")" "\\\$$decimal = $var_value_match" \
+ gdb_test "print my_getenv (\"$var_name\")" "${::valnum_re} = $var_value_match" \
$test_msg
}
set test_msg "check if unset works"
set found_home 0
gdb_test_multiple "print my_getenv (\"HOME\")" $test_msg {
- -re "\\\$$decimal = $hex \".*\"\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = $hex \".*\"\r\n$gdb_prompt $" {
pass $test_msg
set found_home 1
}
- -re "\\\$$decimal = 0x0\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 0x0\r\n$gdb_prompt $" {
untested $test_msg
}
}
gdb_test "p \$_shell(\"false\")" " = 1"
# Test command with arguments.
- gdb_test "p \$_shell(\"echo foo\")" "foo\r\n\\$${decimal} = 0"
+ gdb_test "p \$_shell(\"echo foo\")" "foo\r\n${::valnum_re} = 0"
# Check the type of the result.
gdb_test "ptype \$_shell(\"true\")" "type = int"
# Test passing a non-literal string as command name.
gdb_test "p \$cmd = \"echo bar\"" " = \"echo bar\""
- gdb_test "p \$_shell(\$cmd)" "bar\r\n\\$${decimal} = 0"
+ gdb_test "p \$_shell(\$cmd)" "bar\r\n${::valnum_re} = 0"
# Test executing a non-existing command. The result is
# shell-dependent, but most (all?) POSIX-like shells return 127 in
# ...call the function
- gdb_test "p func1 ()" "^\\\$$decimal = void" \
+ gdb_test "p func1 ()" "^${::valnum_re} = void" \
"p func1 () #1"
# ...veryfiy that the cout was updated
set msg "save \$pc after load"
set saved_pc ""
gdb_test_multiple "print/x \$pc" $msg {
- -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = (\[^\r\n\]*)\r\n$gdb_prompt $" {
set saved_pc $expect_out(1,string)
pass $msg
}
return 0
}
-gdb_test "print/x \$pc" "\\\$$decimal = $saved_pc" "check \$pc after load"
+gdb_test "print/x \$pc" "${::valnum_re} = $saved_pc" "check \$pc after load"
gdb_test "continue" "Stopped due to shared library event.*" "continue to unload"
set msg "save \$pc after unload"
set saved_pc ""
gdb_test_multiple "print/x \$pc" $msg {
- -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = (\[^\r\n\]*)\r\n$gdb_prompt $" {
set saved_pc $expect_out(1,string)
pass $msg
}
return 0
}
-gdb_test "print/x \$pc" "\\\$$decimal = $saved_pc" "check \$pc after unload"
+gdb_test "print/x \$pc" "${::valnum_re} = $saved_pc" "check \$pc after unload"
setup_xfail "*-*-*" gdb/28392
}
- gdb_test "print argv\[1\]" "\\\$$::decimal = $::hex $re" $testname
+ gdb_test "print argv\[1\]" "${::valnum_re} = $::hex $re" $testname
}
}
}
return -1
}
-set vhn "\\$\[0-9\]+"
+set vhn "${::valnum_re}"
# Check the real contents.
gdb_test "print two" "$vhn = {one = {x = 1}, x = 2, y = 3}"
set sfield [limited_style string_field variable]
set efield [limited_style e_field variable]
set evalue [limited_style VALUE_TWO variable]
- set lhs [limited_style "\\\$$decimal" variable]
+ set lhs [limited_style "${::valnum_re}" variable]
gdb_test "print struct_value" \
"$lhs = \{$ifield = 23,.*$sfield = .*,.*$efield = $evalue.*"
return
}
- gdb_test "finish" "Value returned is [style \\\$$::decimal variable] = 0"
+ gdb_test "finish" "Value returned is [style ${::valnum_re} variable] = 0"
}
# Check to see if the Python styling of disassembler output is
# Call some string methods.
-gdb_test "print s.length()" "\\$\[0-9\]+ = 42"
-gdb_test "print s\[0\]" "\\$\[0-9\]+ =.* 'I'"
-gdb_test "print s\[s.length()-1\]" "\\$\[0-9\]+ =.* 'g'"
+gdb_test "print s.length()" "${::valnum_re} = 42"
+gdb_test "print s\[0\]" "${::valnum_re} =.* 'I'"
+gdb_test "print s\[s.length()-1\]" "${::valnum_re} =.* 'g'"
gdb_test "print (const char *) s" \
- "\\$\[0-9\]+ = $hex \"I am a short stringand now a longer string\""
+ "${::valnum_re} = $hex \"I am a short stringand now a longer string\""
gdb_test "b [gdb_get_line_number {breakpoint here} ${testfile}.cc ]" \
".*Breakpoint .*call-c.*"
-gdb_test "print foo(1)" "\\\$$decimal = 1"
+gdb_test "print foo(1)" "${::valnum_re} = 1"
gdb_test "continue" ".*breakpoint here.*" "continue to bp"
-gdb_test "print rf->func()" "\\\$$decimal = 1"
+gdb_test "print rf->func()" "${::valnum_re} = 1"
gdb_test "print sum_vararg_int(0)" "0"
gdb_test "print sum_vararg_int(1, 10)" "10"
gdb_test "print vararg_func(14, 15, \"16\")" "2"
# Regression test for method call via a typedef.
-gdb_test "print handle->func()" "\\\$$decimal = 1"
+gdb_test "print handle->func()" "${::valnum_re} = 1"
# 2008-08-21 we can output the qualifiers for DWARF-2.
gdb_test "print obj_with_enum" \
- "\\$\[0-9\]+ = \{priv_enum = (ClassWithEnum::)?red, x = 0\}" \
+ "${::valnum_re} = \{priv_enum = (ClassWithEnum::)?red, x = 0\}" \
"print obj_with_enum (1)"
# advance one line
# print the object again
gdb_test "print obj_with_enum" \
- "\\$\[0-9\]+ = \{priv_enum = (ClassWithEnum::)?green, x = 0\}" \
+ "${::valnum_re} = \{priv_enum = (ClassWithEnum::)?green, x = 0\}" \
"print obj_with_enum, 2"
# print the enum member
- gdb_test "print obj_with_enum.priv_enum" "\\$\[0-9\]+ = (ClassWithEnum::)?green"
+ gdb_test "print obj_with_enum.priv_enum" "${::valnum_re} = (ClassWithEnum::)?green"
# ptype on the enum member
# See PR gdb/1588.
gdb_test_multiple "print (ClassWithEnum::PrivEnum) 42" "print (ClassWithEnum::PrivEnum) 42" {
- -re "\\$\[0-9\]+ = (ClassWithEnum::)?yellow$nl$gdb_prompt $" {
+ -re "${::valnum_re} = (ClassWithEnum::)?yellow$nl$gdb_prompt $" {
pass "print (ClassWithEnum::PrivEnum) 42"
}
-re "A (parse|syntax) error in expression, near `42'.$nl$gdb_prompt $" {
}
gdb_test_multiple "print ('ClassWithEnum::PrivEnum') 42" "print ('ClassWithEnum::PrivEnum') 42" {
- -re "\\$\[0-9\]+ = (ClassWithEnum::)?yellow$nl$gdb_prompt $" {
+ -re "${::valnum_re} = (ClassWithEnum::)?yellow$nl$gdb_prompt $" {
# gcc 3.3.2 -gstabs+
# gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
pass "print ('ClassWithEnum::PrivEnum') 42"
proc test_pointers_to_class_members {} {
gdb_test "print Bar::z" "Cannot reference non-static field \"z\""
- gdb_test "print &Foo::x" "\\$\[0-9\]+ = &Foo::x"
- gdb_test "print (int)&Foo::x" "\\$\[0-9\]+ = 0"
- gdb_test "print (int)&Bar::y == 2*sizeof(int)" "\\$\[0-9\]+ = true"
+ gdb_test "print &Foo::x" "${::valnum_re} = &Foo::x"
+ gdb_test "print (int)&Foo::x" "${::valnum_re} = 0"
+ gdb_test "print (int)&Bar::y == 2*sizeof(int)" "${::valnum_re} = true"
gdb_test "ptype Bar::z" "type = int"
gdb_test "ptype &Bar::z" "type = int Bar::\\*"
proc test_static_members {} {
global hex
- gdb_test "print Foo::st" "\\$\[0-9\]+ = 100"
+ gdb_test "print Foo::st" "${::valnum_re} = 100"
gdb_test_no_output "set foo.st = 200" ""
- gdb_test "print bar.st" "\\$\[0-9\]+ = 200"
- gdb_test "print &foo.st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex <Foo::st>"
- gdb_test "print &Bar::st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex <Foo::st>"
- gdb_test "print *\$" "\\$\[0-9\]+ = 200"
+ gdb_test "print bar.st" "${::valnum_re} = 200"
+ gdb_test "print &foo.st" "${::valnum_re} = \\(int ?\\*\\) $hex <Foo::st>"
+ gdb_test "print &Bar::st" "${::valnum_re} = \\(int ?\\*\\) $hex <Foo::st>"
+ gdb_test "print *\$" "${::valnum_re} = 200"
gdb_test_no_output "set print static-members off"
gdb_test "print csi" \
fail "$t (conversion failed)"
}
- -re "\\$\[0-9\]+ = 31$nl$gdb_prompt $" {
+ -re "${::valnum_re} = 31$nl$gdb_prompt $" {
pass $t
}
}
set rfunc [string_to_regexp $func]
gdb_test_multiple "print ${func}" "get address of ${func}" {
- -re "\\\$\[0-9\]+ = \\{.*\\} (($hex) <${rfunc}.*>)\[\r\n\]+${gdb_prompt} $" {
+ -re "${::valnum_re} = \\{.*\\} (($hex) <${rfunc}.*>)\[\r\n\]+${gdb_prompt} $" {
# $1 = {int ()} 0x24 <function_bar>
# But if the function is at zero, the name may be omitted.
pass "get address of ${func}"
gdb_breakpoint [gdb_get_line_number "marker add1"]
gdb_continue_to_breakpoint "marker add1"
-gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
-gdb_test "print f" "\\$\[0-9\]+ = 9"
-gdb_test "print i" "\\$\[0-9\]+ = 4"
+gdb_test "print c" "${::valnum_re} = 194 .*"
+gdb_test "print f" "${::valnum_re} = 9"
+gdb_test "print i" "${::valnum_re} = 4"
gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" {
- -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\r\n$gdb_prompt $" {
pass "print add<int>(2,2)"
}
-re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" {
# Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats
gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" {
- -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\\.5\r\n$gdb_prompt $" {
pass "print add<float>(2.25,2.25)"
}
-re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
- -re "\\$\[0-9\]+ = 130 .*\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 130 .*\r\n$gdb_prompt $" {
pass "print add<unsigned char>('A','A')"
}
-re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" {
- -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\r\n$gdb_prompt $" {
pass "print add2<int>(2,2)"
}
-re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" {
- -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\\.5\r\n$gdb_prompt $" {
pass "print add2<float>(2.25,2.25)"
}
-re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
- -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
+ -re "${::valnum_re} = 130 .*$gdb_prompt $" {
pass "print add2<unsigned char>('A','A')"
}
-re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" {
- -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\r\n$gdb_prompt $" {
pass "print add3<int>(2,2)"
}
-re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" {
- -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\\.5\r\n$gdb_prompt $" {
pass "print add3<float>(2.25,2.25)"
}
-re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
- -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
+ -re "${::valnum_re} = 130 .*$gdb_prompt $" {
pass "print add3<unsigned char>('A','A')"
}
-re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" {
- -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\r\n$gdb_prompt $" {
pass "print add4<int>(2,2)"
}
-re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" {
- -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 4\\.5\r\n$gdb_prompt $" {
pass "print add4<float>(2.25,2.25)"
}
-re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" {
}
gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
- -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
+ -re "${::valnum_re} = 130 .*$gdb_prompt $" {
pass "print add4<unsigned char>('A','A')"
}
-re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
# class A
-gdb_test "print a_instance" "\\$\[0-9\]+ = \{a = 1, aa = 2\}" "print value of a_instance"
+gdb_test "print a_instance" "${::valnum_re} = \{a = 1, aa = 2\}" "print value of a_instance"
# Clang does not add accessibility information for typedefs inside classes.
if {[test_compiler_info {clang*} c++]} {
# class D
gdb_test_multiple "print d_instance" "print value of d_instance" {
- -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, d = 7, dd = 8\}$nl$gdb_prompt $" {
+ -re "${::valnum_re} = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, d = 7, dd = 8\}$nl$gdb_prompt $" {
pass "print value of d_instance"
}
}
# class E
gdb_test_multiple "print e_instance" "print value of e_instance" {
- -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, e = 9, ee = 10\}$nl$gdb_prompt $" {
+ -re "${::valnum_re} = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, e = 9, ee = 10\}$nl$gdb_prompt $" {
pass "print value of e_instance"
}
}
# class F
gdb_test_multiple "print f_instance" "print value of f_instance" {
- -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, f = 11, ff = 12\}$nl$gdb_prompt $" {
+ -re "${::valnum_re} = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, f = 11, ff = 12\}$nl$gdb_prompt $" {
pass "print value of f_instance"
}
}
# Print individual fields.
-gdb_test "print d_instance.a" "\\$\[0-9\]+ = 1" "print value of d_instance.a"
-gdb_test "print d_instance.aa" "\\$\[0-9\]+ = 2" "print value of d_instance.aa"
-gdb_test "print d_instance.b" "\\$\[0-9\]+ = 3" "print value of d_instance.b"
-gdb_test "print d_instance.bb" "\\$\[0-9\]+ = 4" "print value of d_instance.bb"
-gdb_test "print d_instance.c" "\\$\[0-9\]+ = 5" "print value of d_instance.c"
-gdb_test "print d_instance.cc" "\\$\[0-9\]+ = 6" "print value of d_instance.cc"
-gdb_test "print d_instance.d" "\\$\[0-9\]+ = 7" "print value of d_instance.d"
-gdb_test "print d_instance.dd" "\\$\[0-9\]+ = 8" "print value of d_instance.dd"
+gdb_test "print d_instance.a" "${::valnum_re} = 1" "print value of d_instance.a"
+gdb_test "print d_instance.aa" "${::valnum_re} = 2" "print value of d_instance.aa"
+gdb_test "print d_instance.b" "${::valnum_re} = 3" "print value of d_instance.b"
+gdb_test "print d_instance.bb" "${::valnum_re} = 4" "print value of d_instance.bb"
+gdb_test "print d_instance.c" "${::valnum_re} = 5" "print value of d_instance.c"
+gdb_test "print d_instance.cc" "${::valnum_re} = 6" "print value of d_instance.cc"
+gdb_test "print d_instance.d" "${::valnum_re} = 7" "print value of d_instance.d"
+gdb_test "print d_instance.dd" "${::valnum_re} = 8" "print value of d_instance.dd"
# Print some fields which are defined in the top of class G
# and in its base classes. This is not be ambiguous.
-gdb_test "print g_instance.a" "\\$\[0-9\]+ = 15" "print value of g_instance.a"
-gdb_test "print g_instance.b" "\\$\[0-9\]+ = 16" "print value of g_instance.b"
-gdb_test "print g_instance.c" "\\$\[0-9\]+ = 17" "print value of g_instance.c"
+gdb_test "print g_instance.a" "${::valnum_re} = 15" "print value of g_instance.a"
+gdb_test "print g_instance.b" "${::valnum_re} = 16" "print value of g_instance.b"
+gdb_test "print g_instance.c" "${::valnum_re} = 17" "print value of g_instance.c"
# Print a function call.
-gdb_test "print g_instance.afoo()" "\\$\[0-9\]+ = 1" "print value of g_instance.afoo()"
+gdb_test "print g_instance.afoo()" "${::valnum_re} = 1" "print value of g_instance.afoo()"
# If GDB fails to restore the selected frame properly after the
# inferior function call above (see GDB PR 1155 for an explanation of
}
}
-gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.bfoo()"
-gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.cfoo()"
+gdb_test "print g_instance.bfoo()" "${::valnum_re} = 2" "print value of g_instance.bfoo()"
+gdb_test "print g_instance.cfoo()" "${::valnum_re} = 3" "print value of g_instance.cfoo()"
# Check typedefs of fields
foreach Klass {"C" "G"} {
global gdb_prompt
gdb_test_multiple "print &$var" "find address of $var" {
- -re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
+ -re "${::valnum_re} = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
return $expect_out(1,string)
}
timeout {
set test "print/x $var"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = \\([string_to_regexp $type]\\) @0x\[a-f0-9\]+: [string_to_regexp $val].*$gdb_prompt $" {
+ -re "${::valnum_re} = \\([string_to_regexp $type]\\) @0x\[a-f0-9\]+: [string_to_regexp $val].*$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
+ -re "${::valnum_re} = $addr.*$gdb_prompt $" {
fail "$test (prints just address)"
}
- -re "\\$\[0-9\]+ = 0x\[a-f0-9\]+.*$gdb_prompt $" {
+ -re "${::valnum_re} = 0x\[a-f0-9\]+.*$gdb_prompt $" {
fail "$test (prints unexpected address)"
}
}
set test "print/x &$var"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
+ -re "${::valnum_re} = $addr.*$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
+ -re "${::valnum_re} = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
fail "$test (prints unexpected address)"
}
}
set test "print/x *(&(&$var))"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
+ -re "${::valnum_re} = $addr.*$gdb_prompt $" {
pass $test
}
-re "Attempt to take address of value not located in memory.*$gdb_prompt $" {
# correctly...
pass $test
}
- -re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
+ -re "${::valnum_re} = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
fail "$test (prints unexpected address)"
}
}
proc test_p_op1_equals_op2 {op1 op2} {
set test "print $op1 == $op2"
- gdb_test $test "\\$\[0-9\]+ = true"
+ gdb_test $test "${::valnum_re} = true"
}
runto ${srcfile}:[gdb_get_line_number "marker here"]
set ws "\[\r\n\t \]+"
set nl "\[\r\n\]+"
-set vhn "\\$\[0-9\]+"
+set vhn "${::valnum_re}"
require allow_cplus_tests
# Written by Satish Pai <pai@apollo.hp.com> 1997-08-19
# Rewritten by Michael Chastain <mec.gnu@mindspring.com> 2004-01-11
-set vhn "\\$\[0-9\]+"
+set vhn "${::valnum_re}"
require allow_cplus_tests
# Test that we can call the method through reference and get the expected result.
gdb_test_multiple "print b.get_foo()" "print method call returning reference" {
- -re "\\$\[0-9\]+ = \\(const foo &\\) @$hex: \\{m_a = 42\\}\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \\(const foo &\\) @$hex: \\{m_a = 42\\}\r\n$gdb_prompt $" {
pass $gdb_test_name
}
-re "Could not validate memory tag: Value can't be converted to integer\\." {
# Test accessing the member through the reference.
gdb_test "print b.get_foo ().m_a" \
- "\\$\[0-9\]+ = 42" \
+ "${::valnum_re} = 42" \
"print member access through reference"
# Test calling method on the referenced object.
gdb_test "print b.get_foo ().get_a()" \
- "\\$\[0-9\]+ = 42" \
+ "${::valnum_re} = 42" \
"print method call on referenced object"
# Test that the stored reference works correctly.
gdb_test_multiple "print ref" "print stored reference" {
- -re "\\$\[0-9\]+ = \\(const foo &\\) @$hex: \\{m_a = 42\\}\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \\(const foo &\\) @$hex: \\{m_a = 42\\}\r\n$gdb_prompt $" {
pass $gdb_test_name
}
-re "Could not validate memory tag: Value can't be converted to integer\\." {
}
gdb_test "print ref.m_a" \
- "\\$\[0-9\]+ = 42" \
+ "${::valnum_re} = 42" \
"print member through stored reference"
gdb_test "print ref.get_a()" \
- "\\$\[0-9\]+ = 42" \
+ "${::valnum_re} = 42" \
"print method call through stored reference"
\ No newline at end of file
# An object declared using "using".
-gdb_test "print ina" "\\$\[0-9\]+ = {xx = 33}"
+gdb_test "print ina" "${::valnum_re} = {xx = 33}"
gdb_test_multiple "ptype ina" "ptype ina" {
-re "type = class (AAA::|)inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*.*int fum\\(int\\);\r\n\}\r\n$gdb_prompt $" {
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);"
set re_synth "foo & operator=\\(foo const ?&\\);"
-gdb_test "print foo_instance1" "\\$\[0-9\]+ = \{ifoo = 111, ccpfoo = 0x0\}"
+gdb_test "print foo_instance1" "${::valnum_re} = \{ifoo = 111, ccpfoo = 0x0\}"
set lines [gdb_get_lines "ptype foo_instance1"]
set test "ptype foo_instance1 output"
# Print variables and method calls.
# This is a walk in the park.
-gdb_test "print foo_instance2" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
-gdb_test "print foo_instance3" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
+gdb_test "print foo_instance2" "${::valnum_re} = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
+gdb_test "print foo_instance3" "${::valnum_re} = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
-gdb_test "print foo_instance1.overloadargs(1)" "\\$\[0-9\]+ = 1" \
+gdb_test "print foo_instance1.overloadargs(1)" "${::valnum_re} = 1" \
"print call overloaded func 1 arg"
# Regression test for overloading with function pointer type.
}
gdb_test "print foo_instance1.overloadargs(1, 2)" \
- "\\$\[0-9\]+ = 2" \
+ "${::valnum_re} = 2" \
"print call overloaded func 2 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3)" \
- "\\$\[0-9\]+ = 3" \
+ "${::valnum_re} = 3" \
"print call overloaded func 3 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4)" \
- "\\$\[0-9\]+ = 4" \
+ "${::valnum_re} = 4" \
"print call overloaded func 4 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5)" \
- "\\$\[0-9\]+ = 5" \
+ "${::valnum_re} = 5" \
"print call overloaded func 5 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)" \
- "\\$\[0-9\]+ = 6" \
+ "${::valnum_re} = 6" \
"print call overloaded func 6 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)" \
- "\\$\[0-9\]+ = 7" \
+ "${::valnum_re} = 7" \
"print call overloaded func 7 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)" \
- "\\$\[0-9\]+ = 8" \
+ "${::valnum_re} = 8" \
"print call overloaded func 8 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)" \
- "\\$\[0-9\]+ = 9" \
+ "${::valnum_re} = 9" \
"print call overloaded func 9 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)" \
- "\\$\[0-9\]+ = 10" \
+ "${::valnum_re} = 10" \
"print call overloaded func 10 args"
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)" \
- "\\$\[0-9\]+ = 11" \
+ "${::valnum_re} = 11" \
"print call overloaded func 11 args"
gdb_test "print foo_instance1.overload1arg()" \
- "\\$\[0-9\]+ = 1" \
+ "${::valnum_re} = 1" \
"print call overloaded func void arg"
gdb_test "print foo_instance1.overload1arg((char)arg2)" \
- "\\$\[0-9\]+ = 2" \
+ "${::valnum_re} = 2" \
"print call overloaded func char arg"
gdb_test "print foo_instance1.overload1arg((signed char)arg3)" \
- "\\$\[0-9\]+ = 3" \
+ "${::valnum_re} = 3" \
"print call overloaded func signed char arg"
gdb_test "print foo_instance1.overload1arg((unsigned char)arg4)" \
- "\\$\[0-9\]+ = 4" \
+ "${::valnum_re} = 4" \
"print call overloaded func unsigned char arg"
gdb_test "print foo_instance1.overload1arg((short)arg5)" \
- "\\$\[0-9\]+ = 5" \
+ "${::valnum_re} = 5" \
"print call overloaded func short arg"
gdb_test "print foo_instance1.overload1arg((unsigned short)arg6)" \
- "\\$\[0-9\]+ = 6" \
+ "${::valnum_re} = 6" \
"print call overloaded func unsigned short arg"
gdb_test "print foo_instance1.overload1arg((int)arg7)" \
- "\\$\[0-9\]+ = 7" \
+ "${::valnum_re} = 7" \
"print call overloaded func int arg"
gdb_test "print foo_instance1.overload1arg((unsigned int)arg8)" \
- "\\$\[0-9\]+ = 8" \
+ "${::valnum_re} = 8" \
"print call overloaded func unsigned int arg"
gdb_test "print foo_instance1.overload1arg((long)arg9)" \
- "\\$\[0-9\]+ = 9" \
+ "${::valnum_re} = 9" \
"print call overloaded func long arg"
gdb_test "print foo_instance1.overload1arg((unsigned long)arg10)" \
- "\\$\[0-9\]+ = 10" \
+ "${::valnum_re} = 10" \
"print call overloaded func unsigned long arg"
gdb_test "print foo_instance1.overload1arg((float)arg11)" \
- "\\$\[0-9\]+ = 11" \
+ "${::valnum_re} = 11" \
"print call overloaded func float arg"
gdb_test "print foo_instance1.overload1arg((double)arg12)" \
- "\\$\[0-9\]+ = 12" \
+ "${::valnum_re} = 12" \
"print call overloaded func double arg"
gdb_test "print foo_instance1.overload1arg(&arg13)" \
- "\\$\[0-9\]+ = 13" \
+ "${::valnum_re} = 13" \
"print call overloaded func int\\* arg"
gdb_test "print foo_instance1.overload1arg(&arg14)" \
- "\\$\[0-9\]+ = 14" \
+ "${::valnum_re} = 14" \
"print call overloaded func char\\* arg"
gdb_test "print bar(a)" "= 11"
# One last mysterious test.
# I wonder what this is for?
-gdb_test "print intToChar(1)" "\\$\[0-9\]+ = 297"
+gdb_test "print intToChar(1)" "${::valnum_re} = 297"
# Test expression evaluation with overloaded methods
gdb_test "print foo::overload1arg" \
"no member function matches that type instantiation"
gdb_test "print foo::overload1arg(void)" \
- "\\$$decimal = {int \\(foo \\*( const|)\\)} $hex <foo::overload1arg\\(\\)>"
+ "${::valnum_re} = {int \\(foo \\*( const|)\\)} $hex <foo::overload1arg\\(\\)>"
foreach t [list char "signed char" "unsigned char" "short" \
"unsigned short" int "unsigned int" long "unsigned long" \
float double] {
gdb_test "print foo::overload1arg($t)" \
- "\\$$decimal = {int \\(foo \\*( const|), $t\\)} $hex <foo::overload1arg\\($t\\)>"
+ "${::valnum_re} = {int \\(foo \\*( const|), $t\\)} $hex <foo::overload1arg\\($t\\)>"
}
gdb_test_no_output "set height 2"
gdb_test_multiple "print c" "" {
- -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n$pagination_prompt$" {
+ -re "${::valnum_re} = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n$pagination_prompt$" {
pass $gdb_test_name
}
-re "\r\n$pagination_prompt$" {
return 0
}
- gdb_test "print pAe->f()" "\\$\[0-9\]+ = 20"
- gdb_test "print pAa->f()" "\\$\[0-9\]+ = 1"
- gdb_test "print pDe->vg()" "\\$\[0-9\]+ = 202"
- gdb_test "print pADe->vg()" "\\$\[0-9\]+ = 202"
- gdb_test "print pDd->vg()" "\\$\[0-9\]+ = 101"
- gdb_test "print pEe->vvb()" "\\$\[0-9\]+ = 411"
- gdb_test "print pVB->vvb()" "\\$\[0-9\]+ = 407"
- gdb_test "print pBe->vvb()" "\\$\[0-9\]+ = 411"
- gdb_test "print pDe->vvb()" "\\$\[0-9\]+ = 411"
- gdb_test "print pEe->vd()" "\\$\[0-9\]+ = 282"
- gdb_test "print pEe->fvb()" "\\$\[0-9\]+ = 311"
+ gdb_test "print pAe->f()" "${::valnum_re} = 20"
+ gdb_test "print pAa->f()" "${::valnum_re} = 1"
+ gdb_test "print pDe->vg()" "${::valnum_re} = 202"
+ gdb_test "print pADe->vg()" "${::valnum_re} = 202"
+ gdb_test "print pDd->vg()" "${::valnum_re} = 101"
+ gdb_test "print pEe->vvb()" "${::valnum_re} = 411"
+ gdb_test "print pVB->vvb()" "${::valnum_re} = 407"
+ gdb_test "print pBe->vvb()" "${::valnum_re} = 411"
+ gdb_test "print pDe->vvb()" "${::valnum_re} = 411"
+ gdb_test "print pEe->vd()" "${::valnum_re} = 282"
+ gdb_test "print pEe->fvb()" "${::valnum_re} = 311"
# more recent results:
# wrong value "202"
# -- chastain 2003-12-31
gdb_test_multiple "print pEe->D::vg()" "print pEe->D::vg()" {
- -re "\\$\[0-9]+ = 102$nl$gdb_prompt $" {
+ -re "${::valnum_re} = 102$nl$gdb_prompt $" {
pass "print pEe->D::vg()"
}
- -re "\\$\[0-9]+ = 202$nl$gdb_prompt $" {
+ -re "${::valnum_re} = 202$nl$gdb_prompt $" {
# To get this result, we have called pEe->*(&D::vg) ().
# That's how GDB interprets this, but it's wrong; in fact
# the explicit D:: means to bypass virtual function lookup,
gdb_breakpoint [gdb_get_line_number "marker 1"]
gdb_continue_to_breakpoint "marker 1"
-gdb_test "print o.do_print()" "\\$\[0-9\]+ = 123456"
-gdb_test "print o.do_print3()" "\\$\[0-9\]+ = 111111"
+gdb_test "print o.do_print()" "${::valnum_re} = 123456"
+gdb_test "print o.do_print3()" "${::valnum_re} = 111111"
-gdb_test "print o2.do_print()" "\\$\[0-9\]+ = 123456"
-gdb_test "print o2.do_print2()" "\\$\[0-9\]+ = 654321"
-gdb_test "print o2.do_print3()" "\\$\[0-9\]+ = 111111"
+gdb_test "print o2.do_print()" "${::valnum_re} = 123456"
+gdb_test "print o2.do_print2()" "${::valnum_re} = 654321"
+gdb_test "print o2.do_print3()" "${::valnum_re} = 111111"
gdb_test "print o" " = {<interface> = {.*_vptr.interface = $hex <vtable for Obj.*>}, <No data fields>}"
gdb_continue_to_breakpoint "Break Here"
gdb_test_no_output "set debug expression 1"
-gdb_test_debug_expr "print obj%three(1)%two(1)%one(1)%i" "\\\$$decimal = 1"
+gdb_test_debug_expr "print obj%three(1)%two(1)%one(1)%i" "${::valnum_re} = 1"
gdb_test_debug_expr "print .TRUE." [multi_line \
"Operation: OP_BOOL" \
" Constant: .*1" \
- "\\\$$decimal = \.TRUE\."]
+ "${::valnum_re} = \.TRUE\."]
gdb_test_debug_expr "print .FALSE." [multi_line \
"Operation: OP_BOOL" \
" Constant: .*0" \
- "\\\$$decimal = \.FALSE\."]
+ "${::valnum_re} = \.FALSE\."]
gdb_breakpoint [gdb_get_line_number "print"]
gdb_continue_to_breakpoint "print"
-gdb_test "print p" "\\$\[0-9\]+ = \\( c = 1, d = 2\\.375 \\)"
-gdb_test "print p%c" "\\$\[0-9\]+ = 1"
-gdb_test "print p%d" "\\$\[0-9\]+ = 2\\.375"
-gdb_test "print q%a" "\\$\[0-9\]+ = 3\\.125"
+gdb_test "print p" "${::valnum_re} = \\( c = 1, d = 2\\.375 \\)"
+gdb_test "print p%c" "${::valnum_re} = 1"
+gdb_test "print p%d" "${::valnum_re} = 2\\.375"
+gdb_test "print q%a" "${::valnum_re} = 3\\.125"
set test "print q%b"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 'abcdefg'\r\n$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
# Compiler should produce string, not an array of characters.
setup_xfail "*-*-*"
fail $test
}
}
-gdb_test "print q%x%c" "\\$\[0-9\]+ = 1"
-gdb_test "print q%x%d" "\\$\[0-9\]+ = 2\\.375"
+gdb_test "print q%x%c" "${::valnum_re} = 1"
+gdb_test "print q%x%d" "${::valnum_re} = 2\\.375"
set result_line "= \\( a = 3.125, x = \\( c = 1, d = 2\\.375 \\),\
b = 'abcdefg' \\)\r\n$gdb_prompt $"
gdb_test "ptype nml" \
"type = Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml"
gdb_test "print nml" \
- "\\$\[0-9\]+ = \\( a = 10, b = 20 \\)"
+ "${::valnum_re} = \\( a = 10, b = 20 \\)"
} else {
gdb_test "ptype nml" \
"No symbol \"nml\" in current context\\."
set test "print str(2:4)"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = 'bcd'\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 'bcd'\r\n$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = \\(98 'b', 99 'c', 100 'd'\\)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \\(98 'b', 99 'c', 100 'd'\\)\r\n$gdb_prompt $" {
# Compiler should produce string, not an array of characters.
setup_xfail "*-*-*"
fail $test
set test "print str(:3)"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = 'abc'\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 'abc'\r\n$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c'\\)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \\(97 'a', 98 'b', 99 'c'\\)\r\n$gdb_prompt $" {
# Compiler should produce string, not an array of characters.
setup_xfail "*-*-*"
fail $test
set test "print str(5:)"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = 'efg'\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 'efg'\r\n$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = \\(101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \\(101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
# Compiler should produce string, not an array of characters.
setup_xfail "*-*-*"
fail $test
set test "print str(:)"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = 'abcdefg'\r\n$gdb_prompt $" {
pass $test
}
- -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
# Compiler should produce string, not an array of characters.
setup_xfail "*-*-*"
fail $test
}
}
-gdb_test "print array(2:4)" "\\$\[0-9\]+ = \\(2, 3, 4\\)"
-gdb_test "print array(:3)" "\\$\[0-9\]+ = \\(1, 2, 3\\)"
-gdb_test "print array(5:)" "\\$\[0-9\]+ = \\(5, 6, 7\\)"
-gdb_test "print array(:)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7\\)"
+gdb_test "print array(2:4)" "${::valnum_re} = \\(2, 3, 4\\)"
+gdb_test "print array(:3)" "${::valnum_re} = \\(1, 2, 3\\)"
+gdb_test "print array(5:)" "${::valnum_re} = \\(5, 6, 7\\)"
+gdb_test "print array(:)" "${::valnum_re} = \\(1, 2, 3, 4, 5, 6, 7\\)"
if { $gdb_spawn_id == $gdb_main_spawn_id } {
# CLI
gdb_test "print 666" \
- "^\\\$$decimal = 666" \
+ "^${::valnum_re} = 666" \
"$test, ensure no output CLI"
} elseif { $gdb_spawn_id == $mi_spawn_id } {
# MI
foreach tid $expected {
append r "\[\r\n\]+"
append r "Thread $tid $any:\r\n"
- append r "\\$$decimal = 1234"
+ append r "${::valnum_re} = 1234"
}
set cmd "thread apply $tid_list"
gdb_test "frame 1" "#1.*in gen_movsd.*" "backtracing"
gdb_test_multiple "print operand0" "print operand0" {
- -re "\\\$$decimal = <optimized out>\r\n$gdb_prompt $" { pass "print operand0"}
+ -re "${::valnum_re} = <optimized out>\r\n$gdb_prompt $" { pass "print operand0"}
-re "$hex\r\n$gdb_prompt $" { gdb_test "print *operand0" "13" "print operand0" }
}
gdb_test_multiple "print operand1" "print operand1" {
- -re "\\\$$decimal = <optimized out>\r\n$gdb_prompt $" { pass "print operand1"}
+ -re "${::valnum_re} = <optimized out>\r\n$gdb_prompt $" { pass "print operand1"}
-re "$hex\r\n$gdb_prompt $" { gdb_test "print *operand1" "14" "print operand1" }
}
# func1_step above).
set x_val -1
gdb_test_multiple "print x" "" {
- -re "\\\$$decimal = (\[0-9\]*)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = (\[0-9\]*)\r\n$gdb_prompt $" {
set x_val $expect_out(1,string)
}
-re "$gdb_prompt $" { }
# Make sure that locals on the stack are found. This is an array to
# prevent it from living in a register.
-gdb_test "print array\[0\]" "\\\$$decimal = 0" "print local 2"
+gdb_test "print array\[0\]" "${::valnum_re} = 0" "print local 2"
if { ! $no_frames } {
# Verify that we do not print out variables from the inlined
gdb_test "info locals" ".*arg2 = 184.*" "info locals above bar (3b)"
}
-gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local 3"
+gdb_test "print array\[0\]" "${::valnum_re} = 184" "print local 3"
# Test printing scoped local variables.
set val ""
gdb_test_multiple "print aaa" "" {
- -re -wrap "^(?:\\$$decimal = )?(.*)" {
+ -re -wrap "^(?:${::valnum_re} = )?(.*)" {
set val $expect_out(1,string)
}
}
gdb_breakpoint marker
gdb_test "run" "Breakpoint.* marker .*" "run to marker"
-gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*"
+gdb_test "print d" "${::valnum_re} = ${hex} \"1\".*"
# Restart the process.
with_test_prefix "restart" {
}
}
- gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*"
+ gdb_test "print d" "${::valnum_re} = ${hex} \"1\".*"
}
gdb_test "kill" "" "kill" "Kill the program being debugged. .y or n. " "y"
set expected_len [expr {1 + [llength $re_list]}]
gdb_test "print argc" \
- "\\\$$::decimal = $expected_len" "check argc"
+ "${::valnum_re} = $expected_len" "check argc"
set i 1
foreach arg $re_list {
gdb_test "print argv\[$i\]" \
- "\\\$$::decimal = $::hex \"$arg\"" \
+ "${::valnum_re} = $::hex \"$arg\"" \
"check argv\[$i\]"
incr i
}
gdb_test "continue" "Breakpoint.* marker .*" "continue to marker"
# Test env var TEST is correctly passed to the program through
# --wrapper.
-gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*"
+gdb_test "print d" "${::valnum_re} = ${hex} \"1\".*"
incr ::thr_count $adjustment
gdb_test "p \$_inferior_thread_count" \
- "^\\\$$::decimal = $::thr_count"
+ "^${::valnum_re} = $::thr_count"
}
with_test_prefix "starting threads" {
foreach_with_prefix call_type { print call } {
gdb_test "$call_type start_thread()" \
- "\\\[New Thread \[^\r\n\]+\\\]\r\n\\\$$decimal = 1" \
+ "\\\[New Thread \[^\r\n\]+\\\]\r\n${::valnum_re} = 1" \
"start another new thread"
check_thread_count +1
}
foreach_with_prefix call_type { print call } {
gdb_test "$call_type stop_thread()" \
- "\\\[Thread \[^\r\n\]+ exited\\\]\r\n\\\$$decimal = 1" \
+ "\\\[Thread \[^\r\n\]+ exited\\\]\r\n${::valnum_re} = 1" \
"stop another thread"
check_thread_count -1
}
"" \
"Thread $::thread2_id ${any}" \
"#${number}${ws}${any} in thread2 ${any}" \
- "\\\$\[0-9]+ = ${number}${any}" \
+ "${::valnum_re} = ${number}${any}" \
"" \
"Thread $::thread1_id ${any}" \
"#${number}${ws}${any} in thread1 ${any}" \
- "\\\$\[0-9]+ = ${number}${any}" \
+ "${::valnum_re} = ${number}${any}" \
] \
"run a failing command except in one frame of thread 2,3, -s to silently continue"
}
gdb_test "thread apply all -s -q frame apply all -s p i" \
[multi_line \
"#${number}${ws}${any} in thread2 ${any}" \
- "\\\$\[0-9]+ = ${number}${any}" \
+ "${::valnum_re} = ${number}${any}" \
"#${number}${ws}${any} in thread1 ${any}" \
- "\\\$\[0-9]+ = ${number}${any}" \
+ "${::valnum_re} = ${number}${any}" \
] \
"run a failing command except in one frame of thread 2,3, -s to silently continue. Do not show thread information"
gdb_test "thread apply all -s -q frame apply all -s -q p i" \
[multi_line \
- "\\\$\[0-9]+ = ${number}${any}" \
- "\\\$\[0-9]+ = ${number}${any}" \
+ "${::valnum_re} = ${number}${any}" \
+ "${::valnum_re} = ${number}${any}" \
] \
"run a failing command except in one frame of thread 2,3, -s to silently continue. Do not show thread and frame info"
set msg "save \$pc after signal"
set saved_pc ""
gdb_test_multiple "print/x \$pc" $msg {
- -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = (\[^\r\n\]*)\r\n$gdb_prompt $" {
set saved_pc $expect_out(1,string)
pass $msg
}
gdb_test "info threads" "\\* 2 .*" "thread 2 is selected on reconnect"
# Check that the program is still alive, and stopped in the same spot.
-gdb_test "print/x \$pc" "\\\$$decimal = $saved_pc" "check \$pc after signal"
+gdb_test "print/x \$pc" "${::valnum_re} = $saved_pc" "check \$pc after signal"
# Check that we didn't lose the signal.
gdb_test "info program" "stopped with signal SIGUSR1,.*"
set test "listed args, $description"
gdb_test_multiple "print args" $test {
- -re "\\\$\[0-9\]+ = {$pattern}.*$gdb_prompt $" {
+ -re "${::valnum_re} = {$pattern}.*$gdb_prompt $" {
pass $test
set result ""
# Set the do_spin variable in the inferior. This will cause it to drop out
# of its spin loop and hit the next breakpoint. Remember, at this point the
# inferior is still executing.
-gdb_test "print do_spin = 0" "\\\$$decimal = 0"
+gdb_test "print do_spin = 0" "${::valnum_re} = 0"
# Collect the notification that the inferior has stopped.
gdb_test_multiple "" "wait for stop" {
# verify that the macro can get past the backtrace error and perform
# subsequent commands.
gdb_test_no_output "set backtrace limit 3"
-gdb_test "thread apply all backthread" "Thread ..*\\\$\[0-9]+ = 0x14.*Thread ..*\\\$\[0-9]+ = 0x14.*Thread ..*\\\$\[0-9]+ = 0x14.*Thread ..*\\\$\[0-9]+ = 0x14.*Thread ..*\\\$\[0-9]+ = 0x14.*Thread ..*\\\$\[0-9]+ = 0x14"
+gdb_test "thread apply all backthread" "Thread ..*${::valnum_re} = 0x14.*Thread ..*${::valnum_re} = 0x14.*Thread ..*${::valnum_re} = 0x14.*Thread ..*${::valnum_re} = 0x14.*Thread ..*${::valnum_re} = 0x14.*Thread ..*${::valnum_re} = 0x14"
# Go into the thread_function to check that a simple "thread apply"
# does not change the selected frame.
gdb_test "step" "thread_function.*" "step to the thread_function"
gdb_test "up" ".*in main.*" "go up in the stack frame"
-gdb_test "thread apply all print 1" "Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1" "run a simple print command on all threads"
+gdb_test "thread apply all print 1" "Thread ..*${::valnum_re} = 1.*Thread ..*${::valnum_re} = 1.*Thread ..*${::valnum_re} = 1.*Thread ..*${::valnum_re} = 1.*Thread ..*${::valnum_re} = 1.*Thread ..*${::valnum_re} = 1" "run a simple print command on all threads"
gdb_test "down" "#0.*thread_function.*" "go down and check selected frame"
# Make sure that GDB doesn't crash when the previously selected thread
if {![string match $host_triplet $target_triplet]} {
setup_kfail "threads/22381" "*-*-*"
}
- gdb_test "p/x foo" "\\$\[0-9]+ = 0xdeadbeef" $test
+ gdb_test "p/x foo" "${::valnum_re} = 0xdeadbeef" $test
} else {
unsupported $test
}
global gdb_prompt
gdb_test_multiple "print /x $reg" "" {
- -re "\\$\[0-9\]+ = \[x0\]+\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \[x0\]+\r\n$gdb_prompt $" {
fail "collect $test_id: collected $reg (zero)"
}
- -re "\\$\[0-9\]+ = \[x0-9a-fA-F\]+\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \[x0-9a-fA-F\]+\r\n$gdb_prompt $" {
pass "collect $test_id: collected $reg"
}
-re "\[Ee\]rror.*$gdb_prompt $" {
}
gdb_test "print argc" \
- "\\$\[0-9\]+ = 1 '.001'" \
+ "${::valnum_re} = 1 '.001'" \
"collected arg char"
gdb_test "print argi" \
- "\\$\[0-9\]+ = 2" \
+ "${::valnum_re} = 2" \
"collected arg int"
gdb_test "print argf" \
- "\\$\[0-9\]+ = 3.\[23\]\[0-9\]*" \
+ "${::valnum_re} = 3.\[23\]\[0-9\]*" \
"collected arg float"
gdb_test "print argd" \
- "\\$\[0-9\]+ = 4.\[34\]\[0-9\]*" \
+ "${::valnum_re} = 4.\[34\]\[0-9\]*" \
"collected arg double"
# struct arg as one of several args (near end of list)
gdb_test "print argstruct.memberc" \
- "\\$\[0-9\]+ = 101 'e'" \
+ "${::valnum_re} = 101 'e'" \
"collected arg struct member char"
gdb_test "print argstruct.memberi" \
- "\\$\[0-9\]+ = 102" \
+ "${::valnum_re} = 102" \
"collected arg struct member int"
gdb_test "print argstruct.memberf" \
- "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*" \
+ "${::valnum_re} = 103.\[23\]\[0-9\]*" \
"collected arg struct member float"
gdb_test "print argstruct.memberd" \
- "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*" \
+ "${::valnum_re} = 104.\[34\]\[0-9\]*" \
"collected arg struct member double"
# array arg as one of several args (near end of list)
setup_xfail "*-*-*"
gdb_test "print argarray\[0\]" \
- "\\$\[0-9\]+ = 111" \
+ "${::valnum_re} = 111" \
"collected argarray #0"
setup_xfail "*-*-*"
gdb_test "print argarray\[1\]" \
- "\\$\[0-9\]+ = 112" \
+ "${::valnum_re} = 112" \
"collected argarray #1"
setup_xfail "*-*-*"
gdb_test "print argarray\[2\]" \
- "\\$\[0-9\]+ = 113" \
+ "${::valnum_re} = 113" \
"collected argarray #2"
setup_xfail "*-*-*"
gdb_test "print argarray\[3\]" \
- "\\$\[0-9\]+ = 114" \
+ "${::valnum_re} = 114" \
"collected argarray #3"
gdb_test "tfind none" \
# struct argument as only argument
gdb_test "print argstruct.memberc" \
- "\\$\[0-9\]+ = 101 'e'" \
+ "${::valnum_re} = 101 'e'" \
"collected arg struct member char"
gdb_test "print argstruct.memberi" \
- "\\$\[0-9\]+ = 102" \
+ "${::valnum_re} = 102" \
"collected arg struct member int"
gdb_test "print argstruct.memberf" \
- "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*" \
+ "${::valnum_re} = 103.\[23\]\[0-9\]*" \
"collected arg struct member float"
gdb_test "print argstruct.memberd" \
- "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*" \
+ "${::valnum_re} = 104.\[34\]\[0-9\]*" \
"collected arg struct member double"
gdb_test "tfind none" \
setup_xfail "*-*-*"
gdb_test "print argarray\[0\]" \
- "\\$\[0-9\]+ = 111" \
+ "${::valnum_re} = 111" \
"collected argarray #0"
setup_xfail "*-*-*"
gdb_test "print argarray\[1\]" \
- "\\$\[0-9\]+ = 112" \
+ "${::valnum_re} = 112" \
"collected argarray #1"
setup_xfail "*-*-*"
gdb_test "print argarray\[2\]" \
- "\\$\[0-9\]+ = 113" \
+ "${::valnum_re} = 113" \
"collected argarray #2"
setup_xfail "*-*-*"
gdb_test "print argarray\[3\]" \
- "\\$\[0-9\]+ = 114" \
+ "${::valnum_re} = 114" \
"collected argarray #3"
gdb_test "tfind none" \
run_trace_experiment $func
gdb_test "print locc" \
- "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'" \
+ "${::valnum_re} = 11 '.\[a-z0-7\]+'" \
"collected local char"
gdb_test "print loci" \
- "\\$\[0-9\]+ = 12" \
+ "${::valnum_re} = 12" \
"collected local int"
gdb_test "print locf" \
- "\\$\[0-9\]+ = 13.\[23\]\[0-9\]*" \
+ "${::valnum_re} = 13.\[23\]\[0-9\]*" \
"collected local float"
gdb_test "print locd" \
- "\\$\[0-9\]+ = 14.\[34\]\[0-9\]*" \
+ "${::valnum_re} = 14.\[34\]\[0-9\]*" \
"collected local double"
gdb_test "print locst.memberc" \
- "\\$\[0-9\]+ = 15 '.017'" \
+ "${::valnum_re} = 15 '.017'" \
"collected local member char"
gdb_test "print locst.memberi" \
- "\\$\[0-9\]+ = 16" \
+ "${::valnum_re} = 16" \
"collected local member int"
gdb_test "print locst.memberf" \
- "\\$\[0-9\]+ = 17.\[67\]\[0-9\]*" \
+ "${::valnum_re} = 17.\[67\]\[0-9\]*" \
"collected local member float"
gdb_test "print locst.memberd" \
- "\\$\[0-9\]+ = 18.\[78\]\[0-9\]*" \
+ "${::valnum_re} = 18.\[78\]\[0-9\]*" \
"collected local member double"
gdb_test "print locar\[0\]" \
- "\\$\[0-9\]+ = 121" \
+ "${::valnum_re} = 121" \
"collected locarray #0"
gdb_test "print locar\[1\]" \
- "\\$\[0-9\]+ = 122" \
+ "${::valnum_re} = 122" \
"collected locarray #1"
gdb_test "print locar\[2\]" \
- "\\$\[0-9\]+ = 123" \
+ "${::valnum_re} = 123" \
"collected locarray #2"
gdb_test "print locar\[3\]" \
- "\\$\[0-9\]+ = 124" \
+ "${::valnum_re} = 124" \
"collected locarray #3"
gdb_test "tfind none" \
run_trace_experiment $func
gdb_test "print $expr" \
- "\\$\[0-9\]+ = $val" \
+ "${::valnum_re} = $val" \
"got expected value '$val'"
gdb_test "tfind none" \
run_trace_experiment globals_test_func
gdb_test "print globalc" \
- "\\$\[0-9\]+ = 71 'G'" \
+ "${::valnum_re} = 71 'G'" \
"collected global char"
gdb_test "print globali" \
- "\\$\[0-9\]+ = 72" \
+ "${::valnum_re} = 72" \
"collected global int"
gdb_test "print globalf" \
- "\\$\[0-9\]+ = 73.\[23\]\[0-9\]*" \
+ "${::valnum_re} = 73.\[23\]\[0-9\]*" \
"collected global float"
gdb_test "print globald" \
- "\\$\[0-9\]+ = 74.\[34\]\[0-9\]*" \
+ "${::valnum_re} = 74.\[34\]\[0-9\]*" \
"collected global double"
gdb_test "print globalstruct.memberc" \
- "\\$\[0-9\]+ = 81 'Q'" \
+ "${::valnum_re} = 81 'Q'" \
"collected struct char member"
gdb_test "print globalstruct.memberi" \
- "\\$\[0-9\]+ = 82" \
+ "${::valnum_re} = 82" \
"collected struct member int"
gdb_test "print globalstruct.memberf" \
- "\\$\[0-9\]+ = 83.\[23\]\[0-9\]*" \
+ "${::valnum_re} = 83.\[23\]\[0-9\]*" \
"collected struct member float"
gdb_test "print globalstruct.memberd" \
- "\\$\[0-9\]+ = 84.\[34\]\[0-9\]*" \
+ "${::valnum_re} = 84.\[34\]\[0-9\]*" \
"collected struct member double"
gdb_test "print globalp == &globalstruct" \
- "\\$\[0-9\]+ = 1" \
+ "${::valnum_re} = 1" \
"collected global pointer"
gdb_test "print globalarr\[1\]" \
- "\\$\[0-9\]+ = 1" \
+ "${::valnum_re} = 1" \
"collected global array element #1"
gdb_test "print globalarr\[2\]" \
- "\\$\[0-9\]+ = 2" \
+ "${::valnum_re} = 2" \
"collected global array element #2"
gdb_test "print globalarr\[3\]" \
- "\\$\[0-9\]+ = 3" \
+ "${::valnum_re} = 3" \
"collected global array element #3"
# Check that we didn't mess up sort&merging memory ranges to
# collect.
gdb_test "print globalarr2" \
- "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}" \
+ "${::valnum_re} = \\{0, 1, 2, 3\\}" \
"collected global array 2"
# GDB would internal error collecting UNOP_MEMVAL's whose address
# corresponding 'collect' action above). This just double checks
# we actually did collect what we wanted.
gdb_test "print globalarr3" \
- "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}" \
+ "${::valnum_re} = \\{3, 2, 1, 0\\}" \
"collect globals: collected global array 3"
gdb_test "tfind none" \
run_trace_experiment $func
gdb_test "print $mystr" \
- "\\$\[0-9\]+ = $hex \"$myrslt\".*" \
+ "${::valnum_re} = $hex \"$myrslt\".*" \
"collected local string"
gdb_test "tfind none" \
gdb_test_no_output "tstop"
gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
- gdb_test "p \$trace_frame" ".*\\\$${decimal} = 0.*" \
+ gdb_test "p \$trace_frame" ".*${::valnum_re} = 0.*" \
"p \$trace_frame before disconnected"
- gdb_test "p \$tracepoint" ".*\\\$${decimal} = 2.*" \
+ gdb_test "p \$tracepoint" ".*${::valnum_re} = 2.*" \
"p \$tracepoint before disconnected"
gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
- gdb_test "p \$trace_frame" ".*\\\$${decimal} = -1.*"
- gdb_test "p \$tracepoint" ".*\\\$${decimal} = -1.*"
- gdb_test "p \$trace_line" ".*\\\$${decimal} = -1.*"
- gdb_test "p \$trace_file" ".*\\\$${decimal} = void.*"
- gdb_test "p \$trace_func" ".*\\\$${decimal} = void.*"
+ gdb_test "p \$trace_frame" ".*${::valnum_re} = -1.*"
+ gdb_test "p \$tracepoint" ".*${::valnum_re} = -1.*"
+ gdb_test "p \$trace_line" ".*${::valnum_re} = -1.*"
+ gdb_test "p \$trace_file" ".*${::valnum_re} = void.*"
+ gdb_test "p \$trace_func" ".*${::valnum_re} = void.*"
}
}
"11.3: test \$trace_line"
gdb_test_multiple "print \$trace_file" "11.4: test \$trace_file" {
- -re "\\$\[0-9\]+ = \"$srcfile\"\[\r\n\]+$gdb_prompt $" {
+ -re "${::valnum_re} = \"$srcfile\"\[\r\n\]+$gdb_prompt $" {
pass "11.4: test \$trace_file"
}
- -re "\\$\[0-9\]+ = \"$srcdir/$subdir/$srcfile\"\[\r\n\]+$gdb_prompt $" {
+ -re "${::valnum_re} = \"$srcdir/$subdir/$srcfile\"\[\r\n\]+$gdb_prompt $" {
pass "11.4: test \$trace_file"
}
}
run_trace_experiment $msg $probe
gdb_test "print \$_probe_arg0" \
- "\\$\[0-9\]+ = $val_arg0" \
+ "${::valnum_re} = $val_arg0" \
"collect $msg: collected probe arg0"
}
gdb_test_no_output "tstop"
gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
- gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = 0, c = <unavailable>}"
- gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0}"
- gdb_test "p/d z" "\\\$${decimal} = {a = <unavailable>, b = 0, c = 0}"
+ gdb_test "p/d x" "${::valnum_re} = {a = 0, b = 0, c = <unavailable>}"
+ gdb_test "p/d y" "${::valnum_re} = {a = 0, b = <unavailable>, c = 0}"
+ gdb_test "p/d z" "${::valnum_re} = {a = <unavailable>, b = 0, c = 0}"
gdb_test "tfind none" "No longer looking at any trace frame.*"
}
gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
if { $endian == "little" } {
- gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
- gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = <unavailable>, f = 0, g = 0, h = 0, i = 0, j = 0}"
- gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
+ gdb_test "p/d x" "${::valnum_re} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
+ gdb_test "p/d y" "${::valnum_re} = {a = 0, b = 0, c = 0, d = 0, e = <unavailable>, f = 0, g = 0, h = 0, i = 0, j = 0}"
+ gdb_test "p/d z" "${::valnum_re} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
} else {
- gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
- gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = <unavailable>, g = 0, h = 0, i = 0, j = 0}"
- gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
+ gdb_test "p/d x" "${::valnum_re} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
+ gdb_test "p/d y" "${::valnum_re} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = <unavailable>, g = 0, h = 0, i = 0, j = 0}"
+ gdb_test "p/d z" "${::valnum_re} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
}
gdb_test "tfind none" "No longer looking at any trace frame.*"
global hex
gdb_test_multiple "print /x $reg" "collected $reg" {
- -re "\\$\[0-9\]+ = \[x0\]+\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = \[x0\]+\r\n$gdb_prompt $" {
fail "collected $reg (zero)"
}
- -re "\\$\[0-9\]+ = $hex\r\n$gdb_prompt $" {
+ -re "${::valnum_re} = $hex\r\n$gdb_prompt $" {
pass "collected $reg"
}
-re "\[Ee\]rror.*$gdb_prompt $" {
"global reference shows address but not value"
gdb_test "print *&g_ref" \
- "\\$\[0-9\]+ = <unavailable>" \
+ "${::valnum_re} = <unavailable>" \
"referenced integer was not collected (taking address of reference)"
gdb_test "print *g_structref_p" " = <unavailable>"
# Incomplete strings print as an array.
gdb_test "print g_string_partial" \
- "\\$\[0-9\]+ = \{<unavailable>, 101 'e', 108 'l', <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>\}" \
+ "${::valnum_re} = \{<unavailable>, 101 'e', 108 'l', <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>\}" \
"printing partially collected string"
# It is important for this test that the last examined value is
exp_continue
}
- -re "^\\\$$::decimal = 123\r\n" {
+ -re "^${::valnum_re} = 123\r\n" {
set saw_result true
exp_continue
}
# $6 = (int (*)()) 0x24 <function_bar>
gdb_test_multiple "print &${var}" "get address of ${var}" {
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
+ -re "${::valnum_re} = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
{
pass "get address of ${var}"
if { $expect_out(1,string) == "0" } {