This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 4/4] Add testcases to break.exp


* Fei Jie <feij.fnst@cn.fujitsu.com> [2015-11-09 16:20:15 +0800]:

>     add testcases to break.exp as follows:
>     *break with non-existed condition
>     *break with out-ou-ranged address
>     *break at offset -1
> 
> gdb/testsuite/ChangeLog:
> 
>     * gdb.base/break.exp: Add new testcases.
> ---
>  gdb/testsuite/gdb.base/break.exp | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
> index f879bc8..5178773 100644
> --- a/gdb/testsuite/gdb.base/break.exp
> +++ b/gdb/testsuite/gdb.base/break.exp
> @@ -334,6 +334,11 @@ gdb_test "enable" "" ""
>  gdb_test "disable 10" "No breakpoint number 10." \
>      "disable non-existent breakpoint 10"
>  
> +gdb_test "break main if donot_exist == 0" \
> +    "No symbol \"donot_exist\" in current context\\."
> +gdb_test "break \*0xfffffffffffffffff" \
> +    "Numeric constant too large\\."
> +
>  gdb_test_no_output "set \$baz = 1.234"
>  gdb_test "disable \$baz" \
>      "Convenience variable must have integer value.*" \
> @@ -399,6 +404,10 @@ set bp_location10 [gdb_get_line_number "set breakpoint 10 here"]
>  gdb_test "break +1" \
>      "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \
>      "breakpoint offset +1"
> +# Test break at offset -1.
> +gdb_test "break -1" \
> +    "Note: breakpoint 6 also set at.*Breakpoint.*at.* file .*$srcfile, line.*" \
> +    "breakpoint offset -1"

You can't rely on the previous breakpoint being number 6.  Some of the
different target types place breakpoints during start up and so the
breakpoint number will be different.  This is why non of the other
tests hard code the breakpoint numbers in the expected output.

You should either just regexp out the breakpoint number, or, capture
the breakpoint number earlier and use that in the expected output,
usually just using a regexp is sufficient.

Thanks,
Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]