This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Use mmap instead of obstack_alloc for dwarf debug sections.


On Wed, May 27, 2009 at 6:16 PM, Tom Tromey <tromey@redhat.com> wrote:

> I like this patch quite a bit.
>
> It has a number of minor formatting problems, mostly missing spaces
> before open parens.

Sorry, these get me every time :-(
I've corrected all I could find in the updated patch (attached).

> Paul> + ? ? ? ? ? ? ? ? ? ? ?fileno ((FILE *)abfd->iostream),
>
> I don't know for sure, but I assume that it is not valid in general to
> cast iostream like this.

I would have used bfd_get_file_window(), but it's only compiled in
when --use-mmap was given to bfd/configure.
Is there a way to turn that on for GDB?

The  bfd_get_file_window() performs above cast, after checking for:

      (abfd->flags & BFD_IN_MEMORY) == 0)

and later

      if (abfd->iostream == NULL
	  && (abfd->iovec == NULL
	      || abfd->iovec->bseek (abfd, offset, SEEK_SET) != 0))

The last 3 conditions can not be true because we just performed bfd_seek
and bfd_bread on abfd.

Looks like BFD_IN_MEMORY could be set if the file was
add-symbol-file-from-memory'd.

Is it ok to do this in gdb/dwarf2read.c:

  if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0
      && (abfd->flags & BFD_IN_MEMORY) == 0)

Thanks,
-- 
Paul Pluzhnikov

Attachment: gdb-dwarf2-mmap-20090528.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]