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.
This commit is contained in:
Pedro Alves
2020-09-17 23:33:41 +01:00
parent 18a25b6481
commit 151fdbad7a
3 changed files with 11 additions and 4 deletions

View File

@@ -1,3 +1,10 @@
2020-09-17 Pedro Alves <pedro@palves.net>
* 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 <pedro@palves.net>
* gdb.base/printcmds.c (three, flag_enum_without_zero)

View File

@@ -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 ()
{

View File

@@ -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 $" {