From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3715 invoked by alias); 24 Oct 2003 18:20:58 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3695 invoked from network); 24 Oct 2003 18:20:57 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 24 Oct 2003 18:20:57 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 763C580040B; Fri, 24 Oct 2003 14:20:56 -0400 (EDT) Message-ID: <3F996D88.9060505@redhat.com> Date: Fri, 24 Oct 2003 18:20:00 -0000 From: "J. Johnston" Organization: Red Hat Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com, ac131313@redhat.com Subject: Re: RFA: ia64 portion of libunwind patch References: <3F986E31.8050201@redhat.com> <1031024175718.ZM3475@localhost.localdomain> In-Reply-To: <1031024175718.ZM3475@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-10/txt/msg00746.txt.bz2 Kevin Buettner wrote: > On Oct 23, 8:11pm, J. Johnston wrote: > > >>Ok to commit? Questions regarding this in conjunction with the generic >>libunwind frame code? > > >>+#ifdef HAVE_LIBUNWIND_IA64_H >>+ >>+# ifndef __NR_getunwind >>+# define __NR_getunwind 1215 >>+# endif > > > Is this part still needed? > Not if we include > ........... > > >>+static void * >>+map_segment (bfd *bfd, Elf_Internal_Phdr *p_text, struct map_info *mi) >>+ { >>+ size_t page_mask = getpagesize () - 1, nbytes; >>+ char *buf, *cp; >>+ ssize_t nread; >>+ int fd; >>+ >>+ if (bfd->iostream) >>+ fd = fileno (bfd->iostream); >>+ else >>+ fd = open (bfd_get_filename (bfd), O_RDONLY); >>+ >>+ if (fd < 0) >>+ return NULL; >>+ >>+ buf = mmap (0, p_text->p_filesz, PROT_READ, MAP_PRIVATE, fd, >>+ p_text->p_offset & ~page_mask); >>+ if (buf != (char *) -1) >>+ { >>+ mi->buf = buf; >>+ mi->length = p_text->p_filesz; >>+ mi->mapped = 1; >>+ buf += p_text->p_offset & page_mask; >>+ } >>+ else >>+ { >>+ /* mmap () failed, try reading the file: */ >>+ mi->mapped = 0; >>+ >>+ if (lseek (fd, p_text->p_offset, SEEK_SET) < 0) >>+ { >>+ if (!bfd->iostream) >>+ close (fd); >>+ return NULL; >>+ } >>+ >>+ nbytes = p_text->p_filesz; >>+ cp = buf = xmalloc (nbytes); >>+ while ((nbytes > 0) && (nread = read (fd, cp, nbytes)) > 0) >>+ { >>+ cp += nread; >>+ nbytes -= nread; >>+ } >>+ if (nbytes > 0) >>+ { >>+ /* premature end-of-file or some error */ >>+ xfree (buf); >>+ buf = 0; >>+ } >>+ mi->buf = buf; >>+ } >>+ if (!bfd->iostream) >>+ close (fd); >>+ >>+ return buf; >>+} > > > For the above, why isn't bfd being employed to read the segment? > Are you referring to using bfd_bread() if the mmap fails or do you mean something higher level? -- Jeff J.