This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Define Elf32_auxv_t and Elf64_auxv_t if not available.


On Thu, 2012-03-29 at 17:02 +0100, Pedro Alves wrote:
> On 03/28/2012 01:11 AM, Thiago Jung Bauermann wrote:
> > That's a good point, I didn't think of that. Like you say it's unlikely
> > to happen in practice but it's cleaner indeed.
> 
> 
> Separate tests is definitely the way to go, but for the reason that you'd
> be always breaking the socklen_t test on non-elf ports, such
> as the Windows port, where elf.h doesn't even exist.

Aha.

> > 2012-03-27  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>
> >
> >         * configure.ac: Check whether Elf32_auxv_t and Elf64_auxv_t
> > 	are available.
> > 	linux-low.c [HAVE_ELF32_AUXV_T] (Elf32_auxv_t): Add typedef.
> > 	[HAVE_ELF64_AUXV_T] (Elf64_auxv_t): Likewise.
> > 	* config.in: Regenerate.
> > 	* configure: Likewise.
> 
> This version looks good to me.

Great, thanks for the review!

> A "Copied from glibc's elf.h." small comment here would be good,
> I think.  Otherwise, the "We use to have pointer elements added here"
> comment is misleading.  :-)

Indeed. I added the comment and committed the patch below.

-- 
[]'s
Thiago Jung Bauermann
Linaro Toolchain Working Group


2012-03-30  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>

	* configure.ac: Check whether Elf32_auxv_t and Elf64_auxv_t
	are available.
	* linux-low.c [HAVE_ELF32_AUXV_T] (Elf32_auxv_t): Add typedef.
	[HAVE_ELF64_AUXV_T] (Elf64_auxv_t): Likewise.
	* config.in: Regenerate.
	* configure: Likewise.


diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index e6e9162..5d1e094 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -168,6 +168,10 @@ AC_CHECK_TYPES(socklen_t, [], [],
 #include <sys/socket.h>
 ])
 
+AC_CHECK_TYPES([Elf32_auxv_t, Elf64_auxv_t], [], [],
+#include <elf.h>
+)
+
 ACX_PKGVERSION([GDB])
 ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index ab87570..043451d 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -82,6 +82,36 @@
 #endif
 #endif
 
+#ifndef HAVE_ELF32_AUXV_T
+/* Copied from glibc's elf.h.  */
+typedef struct
+{
+  uint32_t a_type;		/* Entry type */
+  union
+    {
+      uint32_t a_val;		/* Integer value */
+      /* We use to have pointer elements added here.  We cannot do that,
+	 though, since it does not work when using 32-bit definitions
+	 on 64-bit platforms and vice versa.  */
+    } a_un;
+} Elf32_auxv_t;
+#endif
+
+#ifndef HAVE_ELF64_AUXV_T
+/* Copied from glibc's elf.h.  */
+typedef struct
+{
+  uint64_t a_type;		/* Entry type */
+  union
+    {
+      uint64_t a_val;		/* Integer value */
+      /* We use to have pointer elements added here.  We cannot do that,
+	 though, since it does not work when using 32-bit definitions
+	 on 64-bit platforms and vice versa.  */
+    } a_un;
+} Elf64_auxv_t;
+#endif
+
 /* ``all_threads'' is keyed by the LWP ID, which we use as the GDB protocol
    representation of the thread ID.
 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]