diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8ad2448080..a01a065d81 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2020-06-26 Gary Benson + + * gdb.cp/try_catch.cc: Include string.h. + (main): Replace comparison against string literal with + strcmp, avoiding build failure with -Wstring-compare. + Add "marker test-complete". + * gdb.cp/try_catch.exp: Run the test to the above marker, + then verify that the value of "test" is still true. + 2020-06-25 Andrew Burgess * gdb.arch/riscv-tdesc-regs.exp: New test cases. diff --git a/gdb/testsuite/gdb.cp/try_catch.cc b/gdb/testsuite/gdb.cp/try_catch.cc index 4c4add26e6..5f454f41ec 100644 --- a/gdb/testsuite/gdb.cp/try_catch.cc +++ b/gdb/testsuite/gdb.cp/try_catch.cc @@ -18,6 +18,7 @@ #include #include #include +#include enum region { oriental, egyptian, greek, etruscan, roman }; @@ -129,8 +130,8 @@ int main() } catch (exception& obj) { - if (obj.what() != "gdb.1") // marker 3-catch + if (strcmp (obj.what(), "gdb.1") != 0) // marker 3-catch test &= false; } - return 0; + return 0; // marker test-complete } diff --git a/gdb/testsuite/gdb.cp/try_catch.exp b/gdb/testsuite/gdb.cp/try_catch.exp index fb532949d1..b52e1a0a52 100644 --- a/gdb/testsuite/gdb.cp/try_catch.exp +++ b/gdb/testsuite/gdb.cp/try_catch.exp @@ -63,5 +63,9 @@ gdb_continue_to_breakpoint "marker 3-throw" gdb_breakpoint [gdb_get_line_number "marker 3-catch"] gdb_continue_to_breakpoint "marker 3-catch" +gdb_breakpoint [gdb_get_line_number "marker test-complete"] +gdb_continue_to_breakpoint "marker test-complete" +gdb_test "p test" "= true" + gdb_exit return 0