From: Pedro Alves Date: Thu, 17 Sep 2020 22:33:41 +0000 (+0100) Subject: gdb.base/watchpoint.{c,exp} X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=151fdbad7a4df43fb7e5b1ef2f84622aaaa2ddb5;p=binutils-gdb.git gdb.base/watchpoint.{c,exp} Adjust gdb.base/watchpoint.c so that it can be built as a C++ program. Fixes: gdb compile failed, src/gdb/testsuite/gdb.base/watchpoint.c:33:16: error: initializer-string for array of chars is too long [-fpermissive] 33 | char buf[30] = "testtesttesttesttesttesttestte"; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/gdb/testsuite/gdb.base/watchpoint.c:62:14: error: expected unqualified-id before 'nullptr' 62 | struct foo5 *nullptr; | ^~~~~~~ gdb/testsuite/ChangeLog: * gdb.base/watchpoint.c (buf): Make it 31 bytes. (nullptr): Rename to ... (null_ptr): ... this. * gdb.base/watchpoint.exp: Adjust to rename. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 7b424b509fc..6ff609276c1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2020-09-17 Pedro Alves + + * gdb.base/watchpoint.c (buf): Make it 31 bytes. + (nullptr): Rename to ... + (null_ptr): ... this. + * gdb.base/watchpoint.exp: Adjust to rename. + 2020-09-17 Pedro Alves * gdb.base/printcmds.c (three, flag_enum_without_zero) diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c index 60f60d6c02c..3d6e36ff081 100644 --- a/gdb/testsuite/gdb.base/watchpoint.c +++ b/gdb/testsuite/gdb.base/watchpoint.c @@ -30,7 +30,7 @@ int ival2 = -1; int ival3 = -1; int ival4 = -1; int ival5 = -1; -char buf[30] = "testtesttesttesttesttesttestte"; +char buf[31] = "testtesttesttesttesttesttestte"; struct foo { int val; @@ -59,7 +59,7 @@ struct foo5 struct { int x; } *p; }; -struct foo5 *nullptr; +struct foo5 *null_ptr; void marker1 () { diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 1ed73e8b491..fc84f98534b 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -604,9 +604,9 @@ proc test_watch_location {} { gdb_continue_to_breakpoint "func5 breakpoint here" # Check first if a null pointer can be dereferenced on the target. - gdb_test_multiple "p *nullptr" "" { + gdb_test_multiple "p *null_ptr" "" { -re "Cannot access memory at address 0x0.*$gdb_prompt $" { - gdb_test "watch -location nullptr->p->x" \ + gdb_test "watch -location null_ptr->p->x" \ "Cannot access memory at address 0x0" } -re ".*$gdb_prompt $" {