Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Gary Benson <gbenson@redhat.com>
Cc: gdb-patches@sourceware.org,
	Mark Kettenis <mark.kettenis@xs4all.nl>,
	Pedro Alves <palves@redhat.com>
Subject: [pushed] Fix missing "struct iovec" definition on some x86-linux. (was: "[PATCH 7/7 v2] Tidy #include lists")
Date: Tue, 09 Sep 2014 15:09:00 -0000	[thread overview]
Message-ID: <20140909150904.GA24918@adacore.com> (raw)
In-Reply-To: <1403878351-22974-8-git-send-email-gbenson@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

> This commit tidies up the #include lists in {i386,amd64}-linux-nat.c,
> removing headers that are no longer required and reordering some lines
> so that both files roughly match.  Additionally, an unused definition
> was removed from the middle of the #include list in i386-linux-nat.c.
> 
> This patch is unchanged from the original version in this series.
> 
> gdb/
> 2014-06-27  Gary Benson  <gbenson@redhat.com>
> 
> 	* amd64-linux-nat.c (gdbcore.h): Removed include.
> 	(regset.h): Likewise.
> 	(nat/linux-btrace.h): Likewise.
> 	(btrace.h): Likewise.
> 	(gdb_assert.h): Likewise.
> 	(string.h): Likewise.
> 	(sys/uio.h): Likewise.
> 	(sys/debugreg.h): Likewise.
> 	(sys/syscall.h): Likewise.
> 	(sys/procfs.h): Likewise.
> 	(sys/user.h): Likewise.
> 	(asm/ptrace.h): Likewise.
> 	(i386-nat.h): Likewise.
> 	* i386-linux-nat.c (i386-nat.h): Likewise.
> 	(regset.h): Likewise.
> 	(target.h): Likewise.
> 	(linux-nat.h): Likewise.
> 	(nat/linux-btrace.h): Likewise.
> 	(btrace.h): Likewise.
> 	(gdb_assert.h): Likewise.
> 	(string.h): Likewise.
> 	(sys/uio.h): Likewise.
> 	(sys/user.h): Likewise.
> 	(sys/procfs.h): Likewise.
> 	(sys/reg.h): Likewise.
> 	(sys/debugreg.h): Likewise.
> 	(ORIG_EAX): Removed definition.

Unfortunately, this patch broke GDB builds on some GNU/Linux
distros. I fixed the issue I got by applying the attached patch.

-- 
Joel

[-- Attachment #2: 0001-Fix-missing-struct-iovec-definition-on-some-x86-linu.patch --]
[-- Type: text/x-diff, Size: 2422 bytes --]

From 72fde3dfe9a2367abc593684b9b4d2343d367d85 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 9 Sep 2014 16:49:13 +0200
Subject: [PATCH] Fix missing "struct iovec" definition on some x86-linux.

The following patch...

    commit 3116063bd617de56fbc3bad046a692b1fb363a9d
    Date:   Fri Jun 27 09:52:29 2014 +0100
    Subject: Tidy #include lists

... introduced a build failure on certain x86 GNU/Linux distributions
(reproduced on SuSE 10 and RHES4) due to "struct iovec" not being
defined. This struct is defined in <sys/uio.h>, which used to be
explicitly included, but no longer is after the commit above was
applied.

    [...]/i386-linux-nat.c: In function 'fetch_xstateregs':
    [...]/i386-linux-nat.c:325:16: error: storage size of 'iov' isn't known
    [...]/i386-linux-nat.c: In function 'store_xstateregs':
    [...]/i386-linux-nat.c:348:16: error: storage size of 'iov' isn't known
    make[2]: *** [i386-linux-nat.o] Error 1

It seems to be working on newer GNU/Linux distros thanks to indirect
inclusion of <sys/uio.h>, but it does not work on some other versions
of the same distros. This is why indirect includes of public APIs
should be avoided if at all possible.

This patch fixes the issue by adding the explicit include back.

gdb/ChangeLog:

        * i386-linux-nat.c, x86-linux-nat.c: Add <sys/uio.h> #include.
---
 gdb/ChangeLog        | 4 ++++
 gdb/i386-linux-nat.c | 1 +
 gdb/x86-linux-nat.c  | 1 +
 3 files changed, 6 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9d3f392..393e4a0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2014-09-09  Joel Brobecker  <brobecker@adacore.com>
+
+	* i386-linux-nat.c, x86-linux-nat.c: Add <sys/uio.h> #include.
+
 2014-09-08  Doug Evans  <xdje42@gmail.com>
 
 	PR 17247
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 32a82e9..a08b9b8 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -23,6 +23,7 @@
 #include "regcache.h"
 #include "elf/common.h"
 #include <sys/ptrace.h>
+#include <sys/uio.h>
 #include "gregset.h"
 #include "gdb_proc_service.h"
 
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 67300d8..b2141eb 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -24,6 +24,7 @@
 #include <sys/ptrace.h>
 #include <sys/user.h>
 #include <sys/procfs.h>
+#include <sys/uio.h>
 
 #include "x86-nat.h"
 #include "linux-nat.h"
-- 
1.9.1


  parent reply	other threads:[~2014-09-09 15:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 14:12 [PATCH 0/7 v2] Refactor shared code in {i386,amd64}-linux-nat.c Gary Benson
2014-06-27 14:12 ` [PATCH 3/7 v2] Merge ps_get_thread_area Gary Benson
2014-07-09 13:08   ` Pedro Alves
2014-07-09 13:08   ` Pedro Alves
2014-06-27 14:12 ` [PATCH 1/7 v2] Rename identical functions Gary Benson
2014-07-09 13:04   ` Pedro Alves
2014-06-27 14:12 ` [PATCH 2/7 v2] Merge {i386,amd64}_linux_read_description Gary Benson
2014-07-09 13:07   ` Pedro Alves
2014-06-27 14:28 ` [PATCH 6/7 v2] Move duplicated code into new files Gary Benson
2014-07-09 13:12   ` Pedro Alves
2014-06-27 14:40 ` [PATCH 5/7 v2] Comment and whitespace changes Gary Benson
2014-07-09 13:11   ` Pedro Alves
2014-06-27 14:52 ` [PATCH 7/7 v2] Tidy #include lists Gary Benson
2014-07-09 13:13   ` Pedro Alves
2014-08-06  9:36   ` Yao Qi
2014-08-06 10:19     ` Gary Benson
2014-08-06 11:16       ` Yao Qi
2014-09-09 15:09   ` Joel Brobecker [this message]
2014-09-10 10:59     ` [pushed] Fix missing "struct iovec" definition on some x86-linux. (was: "[PATCH 7/7 v2] Tidy #include lists") Gary Benson
2014-09-10 13:14       ` Joel Brobecker
2014-06-27 14:53 ` [PATCH 4/7 v2] Pull out common parts of _initialize_{i386,amd64}_linux_nat Gary Benson
2014-07-09 13:09   ` Pedro Alves
2014-07-09 13:17 ` [PATCH 0/7 v2] Refactor shared code in {i386,amd64}-linux-nat.c Pedro Alves
2014-07-11 12:34   ` Gary Benson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140909150904.GA24918@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox