* lib/gdb.exp (get_valueof): Accept anything as a return value.

(get_integer_valueof): New procedure.
	(get_sizeof): Use new get_integer_value_of.
	* gdb.base/sizeof.exp: Replace all uses of get_valueof
	by get_integer_valueof.
This commit is contained in:
Pierre Muller 2009-02-13 23:37:24 +00:00
parent 2ff5e6054c
commit 417e16e2a0
3 changed files with 34 additions and 9 deletions

View file

@ -1,3 +1,11 @@
2009-02-14 Pierre Muller <muller@ics.u-strasbg.fr>
* lib/gdb.exp (get_valueof): Accept anything as a return value.
(get_integer_valueof): New procedure.
(get_sizeof): Use new get_integer_value_of.
* gdb.base/sizeof.exp: Replace all uses of get_valueof
by get_integer_valueof.
2009-02-13 Tom Tromey <tromey@redhat.com>
* gdb.base/remote.exp (get_sizeof): Remove.

View file

@ -109,10 +109,10 @@ proc check_valueof { exp val } {
# Check that GDB and the target agree over the sign of a character.
set signof_byte [get_valueof "/d" "'\\377'" -1]
set signof_char [get_valueof "/d" "(int) (char) -1" -1]
set signof_signed_char [get_valueof "/d" "(int) (signed char) -1" -1]
set signof_unsigned_char [get_valueof "/d" "(int) (unsigned char) -1" -1]
set signof_byte [get_integer_valueof "'\\377'" -1]
set signof_char [get_integer_valueof "(int) (char) -1" -1]
set signof_signed_char [get_integer_valueof "(int) (signed char) -1" -1]
set signof_unsigned_char [get_integer_valueof "(int) (unsigned char) -1" -1]
check_valueof "'\\377'" ${signof_byte}
check_valueof "(int) (char) -1" ${signof_char}

View file

@ -2885,19 +2885,36 @@ proc get_valueof { fmt exp default } {
set test "get valueof \"${exp}\""
set val ${default}
gdb_test_multiple "print${fmt} ${exp}" "$test" {
-re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" {
-re "\\$\[0-9\]* = (.*)\[\r\n\]*$gdb_prompt $" {
set val $expect_out(1,string)
pass "$test ($val)"
}
timeout {
set size ${default}
fail "get value of ${exp} (timeout)"
fail "$test (timeout)"
}
}
return ${val}
}
proc get_sizeof { type default } {
return [get_valueof "/d" "sizeof (${type})" $default]
proc get_integer_valueof { exp default } {
global gdb_prompt
set test "get integer valueof \"${exp}\""
set val ${default}
gdb_test_multiple "print /d ${exp}" "$test" {
-re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" {
set val $expect_out(1,string)
pass "$test ($val)"
}
timeout {
fail "$test (timeout)"
}
}
return ${val}
}
proc get_sizeof { type default } {
return [get_integer_valueof "sizeof (${type})" $default]
}