This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Check for POSIX_MADV_WILLNEED to support building against the LSB
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: michael dot hope at linaro dot org
- Cc: gdb-patches at sourceware dot org, patches at linaro dot org
- Date: Mon, 11 Jun 2012 07:59:22 +0200 (CEST)
- Subject: Re: [PATCH] Check for POSIX_MADV_WILLNEED to support building against the LSB
- References: <4FD57332.6020309@linaro.org>
> Date: Mon, 11 Jun 2012 16:25:22 +1200
> From: Michael Hope <michael.hope@linaro.org>
>
> The Linux Standard Base APIs include posix_madvise() but don't define
> values for the 'advice' argument. Check to see if POSIX_MADV_WILLNEED
> is defined before using.
What real-world problem does this fix? It makes no sense to have
posix_madvise() but not define any values for the 'advice' argument.
I'd say this is a "bug" in LSB. Either they should drop
posix_madvise() from the standard, or include at least the 'advice'
values required by POSIX.
> 2012-06-11 Michael Hope <michael.hope@linaro.org>
>
> * dwarf2read.c (dwarf2_read_section): Check for
> POSIX_MADV_WILLNEED.
>
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 589361e..91fab5a 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -1773,7 +1773,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
>
> if ((caddr_t)info->buffer != MAP_FAILED)
> {
> -#if HAVE_POSIX_MADVISE
> +#if HAVE_POSIX_MADVISE && defined(POSIX_MADV_WILLNEED)
> posix_madvise (info->map_addr, info->map_len, POSIX_MADV_WILLNEED);
> #endif
> return;
>