From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6082 invoked by alias); 30 Mar 2012 20:26:42 -0000 Received: (qmail 6070 invoked by uid 22791); 30 Mar 2012 20:26:40 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-gy0-f169.google.com (HELO mail-gy0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Mar 2012 20:26:20 +0000 Received: by ghrr18 with SMTP id r18so736493ghr.0 for ; Fri, 30 Mar 2012 13:26:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:x-mailer:mime-version:x-gm-message-state:content-type :content-transfer-encoding; bh=EgBKiB/EteMTZ0P3YODJHqXNtVREu4MQM6Atkjdhv8Y=; b=EcldG1ev75LjKpH6NnVoGBMld9SuJhgyA8mzUD6QOwtvKxWsWZgBHxJoz3e/uwdG3f 5vV6x6Al92GVaq+D4nxt1sr0Idf86d5gbvzP3p1uR0inAlija3iifEtzrt97zqCYjDzn J3NsIQ7iomon+GwHHJq1Y+sKIV9cXMcqBwxPvyWTfHjWWaFcwShcMvl56Ozg32RwP3mZ 2P1nmIso97uIIfoWOUdMO5FGYHi6cFCIPdKlhhqqBfoAFyAYE+er017O5AD+SwiTJEos ao7VAl/DTT8L11ekq6PWnQZIO8foDgiXQhGcIzrWs8lx6zwY5ZkFPhgoTIuHX3dOQFCS xY4Q== Received: by 10.236.157.9 with SMTP id n9mr3229178yhk.96.1333139180383; Fri, 30 Mar 2012 13:26:20 -0700 (PDT) Received: from [192.168.1.50] (201.22.15.181.dynamic.adsl.gvt.net.br. [201.22.15.181]) by mx.google.com with ESMTPS id b4sm13370736anb.22.2012.03.30.13.26.17 (version=SSLv3 cipher=OTHER); Fri, 30 Mar 2012 13:26:19 -0700 (PDT) Message-ID: <1333139175.11673.1.camel@hactar> Subject: Re: [RFA] Define Elf32_auxv_t and Elf64_auxv_t if not available. From: Thiago Jung Bauermann To: Pedro Alves Cc: Joel Brobecker , gdb-patches ml Date: Fri, 30 Mar 2012 20:26:00 -0000 In-Reply-To: <4F74879B.6070908@redhat.com> References: <1332787763.30339.10.camel@hactar> <20120327152058.GF2701@adacore.com> <1332893506.16415.4.camel@hactar> <4F74879B.6070908@redhat.com> Mime-Version: 1.0 X-Gm-Message-State: ALoCoQkKPkZCFwho0pQStXIgbVnBPMTwe7LXji7Re7Hljds0A4GFRBiTlTdC9iPma/ZCwqSugRVM Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-03/txt/msg01071.txt.bz2 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 > > > > * 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 * 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 ]) +AC_CHECK_TYPES([Elf32_auxv_t, Elf64_auxv_t], [], [], +#include +) + 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.