[RFA] add test for memattr, use get_number_or_range for memattr commands
Michael Snyder
msnyder@vmware.com
Tue Feb 22 17:58:00 GMT 2011
Joel Brobecker wrote:
>> 2011-02-21 Michael Snyder <msnyder@vmware.com>
>>
>> * memattr.c (mem_enable_command): Use get_number_or_range.
>> (mem_disable_command): Ditto.
>> (mem_delete_command): Ditto.
>> (_initialize_mem): Tweak usage message to reflect multiple
>> arguments.
>>
>> 2011-02-21 Michael Snyder <msnyder@vmware.com>
>>
>> * gdb.base/memattr.exp: New test.
>> * gdb.base/memattr.c: Test load for memattr.exp.
>
> Overall, the patch looks OK to me.
>
>> +gdb_test_multiple "info address mem1" "get address of mem1" {
>> + -re "Symbol \"mem1\" is static storage at address ($hex).*$gdb_prompt $" {
>> + set mem1start $expect_out(1,string)
>> + }
>> +}
> [...]
>> +gdb_test_no_output "mem $mem1start $mem1end wo" "create mem region 1"
>
> I still think that, if the first quoted test does not pass, the second
> will cause the testcase to crash because mem1start is going to be
> undefined. This is what you're going to see when that happens:
>
> ERROR: tcl error sourcing /[...]/memattr.exp
> ERROR: can't read "mem1start": no such variable
> while executing
> "gdb_test_no_output "mem $mem1start $mem1end wo" "create mem region 1""
>
> But I'm OK with that, if that's OK with the others.
Hmmm, how about if I initialize mem1start etc. to -1?
Then the rest of the tests will fail but not crash.
Is that better?
More information about the Gdb-patches
mailing list