From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9900 invoked by alias); 2 Jan 2012 14:39:12 -0000 Received: (qmail 9889 invoked by uid 22791); 2 Jan 2012 14:39:11 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_BJ,TW_CP X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Jan 2012 14:38:58 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 47B75CB28AE; Mon, 2 Jan 2012 15:38:58 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tprzcGfo4nRs; Mon, 2 Jan 2012 15:38:58 +0100 (CET) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 34037CB28AC; Mon, 2 Jan 2012 15:38:58 +0100 (CET) Subject: Re: [Patch Darwin] head build fixes for i686-darwin9/x86_64-darwin10. Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: Tristan Gingold In-Reply-To: <59ABFF71-CA26-452C-B9B2-9B0FC6AAE2BD@sandoe-acoustics.co.uk> Date: Mon, 02 Jan 2012 14:39:00 -0000 Cc: gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <03DE2A59-DA13-4F7C-B757-533D4AF5F1DD@adacore.com> References: <59ABFF71-CA26-452C-B9B2-9B0FC6AAE2BD@sandoe-acoustics.co.uk> To: Iain Sandoe X-IsSubscribed: yes 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-01/txt/msg00037.txt.bz2 On Dec 29, 2011, at 9:30 PM, Iain Sandoe wrote: > Hi, > At present trunk gdb does not build for me on either i686-darwin9 or x86_= 64-darwin10. >=20 > There are two problems on Darwin 10 and three on Darwin 9 (description wi= th each patchlet, below). >=20 > OK? Chunk per chunk review. Tristan. > Iain >=20 > gdb: >=20 > * machoread.c (macho_symtab_read): Initialize nbr_syms. > * i386-darwin-nat.c (DR_FIRSTADDR, DR_LASTADDR, DR_STATUS, > DR_CONTROL): Ensure a default definition is available. > * darwin-nat.c (darwin_read_dyld_info): Only build if > TASK_DYLD_INFO_COUNT is available. > (darwin_xfer_partial): Don not try to fetch dyld info > unless TASK_DYLD_INFO_COUNT is available. >=20 > =3D=3D=3D=3D=3D >=20 > 1/ a "maybe used un-initialized" (in machoread.c) >=20 > which is fixed thus: >=20 > diff --git a/gdb/machoread.c b/gdb/machoread.c > index 46b8842..ba38ca6 100644 > --- a/gdb/machoread.c > +++ b/gdb/machoread.c > @@ -180,7 +180,7 @@ macho_symtab_read (struct objfile *objfile, > const asymbol *dir_so =3D NULL; > const asymbol *file_so =3D NULL; > asymbol **oso_file =3D NULL; > - unsigned int nbr_syms; > + unsigned int nbr_syms =3D 0; >=20 > /* Current state while reading stabs. */ > enum >=20 Ok. > =3D=3D=3D=3D=3D=3D=3D >=20 > 2/ DR_FIRSTADDR and cousins are undefined. > (the fragment below is copied verbatim from gdb-7.3.1 - is there some rea= son to expect that it should have been defined elsewhere?) >=20 > diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c > index 23f6a6d..2a346c4 100644 > --- a/gdb/i386-darwin-nat.c > +++ b/gdb/i386-darwin-nat.c > @@ -263,6 +263,22 @@ i386_darwin_store_inferior_registers (struct target_= ops *ops, >=20 > /* Support for debug registers, boosted mostly from i386-linux-nat.c. */ >=20 > +#ifndef DR_FIRSTADDR > +#define DR_FIRSTADDR 0 > +#endif > + > +#ifndef DR_LASTADDR > +#define DR_LASTADDR 3 > +#endif > + > +#ifndef DR_STATUS > +#define DR_STATUS 6 > +#endif > + > +#ifndef DR_CONTROL > +#define DR_CONTROL 7 > +#endif > + > static void > i386_darwin_dr_set (int regnum, uint32_t value) > { >=20 See Pedro's message. > =3D=3D=3D=3D=3D >=20 > 3/ (Darwin 9 only) > TASK_DYLD_INFO_COUNT etc. are not defined. >=20 > Fixed thus: > diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c > index 94f49d6..efc59e7 100644 > --- a/gdb/darwin-nat.c > +++ b/gdb/darwin-nat.c > @@ -1823,6 +1823,7 @@ out: > return length; > } >=20 > +#ifdef TASK_DYLD_INFO_COUNT > /* Read LENGTH bytes at offset ADDR of task_dyld_info for TASK, and copy = them > to RDADDR. > Return 0 on failure; number of bytes read / writen otherwise. */ > @@ -1848,7 +1849,7 @@ darwin_read_dyld_info (task_t task, CORE_ADDR addr,= char *rdaddr, int length) > memcpy (rdaddr, (char *)&task_dyld_info + addr, length); > return length; > } > - > +#endif >=20 > /* Return 0 on failure, number of bytes handled otherwise. TARGET > is ignored. */ > @@ -1890,6 +1891,7 @@ darwin_xfer_partial (struct target_ops *ops, > case TARGET_OBJECT_MEMORY: > return darwin_read_write_inferior (inf->private->task, offset, > readbuf, writebuf, len); > +#ifdef TASK_DYLD_INFO_COUNT > case TARGET_OBJECT_DARWIN_DYLD_INFO: > if (writebuf !=3D NULL || readbuf =3D=3D NULL) > { > @@ -1897,6 +1899,7 @@ darwin_xfer_partial (struct target_ops *ops, > return -1; > } > return darwin_read_dyld_info (inf->private->task, offset, readbuf, = len); > +#endif > default: > return -1; > } Ok (but a comment would be very welcome). Thanks, Tristan.