[PATCH] Handle memory write errors on gdb.base/break-always.exp

Yao Qi qiyaoltc@gmail.com
Tue Apr 14 09:00:00 GMT 2015


Luis Machado <lgustavo@codesourcery.com> writes:

Hi Luis,

> +foreach test_value {0 1} {
> +    set write_test "write $test_value to breakpoint's address $bp_address"
> +

In this way, $bp_address will be shown in the test summary in gdb.sum.
This may cause some differences when we compare gdb.sum of different
runs, like:

-PASS: gdb.base/break-always.exp: write 0 to breakpoint's address 0x1111
+PASS: gdb.base/break-always.exp: write 0 to breakpoint's address 0x2222

Let's remove $bp_address from $write_test.

> +    gdb_test_multiple "p /x *(char *) $bp_address = $test_value" $write_test {
> +	-re "Cannot access memory at address $hex.*$gdb_prompt $" {
> +	  unsupported "Cannot write to address $bp_address"

We need comments to explain we may go here.  Copying some messages from
your mail should be fine.

> +	  return -1
> +	}
> +	-re " = .*$gdb_prompt $" {
> +	  pass $write_test
> +	}
> +    }
> +
> +    set read_test "read back $test_value from the breakpoint's address $bp_address"
> +

Remove $bp_address from $read_test.

> +    gdb_test "p /x *(char *) $bp_address" " = 0x$test_value" $read_test
> +}

Patch is OK to me with these changes.

-- 
Yao (齐尧)



More information about the Gdb-patches mailing list