Fix gdb.arch/aarch64-dbreg-contents.exp build failures
authorLuis Machado <luis.machado@linaro.org>
Tue, 25 Feb 2020 13:09:19 +0000 (10:09 -0300)
committerLuis Machado <luis.machado@linaro.org>
Fri, 28 Feb 2020 15:19:57 +0000 (12:19 -0300)
I ran into the following failures when running tests under QEMU:

--

gdb compile failed, binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c: In function 'set_watchpoint':
binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:41:29: error: storage size of 'dreg_state' isn't known
   struct user_hwdebug_state dreg_state;
                             ^~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/bits/types/struct_iovec.h:23:0,
                 from /usr/include/aarch64-linux-gnu/sys/uio.h:23,
                 from binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:17:
binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:69:18: error: invalid use of undefined type 'struct user_hwdebug_state'
   iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs)
                  ^
binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:74:5: warning: implicit declaration of function 'error'; did you mean 'errno'? [-Wimplicit-function-declaration]
     error (1, errno, "PTRACE_SETREGSET: NT_ARM_HW_WATCH");
     ^~~~~
     errno
binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c: In function 'main':
binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:87:3: warning: implicit declaration of function 'atexit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   atexit (cleanup);
   ^~~~~~
   _Exit
binutils-gdb/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c:89:11: warning: implicit declaration of function 'fork' [-Wimplicit-function-declaration]
   child = fork ();

           ^~~~

--

The following patch fixes those by adding the necessary include files.

With that said, the test doesn't pass at present. I'll have to investigate it
a bit more.

gdb/testsuite/ChangeLog:

2020-02-28  Luis Machado  <luis.machado@linaro.org>

* gdb.arch/aarch64-dbreg-contents.c: Include stdlib.h, unistd,
asm/ptrace.h and error.h.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c

index 70bee9c7de5aa0d63f6f6278810082b040e5cc3d..c3f49e07280a3c769babbe334acc0b36e57a5262 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-28  Luis Machado  <luis.machado@linaro.org>
+
+       * gdb.arch/aarch64-dbreg-contents.c: Include stdlib.h, unistd.h,
+       asm/ptrace.h and error.h.
+
 2020-02-28  Tom de Vries  <tdevries@suse.de>
 
        * gdb.base/c-linkage-name.c (main): Call do_something_other_cu.
index 66ca76f847729d398cfbbdad408b5c105be480dc..ca690f63de87c5f51acbd464ec2d32fe29334fb2 100644 (file)
@@ -9,13 +9,17 @@
   freely.  */
 
 #define _GNU_SOURCE 1
+#include <stdlib.h>
+#include <unistd.h>
 #include <sys/ptrace.h>
+#include <asm/ptrace.h>
 #include <assert.h>
 #include <sys/wait.h>
 #include <stddef.h>
 #include <errno.h>
 #include <sys/uio.h>
 #include <elf.h>
+#include <error.h>
 
 static pid_t child;