Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: Iain Sandoe <developer@sandoe-acoustics.co.uk>
Cc: gdb-patches@sourceware.org
Subject: Re: [Patch Darwin] head build fixes for i686-darwin9/x86_64-darwin10.
Date: Mon, 02 Jan 2012 14:39:00 -0000	[thread overview]
Message-ID: <03DE2A59-DA13-4F7C-B757-533D4AF5F1DD@adacore.com> (raw)
In-Reply-To: <59ABFF71-CA26-452C-B9B2-9B0FC6AAE2BD@sandoe-acoustics.co.uk>


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.
> 
> There are two problems on Darwin 10 and three on Darwin 9 (description with each patchlet, below).
> 
> OK?

Chunk per chunk review.

Tristan.

> Iain
> 
> gdb:
> 
> 	* 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.
> 
> =====
> 
> 1/ a "maybe used un-initialized" (in machoread.c)
> 
> which is fixed thus:
> 
> 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 = NULL;
>   const asymbol *file_so = NULL;
>   asymbol **oso_file = NULL;
> -  unsigned int nbr_syms;
> +  unsigned int nbr_syms = 0;
> 
>   /* Current state while reading stabs.  */
>   enum
> 

Ok.

> =======
> 
> 2/ DR_FIRSTADDR and cousins are undefined.
> (the fragment below is copied verbatim from gdb-7.3.1 - is there some reason to expect that it should have been defined elsewhere?)
> 
> 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,
> 
> /* Support for debug registers, boosted mostly from i386-linux-nat.c.  */
> 
> +#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)
> {
> 

See Pedro's message.


> =====
> 
> 3/ (Darwin 9 only)
> TASK_DYLD_INFO_COUNT etc. are not defined.
> 
> 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;
> }
> 
> +#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
> 
> /* 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 != NULL || readbuf == 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.


  parent reply	other threads:[~2012-01-02 14:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 20:32 Iain Sandoe
2012-01-02 11:40 ` Pedro Alves
2012-01-02 14:39 ` Tristan Gingold [this message]
2012-12-24  3:57   ` Mike Frysinger
2012-12-24  4:27     ` Joel Brobecker
2012-12-24  5:09       ` Mike Frysinger
2012-12-24  3:56 ` Mike Frysinger

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=03DE2A59-DA13-4F7C-B757-533D4AF5F1DD@adacore.com \
    --to=gingold@adacore.com \
    --cc=developer@sandoe-acoustics.co.uk \
    --cc=gdb-patches@sourceware.org \
    /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