[PATCH v2] Fix for PR gdb/17017

Pedro Alves palves@redhat.com
Fri Jun 6 09:18:00 GMT 2014


On 06/05/2014 11:55 PM, Siva Chandra wrote:
> The attached patch fixes PR 17017 along the lines suggested by Pedro
> here: https://sourceware.org/ml/gdb-patches/2014-06/msg00212.html

Thanks!

> diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp
> index 97b6ffa..28786ed 100644
> --- a/gdb/testsuite/gdb.python/py-xmethods.exp
> +++ b/gdb/testsuite/gdb.python/py-xmethods.exp
> @@ -40,25 +40,51 @@ gdb_breakpoint [gdb_get_line_number "Break here."]
>  gdb_continue_to_breakpoint "Break here" ".*Break here.*"
>  
>  # Tests before loading the debug methods.
> -gdb_test "p a1 + a2" "From CC <A_plus_A>.*15" "Before: a1 + a2"
> -gdb_test "p a2 - a1" "From CC <A_minus_A>.*5" "Before: a1 - a2"
> -gdb_test "p b1 - a1" "From CC <A_minus_A>.*25" "Before: b1 - a1"
> -gdb_test "p a1.geta()" "From CC A::geta.*5" "Before: a1.geta()"
> +if {[get_integer_valueof "a1 + a2" 0] != 15
> +    || [get_integer_valueof "a_plus_a" 0] != 1} { 
> +    fail "Before: a1 + a2" 

Shouldn't we have corresponding PASSes ?

> +}

> +if {[get_integer_valueof "a2 - a1" 0] != 5
> +    || [get_integer_valueof "a_minus_a" 0] != 1} { 
> +    fail "Before: a2 - a1"
> +}
> +if {[get_integer_valueof "b1 - a1" 0] != 25
> +    || [get_integer_valueof "a_minus_a" 0] != 2} { 

Hmm, looks like these reads of "a_minus_a" etc. will cause
several duplicated gdb.sum lines.  You can wrap tests with
with_test_prefix to address that:

with_test_prefix "Before: b1 - a1" {
...
}

See:

https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique

Thanks,
-- 
Pedro Alves



More information about the Gdb-patches mailing list