diff mbox series

Fix gdb.arch/aarch64-dbreg-contents.exp build failures

Message ID 20200225131532.5796-1-luis.machado@linaro.org
State New
Headers show
Series Fix gdb.arch/aarch64-dbreg-contents.exp build failures | expand

Commit Message

Luis Machado Feb. 25, 2020, 1:15 p.m. UTC
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-25  Luis Machado  <luis.machado@linaro.org>

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

Signed-off-by: Luis Machado <luis.machado@linaro.org>

---
 gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.17.1

Comments

Alan Hayward Feb. 26, 2020, 11:46 a.m. UTC | #1
> On 25 Feb 2020, at 13:15, Luis Machado <luis.machado@linaro.org> wrote:

> 

> 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-25  Luis Machado  <luis.machado@linaro.org>

> 

> 	* gdb.arch/aarch64-dbreg-contents.c: Include stdlib.h, unistd,

> 	asm/ptrace.h and error.h.

> 

> Signed-off-by: Luis Machado <luis.machado@linaro.org>

> ---

> gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c | 4 ++++

> 1 file changed, 4 insertions(+)

> 

> diff --git a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c

> index 66ca76f847..ca690f63de 100644

> --- a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c

> +++ b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c

> @@ -9,13 +9,17 @@

>   freely.  */

> 

> #define _GNU_SOURCE 1

> +#include <stdlib.h>

> +#include <unistd.h>

> #include <sys/ptrace.h>

> +#include <asm/ptrace.h>


I get a little concerned when we have to include multiple sys, asm, bits etc
version of a header. However, saying that we include both of these in many
aarch64 gdb files (eg aarch64-linux-hw-point.c).

Ok to push.

> #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;

> 

> -- 

> 2.17.1

>
Luis Machado Feb. 28, 2020, 3:27 p.m. UTC | #2
On 2/26/20 8:46 AM, Alan Hayward wrote:
> 

> 

>> On 25 Feb 2020, at 13:15, Luis Machado <luis.machado@linaro.org> wrote:

>>

>> 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-25  Luis Machado  <luis.machado@linaro.org>

>>

>> 	* gdb.arch/aarch64-dbreg-contents.c: Include stdlib.h, unistd,

>> 	asm/ptrace.h and error.h.

>>

>> Signed-off-by: Luis Machado <luis.machado@linaro.org>

>> ---

>> gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c | 4 ++++

>> 1 file changed, 4 insertions(+)

>>

>> diff --git a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c

>> index 66ca76f847..ca690f63de 100644

>> --- a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c

>> +++ b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c

>> @@ -9,13 +9,17 @@

>>    freely.  */

>>

>> #define _GNU_SOURCE 1

>> +#include <stdlib.h>

>> +#include <unistd.h>

>> #include <sys/ptrace.h>

>> +#include <asm/ptrace.h>

> 

> I get a little concerned when we have to include multiple sys, asm, bits etc

> version of a header. However, saying that we include both of these in many

> aarch64 gdb files (eg aarch64-linux-hw-point.c).


I was expecting sys/ptrace.h to include asm/ptrace.h or something a bit 
cleaner. But it seems to be the way things are laid out at the moment, 
as some other files are doing the same.

> 

> Ok to push.


Thanks. Pushed now.
diff mbox series

Patch

diff --git a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c
index 66ca76f847..ca690f63de 100644
--- a/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c
+++ b/gdb/testsuite/gdb.arch/aarch64-dbreg-contents.c
@@ -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;