This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use mmap for symbol tables
- From: Eirik Fuller <eirik at hackrat dot com>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: Jim Blandy <jimb at red-bean dot com>, gdb-patches at sourceware dot org
- Date: Wed, 01 Feb 2006 12:51:46 -0500
- Subject: Re: [PATCH] Use mmap for symbol tables
- References: <20060129233630.3EFA6690067@ns.hackrat.org> <8f2776cb0601292104y1c29f4adl6e681b20cd86c177@mail.gmail.com> <43DDFC13.90909@hackrat.com> <8f2776cb0601301007k5bccb594he33b08e84096d1a2@mail.gmail.com> <43DE61FD.2090309@hackrat.com> <8f2776cb0601301411j17219c9en74881de2489ad129@mail.gmail.com> <43DEB182.4020804@hackrat.com> <200601312147.k0VLlrxj011443@elgar.sibelius.xs4all.nl>
> So you'll have to check at runtime whether mmap is possible and if it
> fails fall back on the old code that simply reads the file.
My patch does that. The compile time conditionals are, um, still in the
future, but the runtime check is, if mmap fails, act as though the call
had never occurred. Disabling the mmap code through a runtime config
option is similar. The trick is to not get rid of the fallback (the
original malloc/seek/read code); each chunk of the patch which adds a
call to mmap test the return value and falls through to the original
code if mmap fails. The calling code doesn't care whether the mmap
syscall failed, or mmap wasn't even called because of a config option.
It wouldn't be all that hard to handle mmap failures by disabling mmap;
that would eliminate the overhead of repeated mmap failures (replace it
by the overhead of repeated checks of the runtime config option value; I
assume that overhead is negligible).